-
Notifications
You must be signed in to change notification settings - Fork 20
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
[feat] Remove kube-rbac-proxy to expose metrics and replace it with current best practice #556
Merged
Merged
Changes from 10 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
776f6ec
[feat] Remove kube-rbac-proxy to expose metrics and replace is with c…
komer3 3b986fb
go mod fix
komer3 a5d1e83
Disable http2 by default and update tiltfile
komer3 60c6da8
refactor main() to improve readability and maintainability
komer3 f99bb9b
lint fix for main.go
komer3 3802096
nilcheck fix
komer3 44fbecd
Switching to http for service monitor since we are by default support…
komer3 bcf4392
typo fix
komer3 d9ffe17
fix
komer3 43c6675
Merge branch 'main' into remove-kube-rbac-proxy
komer3 93b0c5f
Use strconv.ParseBool when parsing ENABLE_WEBHOOK env bool var
komer3 d5c57f1
Switch chainsaw to 0.2.11
komer3 1dd57d0
Revert
komer3 eb9d28d
fix?
komer3 8be4f2b
revert to not use strconv
komer3 d962595
Adding the strconv the right way :)
komer3 6d60c92
Remove output dir labels
komer3 77bb33c
Merge branch 'main' into remove-kube-rbac-proxy
komer3 f17e154
go.sum update
komer3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This patch adds the args to allow exposing the metrics endpoint using HTTPS | ||
- op: add | ||
path: /spec/template/spec/containers/0/args/0 | ||
value: --metrics-bind-address=:8443 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
control-plane: controller-manager | ||
app.kubernetes.io/name: output-dir | ||
app.kubernetes.io/managed-by: kustomize | ||
name: controller-manager-metrics-service | ||
namespace: system | ||
spec: | ||
ports: | ||
- name: https | ||
port: 8443 | ||
protocol: TCP | ||
targetPort: 8443 | ||
selector: | ||
control-plane: controller-manager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This NetworkPolicy allows ingress traffic | ||
# with Pods running on namespaces labeled with 'metrics: enabled'. Only Pods on those | ||
# namespaces are able to gathering data from the metrics endpoint. | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: output-dir | ||
app.kubernetes.io/managed-by: kustomize | ||
name: allow-metrics-traffic | ||
namespace: system | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
control-plane: controller-manager | ||
policyTypes: | ||
- Ingress | ||
ingress: | ||
# This allows ingress traffic from any namespace with the label metrics: enabled | ||
- from: | ||
- namespaceSelector: | ||
matchLabels: | ||
metrics: enabled # Only from namespaces with this label | ||
ports: | ||
- port: 8443 | ||
protocol: TCP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This NetworkPolicy allows ingress traffic to your webhook server running | ||
# as part of the controller-manager from specific namespaces and pods. CR(s) which uses webhooks | ||
# will only work when applied in namespaces labeled with 'webhook: enabled' | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: output-dir | ||
app.kubernetes.io/managed-by: kustomize | ||
name: allow-webhook-traffic | ||
namespace: system | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
control-plane: controller-manager | ||
policyTypes: | ||
- Ingress | ||
ingress: | ||
# This allows ingress traffic from any namespace with the label webhook: enabled | ||
- from: | ||
- namespaceSelector: | ||
matchLabels: | ||
webhook: enabled # Only from namespaces with this label | ||
ports: | ||
- port: 443 | ||
protocol: TCP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resources: | ||
- allow-webhook-traffic.yaml | ||
- allow-metrics-traffic.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: metrics-auth-role | ||
rules: | ||
- apiGroups: | ||
- authentication.k8s.io | ||
resources: | ||
- tokenreviews | ||
verbs: | ||
- create | ||
- apiGroups: | ||
- authorization.k8s.io | ||
resources: | ||
- subjectaccessreviews | ||
verbs: | ||
- create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: metrics-auth-rolebinding | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: metrics-auth-role | ||
subjects: | ||
- kind: ServiceAccount | ||
name: controller-manager | ||
namespace: system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: metrics-reader | ||
rules: | ||
- nonResourceURLs: | ||
- "/metrics" | ||
verbs: | ||
- get |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit pick: I wonder if we want to add a label as
app.kubernetes.io/name: output-dir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh good catch. Let me remove that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated!