fluxcd / helm-controller

The GitOps Toolkit Helm reconciler, for declarative Helming
https://fluxcd.io
Apache License 2.0
404 stars 161 forks source link

Add support for `OCIRepository` as chartRef #905

Closed souleb closed 4 months ago

souleb commented 6 months ago

fixes #789 #903

souleb commented 5 months ago

Testing on a kind cluster gives the following:

install

Name:         podinfo
Namespace:    default
Labels:       <none>
Annotations:  <none>
API Version:  helm.toolkit.fluxcd.io/v2beta2
Kind:         HelmRelease
Metadata:
  Creation Timestamp:  2024-04-04T09:16:45Z
  Finalizers:
    finalizers.fluxcd.io
  Generation:        1
  Resource Version:  67055
  UID:               a188eee1-372d-49d7-9f1b-8fc2ebfdd623
Spec:
  Chart Ref:
    Kind:    OCIRepository
    Name:    podinfo
  Interval:  30s
  Values:
    Resources:
      Requests:
        Cpu:     100m
        Memory:  64Mi
Status:
  Conditions:
    Last Transition Time:  2024-04-04T09:16:48Z
    Message:               Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.6.0+cdd538a0167e
    Observed Generation:   1
    Reason:                InstallSucceeded
    Status:                True
    Type:                  Ready
    Last Transition Time:  2024-04-04T09:16:48Z
    Message:               Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.6.0+cdd538a0167e
    Observed Generation:   1
    Reason:                InstallSucceeded
    Status:                True
    Type:                  Released
  History:
    Chart Name:                    podinfo
    Chart Version:                 6.6.0+cdd538a0167e
    Config Digest:                 sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
    Digest:                        sha256:5930d2f61a467f6b0b3b34a83890a3ad2ee8215b5ca3c99200142c7ad361ddcc
    First Deployed:                2024-04-04T09:16:45Z
    Last Deployed:                 2024-04-04T09:16:45Z
    Name:                          podinfo
    Namespace:                     default
    Oci Digest:                    cdd538a0167e4b51152b71a477e51eb6737553510ce8797dbcc537e1342311bb
    Status:                        deployed
    Version:                       1
  Last Applied Revision:           6.6.0+cdd538a0167e
  Last Attempted Config Digest:    sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
  Last Attempted Generation:       1
  Last Attempted Release Action:   install
  Last Attempted Revision:         6.6.0+cdd538a0167e
  Last Attempted Revision Digest:  cdd538a0167e4b51152b71a477e51eb6737553510ce8797dbcc537e1342311bb
  Observed Generation:             1
  Storage Namespace:               default
Events:
  Type    Reason            Age   From             Message
  ----    ------            ----  ----             -------
  Normal  InstallSucceeded  35s   helm-controller  Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.6.0+cdd538a0167e

upgrade

Name:         podinfo
Namespace:    default
Labels:       <none>
Annotations:  <none>
API Version:  helm.toolkit.fluxcd.io/v2beta2
Kind:         HelmRelease
Metadata:
  Creation Timestamp:  2024-04-04T09:16:45Z
  Finalizers:
    finalizers.fluxcd.io
  Generation:        1
  Resource Version:  67318
  UID:               a188eee1-372d-49d7-9f1b-8fc2ebfdd623
Spec:
  Chart Ref:
    Kind:    OCIRepository
    Name:    podinfo
  Interval:  30s
  Values:
    Resources:
      Requests:
        Cpu:     100m
        Memory:  64Mi
Status:
  Conditions:
    Last Transition Time:  2024-04-04T09:19:21Z
    Message:               Helm upgrade succeeded for release default/podinfo.v2 with chart podinfo@6.6.1+0cc9a8446c95
    Observed Generation:   1
    Reason:                UpgradeSucceeded
    Status:                True
    Type:                  Ready
    Last Transition Time:  2024-04-04T09:19:21Z
    Message:               Helm upgrade succeeded for release default/podinfo.v2 with chart podinfo@6.6.1+0cc9a8446c95
    Observed Generation:   1
    Reason:                UpgradeSucceeded
    Status:                True
    Type:                  Released
  History:
    Chart Name:                    podinfo
    Chart Version:                 6.6.1+0cc9a8446c95
    Config Digest:                 sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
    Digest:                        sha256:44f96abf69e156bddee5d0f7a333a8a405357494ea4bf0e094770b4f3d540a56
    First Deployed:                2024-04-04T09:16:45Z
    Last Deployed:                 2024-04-04T09:19:19Z
    Name:                          podinfo
    Namespace:                     default
    Oci Digest:                    0cc9a8446c95009ef382f5eade883a67c257f77d50f84e78ecef2aac9428d1e5
    Status:                        deployed
    Version:                       2
    Chart Name:                    podinfo
    Chart Version:                 6.6.0+cdd538a0167e
    Config Digest:                 sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
    Digest:                        sha256:eacd9c47dba0ccc8e4eee7c5631fd5ef9257de09fdaa925327cb5c82b5d40288
    First Deployed:                2024-04-04T09:16:45Z
    Last Deployed:                 2024-04-04T09:16:45Z
    Name:                          podinfo
    Namespace:                     default
    Oci Digest:                    0cc9a8446c95009ef382f5eade883a67c257f77d50f84e78ecef2aac9428d1e5
    Status:                        superseded
    Version:                       1
  Last Applied Revision:           6.6.1+0cc9a8446c95
  Last Attempted Config Digest:    sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
  Last Attempted Generation:       1
  Last Attempted Release Action:   upgrade
  Last Attempted Revision:         6.6.1+0cc9a8446c95
  Last Attempted Revision Digest:  0cc9a8446c95009ef382f5eade883a67c257f77d50f84e78ecef2aac9428d1e5
  Observed Generation:             1
  Storage Namespace:               default
Events:
  Type    Reason            Age    From             Message
  ----    ------            ----   ----             -------
  Normal  InstallSucceeded  2m44s  helm-controller  Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.6.0+cdd538a0167e
  Normal  UpgradeSucceeded  11s    helm-controller  Helm upgrade succeeded for release default/podinfo.v2 with chart podinfo@6.6.1+0cc9a8446c95

generated k8s events

- apiVersion: v1
  count: 1
  eventTime: null
  firstTimestamp: "2024-04-04T09:16:48Z"
  involvedObject:
    apiVersion: helm.toolkit.fluxcd.io/v2beta2
    kind: HelmRelease
    name: podinfo
    namespace: default
    resourceVersion: "66956"
    uid: a188eee1-372d-49d7-9f1b-8fc2ebfdd623
  kind: Event
  lastTimestamp: "2024-04-04T09:16:48Z"
  message: Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.6.0+cdd538a0167e
  metadata:
    annotations:
      helm.toolkit.fluxcd.io/oci-digest: cdd538a0167e4b51152b71a477e51eb6737553510ce8797dbcc537e1342311bb
      helm.toolkit.fluxcd.io/revision: 6.6.0+cdd538a0167e
      helm.toolkit.fluxcd.io/token: sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
    creationTimestamp: "2024-04-04T09:16:48Z"
    name: podinfo.17c30906c8220c75
    namespace: default
    resourceVersion: "66990"
    uid: 48aca361-6161-4b16-90e5-1d7fdd86db46
  reason: InstallSucceeded
  reportingComponent: helm-controller
  reportingInstance: ""
  source:
    component: helm-controller
  type: Normal
- apiVersion: v1
  count: 1
  eventTime: null
  firstTimestamp: "2024-04-04T09:19:21Z"
  involvedObject:
    apiVersion: helm.toolkit.fluxcd.io/v2beta2
    kind: HelmRelease
    name: podinfo
    namespace: default
    resourceVersion: "67214"
    uid: a188eee1-372d-49d7-9f1b-8fc2ebfdd623
  kind: Event
  lastTimestamp: "2024-04-04T09:19:21Z"
  message: Helm upgrade succeeded for release default/podinfo.v2 with chart podinfo@6.6.1+0cc9a8446c95
  metadata:
    annotations:
      helm.toolkit.fluxcd.io/oci-digest: 0cc9a8446c95009ef382f5eade883a67c257f77d50f84e78ecef2aac9428d1e5
      helm.toolkit.fluxcd.io/revision: 6.6.1+0cc9a8446c95
      helm.toolkit.fluxcd.io/token: sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
    creationTimestamp: "2024-04-04T09:19:21Z"
    name: podinfo.17c3092a912d5368
    namespace: default
    resourceVersion: "67314"
    uid: 0e25afa3-9d8d-45c2-a0e6-ba890116a001
  reason: UpgradeSucceeded
  reportingComponent: helm-controller
  reportingInstance: ""
  source:
    component: helm-controller
  type: Normal
kind: List
metadata:
  resourceVersion: ""
souleb commented 5 months ago

Last test:

install

Name:         podinfo
Namespace:    default
Labels:       <none>
Annotations:  <none>
API Version:  helm.toolkit.fluxcd.io/v2beta2
Kind:         HelmRelease
Metadata:
  Creation Timestamp:  2024-04-06T12:36:44Z
  Finalizers:
    finalizers.fluxcd.io
  Generation:        1
  Resource Version:  134807
  UID:               5824f638-62a5-4f04-8d9a-147148e773c9
Spec:
  Chart Ref:
    Kind:    OCIRepository
    Name:    podinfo
  Interval:  30s
  Values:
    Resources:
      Requests:
        Cpu:     100m
        Memory:  64Mi
