@@ -20,25 +20,138 @@ import (
2020 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121)
2222
23- // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
24- // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
25-
2623// HubSpec defines the desired state of Hub
2724type HubSpec struct {
28- // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
29- // Important: Run "make" to regenerate code after modifying this file
30- // The following markers will use OpenAPI v3 schema to validate the value
31- // More info: https://book.kubebuilder.io/reference/markers/crd-validation.html
25+ // APIServer is the API server URL for the Hub cluster. If provided, spokes clusters will
26+ // join the hub using this API server instead of the one in the bootstrap kubeconfig.
27+ // Spoke clusters with ForceInternalEndpointLookup set to true will ignore this field.
28+ // +optional
29+ APIServer string `json:"apiServer,omitempty"`
30+
31+ // Hub cluster CA certificate, optional
32+ // +optional
33+ Ca string `json:"ca,omitempty"`
34+
35+ // ClusterManager configuration.
36+ // +optional
37+ ClusterManager * ClusterManager `json:"clusterManager,omitempty"`
38+
39+ // If true, create open-cluster-management namespace, otherwise use existing one.
40+ // +kubebuilder:default:=true
41+ // +optional
42+ CreateNamespace bool `json:"createNamespace,omitempty"`
43+
44+ // If set, the hub will be reinitialized.
45+ // +optional
46+ Force bool `json:"force,omitempty"`
47+
48+ // Kubeconfig details for the Hub cluster.
49+ // +required
50+ Kubeconfig Kubeconfig `json:"kubeconfig"`
3251
33- // foo is an example field of Hub. Edit hub_types.go to remove/update
52+ // Singleton control plane configuration. If provided, deploy a singleton control plane instead of clustermanager.
53+ // This is an alpha stage flag.
3454 // +optional
35- Foo * string `json:"foo,omitempty"`
55+ SingletonControlPlane * SingletonControlPlane `json:"singleton,omitempty"`
56+ }
57+
58+ // SingletonControlPlane is the configuration for a singleton control plane
59+ type SingletonControlPlane struct {
60+ // The name of the singleton control plane.
61+ // +kubebuilder:default:="singleton-controlplane"
62+ // +optional
63+ Name string `json:"name,omitempty"`
64+
65+ // Helm configuration for the multicluster-controlplane Helm chart.
66+ // For now https://open-cluster-management.io/helm-charts/ocm/multicluster-controlplane is always used - no private registry support.
67+ // See: https://github.com/open-cluster-management-io/multicluster-controlplane/blob/main/charts/multicluster-controlplane/values.yaml
68+ // +optional
69+ Helm * Helm `json:"helm,omitempty"`
70+ }
71+
72+ // Helm is the configuration for helm.
73+ type Helm struct {
74+ // Raw, YAML-formatted Helm values.
75+ // +optional
76+ Values string `json:"values,omitempty"`
77+
78+ // Comma-separated Helm values, e.g., key1=val1,key2=val2.
79+ // +optional
80+ Set []string `json:"set,omitempty"`
81+
82+ // Comma-separated Helm JSON values, e.g., key1=jsonval1,key2=jsonval2.
83+ // +optional
84+ SetJSON []string `json:"setJson,omitempty"`
85+
86+ // Comma-separated Helm literal STRING values.
87+ // +optional
88+ SetLiteral []string `json:"setLiteral,omitempty"`
89+
90+ // Comma-separated Helm STRING values, e.g., key1=val1,key2=val2.
91+ // +optional
92+ SetString []string `json:"setString,omitempty"`
93+ }
94+
95+ // ClusterManager is the configuration for a cluster manager.
96+ type ClusterManager struct {
97+ // A set of comma-separated pairs of the form 'key1=value1,key2=value2' that describe feature gates for alpha/experimental features.
98+ // Options are:
99+ // - AddonManagement (ALPHA - default=true)
100+ // - AllAlpha (ALPHA - default=false)
101+ // - AllBeta (BETA - default=false)
102+ // - CloudEventsDrivers (ALPHA - default=false)
103+ // - DefaultClusterSet (ALPHA - default=false)
104+ // - ManagedClusterAutoApproval (ALPHA - default=false)
105+ // - ManifestWorkReplicaSet (ALPHA - default=false)
106+ // - NilExecutorValidating (ALPHA - default=false)
107+ // - ResourceCleanup (BETA - default=true)
108+ // - V1beta1CSRAPICompatibility (ALPHA - default=false)
109+ // +kubebuilder:default:="AddonManagement=true"
110+ // +optional
111+ FeatureGates string `json:"featureGates,omitempty"`
112+
113+ // If set, the cluster manager operator will be purged and the open-cluster-management namespace deleted
114+ // when the FleetConfig CR is deleted.
115+ // +kubebuilder:default:=true
116+ // +optional
117+ PurgeOperator bool `json:"purgeOperator,omitempty"`
118+
119+ // Resource specifications for all clustermanager-managed containers.
120+ // +kubebuilder:default:={}
121+ // +optional
122+ Resources ResourceSpec `json:"resources,omitzero"`
123+
124+ // Version and image registry details for the cluster manager.
125+ // +kubebuilder:default:={}
126+ // +optional
127+ Source OCMSource `json:"source,omitzero"`
128+
129+ // If set, the bootstrap token will used instead of a service account token.
130+ // +optional
131+ UseBootstrapToken bool `json:"useBootstrapToken,omitempty"`
36132}
37133
38134// HubStatus defines the observed state of Hub.
39135type HubStatus struct {
40- // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
41- // Important: Run "make" to regenerate code after modifying this file
136+ // Phase is the current phase of the Hub reconcile.
137+ Phase string `json:"phase,omitempty"`
138+
139+ // Conditions are the current conditions of the Hub.
140+ Conditions []Condition `json:"conditions,omitempty"`
141+
142+ InstalledHubAddOns []InstalledHubAddOn `json:"installedHubAddOns,omitempty"`
143+ }
144+
145+ // InstalledHubAddOn tracks metadata for each hubAddon that is successfully installed on the hub.
146+ type InstalledHubAddOn struct {
147+ // BundleVersion is the bundle version used when installing the addon.
148+ BundleVersion string `json:"bundleVersion"`
149+
150+ // Name is the name of the addon.
151+ Name string `json:"name"`
152+
153+ // Namespace is the namespace that the addon was installed into.
154+ Namespace string `json:"namespace,omitempty"`
42155}
43156
44157// +kubebuilder:object:root=true
0 commit comments