komish / argocd-namespace-operator

Operator to add a namespace to be managed by a namespaced ArgoCD deployment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ArgoCD Namepace Operator

This operator allows a regular user to add the ArgoCD label to any namespace that they are authorized to create objects in.

If ArgoCD is installed into a custom namespace via the OpenShift GitOps operator it can only manage the namespace it is deployed into.

However often developers want to create additional namespaces and manage those with that namespaced ArgoCD installation. This is possible by adding the label argocd.argoproj.io/managed-by: <argocd namespace> to the namespace to be managed. However only cluster administrators are allowed to add labels to a namespace.

This is where this operator helps. A Cluster administrator can deploy this operator to allow regular users to add the label to their namespaces.

Installation

  1. As a cluster administrator deploy the catalog source:

    oc apply -f https://raw.githubusercontent.com/redhat-gpte-devopsautomation/argocd-namespace-operator/main/catalogsource.yaml
  2. Also as a cluster administrator create a subscription to deploy the operator:

    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: argocd-namespace-operator
      namespace: openshift-operators
    spec:
      channel: stable
      installPlanApproval: Automatic
      name: argocd-namespace-operator
      source: argocd-namespace-operator-catalogsource
      sourceNamespace: openshift-operators
  3. Once the operator is running regular users can add their namespaces to their ArgoCD installations.

Usage

In order to use this operator a user will need to create a custom resource, ArgoCDManaged into any namespace to be managed by their ArgoCD.

  1. To add namespace user-development to be managed by ArgoCD deployed into user-argocd deploy the following ArgoCDManaged resource:

    apiVersion: pfe.opentlc.com/v1
    kind: ArgoCDManaged
    metadata:
      name: argocdmanaged
      namespace: user-development
    spec:
      argocdNamespace: user-argocd
  2. The operator will add the label argocd.argoproj.io/managed-by: user-argocd to the namespace user-development.

  3. Deleting the custom resource will remove the label from the namespace again.

About

Operator to add a namespace to be managed by a namespaced ArgoCD deployment


Languages

Language:Makefile 85.3%Language:Dockerfile 14.7%