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

fix: non-namespaced resources incorrectly have namespace #2158

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ function(params) {
clusterRoleBinding: {
apiVersion: 'rbac.authorization.k8s.io/v1',
kind: 'ClusterRoleBinding',
metadata: bb._metadata,
metadata: {
name: 'blackbox-exporter',
labels: bb._config.commonLabels,
},
roleRef: {
apiGroup: 'rbac.authorization.k8s.io',
kind: 'ClusterRole',
Expand Down
10 changes: 8 additions & 2 deletions jsonnet/kube-prometheus/components/node-exporter.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ function(params) {
clusterRoleBinding: {
apiVersion: 'rbac.authorization.k8s.io/v1',
kind: 'ClusterRoleBinding',
metadata: ne._metadata,
metadata: {
name: ne._config.name,
labels: ne._config.commonLabels,
},
roleRef: {
apiGroup: 'rbac.authorization.k8s.io',
kind: 'ClusterRole',
Expand All @@ -108,7 +111,10 @@ function(params) {
clusterRole: {
apiVersion: 'rbac.authorization.k8s.io/v1',
kind: 'ClusterRole',
metadata: ne._metadata,
metadata: {
name: ne._config.name,
labels: ne._config.commonLabels,
},
rules: [
{
apiGroups: ['authentication.k8s.io'],
Expand Down
15 changes: 10 additions & 5 deletions jsonnet/kube-prometheus/components/prometheus-adapter.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ function(params) {
labels: pa._config.commonLabels,
},

_metadata_no_ns:: {
name: pa._config.name,
labels: pa._config.commonLabels,
},

apiService: {
apiVersion: 'apiregistration.k8s.io/v1',
kind: 'APIService',
Expand Down Expand Up @@ -322,7 +327,7 @@ function(params) {
clusterRole: {
apiVersion: 'rbac.authorization.k8s.io/v1',
kind: 'ClusterRole',
metadata: pa._metadata,
metadata: pa._metadata_no_ns,
rules: [{
apiGroups: [''],
resources: ['nodes', 'namespaces', 'pods', 'services'],
Expand All @@ -333,7 +338,7 @@ function(params) {
clusterRoleBinding: {
apiVersion: 'rbac.authorization.k8s.io/v1',
kind: 'ClusterRoleBinding',
metadata: pa._metadata,
metadata: pa._metadata_no_ns,
roleRef: {
apiGroup: 'rbac.authorization.k8s.io',
kind: 'ClusterRole',
Expand All @@ -349,7 +354,7 @@ function(params) {
clusterRoleBindingDelegator: {
apiVersion: 'rbac.authorization.k8s.io/v1',
kind: 'ClusterRoleBinding',
metadata: pa._metadata {
metadata: pa._metadata_no_ns {
name: 'resource-metrics:system:auth-delegator',
},
roleRef: {
Expand All @@ -367,7 +372,7 @@ function(params) {
clusterRoleServerResources: {
apiVersion: 'rbac.authorization.k8s.io/v1',
kind: 'ClusterRole',
metadata: pa._metadata {
metadata: pa._metadata_no_ns {
name: 'resource-metrics-server-resources',
},
rules: [{
Expand All @@ -380,7 +385,7 @@ function(params) {
clusterRoleAggregatedMetricsReader: {
apiVersion: 'rbac.authorization.k8s.io/v1',
kind: 'ClusterRole',
metadata: pa._metadata {
metadata: pa._metadata_no_ns {
name: 'system:aggregated-metrics-reader',
labels+: {
'rbac.authorization.k8s.io/aggregate-to-admin': 'true',
Expand Down
1 change: 0 additions & 1 deletion manifests/blackboxExporter-clusterRoleBinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.24.0
name: blackbox-exporter
namespace: monitoring
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
1 change: 0 additions & 1 deletion manifests/nodeExporter-clusterRole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 1.6.0
name: node-exporter
namespace: monitoring
rules:
- apiGroups:
- authentication.k8s.io
Expand Down
1 change: 0 additions & 1 deletion manifests/nodeExporter-clusterRoleBinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 1.6.0
name: node-exporter
namespace: monitoring
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
1 change: 0 additions & 1 deletion manifests/prometheusAdapter-clusterRole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.10.0
name: prometheus-adapter
namespace: monitoring
rules:
- apiGroups:
- ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ metadata:
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rbac.authorization.k8s.io/aggregate-to-view: "true"
name: system:aggregated-metrics-reader
namespace: monitoring
rules:
- apiGroups:
- metrics.k8s.io
Expand Down
1 change: 0 additions & 1 deletion manifests/prometheusAdapter-clusterRoleBinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.10.0
name: prometheus-adapter
namespace: monitoring
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.10.0
name: resource-metrics:system:auth-delegator
namespace: monitoring
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.10.0
name: resource-metrics-server-resources
namespace: monitoring
rules:
- apiGroups:
- metrics.k8s.io
Expand Down