Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Argo CD ApplicationSet to manage deployments across CDPipeline #20

Closed
zmotso opened this issue Jan 12, 2024 · 1 comment
Closed
Assignees
Labels
enhancement New feature or request

Comments

@zmotso
Copy link
Contributor

zmotso commented Jan 12, 2024

cd-pipeline-operator should start managing (Create/Delete) Argo ApplicationSet object for each kind CDPipeline object.

  1. When the user deletes CDPipeline, then ApplicationSet should also be removed.
  2. When the user removes/adds Stage/Application from CDPipeline ApplicationSet should be updated in the part of the generator list (see Argo CD Application spec)
  3. When the User creates CDPipeline, the proper ApplicationSet should be created (see format below)

The below code represents ApplicationSet for CDPipeline demo with:
Stages: dev and qa
Codebases: demo, myapp

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:   
  name: demo
  namespace: edp-delivery-sk-dev
spec:   
  goTemplate: true
  goTemplateOptions: ["missingkey=error"]
  generators:     
    - list:         
      - elements:        
        - stage: dev
          codebase: demo
          imageTag: main-20240108-161641
          imageRepository: registry.eks-sandbox.aws.main.edp.projects.epam.com/edp-delivery-sk-dev/demo
          cluster: in-cluster
          namespace: edp-delivery-sk-dev-demo-dev
          gitUrlPath: epmd-edp/sk-dev/demo
          versionType: default
        - stage: dev
          codebase: myapp
          imageTag: 0.1.0-SNAPSHOT.2
          imageRepository: registry.eks-sandbox.aws.main.edp.projects.epam.com/edp-delivery-sk-dev/myapp
          cluster: in-cluster
          namespace: edp-delivery-sk-dev-demo-dev
          gitUrlPath: epmd-edp/sk-dev/myapp
          versionType: edp

        - stage: qa
          codebase: demo
          imageTag: main-20240103-141431
          imageRepository: registry.eks-sandbox.aws.main.edp.projects.epam.com/edp-delivery-sk-dev/demo
          cluster: in-cluster
          namespace: edp-delivery-sk-dev-demo-qa
          gitUrlPath: epmd-edp/sk-dev/demo
          versionType: default
        - stage: qa
          codebase: myapp
          imageTag: 0.1.0-SNAPSHOT.1
          imageRepository: registry.eks-sandbox.aws.main.edp.projects.epam.com/edp-delivery-sk-dev/myapp
          cluster: in-cluster
          namespace: edp-delivery-sk-dev-demo-qa
          gitUrlPath: epmd-edp/sk-dev/myapp
          versionType: edp

  template:     
    metadata:       
      finalizers:         
        - resources-finalizer.argocd.argoproj.io
      labels:         
        app.edp.epam.com/app-name: '{{ .codebase }}'
        app.edp.epam.com/pipeline: demo
        app.edp.epam.com/stage: '{{ .stage }}'
      name: 'demo-{{ .stage }}-{{ .codebase }}'
    spec:       
      destination:         
        name: '{{ .cluster }}'
        namespace: '{{ .namespace }}'
      project: edp-delivery-sk-dev
      source:         
        helm:           
          parameters:             
            - name: image.tag
               value: '{{ .imageTag }}'
            - name: image.repository
               value: '{{ .imageRepository }}'
          releaseName: '{{ .codebase }}'
        path: deploy-templates
        repoURL: ssh://git@git.epam.com:22/{{ .gitUrlPath }}
        targetRevision: '{{ if eq .versionType "edp" }}build/{{ .imageTag }}{{ else }}{{ .imageTag }}{{ end }}'

From where to grab values:

        - stage: dev                               # get from kind: Stage
          codebase: demo                           # get from kind: CDPipeline
          imageTag: main-20240108-161641           # NaN in the beginning
          imageRepository: registry.eks-sandbox.aws.main.edp.projects.epam.com/edp-delivery-sk-dev/demo # get from kind: Codebaseimagestream
          cluster: in-cluster                      # get from kind: Stage
          namespace: edp-delivery-sk-dev-demo-dev  # get from kind: Stage
          gitUrlPath: epmd-edp/sk-dev/demo         # get from kind: codebase
          versionType: default                     # get from kind: codebase
@zmotso zmotso added the enhancement New feature or request label Jan 12, 2024
@zmotso zmotso self-assigned this Jan 12, 2024
epmd-edp pushed a commit that referenced this issue Jan 17, 2024
…ine (#20)

Added functionality:
- For every CDPipeline ApplicationSet is created
- If CDPipeline is removed, related ApplicationSet is removed too
- For every Stage and Codebase in the CDPipeline -
  the related ApplicationSet generator is created/deleted

Change-Id: I13bf5a98d84773dd026574246a72072ba8f853e9
epmd-edp pushed a commit that referenced this issue Jan 18, 2024
This field is no longer used

JIRA: EPMDEDP-13166

Signed-off-by: Sergiy Kulanov <sergiy_kulanov@epam.com>
Change-Id: I3963ddd690cdd507bc9618e3702f48b4c555f854
epmd-edp pushed a commit that referenced this issue Jan 18, 2024
Specifies a name of Tekton TriggerTemplate which will
be used as a blueprint for deployment pipeline.
Default value is "cd-stage-deploy" which means that default
TriggerTemplate will be used.

The default TriggerTemplate is delivered using edp-tekton helm chart.

Jira: EPMDEDP-13166

Signed-off-by: Sergiy Kulanov <sergiy_kulanov@epam.com>
Change-Id: Idd8e7ab9f630b600a1f83192dfe03f874da40c29
epmd-edp pushed a commit that referenced this issue Jan 19, 2024
Change-Id: Ifc0571d50502e263dc21bb5f7854c813e47d5834
@zmotso
Copy link
Contributor Author

zmotso commented Jan 24, 2024

Implemented.

@zmotso zmotso closed this as completed Jan 24, 2024
epmd-edp pushed a commit that referenced this issue Jan 24, 2024
This reverts commit 27a2c5d.

Change-Id: I5f9c373dda7909daf857917b424058b07cfa80d9
epmd-edp pushed a commit that referenced this issue Jan 26, 2024
Signed-off-by: Sergiy Kulanov <sergiy_kulanov@epam.com>
Change-Id: I660a77ddd544db62406b9006aecf69fc41b43062
epmd-edp pushed a commit that referenced this issue Mar 7, 2024
Change-Id: I002744b75ab1d235a3f516e52189a4ac9c88777a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

1 participant