Skip to content

samuel-sujith/argo-test-gitops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Continuous Deployment with Argo CD and IBM Multi Cloud Manager

This repository contains a sample app configuration to use as a reference for configuring a helm repo deployment via Continuous Delivery (CD) using GitOps. There are samples for both Argo CD and IBM Multi Cloud Manager

IBM Multi Cloud Manager

IBM Multi Cloud Manager will enable SRE and IT operations to remotely manage the entire development, security and operations pipelines from a single control plane. Automation delivers the operational efficiency and application resiliency necessary to ensure business continuity and continuous innovation.

For more information on how to manage Continuous Delivery of applications with MCM see the details documented here Configure Applications with MCM

ArgoCD

ArgoCD is an open source tool that has been created to enable declarative GitOps Continuous Delivery on container platforms. It fully supports IBM Kubernetes Services and Red Hat OpenShift.

Argo CD follows the GitOps pattern of using Git repositories as the source of truth for defining the desired application state. Kubernetes manifests can be specified in several ways:

  1. kustomize applications
  2. helm charts
  3. Plain directory of YAML/json manifests
  4. Any custom config management tool configured as a config management plugin

Argo CD automates the deployment of the desired application states in the specified target environments. Application deployments can track updates to branches, tags, or pinned to a specific version of manifests at a Git commit. See tracking strategies for additional details about the different tracking strategies available.

Prerequisites

The provided sample assumes the following components are already available:

  1. Helm repository containing versioned artifacts

    The helm repository is used as the source of the base configuration for the application deployment.

  2. ArgoCD instance

Configuring the GitOps repository for an application

The following steps are required for each application that will be deployed by ArgoCD:

  1. Copy templates/app-helm into the root of the repository and name the folder after the application that will be installed
  2. Update {directory}/Chart.yaml
    • Set name value to the directory name
    • Update description value with a brief descrption of the application
  3. Update {directory}/requirements.yaml
    • Set name value to the helm chart name
    • Set repository value to the helm repository url
  4. Update {directory}/values.yaml
    • Replace <app-chart-name> with the helm chart name
    • Add any application-specific configuration under the heading

Creating ArgoCD projects and applications

Components deployed by ArgoCD are called Applications. Applications can be grouped into projects. These components can be defined via the ArgoCD user interface, the ArgoCD CLI, or via custom resources for the ArgoCD operator.

ArgoCD CLI

  • Create a project
argocd proj create {PROJECT} --dest {CLUSTER_HOST},{NAMESPACE} --src {GIT_REPO}

where:

  • {PROJECT} is the name you want to give to the project

  • {CLUSTER_HOST} is the url for the cluster server to which the project applications can be deployed. Use https://kubernetes.default.svc to reference the same cluster where ArgoCD has been deployed. "*" can also be used to allow deployments to any server

  • {NAMESPACE} is the namespace in the cluster where the applications can be deployed. "*" can be used to indicate any namespace

  • {GIT_REPO} is the url of the git repository where the gitops config will be located or "*" if you want to allow any

  • Create an application

argocd app create {APP_NAME} --project {PROJECT} --repo {GIT_REPO} --path {APP_FOLDER} --dest-namespace {NAMESPACE} --dest-server {SERVER_URL}

where:

  • {APP_NAME} is the name you want to give the application
  • {PROJECT} is the name of the project created above or "default"
  • {GIT_REPO} is the url of the git repository where the gitops config is be located
  • {APP_FOLDER} is the path to the configuration for the application in the gitops repo
  • {DEST_NAMESPACE} is the target namespace in the cluster where the application will be deployed
  • {SERVER_URL} is the url of the cluster where the application will be deployed. Use https://kubernetes.default.svc to reference the same cluster where ArgoCD has been dployed

Operator custom resources

The operator defines a custom resource for a Project and Application component in ArgoCD. These are simple yaml files that define the attributes required to configure ArgoCD. The following steps can be followed to create te necessary resources by hand:

  1. Copy the template project from templates/project-config-manual into the root directory and name the folder after the project (e.g. {project name}-config)
  2. Update the project.yaml file with the details of the project. The destinations block can use "*" for the server and namespace or can list multiple destinations explicitly.
  3. Rename the application.yaml file after one of the applications that will be deployed. Update the values to match the application deployment configuration.
  4. For each additional application, copy one of the application yaml files and update the values accordingly.
  5. Register the {project-name}-config folder as a "bootstrap application"
argocd app create {APP_NAME} --repo {GIT_REPO} --path {APP_FOLDER} --revision {GIT_BRANCH} --dest-namespace {NAMESPACE} --dest-server https://kubernetes.default.svc

where:

  • APP_NAME is the name you want to give the application (e.g. {project-name}-config)
  • GIT_REPO is the url of the git repository where the gitops config is be located
  • APP_FOLDER is the path to the configuration for the application in the gitops repo (e.g. {project-name}-config)
  • GIT_BRANCH is the branch where the "bootstrap application" config has been stored
  • DEST_NAMESPACE is the namespace where the ArgoCD operator has been deployed (e.g. tools)
  • SERVER_URL is the url of the cluster where the application will be deployed. Use