-
My apologies in advance for the big thread. I am looking for a way to find a way of removing items from multiple lists and then add them back to the yaml. I understand this cannot be a one-line operation and may need a few lines of code. All I am looking to use I have two yaml files -
big-clusterrole---
# This is just an example role
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: big-clusterrole
rules:
- apiGroups:
- ""
resources:
- podtemplates
- replicationcontrollers
- resourcequotas
- secrets
- serviceaccounts
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps
- batch
resources:
- jobs
- cronjobs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- vpcresources.k8s.aws
resources:
- securitygrouppolicies
verbs:
- create
- delete
- deletecollection
- get
- list small-clusterrole (subset of the big-clusterrole)---
# This role is a subset of the big-clusterrole
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: small-clusterrole
rules:
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- batch
resources:
- jobs
verbs:
- create
- delete
- apiGroups:
- vpcresources.k8s.aws
resources:
- securitygrouppolicies
verbs:
- get
- list What I want is to do the below (as per my understanding) :)
intended-clusterrole---
# The resultant yaml will look something like this
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: intended-clusterrole
rules:
- apiGroups:
- ""
resources:
- podtemplates
- replicationcontrollers
- resourcequotas
- serviceaccounts
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps
resources:
- jobs
- cronjobs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- batch
resources:
- jobs
verbs:
- create
- delete
- apiGroups:
- vpcresources.k8s.aws
resources:
- securitygrouppolicies
verbs:
- get
- list |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @vikas027, Could I get a reduced example of what you'd like to happen here? It's a little hard to follow. |
Beta Was this translation helpful? Give feedback.
Hey @vikas027,
Could I get a reduced example of what you'd like to happen here? It's a little hard to follow.