Status:
  Conditions:
    Last Transition Time:  2024-04-06T12:36:53Z
    Message:               Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.6.0+cdd538a0167e
    Observed Generation:   1
    Reason:                InstallSucceeded
    Status:                True
    Type:                  Ready
    Last Transition Time:  2024-04-06T12:36:53Z
    Message:               Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.6.0+cdd538a0167e
    Observed Generation:   1
    Reason:                InstallSucceeded
    Status:                True
    Type:                  Released
  History:
    Chart Name:                    podinfo
    Chart Version:                 6.6.0+cdd538a0167e
    Config Digest:                 sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
    Digest:                        sha256:d46fc5cfa381e7164a5da267a4a2876adbb36d2685d9a271e8c1471225a55b24
    First Deployed:                2024-04-06T12:36:51Z
    Last Deployed:                 2024-04-06T12:36:51Z
    Name:                          podinfo
    Namespace:                     default
    Oci Digest:                    sha256:cdd538a0167e4b51152b71a477e51eb6737553510ce8797dbcc537e1342311bb
    Status:                        deployed
    Version:                       1
  Last Applied Revision:           6.6.0+cdd538a0167e
  Last Attempted Config Digest:    sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
  Last Attempted Generation:       1
  Last Attempted Release Action:   install
  Last Attempted Revision:         6.6.0+cdd538a0167e
  Last Attempted Revision Digest:  sha256:cdd538a0167e4b51152b71a477e51eb6737553510ce8797dbcc537e1342311bb
  Observed Generation:             1
  Storage Namespace:               default
Events:
  Type    Reason            Age   From             Message
  ----    ------            ----  ----             -------
  Normal  InstallSucceeded  1s    helm-controller  Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.6.0+cdd538a0167e

update

Name:         podinfo
Namespace:    default
Labels:       <none>
Annotations:  <none>
API Version:  helm.toolkit.fluxcd.io/v2beta2
Kind:         HelmRelease
Metadata:
  Creation Timestamp:  2024-04-06T12:36:44Z
  Finalizers:
    finalizers.fluxcd.io
  Generation:        1
  Resource Version:  134973
  UID:               5824f638-62a5-4f04-8d9a-147148e773c9
Spec:
  Chart Ref:
    Kind:    OCIRepository
    Name:    podinfo
  Interval:  30s
  Values:
    Resources:
      Requests:
        Cpu:     100m
        Memory:  64Mi
Status:
  Conditions:
    Last Transition Time:  2024-04-06T12:37:55Z
    Message:               Helm upgrade succeeded for release default/podinfo.v2 with chart podinfo@6.6.1+0cc9a8446c95
    Observed Generation:   1
    Reason:                UpgradeSucceeded
    Status:                True
    Type:                  Ready
    Last Transition Time:  2024-04-06T12:37:55Z
    Message:               Helm upgrade succeeded for release default/podinfo.v2 with chart podinfo@6.6.1+0cc9a8446c95
    Observed Generation:   1
    Reason:                UpgradeSucceeded
    Status:                True
    Type:                  Released
  History:
    Chart Name:                    podinfo
    Chart Version:                 6.6.1+0cc9a8446c95
    Config Digest:                 sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
    Digest:                        sha256:9f82cfde3274ea7acaaa33785eeca8598ffc931caa3c6911923e50789cf116f1
    First Deployed:                2024-04-06T12:36:51Z
    Last Deployed:                 2024-04-06T12:37:53Z
    Name:                          podinfo
    Namespace:                     default
    Oci Digest:                    sha256:0cc9a8446c95009ef382f5eade883a67c257f77d50f84e78ecef2aac9428d1e5
    Status:                        deployed
    Version:                       2
    Chart Name:                    podinfo
    Chart Version:                 6.6.0+cdd538a0167e
    Config Digest:                 sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
    Digest:                        sha256:cd676285e9ee6fea0bf20e5a69933ed034b80320f8bbe80dd29613135a857e8b
    First Deployed:                2024-04-06T12:36:51Z
    Last Deployed:                 2024-04-06T12:36:51Z
    Name:                          podinfo
    Namespace:                     default
    Oci Digest:                    sha256:cdd538a0167e4b51152b71a477e51eb6737553510ce8797dbcc537e1342311bb
    Status:                        superseded
    Version:                       1
  Last Applied Revision:           6.6.1+0cc9a8446c95
  Last Attempted Config Digest:    sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
  Last Attempted Generation:       1
  Last Attempted Release Action:   upgrade
  Last Attempted Revision:         6.6.1+0cc9a8446c95
  Last Attempted Revision Digest:  sha256:0cc9a8446c95009ef382f5eade883a67c257f77d50f84e78ecef2aac9428d1e5
  Observed Generation:             1
  Storage Namespace:               default
Events:
  Type    Reason            Age   From             Message
  ----    ------            ----  ----             -------
  Normal  InstallSucceeded  63s   helm-controller  Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.6.0+cdd538a0167e
  Normal  UpgradeSucceeded  1s    helm-controller  Helm upgrade succeeded for release default/podinfo.v2 with chart podinfo@6.6.1+0cc9a8446c95

generated k8s events

- apiVersion: v1
  count: 1
  eventTime: null
  firstTimestamp: "2024-04-06T12:36:53Z"
  involvedObject:
    apiVersion: helm.toolkit.fluxcd.io/v2beta2
    kind: HelmRelease
    name: podinfo
    namespace: default
    resourceVersion: "134766"
    uid: 5824f638-62a5-4f04-8d9a-147148e773c9
  kind: Event
  lastTimestamp: "2024-04-06T12:36:53Z"
  message: Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.6.0+cdd538a0167e
  metadata:
    annotations:
      helm.toolkit.fluxcd.io/oci-digest: sha256:cdd538a0167e4b51152b71a477e51eb6737553510ce8797dbcc537e1342311bb
      helm.toolkit.fluxcd.io/revision: 6.6.0+cdd538a0167e
      helm.toolkit.fluxcd.io/token: sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
    creationTimestamp: "2024-04-06T12:36:53Z"
    name: podinfo.17c3b11b3595cbe9
    namespace: default
    resourceVersion: "134804"
    uid: ce59218c-0cdb-4386-bfea-df190ec65350
  reason: InstallSucceeded
  reportingComponent: helm-controller
  reportingInstance: ""
  source:
    component: helm-controller
  type: Normal
- apiVersion: v1
  count: 1
  eventTime: null
  firstTimestamp: "2024-04-06T12:37:55Z"
  involvedObject:
    apiVersion: helm.toolkit.fluxcd.io/v2beta2
    kind: HelmRelease
    name: podinfo
    namespace: default
    resourceVersion: "134868"
    uid: 5824f638-62a5-4f04-8d9a-147148e773c9
  kind: Event
  lastTimestamp: "2024-04-06T12:37:55Z"
  message: Helm upgrade succeeded for release default/podinfo.v2 with chart podinfo@6.6.1+0cc9a8446c95
  metadata:
    annotations:
      helm.toolkit.fluxcd.io/oci-digest: sha256:0cc9a8446c95009ef382f5eade883a67c257f77d50f84e78ecef2aac9428d1e5
      helm.toolkit.fluxcd.io/revision: 6.6.1+0cc9a8446c95
      helm.toolkit.fluxcd.io/token: sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
    creationTimestamp: "2024-04-06T12:37:55Z"
    name: podinfo.17c3b129b062ce6e
    namespace: default
    resourceVersion: "134969"
    uid: 8e0496d9-25ba-4f67-babf-00638769a43e
  reason: UpgradeSucceeded
  reportingComponent: helm-controller
  reportingInstance: ""
  source:
    component: helm-controller
  type: Normal
kind: List
metadata:
  resourceVersion: ""
souleb commented 5 months ago

testing switch from chart template to chartRef

install with chart template


Name:         podinfo
Namespace:    default
Labels:       <none>
Annotations:  <none>
API Version:  helm.toolkit.fluxcd.io/v2beta2
Kind:         HelmRelease
Metadata:
  Creation Timestamp:  2024-04-11T19:37:36Z
  Finalizers:
    finalizers.fluxcd.io
  Generation:        1
  Resource Version:  38935
  UID:               6157ab2f-2a24-471c-876f-b10587ffa19e
Spec:
  Chart:
    Spec:
      Chart:               podinfo
      Interval:            1m
      Reconcile Strategy:  ChartVersion
      Source Ref:
        Kind:   HelmRepository
        Name:   podinfo
      Version:  6.0.x
  Interval:     5m
  Values:
    Replica Count:  2
Status:
  Conditions:
    Last Transition Time:  2024-04-11T19:37:42Z
    Message:               Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.0.4
    Observed Generation:   1
    Reason:                InstallSucceeded
    Status:                True
    Type:                  Ready
    Last Transition Time:  2024-04-11T19:37:42Z
    Message:               Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.0.4
    Observed Generation:   1
    Reason:                InstallSucceeded
    Status:                True
    Type:                  Released
  Helm Chart:              default/default-podinfo
  History:
    Chart Name:                   podinfo
    Chart Version:                6.0.4
    Config Digest:                sha256:e15c415d62760896bd8bec192a44c5716dc224db9e0fc609b9ac14718f8f9e56
    Digest:                       sha256:5acea9bb2ccb36016f010bda3fed9611c1c53a5a36d2136f991c03a21b6b19d9
    First Deployed:               2024-04-11T19:37:38Z
    Last Deployed:                2024-04-11T19:37:38Z
    Name:                         podinfo
    Namespace:                    default
    Status:                       deployed
    Version:                      1
  Last Applied Revision:          6.0.4
  Last Attempted Config Digest:   sha256:e15c415d62760896bd8bec192a44c5716dc224db9e0fc609b9ac14718f8f9e56
  Last Attempted Generation:      1
  Last Attempted Release Action:  install
  Last Attempted Revision:        6.0.4
  Observed Generation:            1
  Storage Namespace:              default
Events:
  Type    Reason            Age   From             Message
  ----    ------            ----  ----             -------
  Normal  HelmChartCreated  14s   helm-controller  Created HelmChart/default/default-podinfo with SourceRef 'HelmRepository/default/podinfo'
  Normal  InstallSucceeded  9s    helm-controller  Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.0.4

switch to chartRef (action upgrade expected)

Name:         podinfo
Namespace:    default
Labels:       <none>
Annotations:  <none>
API Version:  helm.toolkit.fluxcd.io/v2beta2
Kind:         HelmRelease
Metadata:
  Creation Timestamp:  2024-04-11T19:37:36Z
  Finalizers:
    finalizers.fluxcd.io
  Generation:        2
  Resource Version:  40908
  UID:               6157ab2f-2a24-471c-876f-b10587ffa19e
Spec:
  Chart Ref:
    Kind:    OCIRepository
    Name:    podinfo
  Interval:  5m
  Values:
    Replica Count:  2
Status:
  Conditions:
    Last Transition Time:  2024-04-11T19:54:10Z
    Message:               Helm upgrade succeeded for release default/podinfo.v2 with chart podinfo@6.1.8+d955ab902166
    Observed Generation:   2
    Reason:                UpgradeSucceeded
    Status:                True
    Type:                  Ready
    Last Transition Time:  2024-04-11T19:54:10Z
    Message:               Helm upgrade succeeded for release default/podinfo.v2 with chart podinfo@6.1.8+d955ab902166
    Observed Generation:   2
    Reason:                UpgradeSucceeded
    Status:                True
    Type:                  Released
  History:
    Chart Name:                    podinfo
    Chart Version:                 6.1.8+d955ab902166
    Config Digest:                 sha256:e15c415d62760896bd8bec192a44c5716dc224db9e0fc609b9ac14718f8f9e56
    Digest:                        sha256:b24c16c1cf7c966f04f977072b9cc9d8dcd801389b0fc2a0b059361bcda02216
    First Deployed:                2024-04-11T19:37:38Z
    Last Deployed:                 2024-04-11T19:54:02Z
    Name:                          podinfo
    Namespace:                     default
    Oci Digest:                    sha256:d955ab90216698298d2b5a0c46e626f6141862070b9665201ada036bf37ab018
    Status:                        deployed
    Version:                       2
    Chart Name:                    podinfo
    Chart Version:                 6.0.4
    Config Digest:                 sha256:e15c415d62760896bd8bec192a44c5716dc224db9e0fc609b9ac14718f8f9e56
    Digest:                        sha256:b9f0b704a14a851a100a33320a949d733526bc0f7071c499784be5e554ee1ad6
    First Deployed:                2024-04-11T19:37:38Z
    Last Deployed:                 2024-04-11T19:37:38Z
    Name:                          podinfo
    Namespace:                     default
    Status:                        superseded
    Version:                       1
  Last Applied Revision:           6.1.8+d955ab902166
  Last Attempted Config Digest:    sha256:e15c415d62760896bd8bec192a44c5716dc224db9e0fc609b9ac14718f8f9e56
  Last Attempted Generation:       2
  Last Attempted Release Action:   upgrade
  Last Attempted Revision:         6.1.8+d955ab902166
  Last Attempted Revision Digest:  sha256:d955ab90216698298d2b5a0c46e626f6141862070b9665201ada036bf37ab018
  Observed Generation:             2
  Storage Namespace:               default
Events:
  Type    Reason            Age   From             Message
  ----    ------            ----  ----             -------
  Normal  HelmChartCreated  16m   helm-controller  Created HelmChart/default/default-podinfo with SourceRef 'HelmRepository/default/podinfo'
  Normal  InstallSucceeded  16m   helm-controller  Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.0.4
  Normal  HelmChartDeleted  24s   helm-controller  deleted HelmChart 'default/default-podinfo'
  Normal  UpgradeSucceeded  16s   helm-controller  Helm upgrade succeeded for release default/podinfo.v2 with chart podinfo@6.1.8+d955ab902166

upgrade chart version (action upgrade expected)

Name:         podinfo
Namespace:    default
Labels:       <none>
Annotations:  <none>
API Version:  helm.toolkit.fluxcd.io/v2beta2
Kind:         HelmRelease
Metadata:
  Creation Timestamp:  2024-04-11T19:37:36Z
  Finalizers:
    finalizers.fluxcd.io
  Generation:        2
  Resource Version:  41875
  UID:               6157ab2f-2a24-471c-876f-b10587ffa19e
Spec:
  Chart Ref:
    Kind:    OCIRepository
    Name:    podinfo
  Interval:  5m
  Values:
    Replica Count:  2
Status:
  Conditions:
    Last Transition Time:  2024-04-11T20:02:16Z
    Message:               Helm upgrade succeeded for release default/podinfo.v3 with chart podinfo@6.6.2+83295d47de6d
    Observed Generation:   2
    Reason:                UpgradeSucceeded
    Status:                True
    Type:                  Ready
    Last Transition Time:  2024-04-11T20:02:16Z
    Message:               Helm upgrade succeeded for release default/podinfo.v3 with chart podinfo@6.6.2+83295d47de6d
    Observed Generation:   2
    Reason:                UpgradeSucceeded
    Status:                True
    Type:                  Released
  History:
    Chart Name:                    podinfo
    Chart Version:                 6.6.2+83295d47de6d
    Config Digest:                 sha256:e15c415d62760896bd8bec192a44c5716dc224db9e0fc609b9ac14718f8f9e56
    Digest:                        sha256:550bff045314a9c066cf1d8e603de89597337988cbd876a6d974e64fda067f30
    First Deployed:                2024-04-11T19:37:38Z
    Last Deployed:                 2024-04-11T20:02:07Z
    Name:                          podinfo
    Namespace:                     default
    Oci Digest:                    sha256:83295d47de6d6ca634ed4b952a7572fc176bcc38854d0c11ca0fa197bc5f1154
    Status:                        deployed
    Version:                       3
    Chart Name:                    podinfo
    Chart Version:                 6.1.8+d955ab902166
    Config Digest:                 sha256:e15c415d62760896bd8bec192a44c5716dc224db9e0fc609b9ac14718f8f9e56
    Digest:                        sha256:581924c809cf98b96ff5e0b8b8a14f3d3e890ea425b2e9b39464e416cc6e3f60
    First Deployed:                2024-04-11T19:37:38Z
    Last Deployed:                 2024-04-11T19:54:02Z
    Name:                          podinfo
    Namespace:                     default
    Oci Digest:                    sha256:d955ab90216698298d2b5a0c46e626f6141862070b9665201ada036bf37ab018
    Status:                        superseded
    Version:                       2
  Last Applied Revision:           6.6.2+83295d47de6d
  Last Attempted Config Digest:    sha256:e15c415d62760896bd8bec192a44c5716dc224db9e0fc609b9ac14718f8f9e56
  Last Attempted Generation:       2
  Last Attempted Release Action:   upgrade
  Last Attempted Revision:         6.6.2+83295d47de6d
  Last Attempted Revision Digest:  sha256:83295d47de6d6ca634ed4b952a7572fc176bcc38854d0c11ca0fa197bc5f1154
  Observed Generation:             2
  Storage Namespace:               default
Events:
  Type    Reason            Age    From             Message
  ----    ------            ----   ----             -------
  Normal  HelmChartCreated  24m    helm-controller  Created HelmChart/default/default-podinfo with SourceRef 'HelmRepository/default/podinfo'
  Normal  InstallSucceeded  24m    helm-controller  Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.0.4
  Normal  HelmChartDeleted  8m31s  helm-controller  deleted HelmChart 'default/default-podinfo'
  Normal  UpgradeSucceeded  8m23s  helm-controller  Helm upgrade succeeded for release default/podinfo.v2 with chart podinfo@6.1.8+d955ab902166
  Normal  UpgradeSucceeded  17s    helm-controller  Helm upgrade succeeded for release default/podinfo.v3 with chart podinfo@6.6.2+83295d47de6d

switch back to chart template (action upgrade expected, plus helmChart created)

Name:         podinfo
Namespace:    default
Labels:       <none>
Annotations:  <none>
API Version:  helm.toolkit.fluxcd.io/v2beta2
Kind:         HelmRelease
Metadata:
  Creation Timestamp:  2024-04-11T19:37:36Z
  Finalizers:
    finalizers.fluxcd.io
  Generation:        3
  Resource Version:  42415
  UID:               6157ab2f-2a24-471c-876f-b10587ffa19e
Spec:
  Chart:
    Spec:
      Chart:               podinfo
      Interval:            1m
      Reconcile Strategy:  ChartVersion
      Source Ref:
        Kind:   HelmRepository
        Name:   podinfo
      Version:  ^6.1.x
  Interval:     5m
  Values:
    Replica Count:  2
Status:
  Conditions:
    Last Transition Time:  2024-04-11T20:06:58Z
    Message:               Helm upgrade succeeded for release default/podinfo.v4 with chart podinfo@6.6.2
    Observed Generation:   3
    Reason:                UpgradeSucceeded
    Status:                True
    Type:                  Ready
    Last Transition Time:  2024-04-11T20:06:58Z
    Message:               Helm upgrade succeeded for release default/podinfo.v4 with chart podinfo@6.6.2
    Observed Generation:   3
    Reason:                UpgradeSucceeded
    Status:                True
    Type:                  Released
  Helm Chart:              default/default-podinfo
  History:
    Chart Name:                   podinfo
    Chart Version:                6.6.2
    Config Digest:                sha256:e15c415d62760896bd8bec192a44c5716dc224db9e0fc609b9ac14718f8f9e56
    Digest:                       sha256:a21423c1835cd45d9cf9eef6fd55263db78a73a6fd577696fa092c7fe0368afc
    First Deployed:               2024-04-11T19:37:38Z
    Last Deployed:                2024-04-11T20:06:57Z
    Name:                         podinfo
    Namespace:                    default
    Status:                       deployed
    Version:                      4
    Chart Name:                   podinfo
    Chart Version:                6.6.2+83295d47de6d
    Config Digest:                sha256:e15c415d62760896bd8bec192a44c5716dc224db9e0fc609b9ac14718f8f9e56
    Digest:                       sha256:78ce11cb415c585f0d07246f3ff85421afbdd4abc2d2fb86cc8489fbebfca467
    First Deployed:               2024-04-11T19:37:38Z
    Last Deployed:                2024-04-11T20:02:07Z
    Name:                         podinfo
    Namespace:                    default
    Oci Digest:                   sha256:83295d47de6d6ca634ed4b952a7572fc176bcc38854d0c11ca0fa197bc5f1154
    Status:                       superseded
    Version:                      3
  Last Applied Revision:          6.6.2
  Last Attempted Config Digest:   sha256:e15c415d62760896bd8bec192a44c5716dc224db9e0fc609b9ac14718f8f9e56
  Last Attempted Generation:      3
  Last Attempted Release Action:  upgrade
  Last Attempted Revision:        6.6.2
  Observed Generation:            3
  Storage Namespace:              default
Events:
  Type    Reason            Age                From             Message
  ----    ------            ----               ----             -------
  Normal  InstallSucceeded  29m                helm-controller  Helm install succeeded for release default/podinfo.v1 with chart podinfo@6.0.4
  Normal  HelmChartDeleted  13m                helm-controller  deleted HelmChart 'default/default-podinfo'
  Normal  UpgradeSucceeded  13m                helm-controller  Helm upgrade succeeded for release default/podinfo.v2 with chart podinfo@6.1.8+d955ab902166
  Normal  UpgradeSucceeded  5m11s              helm-controller  Helm upgrade succeeded for release default/podinfo.v3 with chart podinfo@6.6.2+83295d47de6d
  Normal  HelmChartCreated  31s (x2 over 29m)  helm-controller  Created HelmChart/default/default-podinfo with SourceRef 'HelmRepository/default/podinfo'
  Normal  UpgradeSucceeded  29s                helm-controller  Helm upgrade succeeded for release default/podinfo.v4 with chart podinfo@6.6.2
stefanprodan commented 5 months ago

Some observations about changes in behaviour:

stefanprodan commented 4 months ago

Stuck helm-controller, the OCIRepo predicate is buggy:

$ flux -n podinfo get all
NAME                    REVISION                SUSPENDED   READY   MESSAGE                                            
ocirepository/podinfo   6.6.2@sha256:83295d47   False       True    stored artifact for digest '6.6.2@sha256:83295d47'  

NAME                REVISION    SUSPENDED   READY   MESSAGE                                                                                           
helmrelease/podinfo             False       False   OCIRepository 'podinfo/podinfo' is not ready: latest generation of object has not been reconciled   

The OCIRepo observedGeneration is up to date:

apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: OCIRepository
metadata:
  annotations:
    reconcile.fluxcd.io/requestedAt: "2024-04-12T20:09:15.148746+03:00"
  creationTimestamp: "2024-04-12T17:02:24Z"
  finalizers:
  - finalizers.fluxcd.io
  generation: 2
  name: podinfo
  namespace: podinfo
  resourceVersion: "5910"
  uid: d2464665-8e4c-4845-a449-2e7a384c3292
spec:
  interval: 1m
  layerSelector:
    mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
    operation: copy
  provider: generic
  ref:
    semver: '>=5.0.0'
  timeout: 60s
  url: oci://ghcr.io/stefanprodan/charts/podinfo
  verify:
    provider: notation
    secretRef:
      name: podinfo-notation
status:
  artifact:
    digest: sha256:9db648076519fe8ae594182fe0bb74bceb3bd516407d5da6577216d12a1f6625
    lastUpdateTime: "2024-04-12T17:07:06Z"
    metadata:
      org.opencontainers.image.authors: stefanprodan (stefanprodan@users.noreply.github.com)
      org.opencontainers.image.created: "2024-04-10T11:07:52Z"
      org.opencontainers.image.description: Podinfo Helm chart for Kubernetes
      org.opencontainers.image.source: https://github.com/stefanprodan/podinfo
      org.opencontainers.image.title: podinfo
      org.opencontainers.image.url: https://github.com/stefanprodan/podinfo
      org.opencontainers.image.version: 6.6.2
    path: ocirepository/podinfo/podinfo/sha256:83295d47de6d6ca634ed4b952a7572fc176bcc38854d0c11ca0fa197bc5f1154.tar.gz
    revision: 6.6.2@sha256:83295d47de6d6ca634ed4b952a7572fc176bcc38854d0c11ca0fa197bc5f1154
    size: 14905
    url: http://source-controller.flux-system.svc.cluster.local./ocirepository/podinfo/podinfo/sha256:83295d47de6d6ca634ed4b952a7572fc176bcc38854d0c11ca0fa197bc5f1154.tar.gz
  conditions:
  - lastTransitionTime: "2024-04-12T17:02:45Z"
    message: stored artifact for digest '6.6.2@sha256:83295d47de6d6ca634ed4b952a7572fc176bcc38854d0c11ca0fa197bc5f1154'
    observedGeneration: 2
    reason: Succeeded
    status: "True"
    type: Ready
  - lastTransitionTime: "2024-04-12T17:02:45Z"
    message: stored artifact for digest '6.6.2@sha256:83295d47de6d6ca634ed4b952a7572fc176bcc38854d0c11ca0fa197bc5f1154'
    observedGeneration: 2
    reason: Succeeded
    status: "True"
    type: ArtifactInStorage
  - lastTransitionTime: "2024-04-12T17:02:45Z"
    message: verified signature of revision 6.6.2@sha256:83295d47de6d6ca634ed4b952a7572fc176bcc38854d0c11ca0fa197bc5f1154
    observedGeneration: 2
    reason: Succeeded
    status: "True"
    type: SourceVerified
  lastHandledReconcileAt: "2024-04-12T20:09:15.148746+03:00"
  observedGeneration: 2
  observedLayerSelector:
    mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
    operation: copy
  url: http://source-controller.flux-system.svc.cluster.local./ocirepository/podinfo/podinfo/latest.tar.gz
stefanprodan commented 4 months ago

The test succeded event does not contain the oci-digest annotation and breaks the promotion workflow:

Helm test succeeded for release podinfo/podinfo.v2 with chart podinfo@6.6.2+83295d47de6d: 3 test hooks completed successfully
revision
6.6.2+83295d47de6d

The upgrade event has it:

Helm upgrade succeeded for release podinfo/podinfo.v2 with chart podinfo@6.6.2+83295d47de6d
oci-digest
sha256:83295d47de6d6ca634ed4b952a7572fc176bcc38854d0c11ca0fa197bc5f1154
revision
6.6.2+83295d47de6d
souleb commented 4 months ago

Just tested, test events show the digest as expected now:

- apiVersion: v1
  count: 1
  eventTime: null
  firstTimestamp: "2024-04-16T08:48:41Z"
  involvedObject:
    apiVersion: helm.toolkit.fluxcd.io/v2beta2
    kind: HelmRelease
    name: podinfo
    namespace: default
    resourceVersion: "3928"
    uid: 280e469f-e21e-4edd-b577-8d6ead548396
  kind: Event
  lastTimestamp: "2024-04-16T08:48:41Z"
  message: 'Helm test succeeded for release default/podinfo.v2 with chart podinfo@6.6.2+83295d47de6d:
    3 test hooks completed successfully'
  metadata:
    annotations:
      helm.toolkit.fluxcd.io/oci-digest: sha256:83295d47de6d6ca634ed4b952a7572fc176bcc38854d0c11ca0fa197bc5f1154
      helm.toolkit.fluxcd.io/revision: 6.6.2+83295d47de6d
      helm.toolkit.fluxcd.io/token: sha256:5ee5478adca0d5fa927d1ebff4714f8eea683389ac0e21489b5572806e3ab307
    creationTimestamp: "2024-04-16T08:48:41Z"
    name: podinfo.17c6b674cd8c4571
    namespace: default
    resourceVersion: "4061"
    uid: 15a0533d-68d0-43ae-b019-ff3dd26ddbd2
  reason: TestSucceeded
  reportingComponent: helm-controller
  reportingInstance: ""
  source:
    component: helm-controller
  type: Normal
kind: List
metadata:
  resourceVersion: ""
gabrielqs commented 4 months ago

is this ready to go live? can't wait to use it

stefanprodan commented 4 months ago

@gabrielqs this will be released in Flux v2.3, see https://github.com/fluxcd/flux2/issues/4712

souleb commented 4 months ago

I plan to merge this tomorrow, so late reviews can still happen.