The following example MachineConfiguration
objects contain a node disruption policy.
|
A MachineConfiguration object and a MachineConfig object are different objects. A MachineConfiguration object is a singleton object in the MCO namespace that contains configuration parameters for the MCO operator. A MachineConfig object defines changes that are applied to a machine config pool.
|
The following example MachineConfiguration
object shows no user defined policies. The default node disruption policy values are shown in the status
stanza.
Default node disruption policy
apiVersion: operator.openshift.io/v1
kind: MachineConfiguration
name: cluster
spec:
logLevel: Normal
managementState: Managed
operatorLogLevel: Normal
status:
nodeDisruptionPolicyStatus:
clusterPolicies:
files:
- actions:
- type: None
path: /etc/mco/internal-registry-pull-secret.json
- actions:
- type: None
path: /var/lib/kubelet/config.json
- actions:
- reload:
serviceName: crio.service
type: Reload
path: /etc/machine-config-daemon/no-reboot/containers-gpg.pub
- actions:
- reload:
serviceName: crio.service
type: Reload
path: /etc/containers/policy.json
- actions:
- type: Special
path: /etc/containers/registries.conf
sshkey:
actions:
- type: None
readyReplicas: 0
In the following example, when changes are made to the SSH keys, the MCO drains the cluster nodes, reloads the crio.service
, reloads the systemd configuration, and restarts the crio-service
.
Example node disruption policy for an SSH key change
apiVersion: operator.openshift.io/v1
kind: MachineConfiguration
metadata:
name: cluster
namespace: openshift-machine-config-operator
# ...
spec:
nodeDisruptionPolicy:
sshkey:
actions:
- type: Drain
- reload:
serviceName: crio.service
type: Reload
- type: DaemonReload
- restart:
serviceName: crio.service
type: Restart
# ...
In the following example, when changes are made to the /etc/chrony.conf
file, the MCO reloads the chronyd.service
on the cluster nodes.
Example node disruption policy for a configuration file change
apiVersion: operator.openshift.io/v1
kind: MachineConfiguration
metadata:
name: cluster
namespace: openshift-machine-config-operator
# ...
spec:
nodeDisruptionPolicy:
files:
- actions:
- reload:
serviceName: chronyd.service
type: Reload
path: /etc/chrony.conf
In the following example, when changes are made to the auditd.service
systemd unit, the MCO drains the cluster nodes, reloads the crio.service
, reloads the systemd manager configuration, and restarts the crio.service
.
Example node disruption policy for a systemd unit change
apiVersion: operator.openshift.io/v1
kind: MachineConfiguration
metadata:
name: cluster
namespace: openshift-machine-config-operator
# ...
spec:
nodeDisruptionPolicy:
units:
- name: auditd.service
actions:
- type: Drain
- type: Reload
reload:
serviceName: crio.service
- type: DaemonReload
- type: Restart
restart:
serviceName: crio.service
In the following example, when changes are made to the registries.conf
file, such as by editing an ImageContentSourcePolicy
(ICSP) object, the MCO does not drain or reboot the nodes and applies the changes with no further action.
Example node disruption policy for a registries.conf file change
apiVersion: operator.openshift.io/v1
kind: MachineConfiguration
metadata:
name: cluster
namespace: openshift-machine-config-operator
# ...
spec:
nodeDisruptionPolicy:
files:
- actions:
- type: None
path: /etc/containers/registries.conf