Skip to content

Commit

Permalink
Fix ocp-power-automation#26: deploy powervm-rmc daemonset during ocp-…
Browse files Browse the repository at this point in the history
…customization (ocp-power-automation#36)

Signed-off-by: Sebastien Chabrolles <[email protected]>
  • Loading branch information
schabrolles authored Aug 3, 2020
1 parent 22f8838 commit d9ed193
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 7 deletions.
1 change: 1 addition & 0 deletions playbooks/roles/ocp-customization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Role Variables
| workdir | no | ~/ocp4-workdir | Place for config generation and auth files |
| rhcos_kernel_options | no | [] | List of kernel options for RHCOS nodes eg: ["slub_max_order=0","loglevel=7"] |
| sysctl_tuned_options | no | false | Set to true to apply sysctl options via tuned operator |
| powervm_rmc | no | true | Set to true to deploy RMC daemonset on Node with arch ppc64le |


If `sysctl_tuned_options` is true then the following variables are must and should be set in [vars/tuned.yaml](./vars/tuned.yaml)
Expand Down
1 change: 1 addition & 0 deletions playbooks/roles/ocp-customization/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
workdir: ~/ocp4-workdir
rhcos_kernel_options: []
sysctl_tuned_options: false
powervm_rmc: true

48 changes: 41 additions & 7 deletions playbooks/roles/ocp-customization/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,44 @@
---
# tasks file for ocp4 post install customizations
- name: Install openshift python module
pip:
executable: pip3
name: openshift

- name: Configure RHCOS kernel options via MachineConfig
when: rhcos_kernel_options | length > 0
import_tasks: kernel.yaml
- name:
block:
- name: Pause reboot node (Machineconfig)
k8s:
merge_type: merge
kind: MachineConfigPool
name: "{{ item }}"
definition:
spec:
paused: true
loop:
- master
- worker

- name: Configure Kernel tunables (sysctl) via Tuned Operator
when: sysctl_tuned_options
import_tasks: tuned.yaml
- name: Configure RHCOS kernel options via MachineConfig
when: rhcos_kernel_options | length > 0
import_tasks: kernel.yaml

- name: Configure Kernel tunables (sysctl) via Tuned Operator
when: sysctl_tuned_options
import_tasks: tuned.yaml

- name: Configure PowerVM RMC daemonset
when: powervm_rmc
import_tasks: powervm_rmc.yaml

always:
- name: UnPause reboot node (Machineconfig)
k8s:
merge_type: merge
kind: MachineConfigPool
name: "{{ item }}"
definition:
spec:
paused: false
loop:
- master
- worker
79 changes: 79 additions & 0 deletions playbooks/roles/ocp-customization/tasks/powervm_rmc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
- name: Create powervm-rmc project
k8s:
name: powervm-rmc
api_version: project.openshift.io/v1
kind: Project
state: present

- name: Create powervm-rmc serviceaccount
k8s:
state: present
definition:
api_version: v1
kind: ServiceAccount
metadata:
name: powervm-rmc
namespace: powervm-rmc

- name: Add privileged scc to powervm-rmc serviceaccount
shell: "oc adm policy add-scc-to-user -z powervm-rmc privileged -n powervm-rmc"

- name: Deploy powervm-rmc DaemonSet
k8s:
state: present
definition:
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: powervm-rmc
namespace: powervm-rmc
spec:
selector:
matchLabels:
app: powervm-rmc
template:
metadata:
creationTimestamp: null
labels:
app: powervm-rmc
spec:
nodeSelector:
kubernetes.io/arch: ppc64le
node.openshift.io/os_id: rhcos
restartPolicy: Always
serviceAccountName: powervm-rmc
hostNetwork: true
containers:
- name: powervm-rmc
image: 'quay.io/powercloud/rsct-ppc64le:latest'
ports:
- name: rmc-tcp
hostPort: 657
containerPort: 657
protocol: TCP
- name: rmc-udp
hostPort: 657
containerPort: 657
protocol: UDP
resources:
requests:
cpu: 100m
memory: 500Mi
limits:
memory: 1Gi
volumeMounts:
- name: lib-modules
mountPath: /lib/modules
readOnly: true
securityContext:
privileged: true
runAsUser: 0
serviceAccount: powervm-rmc
volumes:
- name: lib-modules
hostPath:
path: /lib/modules
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule

0 comments on commit d9ed193

Please sign in to comment.