Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions api/v1beta1/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,13 +570,15 @@ type KustomizationRef struct {
// Defaults to 'None', which translates to the root path of the SourceRef.
// These values can be static or leverage Go templates for dynamic customization.
// When expressed as templates, the values are filled in using information from
// resources within the management cluster before deployment (Cluster)
// resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
// +optional
Path string `json:"path,omitempty"`

// Components is a list of paths to Kustomize components. These paths are relative to the
// `Path` field and are included in the Kustomize build to provide reusable configuration logic.
// The paths can be static or leverage Go templates for dynamic customization.
// These values can be static or leverage Go templates for dynamic customization.
// When expressed as templates, the values are filled in using information from
// resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
// +optional
Components []string `json:"components,omitempty"`

Expand Down Expand Up @@ -736,6 +738,9 @@ type PolicyRef struct {
// Path to the directory containing the YAML files.
// Defaults to 'None', which translates to the root path of the SourceRef.
// Used only for GitRepository;OCIRepository;Bucket
// This value can be static or leverage Go templates for dynamic customization.
// When expressed as a template, it is filled in using information from
// resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
// +optional
Path string `json:"path,omitempty"`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,9 @@ spec:
description: |-
Components is a list of paths to Kustomize components. These paths are relative to the
`Path` field and are included in the Kustomize build to provide reusable configuration logic.
The paths can be static or leverage Go templates for dynamic customization.
These values can be static or leverage Go templates for dynamic customization.
When expressed as templates, the values are filled in using information from
resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
items:
type: string
type: array
Expand Down Expand Up @@ -805,7 +807,7 @@ spec:
Defaults to 'None', which translates to the root path of the SourceRef.
These values can be static or leverage Go templates for dynamic customization.
When expressed as templates, the values are filled in using information from
resources within the management cluster before deployment (Cluster)
resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
type: string
skipNamespaceCreation:
default: false
Expand Down Expand Up @@ -1102,6 +1104,9 @@ spec:
Path to the directory containing the YAML files.
Defaults to 'None', which translates to the root path of the SourceRef.
Used only for GitRepository;OCIRepository;Bucket
This value can be static or leverage Go templates for dynamic customization.
When expressed as a template, it is filled in using information from
resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
type: string
remoteURL:
description: |-
Expand Down
15 changes: 13 additions & 2 deletions config/crd/bases/config.projectsveltos.io_clusterpromotions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,9 @@ spec:
description: |-
Components is a list of paths to Kustomize components. These paths are relative to the
`Path` field and are included in the Kustomize build to provide reusable configuration logic.
The paths can be static or leverage Go templates for dynamic customization.
These values can be static or leverage Go templates for dynamic customization.
When expressed as templates, the values are filled in using information from
resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
items:
type: string
type: array
Expand Down Expand Up @@ -707,7 +709,7 @@ spec:
Defaults to 'None', which translates to the root path of the SourceRef.
These values can be static or leverage Go templates for dynamic customization.
When expressed as templates, the values are filled in using information from
resources within the management cluster before deployment (Cluster)
resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
type: string
skipNamespaceCreation:
default: false
Expand Down Expand Up @@ -1004,6 +1006,9 @@ spec:
Path to the directory containing the YAML files.
Defaults to 'None', which translates to the root path of the SourceRef.
Used only for GitRepository;OCIRepository;Bucket
This value can be static or leverage Go templates for dynamic customization.
When expressed as a template, it is filled in using information from
resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
type: string
remoteURL:
description: |-
Expand Down Expand Up @@ -2218,6 +2223,9 @@ spec:
Path to the directory containing the YAML files.
Defaults to 'None', which translates to the root path of the SourceRef.
Used only for GitRepository;OCIRepository;Bucket
This value can be static or leverage Go templates for dynamic customization.
When expressed as a template, it is filled in using information from
resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
type: string
remoteURL:
description: |-
Expand Down Expand Up @@ -2577,6 +2585,9 @@ spec:
Path to the directory containing the YAML files.
Defaults to 'None', which translates to the root path of the SourceRef.
Used only for GitRepository;OCIRepository;Bucket
This value can be static or leverage Go templates for dynamic customization.
When expressed as a template, it is filled in using information from
resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
type: string
remoteURL:
description: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,9 @@ spec:
description: |-
Components is a list of paths to Kustomize components. These paths are relative to the
`Path` field and are included in the Kustomize build to provide reusable configuration logic.
The paths can be static or leverage Go templates for dynamic customization.
These values can be static or leverage Go templates for dynamic customization.
When expressed as templates, the values are filled in using information from
resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
items:
type: string
type: array
Expand Down Expand Up @@ -844,7 +846,7 @@ spec:
Defaults to 'None', which translates to the root path of the SourceRef.
These values can be static or leverage Go templates for dynamic customization.
When expressed as templates, the values are filled in using information from
resources within the management cluster before deployment (Cluster)
resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
type: string
skipNamespaceCreation:
default: false
Expand Down Expand Up @@ -1141,6 +1143,9 @@ spec:
Path to the directory containing the YAML files.
Defaults to 'None', which translates to the root path of the SourceRef.
Used only for GitRepository;OCIRepository;Bucket
This value can be static or leverage Go templates for dynamic customization.
When expressed as a template, it is filled in using information from
resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
type: string
remoteURL:
description: |-
Expand Down
9 changes: 7 additions & 2 deletions config/crd/bases/config.projectsveltos.io_profiles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,9 @@ spec:
description: |-
Components is a list of paths to Kustomize components. These paths are relative to the
`Path` field and are included in the Kustomize build to provide reusable configuration logic.
The paths can be static or leverage Go templates for dynamic customization.
These values can be static or leverage Go templates for dynamic customization.
When expressed as templates, the values are filled in using information from
resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
items:
type: string
type: array
Expand Down Expand Up @@ -805,7 +807,7 @@ spec:
Defaults to 'None', which translates to the root path of the SourceRef.
These values can be static or leverage Go templates for dynamic customization.
When expressed as templates, the values are filled in using information from
resources within the management cluster before deployment (Cluster)
resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
type: string
skipNamespaceCreation:
default: false
Expand Down Expand Up @@ -1102,6 +1104,9 @@ spec:
Path to the directory containing the YAML files.
Defaults to 'None', which translates to the root path of the SourceRef.
Used only for GitRepository;OCIRepository;Bucket
This value can be static or leverage Go templates for dynamic customization.
When expressed as a template, it is filled in using information from
resources within the management cluster before deployment (Cluster and TemplateResourceRefs)
type: string
remoteURL:
description: |-
Expand Down
7 changes: 4 additions & 3 deletions controllers/handlers_kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,9 +698,10 @@ func deployKustomizeRef(ctx context.Context, c client.Client, remoteRestConfig *

defer os.RemoveAll(tmpDir)

// Path can be expressed as a template and instantiate using Cluster fields.
// Path can be expressed as a template and instantiate using Cluster fields and
// TemplateResourceRefs-collected resources.
instantiatedPath, err := instantiateTemplateValues(ctx, getManagementClusterConfig(), getManagementClusterClient(),
dCtx.clusterSummary, dCtx.clusterSummary.GetName(), kustomizationRef.Path, dCtx.clusterObjects, nil, logger)
dCtx.clusterSummary, dCtx.clusterSummary.GetName(), kustomizationRef.Path, dCtx.clusterObjects, dCtx.mgmtResources, logger)
if err != nil {
return nil, nil, err
}
Expand All @@ -711,7 +712,7 @@ func deployKustomizeRef(ctx context.Context, c client.Client, remoteRestConfig *
var instantiatedComponents []string
for _, comp := range kustomizationRef.Components {
instantiatedComp, err := instantiateTemplateValues(ctx, getManagementClusterConfig(), getManagementClusterClient(),
dCtx.clusterSummary, dCtx.clusterSummary.GetName(), comp, dCtx.clusterObjects, nil, logger)
dCtx.clusterSummary, dCtx.clusterSummary.GetName(), comp, dCtx.clusterObjects, dCtx.mgmtResources, logger)
if err != nil {
return nil, nil, err
}
Expand Down
5 changes: 3 additions & 2 deletions controllers/handlers_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ func deployContentOfSource(ctx context.Context, deployingToMgmtCluster bool, des

defer os.RemoveAll(tmpDir)

// Path can be expressed as a template and instantiate using Cluster fields.
// Path can be expressed as a template and instantiate using Cluster fields and
// TemplateResourceRefs-collected resources.
instantiatedPath, err := instantiateTemplateValues(ctx, getManagementClusterConfig(), getManagementClusterClient(),
dCtx.clusterSummary, dCtx.clusterSummary.GetName(), path, dCtx.clusterObjects, nil, logger)
dCtx.clusterSummary, dCtx.clusterSummary.GetName(), path, dCtx.clusterObjects, dCtx.mgmtResources, logger)
if err != nil {
return nil, err
}
Expand Down
Loading