Skip to content

Add subject_alt_names field in ServiceEntry#785

Merged
wenchenglu merged 7 commits intorelease-1.1from
sa1
Feb 5, 2019
Merged

Add subject_alt_names field in ServiceEntry#785
wenchenglu merged 7 commits intorelease-1.1from
sa1

Conversation

@andraxylia
Copy link
Copy Markdown
Contributor

@andraxylia andraxylia commented Feb 4, 2019

As discussed in istio/istio#11293 (comment)

The subject_alt_names field in ServiceEntry contains the reunion of all SAs from all workloads that are backends for that Service. Each MCP source computes the reunion and sends it to Pilot. Pilot merges the service_accounts corresponding to that service from all MCP sources, and maps the result to subject_alt_names field in the Envoy CDS for that ServiceEntry.

cc @nmittler

@googlebot googlebot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Feb 4, 2019
// of namespace names.
repeated string export_to = 7;

// The reunion of service accounts associated with workloads
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.

It might be helpful to describe what exact form this should take. It came up in the meeting today and I suspect there will be confusion for folks going forward. Would be good to try to make it clear now.

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.

@smawson - For TOC FYI even though this is not a user-visible API change, it affects contract between Pilot and Galley or other service registries

This should be marked $hidden_from_docs for the moment.

For documentation

"The set of service accounts identities allowed for workloads that implement this service. This information is used to enforce secure-naming (link https://istio.io/docs/concepts/security/#secure-naming)"

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.

Done, added also an example with SA in SPIFEE format, ptal.

// serviceAccounts:
// - "spiffe://cluster.local/ns/httpbin-ns/sa/httpbin-service-account"
// ```
repeated string service_accounts = 8;
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.

Usual bike-shedding: service account is a k8s term.
We have the same setting in DestinationRule -> TLSSettings -> SubjectAltNames
The actual use is to indicate what SANs are exposed and/or should be expected by the endpoints.

Technically we can achieve the same by creating a synthetic DestinationRule, but it's getting too complicated.

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.

Makes sense to use the same nomenclature with existing, let me change it.

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.

I changed the name.

We need to clarify what is the behavior if the user also configures a DestinationRule for the same service, with a different list of subject_alt_names. Do we want to override or merge? Override may cause auth failures, so merge seems to make more sense. Thoughts?

@andraxylia andraxylia changed the title Add service_accounts field in ServiceEntry Add subject_alt_names field in ServiceEntry Feb 5, 2019
@costinm
Copy link
Copy Markdown
Contributor

costinm commented Feb 5, 2019 via email

// - address: 3.3.3.3
// subjectAltNames:
// - "spiffe://cluster.local/ns/httpbin-ns/sa/httpbin-service-account"
// ```
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You cannot add yamls and other stuff in the field docs. It will mess up the UI. Move this example and text to the area above message ServiceEntry. And keep the documentation here to a minimum, describing the intent of the field.

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.

Done, ptal.

@rshriram
Copy link
Copy Markdown
Member

rshriram commented Feb 5, 2019

while in general this is okay, its instructive to understand why the exact same change 6 months ago (2ba6be9) with the same intent (of syncing service model with service entry) was objected to, by messers @costinm and @louiscryan :).

@costinm
Copy link
Copy Markdown
Contributor

costinm commented Feb 5, 2019 via email

@andraxylia
Copy link
Copy Markdown
Contributor Author

Galley can create the subject_all_names by using the namespace of the service : "spiffe://cluster.local/ns/httpbin-ns/sa/httpbin-service-account".

The list of endpoints for that service can only belong in the same namespace as the service in k8s, otherwise the pods would not be selected.

Since ServiceEntries can come from other MCP sources than Galley, same restriction applies.

@incfly
Copy link
Copy Markdown

incfly commented Feb 5, 2019

The list of endpoints for that service can only belong in the same namespace as the service in k8s, otherwise the pods would not be selected.

+1

@andraxylia
Copy link
Copy Markdown
Contributor Author

/lgtm
/approve

@istio-testing
Copy link
Copy Markdown
Collaborator

@andraxylia: you cannot LGTM your own PR.

Details

In response to this:

/lgtm
/approve

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/test-infra repository.

@andraxylia andraxylia requested a review from wenchenglu February 5, 2019 20:34
Copy link
Copy Markdown
Contributor

@nmittler nmittler left a comment

Choose a reason for hiding this comment

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

/lgtm

@istio-testing
Copy link
Copy Markdown
Collaborator

@nmittler: changing LGTM is restricted to assignees, and only istio/api repo collaborators may be assigned issues.

Details

In response to this:

/lgtm

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/test-infra repository.

@ozevren
Copy link
Copy Markdown
Contributor

ozevren commented Feb 5, 2019

/lgtm

@istio-testing
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andraxylia, nmittler, ozevren

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

@ozevren
Copy link
Copy Markdown
Contributor

ozevren commented Feb 5, 2019

@wenchenglu This is needed for istio/istio#10589

@wenchenglu wenchenglu merged commit 3094619 into release-1.1 Feb 5, 2019
@andraxylia andraxylia deleted the sa1 branch February 5, 2019 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants