gitops-runtime

by codefresh-io

Helm chartv0.32.1App 0.1.72Verified publisher

A Helm chart for Codefresh gitops runtime

About this chart

Codefresh gitops runtime

Table of Content

  • Prerequisites
  • Get Chart Info
  • Codefresh official documentation
  • Argo-workflows artifact and log storage
  • Installation with External ArgoCD
    • ArgoCD compatibility
  • Using with private registries - Helper utility
  • Openshift
  • High Availability
    • HA mode with autoscaling
  • Upgrading
    • To 0.23.x
    • > 0.24.x
    • To 0.32.x

Prerequisites

  • Helm 3.11.0+

Get Chart Info

helm show all oci://quay.io/codefresh/gitops-runtime

See Use OCI-based registries

Codefresh official documentation:

Prior to running the installation please see the official documentation at: https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation/

Multi Runtime Installation

You can install multiple Codefresh GitOps Runtimes in the same cluster, as long as each Runtime is deployed in its own namespace and manages only the applications in that namespace. To achieve this, configure your Runtimes to run in namespaced mode by setting global.runtime.singleNamespace=true. See the values.yaml example below:

global:
  runtime:
    singleNamespace: true
sealed-secrets:
  enabled: false
argo-cd:
  createClusterRoles: false
  crds:
    install: false
  configs:
    params:
      application.namespaces: ''
argo-workflows:
  crds:
    install: false
  singleNamespace: true
  createAggregateRoles: false
  controller:
    clusterWorkflowTemplates:
      enabled: false
  server:
    clusterWorkflowTemplates:
      enabled: false
tunnel-client:
  enabled: false
# gitops-operator is disabled by default (End-of-Life).
gitops-operator:
  crds:
    install: false

Note that for the first runtime in the cluster, you have to configure it to install the CRDs, with setting these values:

global:
  runtime:
    isConfigurationRuntime: true
argo-cd:
  crds:
    install: true
argo-workflows:
  crds:
    install: true
# gitops-operator is disabled by default (End-of-Life).
gitops-operator:
  crds:
    install: true

[!WARNING] If you want more than one runtime in your cluster, make sure that all of the runtimes in your cluster are configured with global.runtime.singleNamespace=true. If you already have a runtime installed in the cluster without this setting, multi runtime installation is not supported.

Argo-workflows artifact and log storage

Codefresh provides a SaaS object storage based solution for Argo workflows logs storage. The chart deploys a configmap named codefresh-workflows-log-store with the repository configuration. If you want to utilize the Codefresh SaaS solution for log storage for all workflows in the runtime please set the following values:

argo-workflows:
  controller:
    workflowDefaults:
      spec:
        artifactRepositoryRef:
          configMap: codefresh-workflows-log-store
          key: codefresh-workflows-log-store

[!WARNING] It's highly recommended to use your own artifact storage for data privacy reasons. Codefresh provided storage has a retention policy of 14 days and limitations on uploaded file sizes. Please refer to the official documentation for more details.

Installation with External ArgoCD

If you want to use an existing ArgoCD installation, you can disable the built-in ArgoCD and configure the GitOps Runtime to use the external ArgoCD. See the values.yaml example below:

global:
  # -- Configuration for external ArgoCD
  # Should be used when `argo-cd.enabled` is set to false
  external-argo-cd:
    # -- ArgoCD server settings
    server:
      # -- Service name of the ArgoCD server
      svc: argocd
      # -- Port of the ArgoCD server
      port: 80
      # -- Set if Argo CD is running behind reverse proxy under subpath different from /
      # e.g.
      # rootpath: '/argocd'
      rootpath: ''
    redis:
      # -- Service name of the ArgoCD Redis
      svc: argocd-redis
      # -- Port of the ArgoCD Redis
      port: 6379
    repoServer:
      # -- Service name of the ArgoCD repo server
      svc: argocd-repo-server
      # -- Port of the ArgoCD repo server
      port: 8081

    # -- How GitOps Runtime should authenticate with ArgoCD
    auth:
      # -- Authentication type. Can be password or token
      type: password

      # If `auth.type=password` is set
      # -- ArgoCD username in plain text
      username: "admin"
      # -- ArgoCD password in plain text
      password: ""
      # -- ArgoCD password referenced by an existing secret
      passwordSecretKeyRef:
        name: argocd-initial-admin-secret
        key: password

      # If `auth.type=token` is set
      # -- ArgoCD token in plain text
      token: ""
      # -- ArgoCD token referenced by an existing secret
      tokenSecretKeyRef: {}
      # e.g:
      # tokenSecretKeyRef:
      #   name: argocd-token
      #   key: token

argo-cd:
  # -- Disable built-in ArgoCD
  enabled: false

⚠️ If auth.type=password is set, ArgoCd user must have apiKey capability enabled.

argocd-cm ConfigMap

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-cm
  namespace: argocd
  labels:
    app.kubernetes.io/name: argocd-cm
    app.kubernetes.io/part-of: argocd
data:
  accounts.admin: apiKey, login
  admin.enabled: "true"

ArgoCD compatibility

GitOps Runtime versionSupported ArgoCD versions
0.32.x>=3.4 <=3.6
0.31.x>=3.3 <=3.5
0.30.x>=3.2 <=3.4
0.29.x>=3.1 <=3.3
0.28.x>=3.0 <=3.2
0.27.x>=3.0 <=3.2
0.26.x>=3.0 <=3.2
0.25.x>=2.12 <=3.0
0.24.x>=2.12 <=3.0

Using with private registries - Helper utility

The GitOps Runtime comprises multiple subcharts and container images. Subcharts also vary in values structure, making it difficult to override image specific values to use private registries. We have created a helper utility to resolve this issue:

  • The utility create values files in the correct structure, overriding the registry for each image. When installing the chart, you can then provide those values files to override all images.
  • The utility also creates other files with data to help you identify and correctly mirror all the images.

Usage

The utility is packaged in a container image. Below are instructions on executing the utility using Docker:

docker run -v <output_dir>:/output quay.io/codefresh/gitops-runtime-private-registry-utils:0.32.1 <local_registry>

output_dir - is a local directory where the utility will output files. local_registry - is your local registry where you want to mirror the images to

The utility will output 4 files into the folder:

  1. image-list.txt - is the list of all images used in this version of the chart. Those are the images that you need to mirror.
  2. image-mirror.csv - is a csv file with 2 fields - source_image and target_image. source_image is the image with the original registry and target_image is the image with the private registry. Can be used as an input file for a mirroring script.
  3. values-images-no-tags.yaml - a values file with all image values with the private registry excluding tags. If provided through --values to helm install/upgrade command - it will override all images to use the private registry.
  4. values-images-with-tags.yaml - The same as 3 but with tags included.

For usage with external ArgoCD run the utility with EXTERNAL_ARGOCD environment variable set to true.

docker run -e EXTERNAL_ARGOCD=true  -v <output_dir>:/output quay.io/codefresh/gitops-runtime-private-registry-utils:0.32.1 <local_registry>

Openshift

internal-router:
  dnsService: dns-default
  dnsNamespace: openshift-dns
  clusterDomain: cluster.local

argo-cd:
  redis:
    securityContext:
      runAsUser: 1000680000 # Arbitrary user ID within allowed range

  openshift:
    enabled: true

sealed-secrets:
  podSecurityContext:
    enabled: false
  containerSecurityContext:
    enabled: false

High Availability

This chart installs the non-HA version of GitOps Runtime by default. If you want to run GitOps Runtime in HA mode, you can use the example values below:

Warning: You need at least 3 worker nodes for HA mode

HA mode with autoscaling

global:
  topologySpreadConstraints:
    - maxSkew: 1
      topologyKey: kubernetes.io/hostname
      whenUnsatisfiable: DoNotSchedule

  event-reporters:
    pdb:
      enabled: true
      minAvailable: 1

app-proxy:
  replicaCount: 2
  pdb:
    enabled: true
    minAvailable: 1
  topologySpreadConstraints:
    - maxSkew: 1
      topologyKey: kubernetes.io/hostname
      whenUnsatisfiable: DoNotSchedule
      labelSelector:
        matchLabels:
          app: cap-app-proxy

# gitops-operator is disabled by default (End-of-Life).
gitops-operator:
  replicaCount: 2
  pdb:
    enabled: true
    minAvailable: 1
  topologySpreadConstraints:
    - maxSkew: 1
      topologyKey: kubernetes.io/hostname
      whenUnsatisfiable: DoNotSchedule
      labelSelector:
        matchLabels:
          app: gitops-operator

internal-router:
  replicaCount: 2
  pdb:
    enabled: true
    minAvailable: 1
  topologySpreadConstraints:
    - maxSkew: 1
      topologyKey: kubernetes.io/hostname
      whenUnsatisfiable: DoNotSchedule
      labelSelector:
        matchLabels:
          app: internal-router

argo-gateway:
  hpa:
    enabled: true
    minReplicas: 2
  pdb:
    enabled: true
    minAvailable: 1
  topologySpreadConstraints:
    - maxSkew: 1
      topologyKey: kubernetes.io/hostname
      whenUnsatisfiable: DoNotSchedule
      labelSelector:
        matchLabels:
          app.kubernetes.io/component: argo-gateway

argo-cd:
  redis-ha:
    enabled: true

  controller:
    replicas: 1

  server:
    autoscaling:
      enabled: true
      minReplicas: 2
    pdb:
      enabled: true
      minAvailable: 1

  repoServer:
    autoscaling:
      enabled: true
      minReplicas: 2
    pdb:
      enabled: true
      minAvailable: 1

  applicationSet:
    replicas: 2

argo-workflows:
  controller:
    replicas: 2
    pdb:
      enabled: true
      minAvailable: 1
  server:
    autoscaling:
      enabled: true
      minReplicas: 2
    pdb:
      enabled: true
      minAvailable: 1

Upgrading

To 0.23.x

Affected values

  • .Values.gitops-operator.image map has been changed to include registry field. Please migrate the values git below:
# before
gitops-operator:
  image:
    repository: quay.io/codefresh/codefresh-gitops-operator
    tag: vX.Y.Z

# after
gitops-operator:
  image:
    registry: quay.io
    repository: codefresh/codefresh-gitops-operator
    tag: vX.Y.Z

> 0.24.x

Affected values

  • .Values.redis/.Values.redis-ha/.Values.redis-secret-init were added
# Enabled standalone Redis (single Deployment with 1 replica)
redis:
  enabled: true

# Enabled Redis High Availability (StatefulSet with Proxy)
redis-ha:
  enabled: false
  • .Values.cf-argocd-extras.eventReporter was updated to .Values.global.event-reporters
# Before:
cf-argocd-extras:
  eventReporter:
    image:
      ...
  ...

# After:
global:
  event-reporters:
    image:
      ...
  ...
  • .Values.cf-argocd-extras.sourcesServer was updated to .Values.argo-gateway
# Before:
cf-argocd-extras:
  sourcesServer:
    image:
      ...
  ...

# After:
argo-gateway:
  image:
      ...
  ...
  • .Values.global.external-argo-cd was changed to .Values.global.integrations.argo-cd
# Before:
global:
  external-argo-cd:
    server:
      svc: argocd-server
      port: 80
    ...

# After:
global:
  integrations:
    argo-cd:
      server:
        svc: argocd-server
        port: 80
      ...

To 0.32.x

GitOps operator is disabled by default

The GitOps operator has reached End-of-Life and .Values.gitops-operator.enabled now defaults to false. On upgrade, the chart removes the gitops-operator Deployment, ServiceAccount, RBAC, PDB, the promotion-template ServiceAccount/RBAC, and the operator CRDs (products, promotionflows, promotionpolicies, promotiontasks, promotiontemplates, restrictedgitsources in the codefresh.io group).

[!WARNING] Deleting a CRD deletes all custom resources of that kind in the cluster. To keep the CRDs and their resources, set gitops-operator.crds.keep: true in your currently installed release (run helm upgrade with it first), and only then upgrade to 0.32.x.

If you still rely on the GitOps operator(you use restricted-git-sources with your runtime), enable it explicitly when upgrading:

gitops-operator:
  enabled: true

Values

KeyTypeDefaultDescription
anchors.common-envs[0].OTEL_EXPORTER_OTLP_COMPRESSIONstring"gzip"Specifies the compression algorithm to be used for all telemetry data. Ref: https://opentelemetry.io/docs/specs/otel/protocol/exporter/
anchors.common-envs[0].OTEL_EXPORTER_OTLP_ENDPOINTstring"http://localhost:4317"Base endpoint URL for all OpenTelemetry signals. Ref

Deploy gitops-runtime with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has gitops-runtime on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartgitops-runtime is pinned at v0.32.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply