Skip to content

NE-1811: Rename the allowlist route annotation - #564

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
Miciah:rename-the-allowlist-route-annotation
Oct 18, 2024
Merged

NE-1811: Rename the allowlist route annotation#564
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
Miciah:rename-the-allowlist-route-annotation

Conversation

@Miciah

@Miciah Miciah commented Feb 20, 2024

Copy link
Copy Markdown
Contributor

Use the new annotation key "haproxy.router.openshift.io/ip_allowlist" in addition to the old "haproxy.router.openshift.io/ip_whitelist" annotation key. Continue to allow the old annotation key for now, but use the new one if it is present.

If a route has annotations with both keys, the annotation with the new key is used, and the annotation with the old key is ignored.

Also rename some template helper functions. Note that this is technically a breaking change for custom config templates!

Also rename internal consts, variables, functions, struct fields, and HAProxy ACLs to change "whitelist" to "allowlist" and "blacklist" to "denylist".

  • images/router/haproxy/conf/haproxy-config.template: Check for both the old annotation and new annotation keys. Rename the associated acl and file name.
  • pkg/cmd/infra/router/router.go (RouterSelection): Rename BlacklistedDomains to DenylistedDomains and WhitelistedDomains to AllowlistedDomains.
    (AdmissionCheck, RouteAdmissionFunc): Update for changes in RouterSelection.
  • pkg/router/router_test.go (TestMain): Use the new HAProxy allowlist file name.
    (TestConfigTemplate): Update tests to use the new annotation key and to check for the new HAProxy ACL name and file name. Add a test for the old annotation key to ensure we don't break existing routes.
  • pkg/router/template/configmanager/haproxy/manager.go (modAnnotationsList): Add the new annotation key (but keep the old one as well as it is still recognized in the template).
  • pkg/router/template/router.go (whitelistDir): Rename...
    (allowlistDir): ...to this.
  • pkg/router/template/template_helper.go (validateHAProxyWhiteList): Rename...
    (validateHAProxyAllowlist): ...to this. Use the new ValidateAllowlist helper.
    (generateHAProxyWhiteListFile): Rename...
    (generateHAProxyAllowlistFile): ...to this. Use the new ValidateAllowlist helper and allowlistDir const, and update an error message.
    (helperFunctions): Rename validateHAProxyWhiteList and generateHAProxyWhiteListFile to validateHAProxyAllowlist and generateHAProxyAllowlistFile, respectively.
  • pkg/router/template/template_helper_test.go (TestGenerateHAProxyWhiteListFile): Rename...
    (Test_generateHAProxyAllowlistFile): ...to this. Use the new allowlistDir const. Update some error messages and internal struct field names.
  • pkg/router/template/util/haproxy/whitelist.go: Rename file...
  • pkg/router/template/util/haproxy/allowlist.go: ...to this.
    (HAPROXY_MAX_WHITELIST_LENGTH): Rename const...
    (HAPROXY_MAX_ALLOWLIST_LENGTH): ...to this.
    (ValidateWhiteList): Rename...
    (ValidateAllowlist): ...to this.
  • pkg/router/template/util/haproxy/whitelist_test.go: Rename file...
  • pkg/router/template/util/haproxy/allowlist_test.go: ...to this.
    (TestValidateWhitelist): Rename...
    (Test_ValidateAllowlist): ...to this.

@openshift-ci
openshift-ci Bot requested review from frobware and rfredette February 20, 2024 18:00
@openshift-bot

Copy link
Copy Markdown
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci Bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 21, 2024
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 21, 2024
@openshift-bot

Copy link
Copy Markdown
Contributor

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci Bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 20, 2024
@Miciah

Miciah commented Jul 11, 2024

Copy link
Copy Markdown
Contributor Author

/remove-lifecycle rotten

@openshift-ci openshift-ci Bot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Jul 11, 2024
@Miciah Miciah changed the title Rename the allowlist route annotation NE-1811: Rename the allowlist route annotation Sep 4, 2024
@openshift-ci-robot

openshift-ci-robot commented Sep 4, 2024

Copy link
Copy Markdown
Contributor

@Miciah: This pull request references NE-1811 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

Details

In response to this:

Use the new annotation key "haproxy.router.openshift.io/ip_allowlist" in addition to the old "haproxy.router.openshift.io/ip_whitelist" annotation key. Continue to allow the old annotation key for now, but use the new one if it is present.

If a route has annotations with both keys, the annotation with the new key is used, and the annotation with the old key is ignored.

Also rename some template helper functions. Note that this is technically a breaking change for custom config templates!

