Skip to content

Instantly share code, notes, and snippets.

@williamcaban
Last active December 6, 2020 00:40
Show Gist options
  • Select an option

  • Save williamcaban/cffdd76f7550c387ce87e193cb2de6fe to your computer and use it in GitHub Desktop.

Select an option

Save williamcaban/cffdd76f7550c387ce87e193cb2de6fe to your computer and use it in GitHub Desktop.
Custom MCP and MC
# To apply as additional role to the node
oc label node <your-node-name> machineconfiguration.openshift.io/role=my-role

# To replace the role of the node
oc label node <your-node-name> machineconfiguration.openshift.io/role=my-role --override
---
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: my-role
name: 50-my-role-files
spec:
config:
ignition:
config: {}
security:
tls: {}
timeouts: {}
version: 3.1.0
networkd: {}
passwd: {}
storage:
files:
- path: "/etc/foo/foo.conf"
filesystem: root
mode: 420
contents:
source: data:;base64,<BASE64_FOO.CONF>
- path: "/etc/foo/foo-other.conf"
filesystem: root
mode: 420
contents:
source: data:;base64,<BASE64_FOO-OTHER.CONF>
---
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: my-role
name: 50-my-role-kargs
spec:
kernelArguments:
#- nosmt
- something=other
- your_custom_karg=here
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
name: worker-bm
spec:
machineConfigSelector:
matchExpressions:
- {key: machineconfiguration.openshift.io/role, operator: In, values: [worker,my-role]}
nodeSelector:
matchLabels:
node-role.kubernetes.io/my-role: ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment