-
Notifications
You must be signed in to change notification settings - Fork 324
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
[NET-11297] Purge on disable #4378
Conversation
charts/consul/values.yaml
Outdated
@@ -2090,6 +2090,10 @@ syncCatalog: | |||
# global.enabled. | |||
enabled: false | |||
|
|||
# True if you want to deregister all services in this cluster from consul that have been registered by the catalog sync when the `enabled` flag is set to false. | |||
# @type: boolean | |||
purgeServicesOnDisable: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs a better name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, as we discussed before, do we need to add more fields here to allow users to control the purging in more granular ways?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't, it's not really a requirement and since we're doing this on a disable of the catalog-sync we don't want to potentially leave behind services that might no longer exist. The main requirement is "remove services registered by catalog sync when catalog sync is disabled"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this still needs a better name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just brain dumping other possibilities:
cleanUpServicesOnDisable
cleanUpOnDisable
(might be my vote thus far 🤷♂️ )deregisterServicesOnDisable
deregisterOnDisable
It feels like the name needs to be some version of ..OnDisable
because putting disable
as a prefix makes it seem like you are disabling something additional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I don't like the prefix disable
I was thinking maybe cleanupNodeOnRemoval
since the Disable
can be a bit of misnomer because this runs on uninstall of consul and when you disable syncCatalog
whereas the removal
can mean "removal of sync catalog" or "removal of consul"
charts/consul/values.yaml
Outdated
@@ -2090,6 +2090,10 @@ syncCatalog: | |||
# global.enabled. | |||
enabled: false | |||
|
|||
# True if you want to deregister all services in this cluster from consul that have been registered by the catalog sync when the `enabled` flag is set to false. | |||
# @type: boolean | |||
purgeServicesOnDisable: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, as we discussed before, do we need to add more fields here to allow users to control the purging in more granular ways?
@@ -156,8 +152,8 @@ func (c *Command) init() { | |||
"\"debug\", \"info\", \"warn\", and \"error\".") | |||
c.flags.BoolVar(&c.flagLogJSON, "log-json", false, | |||
"Enable or disable JSON output format for logging.") | |||
c.flags.StringVar(&c.flagPurgeK8SServicesFromNode, "purge-k8s-services-from-node", "", | |||
"Specifies the name of the Consul node for which to deregister synced Kubernetes services.") | |||
c.flags.BoolVar(&c.flagPurgeK8SServicesFromNode, "purge-k8s-services-from-node", false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! left some suggestions for helm value naming. The only possible blocking questions are:
- related to using the
IsUpgrade
in the delete job - we need BATS tests for these files.
@@ -1,4 +1,5 @@ | |||
{{- if (or (and (ne (.Values.syncCatalog.enabled | toString) "-") .Values.syncCatalog.enabled) (and (eq (.Values.syncCatalog.enabled | toString) "-") .Values.global.enabled)) }} | |||
{{- $syncCatalogEnabled := (or (and (ne (.Values.syncCatalog.enabled | toString) "-") .Values.syncCatalog.enabled) (and (eq (.Values.syncCatalog.enabled | toString) "-") .Values.global.enabled)) }} | |||
{{- if $syncCatalogEnabled }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
charts/consul/templates/sync-catalog-cleanup-podsecuritypolicy.yaml
Outdated
Show resolved
Hide resolved
charts/consul/templates/sync-catalog-cleanup-on-upgrade-job.yaml
Outdated
Show resolved
Hide resolved
charts/consul/templates/sync-catalog-cleanup-on-uninstall-job.yaml
Outdated
Show resolved
Hide resolved
bats tests added with commit 6a2b63d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 🙏 Thank you!
Changes proposed in this PR
How I've tested this PR
How I expect reviewers to test this PR
Checklist