Seagate / cortx-k8s

CORTX Kubernetes Orchestration Repository
https://github.com/Seagate/cortx
Apache License 2.0
6 stars 47 forks source link

CORTX-27411: Add global image options #344

Closed keithpine closed 2 years ago

keithpine commented 2 years ago

Description

Add global values to the Helm Chart for image settings. This makes interacting with Helm simpler.

Set all containers (except Consul) to use a private container registry:

helm install cortx charts/cortx --set global.imageRegistry=private-registry.example.com

Set all of the CORTX containers (not dependencies) to use a private container registry:

helm install cortx charts/cortx --set global.cortx.image.registry=private-registry.example.com

Set all of the CORTX containers to use an image tag with a private registry:

helm install cortx charts/cortx --set global.cortx.image.registry=private-registry.example.com --set global.cortx.image.tag=2.0.0-7344-custom-ci

Configure all CORTX Pods with an imagePullPolicy of Always:

helm install cortx charts/cortx --set global.cortx.image.pullPolicy=Always

Upgrade the CORTX image tags on an installed chart:

helm upgrade cortx charts/cortx --reuse-values --set global.cortx.image.tag=2.0.0-900

Type of change

Applicable issues

How was this tested?

Deployed with custom values.

helm template with different combinations.

(These would be good as unit tests)

Test file:

❯ cat test.yaml
existingSecret: mysecret
storageSets:
  - name: storage-set-1
    durability:
      sns: 1+0+0
      dix: 1+0+0
    containerGroupSize: 1
    storage:
      - name: cvg-01
        type: ios
        devices:
          metadata:
            - path: /dev/sdc
              size: 25Gi
          log:
            - path: /dev/sdd
              size: 25Gi
          data:
            - path: /dev/sde
              size: 25Gi

Default images, based on Chart.AppVersion and sub-chart defaults:

❯ helm template foobar ../charts/cortx -f test.yaml | grep image: | tr -s '[[:space:]]' | sort | uniq -c
      3  image: "hashicorp/consul:1.11.4"
      1  image: docker.io/bitnami/kafka:3.1.0-debian-10-r85
      1  image: docker.io/bitnami/zookeeper:3.8.0-debian-10-r34
      6  image: ghcr.io/seagate/cortx-control:2.0.0-879
      5  image: ghcr.io/seagate/cortx-data:2.0.0-879
      3  image: ghcr.io/seagate/cortx-rgw:2.0.0-879

Set Global registry, affects Bitnami and CORTX images:

❯ helm template foobar ../charts/cortx -f test.yaml --set global.imageRegistry=foobar.io | grep image: | tr -s '[[:space:]]' | sort | uniq -c
      3  image: "hashicorp/consul:1.11.4"
      1  image: foobar.io/bitnami/kafka:3.1.0-debian-10-r85
      1  image: foobar.io/bitnami/zookeeper:3.8.0-debian-10-r34
      6  image: foobar.io/seagate/cortx-control:2.0.0-879
      5  image: foobar.io/seagate/cortx-data:2.0.0-879
      3  image: foobar.io/seagate/cortx-rgw:2.0.0-879

Set CORTX image registry and tag, only CORTX images affected:

❯ helm template foobar ../charts/cortx -f test.yaml --set global.cortx.image.registry=foobar.io --set global.cortx.image.tag=2.0.0-9999 | grep image: | tr -s '[[:space:]]' | sort | uniq -c
      3  image: "hashicorp/consul:1.11.4"
      1  image: docker.io/bitnami/kafka:3.1.0-debian-10-r85
      1  image: docker.io/bitnami/zookeeper:3.8.0-debian-10-r34
      6  image: foobar.io/seagate/cortx-control:2.0.0-9999
      5  image: foobar.io/seagate/cortx-data:2.0.0-9999
      3  image: foobar.io/seagate/cortx-rgw:2.0.0-9999

Set CORTX image pull policy

Default:

❯ helm template foobar ../charts/cortx -f test.yaml | grep imagePullPolicy: | tr -s '[[:space:]]' | sort | uniq -c
     16  imagePullPolicy: "IfNotPresent"

Set to Always:

❯ helm template foobar ../charts/cortx -f test.yaml --set global.cortx.image.pullPolicy=Always | grep imagePullPolicy: | tr -s '[[:space:]]' | sort | uniq -c
     14  imagePullPolicy: "Always"
      2  imagePullPolicy: "IfNotPresent"

Additional information

Alternate values format considered:

global:
  imageRegistry: ""
  cortx:
    imageRegistry: ""
    imageTag: ""
    imagePullPolicy: ""

Checklist

If this change requires newer CORTX or third party image versions:

If this change addresses a CORTX Jira issue:


View rendered charts/cortx/README.md

keithpine commented 2 years ago

The Jira issue recommends that the imagePullPolicy should be set to Always. Is that still the case? If so, I'd suggest it should be done in the deployment script.

osowski commented 2 years ago

The Jira issue recommends that the imagePullPolicy should be set to Always. Is that still the case? If so, I'd suggest it should be done in the deployment script.

The Always default was intended when the container image tag was listed as latest in older versions of cortx-k8s. Based on the evolution to use specific tagged versions, I think we are good to use the default of IfNotPresent now.