Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update loop when chart version is increased through spec.forProvider.chart.url #130

Open
Feggah opened this issue Jul 5, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@Feggah
Copy link

Feggah commented Jul 5, 2022

What happened?

  • When you change the chart version of the Release through the field spec.forProvider.chart.url (not using spec.forProvider.chart.version), the Release controller tries to update the Release in every reconcile.

How can we reproduce it?

  1. Apply the ProviderConfig in examples/provider-config/provider-config-incluster.yaml
  2. Apply the Release below:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
metadata:
  name: sample
spec:
  forProvider:
    chart:
      name: sample
      url: https://github.com/Feggah/chart-sample/releases/download/sample-0.3.0/sample-0.3.0.tgz
    namespace: default
    values:
      name: sample
    wait: true
  providerConfigRef:
    name: helm-provider
  1. Then, update the Release manifest to the specified below and kubectl apply it:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
metadata:
  name: sample
spec:
  forProvider:
    chart:
      name: sample
      url: https://github.com/Feggah/chart-sample/releases/download/sample-0.4.0/sample-0.4.0.tgz
    namespace: default
    values:
      name: test
    wait: true
  providerConfigRef:
    name: helm-provider

Error cause

The update-loop is triggered by the IsUpToDate function, which returns false in every reconcile. The offending lines are

if in.Chart.Version != ocm.Version {
return false, nil
}

The .Version field is always different, because the in.Chart.Version is 0.3.0 and the ocm.Version is 0.4.0.

Probably, the in.Chart.Version is being "imported" just in the first reconcile loop, when its value is empty (""). When we updated the url in the manifest, the in.Chart.Version wasn't updated as well.

The offending lines possibly are

if cr.Spec.ForProvider.Chart.Version == "" {
cr.Spec.ForProvider.Chart.Version = chart.Metadata.Version
if err := e.localKube.Update(ctx, cr); err != nil {
return errors.Wrap(err, errFailedToSetVersion)
}
}

Hypothesis

The versions specified in the spec.forProvider.chart.url and spec.forProvider.chart.version should change together, because if they are different and not empty, this update loop behavior will happen again.

What environment did it happen in?

Crossplane version: 1.6.1
Provider-helm version: 0.10.0

@Feggah Feggah added the bug Something isn't working label Jul 5, 2022
@Feggah
Copy link
Author

Feggah commented Jul 5, 2022

Currently, you can change the versions in the manifest at the same time, and then the controller will behave as expected.

So, based on the example above, in the step [3] you should apply this manifest:

apiVersion: helm.crossplane.io/v1beta1
kind: Release
metadata:
  name: sample
spec:
  forProvider:
    chart:
      name: sample
      url: https://github.com/Feggah/chart-sample/releases/download/sample-0.4.0/sample-0.4.0.tgz
      version: "0.4.0"
    namespace: default
    values:
      name: test
    wait: true
  providerConfigRef:
    name: helm-provider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant