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

🌱 Add metrics-viewer 'battery' #3024

Merged
merged 1 commit into from
Oct 18, 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
16 changes: 16 additions & 0 deletions config/root-phase0/metrics-cluster-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: metrics-viewer
namespace: default
annotations:
bootstrap.kcp.io/battery: metrics-viewer
subjects:
- kind: ServiceAccount
name: metrics
namespace: default
apiGroup: ""
roleRef:
kind: ClusterRole
name: metrics-viewer
apiGroup: ""
11 changes: 11 additions & 0 deletions config/root-phase0/metrics-cluster-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: metrics-viewer
annotations:
bootstrap.kcp.io/battery: metrics-viewer
rules:
- nonResourceURLs:
- '/metrics'
verbs:
- 'GET'
8 changes: 8 additions & 0 deletions config/root-phase0/metrics-service-account-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:
name: metrics
annotations:
kubernetes.io/service-account.name: metrics
bootstrap.kcp.io/battery: metrics-viewer
7 changes: 7 additions & 0 deletions config/root-phase0/metrics-service-account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: metrics
namespace: default
annotations:
bootstrap.kcp.io/battery: metrics-viewer
4 changes: 4 additions & 0 deletions pkg/server/options/batteries/batteries.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ const (

// User leads to an additional user named "user" in the admin.kubeconfig that is not admin.
User = "user"

// MetricsViewer leads to an additional service account named "metrics" in the root namespace that can view metrics.
MetricsViewer = "metrics-viewer"
)

var All = sets.New[string](
WorkspaceTypes,
User,
MetricsViewer,
)

var Defaults = sets.New[string](
Expand Down