Also rename internal consts, variables, functions, struct fields, and HAProxy ACLs to change "whitelist" to "allowlist" and "blacklist" to "denylist".

  • images/router/haproxy/conf/haproxy-config.template: Check for both the old annotation and new annotation keys. Rename the associated acl and file name.
  • pkg/cmd/infra/router/router.go (RouterSelection): Rename BlacklistedDomains to DenylistedDomains and WhitelistedDomains to AllowlistedDomains.
    (AdmissionCheck, RouteAdmissionFunc): Update for changes in RouterSelection.
  • pkg/router/router_test.go (TestMain): Use the new HAProxy allowlist file name.
    (TestConfigTemplate): Update tests to use the new annotation key and to check for the new HAProxy ACL name and file name. Add a test for the old annotation key to ensure we don't break existing routes.
  • pkg/router/template/configmanager/haproxy/manager.go (modAnnotationsList): Add the new annotation key (but keep the old one as well as it is still recognized in the template).
  • pkg/router/template/router.go (whitelistDir): Rename...
    (allowlistDir): ...to this.
  • pkg/router/template/template_helper.go (validateHAProxyWhiteList): Rename...
    (validateHAProxyAllowlist): ...to this. Use the new ValidateAllowlist helper.
    (generateHAProxyWhiteListFile): Rename...
    (generateHAProxyAllowlistFile): ...to this. Use the new ValidateAllowlist helper and allowlistDir const, and update an error message.
    (helperFunctions): Rename validateHAProxyWhiteList and generateHAProxyWhiteListFile to validateHAProxyAllowlist and generateHAProxyAllowlistFile, respectively.
  • pkg/router/template/template_helper_test.go (TestGenerateHAProxyWhiteListFile): Rename...
    (Test_generateHAProxyAllowlistFile): ...to this. Use the new allowlistDir const. Update some error messages and internal struct field names.
  • pkg/router/template/util/haproxy/whitelist.go: Rename file...
  • pkg/router/template/util/haproxy/allowlist.go: ...to this.
    (HAPROXY_MAX_WHITELIST_LENGTH): Rename const...
    (HAPROXY_MAX_ALLOWLIST_LENGTH): ...to this.
    (ValidateWhiteList): Rename...
    (ValidateAllowlist): ...to this.
  • pkg/router/template/util/haproxy/whitelist_test.go: Rename file...
  • pkg/router/template/util/haproxy/allowlist_test.go: ...to this.
    (TestValidateWhitelist): Rename...
    (Test_ValidateAllowlist): ...to this.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Sep 4, 2024
@Miciah Miciah closed this Sep 4, 2024
@Miciah
Miciah deleted the rename-the-allowlist-route-annotation branch September 4, 2024 15:40
@Miciah
Miciah restored the rename-the-allowlist-route-annotation branch September 4, 2024 15:41
@Miciah Miciah reopened this Sep 4, 2024
@openshift-ci-robot

openshift-ci-robot commented Sep 4, 2024

Copy link
Copy Markdown
Contributor

@Miciah: This pull request references NE-1811 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

Details

In response to this:

Use the new annotation key "haproxy.router.openshift.io/ip_allowlist" in addition to the old "haproxy.router.openshift.io/ip_whitelist" annotation key. Continue to allow the old annotation key for now, but use the new one if it is present.

If a route has annotations with both keys, the annotation with the new key is used, and the annotation with the old key is ignored.

Also rename some template helper functions. Note that this is technically a breaking change for custom config templates!

Also rename internal consts, variables, functions, struct fields, and HAProxy ACLs to change "whitelist" to "allowlist" and "blacklist" to "denylist".

  • images/router/haproxy/conf/haproxy-config.template: Check for both the old annotation and new annotation keys. Rename the associated acl and file name.
  • pkg/cmd/infra/router/router.go (RouterSelection): Rename BlacklistedDomains to DenylistedDomains and WhitelistedDomains to AllowlistedDomains.
    (AdmissionCheck, RouteAdmissionFunc): Update for changes in RouterSelection.
  • pkg/router/router_test.go (TestMain): Use the new HAProxy allowlist file name.
    (TestConfigTemplate): Update tests to use the new annotation key and to check for the new HAProxy ACL name and file name. Add a test for the old annotation key to ensure we don't break existing routes.
  • pkg/router/template/configmanager/haproxy/manager.go (modAnnotationsList): Add the new annotation key (but keep the old one as well as it is still recognized in the template).
  • pkg/router/template/router.go (whitelistDir): Rename...
    (allowlistDir): ...to this.
  • pkg/router/template/template_helper.go (validateHAProxyWhiteList): Rename...
    (validateHAProxyAllowlist): ...to this. Use the new ValidateAllowlist helper.
    (generateHAProxyWhiteListFile): Rename...
    (generateHAProxyAllowlistFile): ...to this. Use the new ValidateAllowlist helper and allowlistDir const, and update an error message.
    (helperFunctions): Rename validateHAProxyWhiteList and generateHAProxyWhiteListFile to validateHAProxyAllowlist and generateHAProxyAllowlistFile, respectively.
  • pkg/router/template/template_helper_test.go (TestGenerateHAProxyWhiteListFile): Rename...
    (Test_generateHAProxyAllowlistFile): ...to this. Use the new allowlistDir const. Update some error messages and internal struct field names.
  • pkg/router/template/util/haproxy/whitelist.go: Rename file...
  • pkg/router/template/util/haproxy/allowlist.go: ...to this.
    (HAPROXY_MAX_WHITELIST_LENGTH): Rename const...
    (HAPROXY_MAX_ALLOWLIST_LENGTH): ...to this.
    (ValidateWhiteList): Rename...
    (ValidateAllowlist): ...to this.
  • pkg/router/template/util/haproxy/whitelist_test.go: Rename file...
  • pkg/router/template/util/haproxy/allowlist_test.go: ...to this.
    (TestValidateWhitelist): Rename...
    (Test_ValidateAllowlist): ...to this.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@Miciah
