diff --git a/apis/projects/v1alpha1/types.go b/apis/projects/v1alpha1/types.go index 3bc5043..050c853 100644 --- a/apis/projects/v1alpha1/types.go +++ b/apis/projects/v1alpha1/types.go @@ -41,6 +41,9 @@ type ProjectParameters struct { // Destinations contains list of destinations available for deployment // +optional Destinations []ApplicationDestination `json:"destinations,omitempty"` + // SourceNamespaces contains list of namespaces which are authorized in the project + // +optional + SourceNamespaces []string `json:"sourceNamespaces,omitempty"` // Description contains optional project description // +optional Description *string `json:"description,omitempty"` diff --git a/apis/projects/v1alpha1/zz_generated.deepcopy.go b/apis/projects/v1alpha1/zz_generated.deepcopy.go index e0d4875..9aa41b6 100644 --- a/apis/projects/v1alpha1/zz_generated.deepcopy.go +++ b/apis/projects/v1alpha1/zz_generated.deepcopy.go @@ -278,6 +278,11 @@ func (in *ProjectParameters) DeepCopyInto(out *ProjectParameters) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.SourceNamespaces != nil { + in, out := &in.SourceNamespaces, &out.SourceNamespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } if in.Description != nil { in, out := &in.Description, &out.Description *out = new(string) diff --git a/examples/projects/project-with-source-namespaces.yaml b/examples/projects/project-with-source-namespaces.yaml new file mode 100644 index 0000000..70edd7e --- /dev/null +++ b/examples/projects/project-with-source-namespaces.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: projects.argocd.crossplane.io/v1alpha1 +kind: Project +metadata: + name: example-project +spec: + forProvider: + sourceNamespaces: + - default + projectLabels: + argocd.crossplane.io/global-project: "true" + providerConfigRef: + name: argocd-provider diff --git a/package/crds/projects.argocd.crossplane.io_projects.yaml b/package/crds/projects.argocd.crossplane.io_projects.yaml index 6962dbb..ee997cc 100644 --- a/package/crds/projects.argocd.crossplane.io_projects.yaml +++ b/package/crds/projects.argocd.crossplane.io_projects.yaml @@ -334,6 +334,12 @@ spec: - keyID type: object type: array + sourceNamespaces: + description: SourceNamespaces contains list of namespaces which + are authorized in the project + items: + type: string + type: array sourceRepos: description: SourceRepos contains list of repository URLs which can be used for deployment diff --git a/pkg/controller/projects/controller.go b/pkg/controller/projects/controller.go index c32535d..6778a89 100644 --- a/pkg/controller/projects/controller.go +++ b/pkg/controller/projects/controller.go @@ -434,6 +434,10 @@ func generateProjectSpec(p *v1alpha1.ProjectParameters) argocdv1alpha1.AppProjec projSpec.ClusterResourceBlacklist = p.ClusterResourceBlacklist } + if p.SourceNamespaces != nil { + projSpec.SourceNamespaces = p.SourceNamespaces + } + return projSpec }