portworx / helm

Repository for Portworx Helm assets
Apache License 2.0
48 stars 63 forks source link

PWX-37588 | Add missing fields for stork #596

Closed hitesh-wani-px closed 1 month ago

hitesh-wani-px commented 2 months ago

What this PR does / why we need it: Add missing fields in Stork component for helm. Which issue(s) this PR fixes (optional) Closes #https://purestorage.atlassian.net/browse/PWX-37568

Special notes for your reviewer:

hitesh-wani-px commented 2 months ago

Testing Notes:

  1. Enter all optional values for stork in values.yaml
    stork:                                
    enabled: true
    storkVersion: 2.7.0                      .
    lockImage: false                              
    args: verbose=true;webhook-controller=true                          
    volumes:                            
    - name: "px-test-volume"
    mountPath: /etc/px-test
    hostPath:
      path: /test
    env:                               
    - name: PX_TEST_ENV
    value: "test_env_autopilot"
  2. Install PX using helm
    helm install my-release --set internalKVDB=true,clusterName=$(uuidgen) ./charts/portworx/ -n portworx --debug
  3. The generated storageCluster template should incorporate all specified values.

    # Source: portworx/templates/storage-cluster.yaml
    kind: StorageCluster
    apiVersion: core.libopenstorage.org/v1
    metadata:
    name: "e6d805db-dcc3-4b0d-91a4-d65ced4208d1"
    namespace: portworx
    annotations:
    labels:
    heritage: "Helm"
    release: "my-release"
    chart: "portworx-3.1.0"
    app.kubernetes.io/managed-by: "Helm"
    app.kubernetes.io/instance: "my-release"
    spec:
    image: portworx/oci-monitor:3.1.0
    imagePullPolicy: Always
    
    kvdb:
    internal: true
    storage:
    useAll: true
    secretsProvider: k8s
    
    env:
    - name: PX_SECRETS_NAMESPACE
    value: portworx
    
    stork:
    enabled: true
    image: openstorage/stork:2.7.0                      .
    env:
    - name: PX_TEST_ENV
      value: test_env_autopilot
    volumes:
    - hostPath:
        path: /test
      mountPath: /etc/px-test
      name: px-test-volume
    args:
      verbose: "true"
      webhook-controller: "true"
    csi:
    enabled: false
  4. We should be able to see the following configurations reflected on the cluster:
    1. stork and stork-scheduler pods should be deployed and running.
    2. stork pod should have same image as we mentioned in the storkVersion
    3. stork pod should have appended args passed stork.args
      containers:
      - command:
      - /stork
      - --driver=pxd
      - --health-monitor-interval=120
      - --leader-elect=true
      - --lock-object-namespace=portworx
      - --verbose=true
      - --webhook-controller=true
  5. We should be able to see the environment variables and volumes specified in stork.env and stork.volumes reflected in the Autopilot pod.

Unit test cases Results:

--- PASS: TestStorageClusterHelmTemplate (0.00s)
    --- PASS: TestStorageClusterHelmTemplate/TestDefaultChartValues (0.07s)
    --- PASS: TestStorageClusterHelmTemplate/TestCustomRegistry (0.07s)
    --- PASS: TestStorageClusterHelmTemplate/TestStork (0.07s)
    --- PASS: TestStorageClusterHelmTemplate/TestAllComponentsEnabled (0.07s)
    --- PASS: TestStorageClusterHelmTemplate/TestExternalETCD (0.07s)
    --- PASS: TestStorageClusterHelmTemplate/TestPlacementTolerations (0.07s)
PASS
ok      github.com/portworx/helm/test/portworx  0.102s