/
core_types.go
56 lines (49 loc) · 1.37 KB
/
core_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package v1beta1
import (
opnicorev1 "github.com/rancher/opni/pkg/apis/core/v1"
"github.com/rancher/wrangler/pkg/crd"
"github.com/rancher/wrangler/pkg/schemas/openapi"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +kubebuilder:object:root=true
type BootstrapToken struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec *opnicorev1.BootstrapToken `json:"spec,omitempty"`
}
// +kubebuilder:object:root=true
type BootstrapTokenList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []BootstrapToken `json:"items"`
}
// +kubebuilder:object:root=true
type Keyring struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Data []byte `json:"data,omitempty"`
}
// +kubebuilder:object:root=true
type KeyringList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Keyring `json:"items"`
}
func KeyringCRD() (*crd.CRD, error) {
schema, err := openapi.ToOpenAPIFromStruct(Keyring{})
if err != nil {
return nil, err
}
return &crd.CRD{
GVK: GroupVersion.WithKind("Keyring"),
PluralName: "keyrings",
Status: true,
Schema: schema,
}, nil
}
func init() {
SchemeBuilder.Register(
&BootstrapToken{}, &BootstrapTokenList{},
&Keyring{}, &KeyringList{},
)
}