Skip to content

Commit

Permalink
feat(projects): add sourceNamespaces field to ProjectParameters (#199)
Browse files Browse the repository at this point in the history
Signed-off-by: Ismail KABOUBI <ikaboubi@gmail.com>
  • Loading branch information
smileisak authored Sep 23, 2024
1 parent 41e9c8f commit 1568f5c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apis/projects/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
5 changes: 5 additions & 0 deletions apis/projects/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions examples/projects/project-with-source-namespaces.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions package/crds/projects.argocd.crossplane.io_projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions pkg/controller/projects/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 1568f5c

Please sign in to comment.