@@ -42,20 +42,20 @@ type KCLRunSpec struct {
4242 // applied to all resources. Any existing label or annotation will be
4343 // overridden if its key matches a common one.
4444 // +optional
45- CommonMetadata * CommonMetadata `json:"commonMetadata,omitempty"`
45+ CommonMetadata * CommonMetadata `json:"commonMetadata,omitempty" yaml:"commonMetadata,omitempty" `
4646
4747 // DependsOn may contain a meta.NamespacedObjectReference slice
4848 // with references to Kustomization resources that must be ready before this
4949 // Kustomization can be reconciled.
5050 // +optional
51- DependsOn []meta.NamespacedObjectReference `json:"dependsOn,omitempty"`
51+ DependsOn []meta.NamespacedObjectReference `json:"dependsOn,omitempty" yaml:"dependsOn,omitempty" `
5252
5353 // Timeout is the time to wait for any individual Kubernetes operation (like Jobs
5454 // for hooks) during the performance. Defaults to '5m0s'.
5555 // +kubebuilder:validation:Type=string
5656 // +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"
5757 // +optional
58- Timeout * metav1.Duration `json:"timeout,omitempty"`
58+ Timeout * metav1.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty" `
5959
6060 // PersistentClient tells the controller to use a persistent Kubernetes
6161 // client for this release. When enabled, the client will be reused for the
@@ -65,7 +65,7 @@ type KCLRunSpec struct {
6565 // If not set, it defaults to true.
6666 //
6767 // +optional
68- PersistentClient * bool `json:"persistentClient,omitempty"`
68+ PersistentClient * bool `json:"persistentClient,omitempty" yaml:"persistentClient,omitempty" `
6969
7070 // The KubeConfig for reconciling the controller on a remote cluster.
7171 // When used in combination with `KCLRunSpec.ServiceAccountName`,
@@ -75,49 +75,49 @@ type KCLRunSpec struct {
7575 // a controller level fallback for when `KCLRunSpec.ServiceAccountName`
7676 // is empty.
7777 // +optional
78- KubeConfig * meta.KubeConfigReference `json:"kubeConfig,omitempty"`
78+ KubeConfig * meta.KubeConfigReference `json:"kubeConfig,omitempty" yaml:"kubeConfig,omitempty" `
7979
8080 // The name of the Kubernetes service account to impersonate
8181 // when reconciling this KCL source.
8282 // +kubebuilder:validation:MinLength=1
8383 // +kubebuilder:validation:MaxLength=253
8484 // +optional
85- ServiceAccountName string `json:"serviceAccountName,omitempty"`
85+ ServiceAccountName string `json:"serviceAccountName,omitempty" yaml:"serviceAccountName,omitempty" `
8686
8787 // TargetNamespace to target when performing operations for the KCL.
8888 // Defaults to the namespace of the KCL source.
8989 // +kubebuilder:validation:MinLength=1
9090 // +kubebuilder:validation:MaxLength=63
9191 // +kubebuilder:validation:Optional
9292 // +optional
93- TargetNamespace string `json:"targetNamespace,omitempty"`
93+ TargetNamespace string `json:"targetNamespace,omitempty" yaml:"targetNamespace,omitempty" `
9494
9595 // Force instructs the controller to recreate resources
9696 // when patching fails due to an immutable field change.
9797 // +kubebuilder:default:=false
9898 // +optional
99- Force bool `json:"force,omitempty"`
99+ Force bool `json:"force,omitempty" yaml:"force,omitempty" `
100100
101101 // The interval at which to reconcile the KCL Module.
102102 // This interval is approximate and may be subject to jitter to ensure
103103 // efficient use of resources.
104104 // +kubebuilder:validation:Type=string
105105 // +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"
106106 // +required
107- Interval metav1.Duration `json:"interval"`
107+ Interval metav1.Duration `json:"interval" yaml:"interval" `
108108
109109 // The interval at which to retry a previously failed reconciliation.
110110 // When not specified, the controller uses the KCLRunSpec.Interval
111111 // value to retry failures.
112112 // +kubebuilder:validation:Type=string
113113 // +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"
114114 // +optional
115- RetryInterval * metav1.Duration `json:"retryInterval,omitempty"`
115+ RetryInterval * metav1.Duration `json:"retryInterval,omitempty" yaml:"retryInterval,omitempty" `
116116
117117 // Path to the directory containing the kcl.mod file.
118118 // Defaults to 'None', which translates to the root path of the SourceRef.
119119 // +optional
120- Path string `json:"path,omitempty"`
120+ Path string `json:"path,omitempty" yaml:"path,omitempty" `
121121
122122 // Params are the parameters in key-value pairs format.
123123 // +optional
@@ -127,6 +127,11 @@ type KCLRunSpec struct {
127127 // +optional
128128 Config * ConfigSpec `json:"config,omitempty" yaml:"config,omitempty"`
129129
130+ // ConfigReference holds references to ConfigMaps and Secrets containing
131+ // the KCL compile config. The ConfigMap and the Secret data keys represent the config names.
132+ // +optional
133+ ConfigReference * ConfigReference `json:"configReference,omitempty" yaml:"configReference,omitempty"`
134+
130135 // Prune enables garbage collection.
131136 // +required
132137 Prune bool `json:"prune"`
@@ -189,59 +194,79 @@ type ConfigSpec struct {
189194 DisableNone bool `json:"disableNone,omitempty" yaml:"disableNone,omitempty"`
190195}
191196
197+ // ConfigReference contains a reference to a resource containing the KCL compile config.
198+ type ConfigReference struct {
199+ // Kind of the values referent, valid values are ('Secret', 'ConfigMap').
200+ // +kubebuilder:validation:Enum=Secret;ConfigMap
201+ // +required
202+ Kind string `json:"kind" yaml:"kind"`
203+ // Name of the values referent. Should reside in the same namespace as the
204+ // referring resource.
205+ // +kubebuilder:validation:MinLength=1
206+ // +kubebuilder:validation:MaxLength=253
207+ // +required
208+ Name string `json:"name" yaml:"name"`
209+ // Optional indicates whether the referenced resource must exist, or whether to
210+ // tolerate its absence. If true and the referenced resource is absent, proceed
211+ // as if the resource was present but empty, without any variables defined.
212+ // +kubebuilder:default:=false
213+ // +optional
214+ Optional bool `json:"optional,omitempty" yaml:"optional,omitempty"`
215+ }
216+
192217// KCLRunStatus defines the observed state of KCLRun
193218type KCLRunStatus struct {
194- meta.ReconcileRequestStatus `json:",inline"`
219+ meta.ReconcileRequestStatus `json:",inline" yaml:",inline" `
195220
196221 // ObservedGeneration is the last reconciled generation.
197222 // +optional
198- ObservedGeneration int64 `json:"observedGeneration,omitempty"`
223+ ObservedGeneration int64 `json:"observedGeneration,omitempty" yaml:"observedGeneration,omitempty" `
199224
200225 // +optional
201- Conditions []metav1.Condition `json:"conditions,omitempty"`
226+ Conditions []metav1.Condition `json:"conditions,omitempty" yaml:"conditions,omitempty" `
202227
203228 // The last successfully applied revision.
204229 // Equals the Revision of the applied Artifact from the referenced Source.
205230 // +optional
206- LastAppliedRevision string `json:"lastAppliedRevision,omitempty"`
231+ LastAppliedRevision string `json:"lastAppliedRevision,omitempty" yaml:"lastAppliedRevision,omitempty" `
207232
208233 // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
209234 // Important: Run "make" to regenerate code after modifying this file
210235
211236 // LastAttemptedRevision is the revision of the last reconciliation attempt.
212237 // +optional
213- LastAttemptedRevision string `json:"lastAttemptedRevision,omitempty"`
238+ LastAttemptedRevision string `json:"lastAttemptedRevision,omitempty" yaml:"lastAttemptedRevision,omitempty" `
214239
215240 // LastAttemptedRevisionDigest is the digest of the last reconciliation attempt.
216241 // This is only set for OCIRepository sources.
217242 // +optional
218- LastAttemptedRevisionDigest string `json:"lastAttemptedRevisionDigest,omitempty"`
243+ LastAttemptedRevisionDigest string `json:"lastAttemptedRevisionDigest,omitempty" yaml:"lastAttemptedRevisionDigest,omitempty" `
219244
220245 // Inventory contains the list of Kubernetes resource object references that
221246 // have been successfully applied.
222247 // +optional
223- Inventory * ResourceInventory `json:"inventory,omitempty"`
248+ Inventory * ResourceInventory `json:"inventory,omitempty" yaml:"inventory,omitempty" `
224249}
225250
226251//+kubebuilder:object:root=true
227252//+kubebuilder:subresource:status
228253
229254// KCLRun is the Schema for the kclruns API
230255type KCLRun struct {
231- metav1.TypeMeta `json:",inline"`
232- metav1.ObjectMeta `json:"metadata,omitempty"`
256+ metav1.TypeMeta `json:",inline" yaml:",inline" `
257+ metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" `
233258
234- Spec KCLRunSpec `json:"spec,omitempty"`
235- Status KCLRunStatus `json:"status,omitempty"`
259+ Spec KCLRunSpec `json:"spec,omitempty" yaml:"spec,omitempty" `
260+ Status KCLRunStatus `json:"status,omitempty" yaml:"status,omitempty" `
236261}
237262
238263//+kubebuilder:object:root=true
239264
240265// KCLRunList contains a list of KCLRun
241266type KCLRunList struct {
242- metav1.TypeMeta `json:",inline"`
243- metav1.ListMeta `json:"metadata,omitempty"`
244- Items []KCLRun `json:"items"`
267+ metav1.TypeMeta `json:",inline" yaml:",inline" `
268+ metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" `
269+ Items []KCLRun `json:"items" yaml:"items" `
245270}
246271
247272func init () {
0 commit comments