Miciah force-pushed the rename-the-allowlist-route-annotation branch from e80f8a4 to 5d53eea Compare September 4, 2024 15:42
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 4, 2024
@Miciah

Miciah commented Sep 4, 2024

Copy link
Copy Markdown
Contributor Author

@candita

candita commented Sep 11, 2024

Copy link
Copy Markdown
Contributor

/assign @gcs278

Use the new annotation key "haproxy.router.openshift.io/ip_allowlist" in
addition to the old "haproxy.router.openshift.io/ip_whitelist" annotation
key.  Continue to allow the old annotation key for now, but use the new one
if it is present.

If a route has annotations with both keys, the annotation with the new key
is used, and the annotation with the old key is ignored.

Also rename some template helper functions.  Note that this is technically
a breaking change for custom config templates!

Also rename internal consts, variables, functions, struct fields, and
HAProxy ACLs to change "whitelist" to "allowlist" and "blacklist" to
"denylist".

* hack/Dockerfile.debug:
* images/router/haproxy/Dockerfile:
* images/router/haproxy/Dockerfile.ocp:
* images/router/haproxy/Dockerfile.rhel: Replace the "whitelists" file name with
"allowlists".
* images/router/haproxy/conf/haproxy-config.template: Check for both the
old annotation and new annotation keys.  Rename the associated acl and file
name.
* pkg/cmd/infra/router/router.go (RouterSelection): Rename
BlacklistedDomains to DenylistedDomains and WhitelistedDomains to
AllowlistedDomains.
(AdmissionCheck, RouteAdmissionFunc): Update for changes in
RouterSelection.
* pkg/router/router_test.go (TestMain): Use the new HAProxy allowlist file
name.
(TestConfigTemplate): Update tests to use the new annotation key and to
check for the new HAProxy ACL name and file name.  Add a test for the old
annotation key to ensure we don't break existing routes.
* pkg/router/template/configmanager/haproxy/manager.go
(modAnnotationsList): Add the new annotation key (but keep the old one as
well as it is still recognized in the template).
* pkg/router/template/router.go (whitelistDir): Rename...
(allowlistDir): ...to this.
* pkg/router/template/template_helper.go (validateHAProxyWhiteList):
Rename...
(validateHAProxyAllowlist): ...to this.  Use the new ValidateAllowlist
helper.
(generateHAProxyWhiteListFile): Rename...
(generateHAProxyAllowlistFile): ...to this.  Use the new ValidateAllowlist
helper and allowlistDir const, and update an error message.
(helperFunctions): Rename validateHAProxyWhiteList and
generateHAProxyWhiteListFile to validateHAProxyAllowlist and
generateHAProxyAllowlistFile, respectively.
* pkg/router/template/template_helper_test.go
(TestGenerateHAProxyWhiteListFile): Rename...
(Test_generateHAProxyAllowlistFile): ...to this.  Use the new allowlistDir
const.  Update some error messages and internal struct field names.
* pkg/router/template/util/haproxy/whitelist.go: Rename file...
* pkg/router/template/util/haproxy/allowlist.go: ...to this.
(HAPROXY_MAX_WHITELIST_LENGTH): Rename const...
(HAPROXY_MAX_ALLOWLIST_LENGTH): ...to this.
(ValidateWhiteList): Rename...
(ValidateAllowlist): ...to this.
* pkg/router/template/util/haproxy/whitelist_test.go: Rename file...
* pkg/router/template/util/haproxy/allowlist_test.go: ...to this.
(TestValidateWhitelist): Rename...
(Test_ValidateAllowlist): ...to this.
@Miciah
Miciah force-pushed the rename-the-allowlist-route-annotation branch from 5d53eea to 242ad71 Compare September 12, 2024 15:14
@Miciah

Miciah commented Sep 12, 2024

Copy link
Copy Markdown
Contributor Author

@openshift-ci

openshift-ci Bot commented Sep 12, 2024

Copy link
Copy Markdown
Contributor

@Miciah: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-metal-ipi-ovn-ipv6 242ad71 link false /test e2e-metal-ipi-ovn-ipv6

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

"generateHAProxyMap": generateHAProxyMap, //generates a haproxy map content
"validateHAProxyWhiteList": validateHAProxyWhiteList, //validates a haproxy whitelist (acl) content
"generateHAProxyWhiteListFile": generateHAProxyWhiteListFile, //generates a haproxy whitelist file for use in an acl
"validateHAProxyAllowlist": validateHAProxyAllowlist, //validates a haproxy allowlist (acl) content

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are you concerned about breaking custom templates at all? I don't think we officially support any form of custom template, so don't have to maintain compatibility?

If it actually is a concern, you could leave "validateHAProxyWhiteList" as an entry in this template.FuncMap to maintain support for custom template. I think its okay to break custom templates though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Are you concerned about breaking custom templates at all?

A little bit.

I don't think we officially support any form of custom template, so don't have to maintain compatibility?

We absolutely do not, and never did, support custom templates. That said, it's entirely possible to run an unsupported custom router deployment on OCP, and then of course there's OKD. Support concerns aside, it is unkind to break custom config capriciously, be it customers' or community members'. For what it's worth, when I carelessly broke the dynamic config manager, which isn't enabled in OCP 4, in #51, someone noticed (and then graciously fixed it for us; see #107). However, I do not believe we are being capricious or careless in this case.

If it actually is a concern, you could leave "validateHAProxyWhiteList" as an entry in this template.FuncMap to maintain support for custom template. I think its okay to break custom templates though.

Yeah, it would be trivial to maintain backwards compatibility. It would be slightly more effort to add a "this helper is deprecated" log message.

Normally I would push back against any kind of breaking change. However, the goal here is specifically to remove the old names, we will document the change in a release note, and it is trivial to update one's custom template once one realizes it is necessary to do so (either from seeing the release note or from testing the custom template in the new .y release before deploying one's unsupported custom template to a production environment).

One more thing to consider is that we cannot really force a migration for unsupported config. At most we could start logging an error message in one release and then remove the helper entirely in a later release. However, the fact that the thing we are talking about here is a custom router deployment means that it isn't being managed by a version of cluster-ingress-operator that we maintain, so our operator cannot necessarily detect the problematic config in order to block an upgrade.

In light of all that, does it seem reasonable just to remove the helpers?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yea that sounds convincing enough, I just wanted to be sure. To reiterate:

  1. This change is different, we are specifically trying to change the function name here
  2. Custom templates are unsupported
  3. We'll do a release note
  4. We don't have a reasonable way to force a migration for these situations anyways

@gcs278

gcs278 commented Oct 17, 2024

Copy link
Copy Markdown
Contributor

It's a pretty straightforward PR. I've tested this PR a cluster just to be sure it works as expected. I have one question, but I don't think it's a concern.
/approve
/lgtm

@Miciah feel free to remove the hold when you are ready.
/hold

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 17, 2024
@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Oct 17, 2024
@openshift-ci

openshift-ci Bot commented Oct 17, 2024

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gcs278

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 17, 2024
@gcs278

gcs278 commented Oct 18, 2024

Copy link
Copy Markdown
Contributor

I'm okay with the PR as is, I have no other concerns.
/unhold

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 18, 2024
@openshift-merge-bot
openshift-merge-bot Bot merged commit d095bdb into openshift:master Oct 18, 2024
@openshift-bot

Copy link
Copy Markdown
Contributor

[ART PR BUILD NOTIFIER]

Distgit: ose-haproxy-router-base
This PR has been included in build ose-haproxy-router-base-container-v4.18.0-202410182140.p0.gd095bdb.assembly.stream.el9.
All builds following this will include this PR.

@openshift-bot

Copy link
Copy Markdown
Contributor

[ART PR BUILD NOTIFIER]

Distgit: openshift-enterprise-haproxy-router
This PR has been included in build openshift-enterprise-haproxy-router-container-v4.18.0-202410182140.p0.gd095bdb.assembly.stream.el9.
All builds following this will include this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants