diff --git a/operatorconfig/clientconfig/apexconnectivityclient/v1.0.0/brownfield-onboard.yaml b/operatorconfig/clientconfig/apexconnectivityclient/v1.0.0/brownfield-onboard.yaml new file mode 100644 index 000000000..46864aaf2 --- /dev/null +++ b/operatorconfig/clientconfig/apexconnectivityclient/v1.0.0/brownfield-onboard.yaml @@ -0,0 +1,32 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: connectivity-client-docker-k8s + namespace: +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["list","get", "create", "update", "delete","watch"] + - apiGroups: ["storage.dell.com"] + resources: ["containerstoragemodules"] + verbs: ["create", "delete"] + - apiGroups: [""] + resources: ["configmaps"] + verbs: ["get", "create", "delete", "update"] + - apiGroups: ["mobility.storage.dell.com"] + resources: ["backups"] + verbs: ["create"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: connectivity-client-docker-k8s + namespace: +subjects: + - kind: ServiceAccount + name: connectivity-client-docker-k8s + namespace: +roleRef: + kind: Role + name: connectivity-client-docker-k8s + apiGroup: rbac.authorization.k8s.io diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index ccbc62a3f..2bdb1bfaa 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -1175,3 +1175,25 @@ func getUpgradeInfo[T csmv1.CSMComponentType](ctx context.Context, operatorConfi // Example return value: "v2.2.0" return upgradePath.MinUpgradePath, nil } + +func getNamespaces(ctx context.Context, ctrlClient crclient.Client) ([]string, error) { + // Set to store unique namespaces + namespaceMap := make(map[string]struct{}) + + csmList := &csmv1.ContainerStorageModuleList{} + + if err := ctrlClient.List(ctx, csmList); err != nil { + return nil, fmt.Errorf("error listing csm resources: %w", err) + } + for _, csmResource := range csmList.Items { + namespaceMap[csmResource.Namespace] = struct{}{} + } + + // Convert set to slice + var namespaces []string + for namespace := range namespaceMap { + namespaces = append(namespaces, namespace) + } + + return namespaces, nil +}