SaFi Bank Space : (Deprecated) CD DevOps Runbook

Runbook name

Argo CD

Runbook description

Argo CD Synchronization

Owner

Veneraldo Apelo (Unlicensed)

Version

1.0

Version date

On this page

(blue star) Architecture

ArgoCD is a CD (Continuous Delivery or Deployment) tool for Kubernetes. This tool simplifies and greatly improves the deployment of micro-services applications in Kubernetes clusters by following GitOps principles.

Using the main GitOps tenet where git repository is the single source of truth, the application deployment code written in Kubernetes manifests or Helm charts should reside in GitHub.

The ArgoCD controller, itself is also part of the K8S cluster i.e. installed within the cluster, usually in just a separate namespace will poll the deployment repository every 3 minutes (this is configurable as maxDuration parameter. see code_list1) for any changes, pull updates, sync-up and adjust the target application Kubernetes cluster infrastructure accordingly. This prevents any unwanted manual changes directly in GKE as when this happens, ArgoCD will just rollback and sync with what is declared in GitHub as per syncPolicy configured.

Application deployment that utilizes declarative configuration in ArgoCD should be also written as manifests (yaml ArgoCD template format i.e. code_list 1 as an example below) and put in GitHub even though we can create and configure an “application” via ArgoCD UI manually. This means that we must only connect to ArgoCD to verify and check status of deployment for visibility and troubleshooting purposes only.

# This is the application configuration of ArgoCD for 
# transaction-processor-manager micro-service
# located at
# SaFiMono/devops/argocd/environments/dev/apps/base/transaction-processor-manager.yaml
      
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: transaction-processor-manager-dev
  namespace: argo-cd
spec:
  project: env-dev-apps
  source:
    repoURL: 'https://github.com/SafiBank/SaFiMono.git'
    path: devops/argocd/environments/dev/apps/transaction-processor-manager
    targetRevision: HEAD
    plugin:
      name: helm-argocd-vault-replacer
  destination:
    server: 'https://172.16.47.220:8081'
    namespace: safi-transaction-processor-manager
  syncPolicy:
    automated:
      prune: true
    syncOptions:
    - CreateNamespace=true
    retry:
      limit: 5
      backoff:
        duration: 5s
        factor: 2
        maxDuration: 3m      

code_list 1

With the application config shown above, any changes in the repo path: devops/argocd/environments/dev/apps/transaction-processor-manager , for every 3 minutes poll time, the ArgoCD controller will then apply and deploy the changes to the cluster.

figure 1: transaction-processor-manager as “application” within the ArgoCD Web UI dashboard.

We can also see the status and health of the “application” in the Web UI as shown in figure 2 below.

figure 2: transaction-processor-manager application sync and health status.

Chart.yml below which is under the github.com/SafiBank/SaFiMono repo pathdevops/argocd/environments/dev/apps/transaction-processor-manager

apiVersion: v2
name: transaction-processor-manager
type: application
version: 1.0.0
appVersion: "1.0.0"
dependencies:
  - name: kotlin
    version: 0.2.1
    repository: https://safi-chartmuseum-cicd-v33xcn232a-as.a.run.app

and values.yml

kotlin:
  image:
    repository: "asia-southeast1-docker.pkg.dev/safi-repos/safi-docker/transaction_processor_manager"
    tag: "<secret:secret/data/dev/apps/transaction_processor_manager/cicd~tag>"

  ingress:
    enabled: true
    annotations:
      cert-manager.io/cluster-issuer: letsencrypt-prod
      traefik.ingress.kubernetes.io/router.tls: "true"
      traefik.ingress.kubernetes.io/router.entrypoints: websecure
    hosts:
    - host: transaction-processor-manager.apps.dev.safibank.online
      paths:
        - path: /
          pathType: ImplementationSpecific
    tls:
      - secretName: transaction-processor-manager.apps.dev.safibank.online-tls
        hosts:
          - transaction-processor-manager.apps.dev.safibank.online

  env:
    SCHEMA_REGISTRY_URL: http://172.16.48.7:8081
    KAFKA_URL: 172.16.48.7:9092

  secret:
    DB_PASSWORD: <secret:secret/data/dev/apps/transaction_processor_manager/postgres~password>
    DB_URL: <secret:secret/data/dev/apps/transaction_processor_manager/postgres~db_url>
    DB_USER: <secret:secret/data/dev/apps/transaction_processor_manager/postgres~user>

(blue star) Support contacts

Expertise level

Team

Team lead

Contact info

Level 1

Level 2

Level 3

(blue star) Runs

Deploying Applications via ArgoCD with actual deployment time as reference baseline.

Project

Name

State

Start time

Completed time

Duration

Remarks

Deploy Tyk

SUCCESS / ERROR

TBD

Deploy TM

SUCCESS

TBD

env-dev-apps

transaction-processor-manager-dev

SUCCESS

20:22

20:22

“< 1 min”

transaction-history-manager-dev

SUCCESS

TBD

TBD

TBD

account-manager-dev

SUCCESS

15:16

15:16

“< 1 min”

card-manager-dev

SUCCESS

16:00

16:01

1 min

advanceai-gateway-dev

SUCCESS

20:20

20:21

1 min

audit-log-manager-dev

SUCCESS

20:51

20:54

3 min

backoffice-manager-dev

SUCCESS

15:45

15:48

“< 1 min”

bofe-dev

SUCCESS

TBD

TBD

TBD

card-aggregator-dev

SUCCESS

15:28

15:28

“< 1 min”

(blue star) Process

Tyk API Gateway Deployment (CD)

Step instructions

Enabled

Execution location

Run environments

Run conditions

Documentation

1

Create and modify Helm Charts in GitHub mono-repo

YES / NO

Your workstation

2

Push and PR to main branch

Your workstation

3

Login to Argo CD UI at https://argocd.safibank.online/ and verify the deployment synchronization by clicking the application named Tyk after about 5 minutes. You may manually click the SYNCHRONIZATION button if you don't want to wait for 5 minutes polling time.

Your workstation

TM Deployment (CD)

Step instructions

Enabled

Execution location

Run environments

Run conditions

Documentation

1

Create and modify Helm Charts and Kubernetes manifests in GitHub mono-repo

YES / NO

Your workstation

2

Push and PR to main branch

Your workstation

3

Login to Argo CD UI at https://argocd.safibank.online/ and verify the deployment synchronization by clicking the application named TM after about 5 minutes. You may manually click the SYNCHRONIZATION button if you don't want to wait for 5 minutes polling time.

Your workstation

Micro-service Deployment (CD)

Step instructions

Enabled

Execution location

Run environments

Run conditions

Documentation

1

Create and modify Helm Charts and Kubernetes manifests in GitHub mono-repo

YES / NO

Your workstation

2

Push and PR to main branch

Your workstation

3

Login to Argo CD UI https://argocd.safibank.online/ and verify the deployment synchronization by clicking the application named “Micro-service” after about 5 minutes. You may manually click the SYNCHRONIZATION button if you don't want to wait for 5 minutes polling time.

Your workstation