apiserver-network-proxy icon indicating copy to clipboard operation
apiserver-network-proxy copied to clipboard

Add file watcher for TLS certificate files

Open afritzler opened this issue 1 year ago • 10 comments

Currently the agent and server are not honouring the change of TLS certificates provided to them. This PR introduces a file watcher for both agent and server to restart the corresponding components in case there as been a change in the TLS certificates.

Changes

  • Add fsnotify dependency to go.mod
  • Add file watcher for certificate files in cmd/agent/app/server.go and cmd/server/app/server.go
  • Reload TLS config and credentials on certificate file change in cmd/agent/app/server.go and cmd/server/app/server.go
  • Refactor and clean up file watcher code in cmd/agent/app/server.go and cmd/server/app/server.go

afritzler avatar Jun 27 '23 07:06 afritzler

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: afritzler Once this PR has been reviewed and has the lgtm label, please assign jkh52 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 avatar Jun 27 '23 07:06 k8s-ci-robot

Welcome @afritzler!

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. :smiley:

k8s-ci-robot avatar Jun 27 '23 07:06 k8s-ci-robot

Hi @afritzler. 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.

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 avatar Jun 27 '23 07:06 k8s-ci-robot

/ok-to-test

jkh52 avatar Jun 30 '23 16:06 jkh52

Initial thoughts:

Some admins may want a security posture that disallows this, it could be better to opt-in to the new feature via flag (or at a minimum support an opt-out).

We need to make sure this doesn't make https://github.com/kubernetes-sigs/apiserver-network-proxy/issues/350 harder to implement (seems like it shouldn't).

It would be nice to see some unit test coverage.

jkh52 avatar Jun 30 '23 17:06 jkh52

/cc @tallclair

jkh52 avatar Jun 30 '23 17:06 jkh52

@jkh52 thanks a lot for the feedback. Let me address the point of disabling the rotation + adding some test coverage.

afritzler avatar Jul 04 '23 13:07 afritzler

PR needs rebase.

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 avatar Jul 29 '23 10:07 k8s-ci-robot

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jan 20 '24 18:01 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Feb 19 '24 18:02 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

k8s-triage-robot avatar Mar 20 '24 19:03 k8s-triage-robot

@k8s-triage-robot: Closed this PR.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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 avatar Mar 20 '24 19:03 k8s-ci-robot

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: afritzler / name: Andreas Fritzler (34f2fe7c93ef0bb0e2a06c6f990b73fb9a644937)

@afritzler - see the effort at https://github.com/kubernetes-sigs/apiserver-network-proxy/pull/577 (it would give you attribution, but 'EasyCLA check' does not pass. Can you fix that part?)

jkh52 avatar Mar 20 '24 19:03 jkh52

@afritzler: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-apiserver-network-proxy-docker-build-arm64-master 34f2fe7c93ef0bb0e2a06c6f990b73fb9a644937 link true /test pull-apiserver-network-proxy-docker-build-arm64-master
pull-apiserver-network-proxy-docker-build-amd64-master 34f2fe7c93ef0bb0e2a06c6f990b73fb9a644937 link true /test pull-apiserver-network-proxy-docker-build-amd64-master
pull-apiserver-network-proxy-make-lint-master 34f2fe7c93ef0bb0e2a06c6f990b73fb9a644937 link true /test pull-apiserver-network-proxy-make-lint-master
pull-apiserver-network-proxy-test-master 34f2fe7c93ef0bb0e2a06c6f990b73fb9a644937 link true /test pull-apiserver-network-proxy-test-master

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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 avatar Mar 20 '24 22:03 k8s-ci-robot

@afritzler - see the effort at #577 (it would give you attribution, but 'EasyCLA check' does not pass. Can you fix that part?)

Thanks a lot for the update. I fixed the CLA issue. I guess we can close this PR in favor of #577.

afritzler avatar Mar 20 '24 22:03 afritzler