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

helm.operator-sdk/upgrade-force annotation value is not actually parsed #2884

Closed
anfanycw opened this issue Apr 23, 2020 · 10 comments · Fixed by #2894
Closed

helm.operator-sdk/upgrade-force annotation value is not actually parsed #2884

anfanycw opened this issue Apr 23, 2020 · 10 comments · Fixed by #2894
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. language/helm Issue is related to a Helm operator project priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done.
Milestone

Comments

@anfanycw
Copy link
Contributor

Bug Report

What did you do?

  1. Created an helm-based operator for locust with operator-sdk new ...
  2. Created operator and generated CRD yamls in minikube
  3. Applied generated custom resource
  4. Updated a value in the custom resource so a configuration change is recognized and re-applied the custom resource yaml.

What did you expect to see?
Expected to see all existing helm chart resources to be replaced. In this case, a new set of master and worker pods for locust.

What did you see instead? Under which circumstances?
Only the resource applicable to the updated config value was changed. In this case I decremented the worker replica count which only replaced the master pod and destroyed one worker pod. This debug statement showed up in the operator logs:

{"level":"info","ts":1587606295.6086833,"logger":"helm.controller","msg":"Could not parse annotation as a boolean","annotation":"helm.operator-sdk/upgrade-force","value informed":"T"}

This is when I noticed this: https://github.com/operator-framework/operator-sdk/pull/2773/files#diff-66372f3cbaf2399b5e8895c882e4eadfR336. force is not being parsed.

Environment

  • operator-sdk version:
"v0.17.0", commit: "2fd7019f856cdb6f6618e2c3c80d15c3c79d1b6c", kubernetes version: "v1.17.2", go version: "go1.14.2 darwin/amd64"
  • go version:
go version go1.14.2 darwin/amd64
  • Kubernetes version information:
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-16T23:34:25Z", GoVersion:"go1.14.2", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", BuildDate:"2020-03-25T14:50:46Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
  • Kubernetes cluster kind:

Helm

Possible Solution

On line: https://github.com/operator-framework/operator-sdk/pull/2773/files#diff-66372f3cbaf2399b5e8895c882e4eadfR336. force is not being parsed.

...
if i, err := strconv.ParseBool(force)
...

Additional context
Add any other context about the problem here.

@camilamacedo86
Copy link
Contributor

Hi @anfanycw,

According to the error see "value informed":"T" you informed "T" instead of "True". Am I right?
Could you please check it with the value as True?

@anfanycw
Copy link
Contributor Author

@camilamacedo86 ParseBool accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False. “T” was just one of the cases I tried besides the original from the README (True) before looking at the code.

@camilamacedo86 camilamacedo86 added language/helm Issue is related to a Helm operator project triage/support Indicates an issue that is a support question. labels Apr 23, 2020
@camilamacedo86
Copy link
Contributor

I will do a test to check it as soon as possible. A possible way to verify that and/or may its fix is by creating a unit test in the to cover this code and ensure that it will work. I do not think that it has been covered by tests.

However, your collaboration would be very welcome as well. Please, if you wish and have time feel free to come up with the fix and tests in a PR.

@joelanford
Copy link
Member

The problem is that we need to pass force to strconv.ParseBool(), not helmUpgradeForceAnnotation

https://github.com/operator-framework/operator-sdk/blob/master/pkg/helm/controller/reconcile.go#L336

@camilamacedo86 camilamacedo86 added kind/bug Categorizes issue or PR as related to a bug. and removed triage/support Indicates an issue that is a support question. labels Apr 23, 2020
@dian-xh
Copy link

dian-xh commented May 27, 2020

greetings,
tried with the new 0.17.1 image, and still seeing this issue when parsing the annotation boolean:

cr managed by helm operator:

    "metadata": {
      "name": "test",
      "annotations": {
        "helm.operator-sdk/upgrade-force": "True"
      }

log:

{"level":"info","ts":1590607171.116301,"logger":"helm.controller","msg":"Could not parse annotation as a boolean","annotation":"helm.operator-sdk/upgrade-force","value informed":"True"}
{"level":"info","ts":1590607171.9757097,"logger":"helm.controller","msg":"Updated release","namespace":"test","name":"logging","apiVersion":"myapi","kind":"MyType","release":"test","force":false}

I don't have permission to reopen this ticket. let me know if I should create a new one. thanks!

@camilamacedo86
Copy link
Contributor

Hi @dian-xh,

I will be working on in this fix, thank you for let us know.
/assign @camilamacedo86

@estroz
Copy link
Member

estroz commented May 28, 2020

@dian-xh I am not able to reproduce this issue in v0.17.1. The CR being reconciled is being created from your CSV's alm-examples right?

@dian-xh
Copy link

dian-xh commented May 28, 2020

Yes

@camilamacedo86 camilamacedo86 added priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. triage/support Indicates an issue that is a support question. labels May 29, 2020
@camilamacedo86
Copy link
Contributor

HI @dian-xh,

I am trying to reproduce the issue faced by you and I also could not face the error. So, lets keeping this close as history and track your scenario in the new issue because it shows no be tthe same case.

I also try to check your project and I will add all info in this new issue. Could you please follow up there? See; #3144

@camilamacedo86 camilamacedo86 removed the triage/support Indicates an issue that is a support question. label May 29, 2020
@camilamacedo86 camilamacedo86 modified the milestones: v0.19.0, v0.18.0 May 29, 2020
@dian-xh
Copy link

dian-xh commented Jun 2, 2020

@camilamacedo86 sounds good. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. language/helm Issue is related to a Helm operator project priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants