flagger
flagger copied to clipboard
refactor: use a pointer for field skipAnalysis in Canary object
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:
...
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.