Skip to content

pilot: set istio.alpn_override: false in subset clusters #46496

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

Merged
merged 7 commits into from
Aug 12, 2023

Conversation

jewertow
Copy link
Member

@jewertow jewertow commented Aug 11, 2023

Please provide a description of this PR:

This is a follow-up to #44918.

That PR didn't cover a case where TLS policy is configured for a subset, like this:

apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
  name: originate-simple-tls
spec:
  host: app.default.svc.cluster.local
  subsets:
  - name: v1
    trafficPolicy:
      tls:
        mode: SIMPLE

Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>
Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>
Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>
Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>
@jewertow jewertow requested review from a team as code owners August 11, 2023 19:02
@jewertow jewertow requested a review from ksubrmnn August 11, 2023 19:02
@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 11, 2023
@jewertow jewertow added the cherrypick/release-1.19 Set this label on a PR to auto-merge it to the release-1.19 branch label Aug 11, 2023
@@ -395,9 +395,13 @@ func AddSubsetToMetadata(md *core.Metadata, subset string) {
}
}

// AddALPNOverrideToMetadata adds whether the the ALPN prefix should be added to the header
// to the given core.Metadata struct, if metadata is not initialized, build a new metadata.
func AddALPNOverrideToMetadata(metadata *core.Metadata, alpnOverride bool) *core.Metadata {
Copy link
Member Author

Choose a reason for hiding this comment

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

JFYI: alpn_override is always set to "false", and this is very unlikely that we will need to set "true", so I decided to refactor this function to simplify cluster builder.

@@ -218,6 +218,7 @@ func (cb *ClusterBuilder) buildSubsetCluster(opts buildClusterOpts,
// basis in buildCluster, so we can just insert without a copy.
subsetCluster.cluster.Metadata = util.AddConfigInfoMetadata(subsetCluster.cluster.Metadata, destRule.Meta)
util.AddSubsetToMetadata(subsetCluster.cluster.Metadata, subset.Name)
subsetCluster.cluster.Metadata = util.AddALPNOverrideToMetadata(subsetCluster.cluster.Metadata, opts.policy.GetTls().GetMode())
Copy link
Member Author

Choose a reason for hiding this comment

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

As you can see, util.AddSubsetToMetadata does not return metadata, it does not initialize metadata if it's nil. Do you think that we should follow that semantics?

Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>
Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>
Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>
@jewertow
Copy link
Member Author

/retest

2 similar comments
@jewertow
Copy link
Member Author

/retest

@jewertow
Copy link
Member Author

/retest

@istio-testing istio-testing merged commit e4c2b5a into istio:master Aug 12, 2023
@istio-testing
Copy link
Collaborator

In response to a cherrypick label: #46496 failed to apply on top of branch "release-1.19":

Applying: Add tests for destination rules with port level settings
Applying: Add test cases for subsets
Using index info to reconstruct a base tree...
M	pilot/pkg/networking/core/v1alpha3/cluster_builder.go
M	pilot/pkg/networking/core/v1alpha3/cluster_builder_test.go
Falling back to patching base and 3-way merge...
Auto-merging pilot/pkg/networking/core/v1alpha3/cluster_builder_test.go
Auto-merging pilot/pkg/networking/core/v1alpha3/cluster_builder.go
Applying: Refactor AddALPNOverrideToMetadata
Using index info to reconstruct a base tree...
M	pilot/pkg/networking/core/v1alpha3/cluster_builder.go
M	pilot/pkg/networking/core/v1alpha3/cluster_builder_test.go
M	pilot/pkg/networking/util/util.go
Falling back to patching base and 3-way merge...
Auto-merging pilot/pkg/networking/util/util.go
Auto-merging pilot/pkg/networking/core/v1alpha3/cluster_builder_test.go
Auto-merging pilot/pkg/networking/core/v1alpha3/cluster_builder.go
CONFLICT (content): Merge conflict in pilot/pkg/networking/core/v1alpha3/cluster_builder.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0003 Refactor AddALPNOverrideToMetadata
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

@istio-testing
Copy link
Collaborator

In response to a cherrypick label: new issue created for failed cherrypick: #46504

jewertow added a commit to jewertow/upstream-istio that referenced this pull request Aug 14, 2023
* Add tests for destination rules with port level settings

Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>

* Add test cases for subsets

Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>

* Refactor AddALPNOverrideToMetadata

Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>

* Update comment for AddALPNOverrideToMetadata

Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>

* Fix lint error

Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>

* Add release note

Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>

* Fix release note

Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>

---------

Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>
istio-testing pushed a commit that referenced this pull request Aug 15, 2023
…46529)

* Add tests for destination rules with port level settings



* Add test cases for subsets



* Refactor AddALPNOverrideToMetadata



* Update comment for AddALPNOverrideToMetadata



* Fix lint error



* Add release note



* Fix release note



---------

Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>
luksa pushed a commit to luksa/istio that referenced this pull request Apr 11, 2024
…e"` for SIMPLE and MUTUAL TLS (istio#833)

* Set alpnOverride depending on TLS Mode (istio#44918)

* Set alpnOverride

Signed-off-by: Kalya Subramanian <kasubra@microsoft.com>

* remove test logs

Signed-off-by: Kalya Subramanian <kasubra@microsoft.com>

---------

Signed-off-by: Kalya Subramanian <kasubra@microsoft.com>

* pilot: set `istio.alpn_override: false` in subset clusters (istio#46496) (istio#46529)

* Add tests for destination rules with port level settings

* Add test cases for subsets

* Refactor AddALPNOverrideToMetadata

* Update comment for AddALPNOverrideToMetadata

* Fix lint error

* Add release note

* Fix release note

---------

Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>

---------

Signed-off-by: Kalya Subramanian <kasubra@microsoft.com>
Signed-off-by: Jacek Ewertowski <jewertow@redhat.com>
Co-authored-by: Kalya Subramanian <42158129+ksubrmnn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking cherrypick/release-1.19 Set this label on a PR to auto-merge it to the release-1.19 branch size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants