Codefresh Steps: Reusable Code for Common Operations
This page provides code you can use to perform common operations in the Codefresh CI/CD platform.
53

Canary deployment for plain K8s k8s-canary-deployment

Perform a gradual canary deployment using only Kubernetes manifests.

arguments

  • ANALYSIS_TYPE - Can analyze canary health by pipeline execution or health checks (PIPELINE or HEALTH)
  • BRANCH - Branch
  • DEPLOYMENT_NAME - Kubernetes deployment name
  • KUBE_CONTEXT - The name of your cluster (as found in the Codefresh Kubernetes dashboard).
  • NAMESPACE - The name of the kubernetes namespace
  • NEW_VERSION
  • NO_CACHE - Ignore cached images
  • NO_CF_CACHE - Ignore Codefresh cache optimizations
  • PIPELINE_ID - Pipeline name or id
  • RESET_VOLUME - Reset pipeline cached volume
  • SERVICE_NAME - Kubernetes service name
  • SHA - Set commit sha
  • SLEEP_SECONDS - Time to sleep
  • TRAFFIC_INCREMENT
  • TRIGGER_ID - Trigger id or name
  • WORKING_VOLUME - Path to directory
    run:
  title: 'Deploying new version ${{CF_SHORT_REVISION}}'
  type: k8s-canary-deployment
  arguments:
    WORKING_VOLUME: '${{WORKING_VOLUME}}'
    SERVICE_NAME: '${{SERVICE_NAME}}'
    DEPLOYMENT_NAME: '${{DEPLOYMENT_NAME}}'
    TRAFFIC_INCREMENT: '${{TRAFFIC_INCREMENT}}'
    NEW_VERSION: '${{NEW_VERSION}}'
    SLEEP_SECONDS: '${{SLEEP_SECONDS}}'
    NAMESPACE: '${{NAMESPACE}}'
    KUBE_CONTEXT: '${{KUBE_CONTEXT}}'

  
    run:
  title: 'Deploying new version ${{CF_SHORT_REVISION}}'
  type: k8s-canary-deployment
  arguments:
    WORKING_VOLUME: '${{WORKING_VOLUME}}'
    SERVICE_NAME: '${{SERVICE_NAME}}'
    DEPLOYMENT_NAME: '${{DEPLOYMENT_NAME}}'
    TRAFFIC_INCREMENT: '${{TRAFFIC_INCREMENT}}'
    NEW_VERSION: '${{NEW_VERSION}}'
    SLEEP_SECONDS: '${{SLEEP_SECONDS}}'
    NAMESPACE: '${{NAMESPACE}}'
    KUBE_CONTEXT: '${{KUBE_CONTEXT}}'
    PIPELINE_ID: project/health-check-pipeline
    NO_CACHE: true
    NO_CF_CACHE: true
    RESET_VOLUME: true

  
github.com
Kostis Kapelonis
Jul 4, 2021