Skip to content

Commit

Permalink
sync labels from klusterlet to all agent resources
Browse files Browse the repository at this point in the history
Signed-off-by: Zhiwei Yin <zyin@redhat.com>
  • Loading branch information
zhiweiyin318 committed May 27, 2024
1 parent a148049 commit 19eca1e
Show file tree
Hide file tree
Showing 36 changed files with 278 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: appliedmanifestworks.work.open-cluster-management.io
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
spec:
group: work.open-cluster-management.io
names:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clusterclaims.cluster.open-cluster-management.io
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
spec:
group: cluster.open-cluster-management.io
names:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ kind: CustomResourceDefinition
metadata:
creationTimestamp: null
name: appliedmanifestworks.work.open-cluster-management.io
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
spec:
group: work.open-cluster-management.io
names:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: clusterclaims.cluster.open-cluster-management.io
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
spec:
group: cluster.open-cluster-management.io
names:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: open-cluster-management:{{ .KlusterletName }}-registration:addon-management
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
rules:
# Allow agent to get/list/watch/create/delete/update/patch secrets.
- apiGroups: [""]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: open-cluster-management:{{ .KlusterletName }}-registration:agent
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
rules:
# Allow agent to get/list/watch nodes
# list nodes to calculates the capacity and allocatable resources of the managed cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: open-cluster-management:{{ .KlusterletName }}-registration:addon-management
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: open-cluster-management:{{ .KlusterletName }}-registration:agent
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@ kind: ServiceAccount
metadata:
name: {{ .RegistrationServiceAccount }}
namespace: {{ .KlusterletNamespace }}
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
imagePullSecrets:
- name: open-cluster-management-image-pull-credentials
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ metadata:
name: open-cluster-management:{{ .KlusterletName }}-work:execution
labels:
open-cluster-management.io/aggregate-to-work: "true"
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
rules:
# Allow agent to get/list/watch/create/delete crds.
- apiGroups: ["apiextensions.k8s.io"]
Expand Down
8 changes: 8 additions & 0 deletions manifests/klusterlet/managed/klusterlet-work-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: open-cluster-management:{{ .KlusterletName }}-work:agent
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
rules:
# Allow agent to managed appliedmanifestworks
- apiGroups: ["work.open-cluster-management.io"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: open-cluster-management:{{ .KlusterletName }}-work:aggregate
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: open-cluster-management:{{ .KlusterletName }}-work:execution-admin
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: open-cluster-management:{{ .KlusterletName }}-work:execution
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: open-cluster-management:{{ .KlusterletName }}-work:agent
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@ kind: ServiceAccount
metadata:
name: {{ .WorkServiceAccount }}
namespace: {{ .KlusterletNamespace }}
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
imagePullSecrets:
- name: open-cluster-management-image-pull-credentials
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ metadata:
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
spec:
replicas: {{ .Replica }}
selector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: open-cluster-management:management:{{ .KlusterletName }}-registration:addon-management
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
rules:
# Allow agent to get/list/watch/create/delete/update/patch secrets, registration agent needs secret permission for an
# arbitrary namespace to create hub-kubeconfig secret for an addon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: open-cluster-management:management:{{ .KlusterletName }}-registration:addon-management
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ metadata:
labels:
app: klusterlet-registration-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
spec:
replicas: {{ .Replica }}
selector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ kind: Role
metadata:
name: open-cluster-management:management:{{ .KlusterletName }}-registration:agent
namespace: {{ .AgentNamespace }}
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
rules:
# leader election needs to operate configmaps and leases
- apiGroups: [""]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ kind: RoleBinding
metadata:
name: open-cluster-management:management:{{ .KlusterletName }}-registration:agent
namespace: kube-system
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ kind: RoleBinding
metadata:
name: open-cluster-management:management:{{ .KlusterletName }}-registration:agent
namespace: {{ .AgentNamespace }}
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@ kind: ServiceAccount
metadata:
name: {{ .RegistrationServiceAccount }}
namespace: {{ .AgentNamespace }}
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
imagePullSecrets:
- name: open-cluster-management-image-pull-credentials
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ kind: Role
metadata:
name: open-cluster-management:management:{{ .KlusterletName }}:extension-apiserver
namespace: kube-system
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
rules:
- apiGroups: [""]
resources: ["configmaps"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ metadata:
labels:
app: klusterlet-manifestwork-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
spec:
replicas: {{ .Replica }}
selector:
Expand Down
8 changes: 8 additions & 0 deletions manifests/klusterlet/management/klusterlet-work-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ kind: Role
metadata:
name: open-cluster-management:management:{{ .KlusterletName }}-work:agent
namespace: {{ .AgentNamespace }}
labels:
app: klusterlet-agent
createdBy: klusterlet
{{ if gt (len .Labels) 0 }}
{{ range $key, $value := .Labels }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
rules:
# leader election needs to operate configmaps and leases
- apiGroups: [""]
Expand Down
Loading

0 comments on commit 19eca1e

Please sign in to comment.