I need to add several users to a new group template
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: group-devops-template
objects:
- apiVersion: user.openshift.io/v1
kind: Group
metadata:
name: ${GROUP_NAME}
users: ["${USER_NAMES}"] # <--- here the issue
#- user1
#- user2
#- user3
parameters:
- name: GROUP_NAME
description: Password used for Redis authentication
- name: USER_NAMES
description: user or users to add
The nightmare happens when I process the template with the values.
oc process -f grup_template3 -p GROUP_NAME=admin_devops -p USER_NAMES=["user1","user2","user3"] | oc create -f -
How to specify correctly the list of values: "user1","user2","user3"
oc get groups admin_devops -o yaml
apiVersion: user.openshift.io/v1
kind: Group
metadata:
name: admin_devops
users:
- user1
- user2
- user3
Any idea about how to achieve this?
Thank you for the help
Your users var should be written as ${{USER_NAMES}
and USER_NAMES
var should be formatted as a correct yaml. Here is working example:
template.yaml
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: group-devops-template
objects:
- apiVersion: user.openshift.io/v1
kind: Group
metadata:
name: ${GROUP_NAME}
users: ${{USER_NAMES}}
parameters:
- name: GROUP_NAME
description: Password used for Redis authentication
- name: USER_NAMES
description: user or users to add
command:
oc process -f template.yaml -p GROUP_NAME=admin_devops -p USER_NAMES='["user1","user2","user3"]' --local=true -o yaml
output:
apiVersion: v1
items:
- apiVersion: user.openshift.io/v1
kind: Group
metadata:
name: admin_devops
users:
- user1
- user2
- user3
kind: List
metadata: {}