Skip to content

Commit 1495dbc

Browse files
committed
Fix changes from review comments for namespaceManagement
Signed-off-by: Rizwana777 <[email protected]>
1 parent ea3d288 commit 1495dbc

31 files changed

+2329
-595
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*.dylib
88
/bin
99
testbin/*
10+
*.bak
1011

1112
# Test binary, build with `go test -c`
1213
*.test

api/v1alpha1/argocd_conversion.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ func (src *ArgoCD) ConvertTo(dstRaw conversion.Hub) error {
9696
dst.Spec.Banner = (*v1beta1.Banner)(src.Spec.Banner)
9797
dst.Spec.DefaultClusterScopedRoleDisabled = src.Spec.DefaultClusterScopedRoleDisabled
9898
dst.Spec.AggregatedClusterRoles = src.Spec.AggregatedClusterRoles
99+
dst.Spec.NamespaceManagement = ConvertAlphaToBetaNamespaceManagement(src.Spec.NamespaceManagement)
99100

100101
// Status conversion
101102
dst.Status = v1beta1.ArgoCDStatus(src.Status)
@@ -166,6 +167,7 @@ func (dst *ArgoCD) ConvertFrom(srcRaw conversion.Hub) error {
166167
dst.Spec.Banner = (*Banner)(src.Spec.Banner)
167168
dst.Spec.DefaultClusterScopedRoleDisabled = src.Spec.DefaultClusterScopedRoleDisabled
168169
dst.Spec.AggregatedClusterRoles = src.Spec.AggregatedClusterRoles
170+
dst.Spec.NamespaceManagement = ConvertBetaToAlphaNamespaceManagement(src.Spec.NamespaceManagement)
169171

170172
// Status conversion
171173
dst.Status = ArgoCDStatus(src.Status)
@@ -701,3 +703,26 @@ func ConvertBetaToAlphaRepo(src *v1beta1.ArgoCDRepoSpec) *ArgoCDRepoSpec {
701703
}
702704
return dst
703705
}
706+
707+
func ConvertBetaToAlphaNamespaceManagement(src []v1beta1.ManagedNamespaces) []ManagedNamespaces {
708+
var dst []ManagedNamespaces
709+
for _, s := range src {
710+
dst = append(dst, ManagedNamespaces{
711+
Name: s.Name,
712+
AllowManagedBy: s.AllowManagedBy,
713+
})
714+
}
715+
return dst
716+
}
717+
718+
func ConvertAlphaToBetaNamespaceManagement(src []ManagedNamespaces) []v1beta1.ManagedNamespaces {
719+
var dst []v1beta1.ManagedNamespaces
720+
for _, s := range src {
721+
dst = append(dst, v1beta1.ManagedNamespaces{
722+
Name: s.Name,
723+
AllowManagedBy: s.AllowManagedBy,
724+
},
725+
)
726+
}
727+
return dst
728+
}

api/v1alpha1/argocd_conversion_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,12 @@ func TestAlphaToBetaConversion(t *testing.T) {
327327
Kind: "Deployment",
328328
},
329329
}
330+
cr.Spec.NamespaceManagement = []ManagedNamespaces{
331+
{
332+
Name: "test-nm-namespace",
333+
AllowManagedBy: true,
334+
},
335+
}
330336
}),
331337
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
332338
cr.Spec.ResourceIgnoreDifferences = &v1beta1.ResourceIgnoreDifference{
@@ -374,6 +380,12 @@ func TestAlphaToBetaConversion(t *testing.T) {
374380
Kind: "Deployment",
375381
},
376382
}
383+
cr.Spec.NamespaceManagement = []v1beta1.ManagedNamespaces{
384+
{
385+
Name: "test-nm-namespace",
386+
AllowManagedBy: true,
387+
},
388+
}
377389
}),
378390
},
379391
{

argocd-app.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

bundle/manifests/argocd-operator-namespacemanagement-editor-role_rbac.authorization.k8s.io_v1_clusterrole.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
44
creationTimestamp: null
5-
labels:
6-
app.kubernetes.io/managed-by: kustomize
7-
app.kubernetes.io/name: argocd-operator
85
name: argocd-operator-namespacemanagement-editor-role
96
rules:
107
- apiGroups:

bundle/manifests/argocd-operator-namespacemanagement-viewer-role_rbac.authorization.k8s.io_v1_clusterrole.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
44
creationTimestamp: null
5-
labels:
6-
app.kubernetes.io/managed-by: kustomize
7-
app.kubernetes.io/name: argocd-operator
85
name: argocd-operator-namespacemanagement-viewer-role
96
rules:
107
- apiGroups:

bundle/manifests/argocd-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,6 @@ metadata:
247247
"apiVersion": "argoproj.io/v1beta1",
248248
"kind": "NamespaceManagement",
249249
"metadata": {
250-
"labels": {
251-
"app.kubernetes.io/managed-by": "kustomize",
252-
"app.kubernetes.io/name": "argocd-operator"
253-
},
254250
"name": "namespacemanagement-sample"
255251
},
256252
"spec": {
@@ -261,11 +257,7 @@ metadata:
261257
capabilities: Deep Insights
262258
categories: Integration & Delivery
263259
certified: "false"
264-
<<<<<<< HEAD
265-
createdAt: "2025-04-17T06:59:28Z"
266-
=======
267-
createdAt: "2025-03-10T14:57:27Z"
268-
>>>>>>> 2badd95 (Run make manifests and bundle)
260+
createdAt: "2025-04-28T10:48:34Z"
269261
description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes.
270262
operators.operatorframework.io/builder: operator-sdk-v1.35.0
271263
operators.operatorframework.io/project_layout: go.kubebuilder.io/v4

common/keys.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ const (
235235
// ArgoCDKeyInstallationID is the configuration key for the installation ID.
236236
ArgoCDKeyInstallationID = "installationID"
237237

238-
// ENABLE_MANAGED_NAMESPACE_FEATURE is an environment variable that controls whether
238+
// ALLOW_NAMESPACE_MANAGEMENT_IN_NAMESPACE_SCOPED_INSTANCES is an environment variable that controls whether
239239
// the Namespace Management feature is enabled.
240-
EnableManagedNamespace = "ENABLE_MANAGED_NAMESPACE_FEATURE"
240+
EnableManagedNamespace = "ALLOW_NAMESPACE_MANAGEMENT_IN_NAMESPACE_SCOPED_INSTANCES"
241241
)

config/crd/bases/argoproj.io_argocdexports.yaml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -149,33 +149,6 @@ spec:
149149
status field of the claim.
150150
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
151151
properties:
152-
claims:
153-
description: |-
154-
Claims lists the names of resources, defined in spec.resourceClaims,
155-
that are used by this container.
156-
157-
158-
This is an alpha field and requires enabling the
159-
DynamicResourceAllocation feature gate.
160-
161-
162-
This field is immutable. It can only be set for containers.
163-
items:
164-
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
165-
properties:
166-
name:
167-
description: |-
168-
Name must match the name of one entry in pod.spec.resourceClaims of
169-
the Pod where this field is used. It makes that resource available
170-
inside a container.
171-
type: string
172-
required:
173-
- name
174-
type: object
175-
type: array
176-
x-kubernetes-list-map-keys:
177-
- name
178-
x-kubernetes-list-type: map
179152
limits:
180153
additionalProperties:
181154
anyOf:

config/crd/bases/argoproj.io_argocds.yaml

Lines changed: 0 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -5303,34 +5303,6 @@ spec:
53035303
status field of the claim.
53045304
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
53055305
properties:
5306-
claims:
5307-
description: |-
5308-
Claims lists the names of resources, defined in spec.resourceClaims,
5309-
that are used by this container.
5310-
5311-
5312-
This is an alpha field and requires enabling the
5313-
DynamicResourceAllocation feature gate.
5314-
5315-
5316-
This field is immutable. It can only be set for containers.
5317-
items:
5318-
description: ResourceClaim references
5319-
one entry in PodSpec.ResourceClaims.
5320-
properties:
5321-
name:
5322-
description: |-
5323-
Name must match the name of one entry in pod.spec.resourceClaims of
5324-
the Pod where this field is used. It makes that resource available
5325-
inside a container.
5326-
type: string
5327-
required:
5328-
- name
5329-
type: object
5330-
type: array
5331-
x-kubernetes-list-map-keys:
5332-
- name
5333-
x-kubernetes-list-type: map
53345306
limits:
53355307
additionalProperties:
53365308
anyOf:
@@ -8380,34 +8352,6 @@ spec:
83808352
status field of the claim.
83818353
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
83828354
properties:
8383-
claims:
8384-
description: |-
8385-
Claims lists the names of resources, defined in spec.resourceClaims,
8386-
that are used by this container.
8387-
8388-
8389-
This is an alpha field and requires enabling the
8390-
DynamicResourceAllocation feature gate.
8391-
8392-
8393-
This field is immutable. It can only be set for containers.
8394-
items:
8395-
description: ResourceClaim references
8396-
one entry in PodSpec.ResourceClaims.
8397-
properties:
8398-
name:
8399-
description: |-
8400-
Name must match the name of one entry in pod.spec.resourceClaims of
8401-
the Pod where this field is used. It makes that resource available
8402-
inside a container.
8403-
type: string
8404-
required:
8405-
- name
8406-
type: object
8407-
type: array
8408-
x-kubernetes-list-map-keys:
8409-
- name
8410-
x-kubernetes-list-type: map
84118355
limits:
84128356
additionalProperties:
84138357
anyOf:
@@ -13297,34 +13241,6 @@ spec:
1329713241
status field of the claim.
1329813242
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
1329913243
properties:
13300-
claims:
13301-
description: |-
13302-
Claims lists the names of resources, defined in spec.resourceClaims,
13303-
that are used by this container.
13304-
13305-
13306-
This is an alpha field and requires enabling the
13307-
DynamicResourceAllocation feature gate.
13308-
13309-
13310-
This field is immutable. It can only be set for containers.
13311-
items:
13312-
description: ResourceClaim references
13313-
one entry in PodSpec.ResourceClaims.
13314-
properties:
13315-
name:
13316-
description: |-
13317-
Name must match the name of one entry in pod.spec.resourceClaims of
13318-
the Pod where this field is used. It makes that resource available
13319-
inside a container.
13320-
type: string
13321-
required:
13322-
- name
13323-
type: object
13324-
type: array
13325-
x-kubernetes-list-map-keys:
13326-
- name
13327-
x-kubernetes-list-type: map
1332813244
limits:
1332913245
additionalProperties:
1333013246
anyOf:
@@ -18997,34 +18913,6 @@ spec:
1899718913
status field of the claim.
1899818914
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
1899918915
properties:
19000-
claims:
19001-
description: |-
19002-
Claims lists the names of resources, defined in spec.resourceClaims,
19003-
that are used by this container.
19004-
19005-
19006-
This is an alpha field and requires enabling the
19007-
DynamicResourceAllocation feature gate.
19008-
19009-
19010-
This field is immutable. It can only be set for containers.
19011-
items:
19012-
description: ResourceClaim references
19013-
one entry in PodSpec.ResourceClaims.
19014-
properties:
19015-
name:
19016-
description: |-
19017-
Name must match the name of one entry in pod.spec.resourceClaims of
19018-
the Pod where this field is used. It makes that resource available
19019-
inside a container.
19020-
type: string
19021-
required:
19022-
- name
19023-
type: object
19024-
type: array
19025-
x-kubernetes-list-map-keys:
19026-
- name
19027-
x-kubernetes-list-type: map
1902818916
limits:
1902918917
additionalProperties:
1903018918
anyOf:
@@ -24057,37 +23945,6 @@ spec:
2405723945
status field of the claim.
2405823946
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
2405923947
properties:
24060-
<<<<<<< HEAD
24061-
=======
24062-
claims:
24063-
description: |-
24064-
Claims lists the names of resources, defined in spec.resourceClaims,
24065-
that are used by this container.
24066-
24067-
24068-
This is an alpha field and requires enabling the
24069-
DynamicResourceAllocation feature gate.
24070-
24071-
24072-
This field is immutable. It can only be set for containers.
24073-
items:
24074-
description: ResourceClaim references
24075-
one entry in PodSpec.ResourceClaims.
24076-
properties:
24077-
name:
24078-
description: |-
24079-
Name must match the name of one entry in pod.spec.resourceClaims of
24080-
the Pod where this field is used. It makes that resource available
24081-
inside a container.
24082-
type: string
24083-
required:
24084-
- name
24085-
type: object
24086-
type: array
24087-
x-kubernetes-list-map-keys:
24088-
- name
24089-
x-kubernetes-list-type: map
24090-
>>>>>>> 3ebf26f (Add NamespaceManagement reconciliation)
2409123948
limits:
2409223949
additionalProperties:
2409323950
anyOf:

config/rbac/namespacemanagement_editor_role.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
44
metadata:
5-
labels:
6-
app.kubernetes.io/name: argocd-operator
7-
app.kubernetes.io/managed-by: kustomize
85
name: namespacemanagement-editor-role
96
rules:
107
- apiGroups:

config/rbac/namespacemanagement_viewer_role.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
44
metadata:
5-
labels:
6-
app.kubernetes.io/name: argocd-operator
7-
app.kubernetes.io/managed-by: kustomize
85
name: namespacemanagement-viewer-role
96
rules:
107
- apiGroups:
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
apiVersion: argoproj.io/v1beta1
22
kind: NamespaceManagement
33
metadata:
4-
labels:
5-
app.kubernetes.io/name: argocd-operator
6-
app.kubernetes.io/managed-by: kustomize
74
name: namespacemanagement-sample
85
spec:
96
managedBy: argocd-ns

0 commit comments

Comments
 (0)