Add support for future flag to protect our service from being deploye…#1871
Add support for future flag to protect our service from being deploye…#1871mploski wants to merge 1 commit intofeature/database-controllersfrom
Conversation
|
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request |
| } | ||
|
|
||
| // ValidatePostgresDatabaseUpdate validates a PostgresDatabase on UPDATE. | ||
| func ValidatePostgresDatabaseUpdate(obj, oldObj *enterpriseApi.PostgresDatabase) field.ErrorList { |
There was a problem hiding this comment.
nit: if we only alias the method here, maybe It would be fine to limit the functionality to only one method with a more direct name? fe. IsPostgresEnabled. Or is there potential that the update/create validation will diverge in the future?
| obj *enterpriseApi.PostgresDatabase | ||
| wantErrCount int | ||
| }{ | ||
| { |
There was a problem hiding this comment.
Is there a possibility, that this test will expand in the future? What I mean, is the table driven pattern neccessary here? Or maybe the below "create(...)"(similar kind) test can be merged with this one to provide table driven n > 1 testcases scenario?
|
|
||
| func TestValidatePostgresDatabaseCreateFeatureGateDisabled(t *testing.T) { | ||
| config.DefaultMutableFeatureGate.SetFromMap(map[string]bool{string(config.PostgresController): false}) | ||
| t.Cleanup(func() { |
There was a problem hiding this comment.
Would It be worth It to have this enabled as a fixture before each testcases?
It's a redundancy, but ensures hermetic test development effort from our side and makes tests resilient and immune to human error (not cleaning up once and influencing n > 1 tests later).
M4KIF
left a comment
There was a problem hiding this comment.
left a few comments in tests and .../webhook/...
Description
Enables the PostgresController feature gate mechanism across all three Postgres CRs — PostgresCluster, PostgresClusterClass, and PostgresDatabase. When the gate is off (default, Alpha), the validation webhook rejects any attempt to create or update these resources, preventing them from being deployed to environments where the controller is not active. This protects production clusters from silently accumulating CRs that no controller will reconcile.
Key Changes
Testing and Verification
ok github.com/splunk/splunk-operator/pkg/postgresql/cluster/adapter/webhook
ok github.com/splunk/splunk-operator/pkg/postgresql/database/adapter/webhook
ok github.com/splunk/splunk-operator/pkg/splunk/enterprise/validation
Related Issues
Jira tickets, GitHub issues, Support tickets...
PR Checklist