diff --git a/api/v1beta2/kustomization_types.go b/api/v1beta2/kustomization_types.go index 09a5739b0..b6b9caa31 100644 --- a/api/v1beta2/kustomization_types.go +++ b/api/v1beta2/kustomization_types.go @@ -153,6 +153,11 @@ type KustomizationSpec struct { // +kubebuilder:validation:Enum=none;client;server // +optional Validation string `json:"validation,omitempty"` + + // Components specifies relative paths to specifications of other Components + // via relative paths, absolute paths, or URLs. + // +optional + Components []string `json:"components,omitempty"` } // Decryption defines how decryption is handled for Kubernetes manifests. diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go index 93ab196c7..0ef46eab1 100644 --- a/api/v1beta2/zz_generated.deepcopy.go +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -187,6 +187,11 @@ func (in *KustomizationSpec) DeepCopyInto(out *KustomizationSpec) { *out = new(v1.Duration) **out = **in } + if in.Components != nil { + in, out := &in.Components, &out.Components + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KustomizationSpec. diff --git a/config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml b/config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml index 0b4cc2a0c..e04f611d1 100644 --- a/config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml +++ b/config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml @@ -585,6 +585,12 @@ spec: description: KustomizationSpec defines the configuration to calculate the desired state from a Source using Kustomize. properties: + components: + description: Components specifies relative paths to specifications + of other Components via relative paths, absolute paths, or URLs. + items: + type: string + type: array decryption: description: Decrypt Kubernetes secrets before applying them on the cluster. diff --git a/internal/generator/generator.go b/internal/generator/generator.go index cb7ed9718..b1ef25fb7 100644 --- a/internal/generator/generator.go +++ b/internal/generator/generator.go @@ -79,6 +79,8 @@ func (kg *KustomizeGenerator) WriteFile(dirPath string) (string, error) { }) } + kus.Components = kg.kustomization.Spec.Components + for _, m := range kg.kustomization.Spec.PatchesStrategicMerge { kus.PatchesStrategicMerge = append(kus.PatchesStrategicMerge, kustypes.PatchStrategicMerge(m.Raw)) }