argocd configuring policies for application teams

 We can define rules of what can be deploy to a kubernetes cluster. This is an example of what we can do 


apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
  name: engineering-team-alpha
  namespace: argocd
spec:
  description: "Restricted project for Team Alpha development work"
 
  # 1. Restrict which repositories apps in this project can pull from
  sourceRepos:
    - "https://github.com/my-org/alpha-apps.git"

  # 2. Restrict where these apps can be deployed (Cluster & Namespace)
  destinations:
    - server: https://kubernetes.default.svc
      namespace: alpha-dev
    - server: https://kubernetes.default.svc
      namespace: alpha-staging

  # 3. Whitelist: Only allow specific Namespaced resources
  # This blocks ClusterRoles, CustomResourceDefinitions, etc.
  clusterResourceWhitelist: [] # Empty means NO cluster-scoped resources allowed
 
  namespaceResourceWhitelist:
    - group: 'apps'
      kind: Deployment
    - group: ''
      kind: Service
    - group: 'networking.k8s.io'
      kind: Ingress

  # 4. Sync Windows: Only allow changes during business hours
  syncWindows:
    - kind: allow
      schedule: "0 9 * * 1-5"
      duration: "8h"
      applications:
        - "*"


Example of fail yaml  (Please note this will create an application but it won't appear in the UI)

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: guestbook
  namespace:  alpha-dev-fake
spec:
  project: engineering-team-alpha
  source:
    repoURL: https://github.com/argoproj/argocd-example-apps.git
    targetRevision: HEAD
    path: guestbook
  destination:
    server: https://kubernetes.default.svc
    namespace: guestbook


From the UI point of view, you will get some validation  



Minimal successfully app

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: guestbook-ok
  namespace:  argocd
spec:
  project: engineering-team-alpha
  source:
    repoURL: https://github.com/argoproj/argocd-example-apps.git
    targetRevision: HEAD
    path: guestbook
  destination:
    server: https://kubernetes.default.svc
    namespace: alpha-dev

And it appears in your UI 






Comments

Popular posts from this blog

vllm : Failed to infer device type

android studio kotlin source is null error

gemini cli getting file not defined error