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

[NET-11297] Purge on disable #4378

Merged
merged 11 commits into from
Oct 21, 2024
Merged

[NET-11297] Purge on disable #4378

merged 11 commits into from
Oct 21, 2024

Conversation

jm96441n
Copy link
Member

@jm96441n jm96441n commented Oct 1, 2024

Changes proposed in this PR

  • add new field to the helm chart to allow users to purge services from consul when catalog sync is disabled, users will have to opt into this to preserve existing behavior

How I've tested this PR

How I expect reviewers to test this PR

Checklist

@@ -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
Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

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"

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member Author

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"

@@ -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
Copy link
Member

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?

@jm96441n jm96441n changed the title Purge on disable [NET-11297] Purge on disable Oct 10, 2024
@jm96441n jm96441n marked this pull request as ready for review October 21, 2024 15:58
@jm96441n jm96441n requested a review from a team as a code owner October 21, 2024 15:58
@jm96441n jm96441n added the backport/1.6.x Changes are backported to 1.6 label Oct 21, 2024
@@ -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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

Copy link
Member

@jmurret jmurret left a 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 }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@jm96441n
Copy link
Member Author

bats tests added with commit 6a2b63d

Copy link
Member

@jmurret jmurret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 :shipit: 🙏 Thank you!

@jm96441n jm96441n enabled auto-merge (squash) October 21, 2024 20:51
@jm96441n jm96441n merged commit f31a6ba into main Oct 21, 2024
50 of 51 checks passed
@jm96441n jm96441n deleted the purge-on-disable branch October 21, 2024 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.6.x Changes are backported to 1.6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants