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

Backport of Ignore partition/namespace on SourceIntention list to match top-level compare logic into release/1.0.x #1807

Conversation

hc-github-team-consul-ecosystem
Copy link
Contributor

Backport

This PR is auto-generated from #1804 to be assessed for backporting due to the inclusion of the label backport/1.0.x.

The below text is copied from the body of the original PR.


This PR updates the logic in MatchesConsul for intentions to add partition/namespace to the list of ignored fields for the SourceIntention list to match the ignored fields on the top-level config entry struct. This is to fix an issue where upgrading from Consul pre-1.12 to 1.12+ can trigger an update of all config entries due to the partition/namespace fields in the SourceIntentions from Consul being filled in as "default" instead of "".

Here's what the entry coming from consul 1.12+ looks like:

{
  "Kind": "service-intentions",
  "Name": "*",
  "Partition": "default",
  "Namespace": "default",
  "Sources": [
    {
      "Name": "foo",
      "Partition": "default",
      "Namespace": "default",
      "Action": "allow",
      ...
    }
  ],
  ...
}

And this is what consul-k8s generates via the ToConsul function:

{
  "Kind": "service-intentions",
  "Name": "*",
  "Sources": [
    {
      "Name": "foo",
      "Action": "allow",
      ...
    }
  ],
  ...
}

How I've tested this PR:
Created a consul 1.11.1+ent cluster alongside consul-k8s with a couple basic service intention config entries, then upgraded to 1.12.3+ent. Without this change there's an update to each intention because of the diff/MatchesConsul returns false.

How I expect reviewers to test this PR:

Checklist:

  • Tests added
  • CHANGELOG entry added

Overview of commits

@hc-github-team-consul-ecosystem hc-github-team-consul-ecosystem force-pushed the backport/kyhavlov/diff-intention-sources/terribly-proud-unicorn branch from 8b3ee24 to 79e5a71 Compare December 19, 2022 23:41
@hc-github-team-consul-ecosystem hc-github-team-consul-ecosystem merged commit 00fe528 into release/1.0.x Dec 19, 2022
@hc-github-team-consul-ecosystem hc-github-team-consul-ecosystem deleted the backport/kyhavlov/diff-intention-sources/terribly-proud-unicorn branch December 19, 2022 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants