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

refactor: use a pointer for field skipAnalysis in Canary object #1661

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Wenliang-CHEN
Copy link

This refactor tries to fulfil a special use case #1660 : when a custom
controller uses the Flagger API to render the Canary object to
json/yaml, it makes sure the skipAnalysis field is rendered when the
value is "false", so that the field is always communicated to the k8s
API server.

Comparison after marshalling the Canary object to yaml is as follows:

before, when skipAnalysis is "false", the canary object is rendered as such:

apiVersion: flagger.app/v1beta1
kind: Canary
...
# the skipAnalysis field is not rendered
spec:
  analysis:
...

After, it is as such:

apiVersion: flagger.app/v1beta1
kind: Canary
...
spec:
  skipAnalysis: false # this is the field we expected
  analysis:
...

This refactor tries to fulfil a special use case fluxcd#1660: when a custom
controller uses the Flagger API to render the Canary object to
json/yaml, it makes sure the skipAnalysis field is rendered when the
value is "false", so that the field is always communicated to the k8s
API server.

Comparison is as follows:

before, when skipAnalysis is "false" the canary object is rendered as such:

```
apiVersion: flagger.app/v1beta1
kind: Canary
...
spec:
  analysis:
...
```

After, it is as such:
```
apiVersion: flagger.app/v1beta1
kind: Canary
...
spec:
  skipAnalysis: false # this is the field we expected
  analysis:
...
```
@Wenliang-CHEN
Copy link
Author

Hey all, I noticed that the RevertOnDeletion and the Suspend fields are in the same situation. If this is a "go", please let me know if it make sense also to make these 2 fields as a pointer to keep it consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants