Skip to content

Adding support for agent authenticate server by using kubeapi-server ca #47

Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:masterfrom
dberkov:auth
Jan 14, 2020
Merged

Adding support for agent authenticate server by using kubeapi-server ca #47
k8s-ci-robot merged 1 commit intokubernetes-sigs:masterfrom
dberkov:auth

Conversation

@dberkov
Copy link
Copy Markdown
Contributor

@dberkov dberkov commented Dec 18, 2019

The PR allows to reuse certificate generated for kubelet by proxy/agent/test-client, instead of generating dedicated set of certificates for proxy / agent / test-agent.

Server

Proxy-server runs as a static pod on master and initializes a grpc server with /etc/srv/kubernetes/pki/apiserver.crt & /etc/srv/kubernetes/pki/apiserver.key (no CA certificate)

Agent

Agent runs on node as a regular pod. It uses existing /var/run/secrets/kubernetes.io/serviceaccount/ca.crt (ca.crt bounds in every pod by k8s) to validate proxy-server's certificate returns during tls handshake.

Test-Clinet

As part of the tests, test-client runs on master VM as a static pod and communicates with proxy-server via UDS.

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


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/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Dec 18, 2019
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Welcome @dberkov!

It looks like this is your first PR to kubernetes-sigs/apiserver-network-proxy 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/apiserver-network-proxy has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @dberkov. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 18, 2019
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 18, 2019
@caesarxuchao
Copy link
Copy Markdown

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 18, 2019
@caesarxuchao
Copy link
Copy Markdown

cc @cheftako @Jefftree

@dberkov
Copy link
Copy Markdown
Contributor Author

dberkov commented Dec 18, 2019

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.

CLA signature completed

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Dec 18, 2019
@dberkov dberkov force-pushed the auth branch 2 times, most recently from 080653c to a669644 Compare December 28, 2019 00:26
@caesarxuchao
Copy link
Copy Markdown

/assign

Copy link
Copy Markdown

@caesarxuchao caesarxuchao left a comment

Choose a reason for hiding this comment

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

Dima, can you move the code refactor into another PR?

If I understand correctly, with this PR, only the proxy agent validates the identity of the proxy server, but not the other way. Will there be follow-up PRs that implement the other direction of verification?

I haven't reviewed the test changes.

@dberkov
Copy link
Copy Markdown
Contributor Author

dberkov commented Jan 6, 2020

Dima,
[1] can you move the code refactor into another PR?

[2] If I understand correctly, with this PR, only the proxy agent validates the identity of the proxy server, but not the other way. Will there be follow-up PRs that implement the other direction of verification?

[3] I haven't reviewed the test changes.

[1] - renaming udsName has been undo
[2] - yes. This PR covers the flow when agent validates proxy's identity. The opposite direction will be in separate PR.

${DOCKER_CMD} manifest push --purge $(SERVER_FULL_IMAGE):$(TAG)

.PHONY: docker-push-manifest/proxy-test-client
docker-push-manifest/proxy-test-client: ## Push the fat manifest docker image.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I know it's copied from somewhere, but what does "fat manifest" mean?

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.

https://developer.ibm.com/linuxonpower/2017/07/27/create-multi-architecture-docker-image/ suggest a "fat manifest" is a mutli-architecture manifest.

@caesarxuchao
Copy link
Copy Markdown

Thank you @dberkov. The refactor looks good. I have some comments on the details.

Copy link
Copy Markdown

@caesarxuchao caesarxuchao left a comment

Choose a reason for hiding this comment

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

/lgtm

timeoutSeconds: 15
resources:
limits:
cpu: 50m
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

is this accurate?

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.

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.

A very good question. Its sufficient for the server to come up. It will be interesting to see if its sufficient to proxy something like a cluster with high admission webhook load.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 10, 2020
@caesarxuchao
Copy link
Copy Markdown

Can you squash the commits? At least the "Do not make unnecessary call to kubeapi-server to pull certificates" commit is redundant.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 10, 2020
@dberkov dberkov changed the title Add support for authentication via kube-api-server Adding support for agent authenticate server by using kubeapi-server ca Jan 11, 2020
@Jefftree
Copy link
Copy Markdown
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 11, 2020
@caesarxuchao
Copy link
Copy Markdown

/lgtm

flags.IntVar(&o.requestPort, "request-port", o.requestPort, "The port the request server is listening on.")
flags.StringVar(&o.proxyHost, "proxy-host", o.proxyHost, "The host of the proxy server.")
flags.IntVar(&o.proxyPort, "proxy-port", o.proxyPort, "The port the proxy server is listening on.")
flags.StringVar(&o.proxyUdsName, "proxy-uds", o.proxyHost, "The UDS name to connect to.")
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.

Good catch

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 14, 2020
Copy link
Copy Markdown
Contributor

@cheftako cheftako left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 14, 2020
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 14, 2020
@dberkov
Copy link
Copy Markdown
Contributor Author

dberkov commented Jan 14, 2020

/assign @cheftako

@Jefftree
Copy link
Copy Markdown
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 14, 2020
@cheftako
Copy link
Copy Markdown
Contributor

/approve

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cheftako, dberkov

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 14, 2020
@k8s-ci-robot k8s-ci-robot merged commit b03c198 into kubernetes-sigs:master Jan 14, 2020
River-sh pushed a commit to River-sh/apiserver-network-proxy that referenced this pull request Sep 22, 2023
…odules/github.com/stretchr/testify-1.7.3

Build(deps): bump github.com/stretchr/testify from 1.7.2 to 1.7.3
csrwng pushed a commit to csrwng/apiserver-network-proxy that referenced this pull request Feb 20, 2024
…ncy-openshift-4.16-ose-apiserver-network-proxy

OCPBUGS-27932: Updating ose-apiserver-network-proxy-container image to be consistent with ART for 4.16
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

6 participants