@@ -22,6 +22,7 @@ import (
2222 kc "github.com/fluxcd/kustomize-controller/api/v1"
2323 "github.com/fluxcd/pkg/apis/meta"
2424 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
25+ runtime "k8s.io/apimachinery/pkg/runtime"
2526)
2627
2728const (
@@ -97,7 +98,7 @@ type KCLRunSpec struct {
9798 // +optional
9899 Force bool `json:"force,omitempty"`
99100
100- // The interval at which to reconcile the Kustomization .
101+ // The interval at which to reconcile the KCL Module .
101102 // This interval is approximate and may be subject to jitter to ensure
102103 // efficient use of resources.
103104 // +kubebuilder:validation:Type=string
@@ -106,7 +107,7 @@ type KCLRunSpec struct {
106107 Interval metav1.Duration `json:"interval"`
107108
108109 // The interval at which to retry a previously failed reconciliation.
109- // When not specified, the controller uses the KustomizationSpec .Interval
110+ // When not specified, the controller uses the KCLRunSpec .Interval
110111 // value to retry failures.
111112 // +kubebuilder:validation:Type=string
112113 // +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"
@@ -118,10 +119,13 @@ type KCLRunSpec struct {
118119 // +optional
119120 Path string `json:"path,omitempty"`
120121
121- // PostBuild describes which actions to perform on the YAML manifest
122- // generated by building the KCL module.
122+ // Params are the parameters in key-value pairs format.
123123 // +optional
124- PostBuild * PostBuild `json:"postBuild,omitempty"`
124+ Params map [string ]runtime.RawExtension `json:"params,omitempty" yaml:"params,omitempty"`
125+
126+ // Config is the KCL compile config.
127+ // +optional
128+ Config * ConfigSpec `json:"config,omitempty" yaml:"config,omitempty"`
125129
126130 // Prune enables garbage collection.
127131 // +required
@@ -157,47 +161,32 @@ type CommonMetadata struct {
157161 Labels map [string ]string `json:"labels,omitempty"`
158162}
159163
160- // PostBuild describes which actions to perform on the YAML manifest
161- // generated by building the kustomize overlay.
162- type PostBuild struct {
163- // Substitute holds a map of key/value pairs.
164- // The variables defined in your YAML manifests that match any of the keys
165- // defined in the map will be substituted with the set value.
166- // Includes support for bash string replacement functions
167- // e.g. ${var:=default}, ${var:position} and ${var/substring/replacement}.
164+ // ConfigSpec defines the compile config.
165+ type ConfigSpec struct {
166+ // Arguments is the list of top level dynamic arguments for the kcl option function, e.g., env="prod"
168167 // +optional
169- Substitute map [string ]string `json:"substitute,omitempty"`
170-
171- // SubstituteFrom holds references to ConfigMaps and Secrets containing
172- // the variables and their values to be substituted in the YAML manifests.
173- // The ConfigMap and the Secret data keys represent the var names, and they
174- // must match the vars declared in the manifests for the substitution to
175- // happen.
168+ Arguments []string `json:"arguments,omitempty" yaml:"arguments,omitempty"`
169+ // Settings is the list of kcl setting files including all of the CLI config.
176170 // +optional
177- SubstituteFrom []SubstituteReference `json:"substituteFrom,omitempty"`
178- }
179-
180- // SubstituteReference contains a reference to a resource containing
181- // the variables name and value.
182- type SubstituteReference struct {
183- // Kind of the values referent, valid values are ('Secret', 'ConfigMap').
184- // +kubebuilder:validation:Enum=Secret;ConfigMap
185- // +required
186- Kind string `json:"kind"`
187-
188- // Name of the values referent. Should reside in the same namespace as the
189- // referring resource.
190- // +kubebuilder:validation:MinLength=1
191- // +kubebuilder:validation:MaxLength=253
192- // +required
193- Name string `json:"name"`
194-
195- // Optional indicates whether the referenced resource must exist, or whether to
196- // tolerate its absence. If true and the referenced resource is absent, proceed
197- // as if the resource was present but empty, without any variables defined.
198- // +kubebuilder:default:=false
171+ Settings []string `json:"settings,omitempty" yaml:"settings,omitempty"`
172+ // Overrides is the list of override paths and values, e.g., app.image="v2"
173+ // +optional
174+ Overrides []string `json:"overrides,omitempty" yaml:"overrides,omitempty"`
175+ // PathSelectors is the list of path selectors to select output result, e.g., a.b.c
176+ // +optional
177+ PathSelectors []string `json:"pathSelectors,omitempty" yaml:"pathSelectors,omitempty"`
178+ // Vendor denotes running kcl in the vendor mode.
179+ // +optional
180+ Vendor bool `json:"vendor,omitempty" yaml:"vendor,omitempty"`
181+ // SortKeys denotes sorting the output result keys, e.g., `{b = 1, a = 2} => {a = 2, b = 1}`.
182+ // +optional
183+ SortKeys bool `json:"sortKeys,omitempty" yaml:"sortKeys,omitempty"`
184+ // ShowHidden denotes output the hidden attribute in the result.
185+ // +optional
186+ ShowHidden bool `json:"showHidden,omitempty" yaml:"showHidden,omitempty"`
187+ // DisableNone denotes running kcl and disable dumping None values.
199188 // +optional
200- Optional bool `json:"optional ,omitempty"`
189+ DisableNone bool `json:"disableNone,omitempty" yaml:"disableNone ,omitempty"`
201190}
202191
203192// KCLRunStatus defines the observed state of KCLRun
0 commit comments