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

Unnecessary Deployment reconciliation due to autogenerated default field #55

Open
miguelsorianod opened this issue Feb 28, 2020 · 0 comments

Comments

@miguelsorianod
Copy link
Contributor

It has been observed on the APIcast operator logs that after APIcast is reconciliated, if you force a reconciliation event (for example adding an annotation to an APIcast custom resource) the following log lines are shown:

{"level":"info","ts":1582906718.9778767,"logger":"controller_apicast","msg":"Reconciling APIcast","Request.Namespace":"msoriano-test","Request.Name":"example-apicast"}
{"level":"info","ts":1582906718.9780028,"logger":"controller_apicast","msg":"Updating Deployment/apicast-example-apicast"}
{"level":"info","ts":1582906718.9828045,"logger":"controller_apicast","msg":"APIcast logic reconciled"}
{"level":"info","ts":1582906718.9828653,"logger":"controller_apicast","msg":"APIcast status reconciled"}
{"level":"info","ts":1582906718.9828753,"logger":"controller_apicast","msg":"Finished current reconcile request successfully. Skipping requeue of the request"}

The

{"level":"info","ts":1582906718.9780028,"logger":"controller_apicast","msg":"Updating Deployment/apicast-example-apicast"}

Should not appear in that case as the object should have been reconciliated at that point.

By adding some logs to the code it has been observed that the reason of this is due to the field 'Spec.Template.Spec.Volumes[*].VolumeSource.Secret.DefaultMode of the managed Deployment by APIcast when an embedded configuration is set is automatically set to 420 (0644 permission mode) as a default when not defined:

SecretVolumeSource defaultMode:

- 				DefaultMode: &420,
+ 				DefaultMode: nil,

In the previous code '-' is existing and '+' is desired.

This default setting behavior can be observed in the documentation itself of the SecretVolumeSource:

       ...
	// Optional: mode bits to use on created files by default. Must be a
	// value between 0 and 0777. Defaults to 0644.
	// Directories within the path are not affected by this setting.
	// This might be in conflict with other options that affect the file
	// mode, like fsGroup, and the result can be other mode bits set.
	// +optional
	DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"bytes,3,opt,name=defaultMode"`
      ...

Because in our code we don't have it defined the desired differs from the existing deployed element and this causes an unnecessary update. This does not break functionality due to when the update is performed (set to nil) K8s/OpenShift automatically sets it as 420 again which is what is set on the deployed element so no changes happen/redeployments happen, but we should fix this to avoid the false positive change detection and update there

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

No branches or pull requests

1 participant