MGDAPI-5640 - allow 0 value maintenance hour #680
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
MGDAPI-5640
What
Due to the configuration of the maintenanceWindow, 0 values are omitted during serialization as they are marked omit empty. I have included our version of the
MaintenanceWindow
in gcpiface with theDay
andHour
parameters set as pointers. This allows us to determine if the parameter is set or not (nil = omitted), and also whether it is set but a zero value. In the case of days the permitted values are only 1-7 and so we do not set ForceSendFields (as an omitted value is not valid). However in the case of hours we set theForceSendFields
in the case of zero values to ensure that the value is serialized before GCP API calls.Also updated code in the updateStrategy to monitor changes to the maintenance and reflect them in GCP.
Verification
It would be easiest to reproduce alongside the integreatly-operator where the issue first arose.
Provision a GCP CCS cluster
From the master branch of the Delorean repo create a file in the root of the repo called gcp_service_account.json. Request GCP credentials and add these to this file. Adjust this command to suit your needs, it will generate a config at ocm/cluster.json:
Once you have checked the ocm/cluster.json, create the cluster:
Verify changes
Install RHOAM from master with MaintenanceWindow set as 0,0:
Installation should get stuck creating the initial Postgres instance due to the hour field not being set in the strategy:
Stop the operator and checkout the changes from my branch https://github.com/adam-cattermole/integreatly-operator/tree/MGDAPI-5640 (this is consuming API changes + new CRO v1.0.2 from this PR), rerun the operator.
The ConfigMap should update to include the hour:
The Postgres creation will still fail until CRO updates to v1.0.2 (dev version including these changes) - wait for this to take place.
RHOAM installation should complete as expected.