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

allow multiple of --service-account-issuer #101155

Merged
merged 1 commit into from
Apr 19, 2021

Conversation

zshihang
Copy link
Contributor

@zshihang zshihang commented Apr 15, 2021

What type of PR is this?

/kind feature
/kind api-change

What this PR does / why we need it:

change the issuer in a non-disruptive way

Special notes for your reviewer:

Does this PR introduce a user-facing change?

-->

kube-apiserver: `--service-account-issuer` can be specified multiple times now, to enable non-disruptive change of issuer.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

- [KEP]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-auth/1205-bound-service-account-tokens

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 15, 2021
@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/auth Categorizes an issue or PR as relevant to SIG Auth. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 15, 2021
@k8s-ci-robot k8s-ci-robot added area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Apr 15, 2021
@zshihang
Copy link
Contributor Author

/assign @liggitt
/sig auth
/triage accepted
/priority important-soon

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 15, 2021
@@ -416,7 +416,7 @@ func CreateKubeAPIServerConfig(
pubKeys = append(pubKeys, keys...)
}
// Plumb the required metadata through ExtraConfig.
config.ExtraConfig.ServiceAccountIssuerURL = s.Authentication.ServiceAccounts.Issuer
config.ExtraConfig.ServiceAccountIssuerURL = s.Authentication.ServiceAccounts.Issuers[0]
Copy link
Member

Choose a reason for hiding this comment

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

are we guaranteed len(s.Authentication.ServiceAccounts.Issuers) > 0 here so this doesn't panic?

Copy link
Contributor Author

@zshihang zshihang Apr 15, 2021

Choose a reason for hiding this comment

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

it is guaranteed as long as the validation is called. in the integration tests, the test server doesn't provide those options and the validation is not called.

done. i added the validation logic in the test server initialization and the missing options.

Comment on lines 335 to 336
"This flag can be specified multiple times with different values but only the first one"+
"is used to generate tokens.")
Copy link
Member

Choose a reason for hiding this comment

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

clarify that when specified multiple times, the first is used to generate tokens and all are used to determine which issuers are accepted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@liggitt
Copy link
Member

liggitt commented Apr 15, 2021

looks like a fair number of panics in integration tests, a few questions/clarifications, lgtm otherwise

1 similar comment
@liggitt
Copy link
Member

liggitt commented Apr 15, 2021

looks like a fair number of panics in integration tests, a few questions/clarifications, lgtm otherwise

@fejta-bot
Copy link

This PR may require API review.

If so, when the changes are ready, complete the pre-review checklist and request an API review.

Status of requested reviews is tracked in the API Review project.

@liggitt
Copy link
Member

liggitt commented Apr 16, 2021

integration test failures look relevant

@zshihang zshihang force-pushed the bound branch 2 times, most recently from a4a1de7 to e137547 Compare April 16, 2021 19:08
@k8s-ci-robot k8s-ci-robot added the sig/node Categorizes an issue or PR as relevant to SIG Node. label Apr 16, 2021
@zshihang
Copy link
Contributor Author

/test pull-kubernetes-e2e-kind

@zshihang
Copy link
Contributor Author

/test pull-kubernetes-e2e-kind

@zshihang
Copy link
Contributor Author

/retest

@@ -159,6 +160,7 @@ var (
gvr("authorization.k8s.io", "v1beta1", "selfsubjectrulesreviews"): `{"metadata": {"name": "", "namespace":"` + testNamespace + `"}, "spec": {"namespace":"` + testNamespace + `"}}`,

// Other Non persistent resources
gvr("", "v1", "serviceaccounts/token"): `{"metadata": {"name": "sa1name"}, "spec": {"audience": ["api"]}}`,
Copy link
Member

Choose a reason for hiding this comment

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

this is probably better done as an addition to customTestFuncs (similar to something like testPodBindingEviction)... I don't think the subresource create implementation is likely to work well as a generic implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -70,12 +77,25 @@ func StartRealMasterOrDie(t *testing.T, configFuncs ...func(*options.ServerRunOp
t.Fatal(err)
}

saSigningKeyFile, err := ioutil.TempFile("/tmp", "key")
Copy link
Member

Choose a reason for hiding this comment

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

nit: name the file so it is clear it is a test key (insecure_test_key or something), since we're setting permission file permissions on it. applies to all the places we're persisting the test keys

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -53,6 +54,12 @@ import (
_ "k8s.io/kubernetes/pkg/controlplane"
)

const ecdsaPrivateKey = `-----BEGIN EC PRIVATE KEY-----
Copy link
Member

@liggitt liggitt Apr 19, 2021

Choose a reason for hiding this comment

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

Add a comment to all the places we're inlining private keys that they are for test purposes only and are not considered secure (This key is for testing purposes only and is not considered secure.). Applies to all the places you added test key data

We've had issues with people reporting keys in testdata as security vulnerabilities

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@liggitt
Copy link
Member

liggitt commented Apr 19, 2021

a few comments on tests and testdata, lgtm otherwise

@liggitt
Copy link
Member

liggitt commented Apr 19, 2021

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 19, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, zshihang

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

The pull request process is described here

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 19, 2021
@zshihang
Copy link
Contributor Author

/retest

3 similar comments
@zshihang
Copy link
Contributor Author

/retest

@zshihang
Copy link
Contributor Author

/retest

@zshihang
Copy link
Contributor Author

/retest

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. area/apiserver area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants