Skip to content

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

Open
Wenliang-CHEN wants to merge 1 commit into
fluxcd:mainfrom
personio:feat/use-pointer-for-skipAnalysis-field
Open

refactor: use a pointer for field skipAnalysis in Canary object#1661
Wenliang-CHEN wants to merge 1 commit into
fluxcd:mainfrom
personio:feat/use-pointer-for-skipAnalysis-field

Conversation

@Wenliang-CHEN
Copy link
Copy Markdown

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
Copy Markdown
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