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

disable injecting unnecessary variables allowing access to k8s API #1591

Merged

Conversation

paulfantom
Copy link
Member

@paulfantom paulfantom commented Jan 21, 2022

Description

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.
If it fixes a bug or resolves a feature request, be sure to link to that issue.

This will explicitly specify which applications need SA token and which do not need it.

Due to how prometheus server is managed, this PR requires prometheus-operator/prometheus-operator#4514 to be merged first.

This is a part of #1589

Type of change

What type of changes does your code introduce to the kube-prometheus? Put an x in the box that apply.

  • CHANGE (fix or feature that would cause existing functionality to not work as expected)
  • FEATURE (non-breaking change which adds functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • NONE (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

Changelog entry

Please put a one-line changelog entry below. Later this will be copied to the changelog file.

Specify SA token automounting on pod-level where necessary

@@ -98,6 +98,7 @@ function(params) {
apiVersion: 'v1',
kind: 'ServiceAccount',
metadata: p._metadata,
automountServiceAccountToken: false,
Copy link
Member Author

Choose a reason for hiding this comment

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

This part can be treated as a breaking change for folks who are using prometheus-operator in versions that do not have change from prometheus-operator/prometheus-operator#4514. Do you think we should wait with this until we have a new operator version and then circle back?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes sounds good

Copy link
Member

Choose a reason for hiding this comment

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

Just out of curiosity, what is the next release date?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yesterday 😄

@paulfantom paulfantom marked this pull request as draft January 21, 2022 13:52
@paulfantom paulfantom force-pushed the automountServiceAccountToken branch from 7f58166 to 2d077a0 Compare January 31, 2022 18:40
@paulfantom
Copy link
Member Author

rebased

@paulfantom paulfantom force-pushed the automountServiceAccountToken branch 5 times, most recently from b9c3de4 to 648a675 Compare February 4, 2022 12:40
@paulfantom paulfantom force-pushed the automountServiceAccountToken branch from 648a675 to 8cb6979 Compare February 4, 2022 13:10
@paulfantom paulfantom marked this pull request as ready for review February 4, 2022 13:17
Copy link
Contributor

@philipgough philipgough left a comment

Choose a reason for hiding this comment

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

lgtm

Aside, if we had some way of generating certs and configure scraping over TLS or mTLS would it be wise to remove (optionally) kube-rbac-proxy or are there some other considerations to be had?

Copy link
Member

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

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

Nice, thanks for taking care of this one!

@ArthurSens ArthurSens merged commit db61b3e into prometheus-operator:main Feb 5, 2022
bfritz added a commit to bfritz/homelab-apps that referenced this pull request Feb 7, 2022
After the kube-prometheus upgrade in #65, Grafana broke because the
k8s-sidecar container that loads custom dashboards needs access to
the service account token.  That access was removed in
prometheus-operator/kube-prometheus#1591 .

A quick search did not turn up a simple way to only mount the token in
one of the pod's containers (`k8s-sidecar`, not `grafana`), so we're
mounting it for all containers in the pod instead.  Might be possible to
tighten this up further.
bors bot added a commit to bfritz/homelab-apps that referenced this pull request Feb 7, 2022
66: monitoring: mount service account token for grafana dashboard sidecar r=bfritz a=bfritz

After the kube-prometheus upgrade in #65, Grafana broke because the k8s-sidecar container that loads custom dashboards needs access to the service account token.  That access was removed in prometheus-operator/kube-prometheus#1591 .

A quick search did not turn up a simple way to only mount the token in one of the pod's containers (`k8s-sidecar`, not `grafana`), so we're mounting it for all containers in the pod instead.  Might be possible to tighten this up further.

Co-authored-by: Brad Fritz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants