Repository navigation
Description
I've been following https://github.com/openshift/training/blob/master/docs/05-infrastructure-nodes.md in an attempt to create "workers" with different roles for distruptive e2e tests. So, no matter anything, creating a new machineset always apply the "worker" role to a node, resulting in nodes having multi roles:
ip-6.us-west-2.compute.internal Ready infra,worker 9m44s v1.12.4+a532756e37
ip-.us-west-2.compute.internal Ready worker 120m v1.12.4+a532756e37
ip-.us-west-2.compute.internal NotReady,SchedulingDisabled infra,worker 45m v1.12.4+a532756e37
ip-.us-west-2.compute.internal Ready worker 54m v1.12.4+a532756e37
ip-.us-west-2.compute.internal Ready infra,worker 5m27s v1.12.4+a532756e37
ip-.us-west-2.compute.internal Ready worker 120m v1.12.4+a532756e37
ip-.us-west-2.compute.internal Ready worker 120m v1.12.4+a532756e37
ip-.us-west-2.compute.internal Ready master 135m v1.12.4+a532756e37
ip-.us-west-2.compute.internal Ready master 135m v1.12.4+a532756e37
ip-.us-west-2.compute.internal Ready master 135m v1.12.4+a532756e37
if you add a pool matching infra now (and you already have one matching worker) and give it an MC, it results in errors in the controller like:
E0214 13:55:36.896535 1 node_controller.go:195] error finding pools for node: node ip-10-0-143-182.us-west-2.compute.internal belongs to more than one MachineConfigPool, cannot proceed with this Node
Which is expected from the code but actually prevents multi labeled nodes from working correctly with MCPs and MCs.
This is probably not a bug (or maybe it is since multi labeled nodes are a thing). My point here is we still have to find a way to create nodes to degrade for testing in a cluster.
Activity
runcom commentedon Feb 15, 2019
I may have found another way to just have pure "infra" nodes but that requires a lot of messing (create secret for machine-api-opreator, copy and edit the -worker MC and so on and so forth). Scripting all of that in a test is also a pain and it would be just AWS which isn't perfect either...still not sure
cgwalters commentedon Mar 25, 2019
Generalizing a bit, using the term "custom role" to mean "not master,worker", I think the logic should be:
IOW, we just error out if there are multiple custom roles assigned to a node, and we also don't support custom masters. Sound good?
runcom commentedon Mar 25, 2019
it does yeah
runcom commentedon Jun 6, 2019
This is now possible with:
runcom commentedon Jun 6, 2019
not sure why I closed, close it if you think it's done (which I think)
yrobla commentedon Jul 23, 2019
So for my use case, it doesn't seem to be working. What i need is to have a machineconfigpool called worker-rt, that adds some specific extra configuration with new MachineConfigs(kernel update, tuning...) to the original worker. But i still need all the MachineConfig used in worker.
So i tried your suggestion, and i edited machineconfigpool/worker, i added
spec:
machineConfigSelector:
matchExpressions:
- {key: machineconfiguration.openshift.io/role, operator: In, values: [worker,worker-rt]}
And it just accepts it, but inmediately the value is overwritten by the operator, removing all the matchExpressions entry. So I continue having the same problem of heterogeneous workers, and i cannot use this solution.
vrutkovs commentedon Jul 23, 2019
Shouldn't be
worker-rtpool be modified instead to includeworkerMCs?runcom commentedon Jul 23, 2019
And it just accepts it, but inmediately the value is overwritten by the operator, removing all the matchExpressions entry. So I continue having the same problem of heterogeneous workers, and i cannot use this solution.
You shouldn't edit worker directly, that is MCO managed. Again, your use case is covered by using a custom machine Config pool called worker-rt which inherits from worker and adds more to it. Do not touch worker, you need a super class of worker so why editing worker, you need a new one
yrobla commentedon Aug 19, 2019
Hi Antonio
I tested this morning with 4.1.11 version, to pick latest code. This is what i have:
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
name: worker-rt
spec:
machineConfigSelector:
matchExpressions:
- {key: machineconfiguration.openshift.io/role, operator: In, values: [worker,worker-rt]}
maxUnavailable: null
nodeSelector:
matchLabels:
node-role.kubernetes.io/worker-ran: ""
paused: false
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: worker-rt
name: machine-config-worker-rt
spec:
config:
ignition:
version: 2.2.0
storage:
files:
-
contents:
source: data:text/plain;base64,IyEvYmluL2Jhc2gKc3Vic2NyaXB0aW9uLW1hbmFnZXIgcmVwb3MgLS1lbmFibGUgcmhlbC04LWZvci14ODZfNjQtcnQtcnBtcwp5dW0gZ3JvdXBpbnN0YWxsIC15IFJUCnRvdWNoIC9vcHQvcnRfZXhlY3V0ZWQKcmVib290
filesystem: root
mode: 0777
path: /opt/setup_rt.sh
systemd:
units:
-
contents: |
[Unit]
Description=One time service to install rt and tuned profile
After=network-online.target
ConditionPathExists=!/opt/rt_executed
[Service]
Type=oneshot
ExecStart=/opt/setup_rt.sh
[Install]
WantedBy=multi-user.target
enabled: true
name: install_realtime.service
The node is labelled with the 2 roles:
test-worker-0 Ready worker,worker-rt 14m v1.13.4+0cb23916f
This time i see that machineconfigpools are doing anything:
NAME CONFIG UPDATED UPDATING DEGRADED
master rendered-master-50eaff4021bdd2e6f2747a480e798043 True False False
worker rendered-worker-d237e500f27ba6490366ac6231264404 True False False
worker-rt rendered-worker-rt-9ae4c28ebf17bc662134bbb2416252f2 True False False
If i look at logs in machine config controller pod , i see that:
I0814 10:57:30.766188 1 container_runtime_config_controller.go:342] Dropping image config "openshift-config" out of the queue: could not Create/Update MachineConfig: could not generate origin ContainerRuntime Configs: generateMachineConfigsforRole failed with error failed to read dir "/etc/mcc/templates/worker-rt": open /etc/mcc/templates/worker-rt: no such file or directory
It's just iterating over it without any other activity. What can be happening, have i done anything wrong?
cgwalters commentedon Aug 19, 2019
I think CRC should now be using #763
runcom commentedon Aug 22, 2019
this is actually not an issue per-se, but the custom pools lack orignal templating for kubeletconfig and ctrcfg - I also think we should fix that somehow
yrobla commentedon Aug 26, 2019
Ok i did more testing there. Same config as before with worker/worker-rt machineconfigpools. Everything works fine, i see the extra config applied on my worker-rt (realtime kernel). Node reboots and picks the changes ok, machineconfigpool report success:
NAME CONFIG UPDATED UPDATING DEGRADED
master rendered-master-e27ad27cff45e220196e5c8158c73666 True False False
worker rendered-worker-36092785698f39dbf9ca571648ed91f7 True False False
worker-rt rendered-worker-rt-071336ae6a68ae34d8b783968f62f9dd True False False
But then, if you do a manual reboot (or any accidental power down/on), the worker machineconfigpool seems stuck at updating, ends degraded:
[root@vip installer]# oc get machineconfigpool
NAME CONFIG UPDATED UPDATING DEGRADED
master rendered-master-e27ad27cff45e220196e5c8158c73666 True False False
worker rendered-worker-36092785698f39dbf9ca571648ed91f7 False True False
worker-rt rendered-worker-rt-071336ae6a68ae34d8b783968f62f9dd True False False
That's the error i can see:
[root@vip installer]# oc describe machineconfigpool/worker
Name: worker
Namespace:
Labels:
Annotations:
API Version: machineconfiguration.openshift.io/v1
Kind: MachineConfigPool
Metadata:
Creation Timestamp: 2019-08-26T08:19:34Z
Generation: 2
Resource Version: 93101
Self Link: /apis/machineconfiguration.openshift.io/v1/machineconfigpools/worker
UID: 3c751a7c-c7da-11e9-a771-52540082683d
Spec:
Configuration:
Name: rendered-worker-36092785698f39dbf9ca571648ed91f7
Source:
API Version: machineconfiguration.openshift.io/v1
Kind: MachineConfig
Name: 00-worker
API Version: machineconfiguration.openshift.io/v1
Kind: MachineConfig
Name: 01-worker-container-runtime
API Version: machineconfiguration.openshift.io/v1
Kind: MachineConfig
Name: 01-worker-kubelet
API Version: machineconfiguration.openshift.io/v1
Kind: MachineConfig
Name: 99-worker-ssh
Machine Config Selector:
Match Labels:
machineconfiguration.openshift.io/role: worker
Max Unavailable:
Node Selector:
Match Labels:
node-role.kubernetes.io/worker:
Paused: false
Status:
Conditions:
Last Transition Time: 2019-08-26T08:32:34Z
Message:
Reason:
Status: False
Type: RenderDegraded
Last Transition Time: 2019-08-26T10:40:44Z
Message:
Reason:
Status: False
Type: NodeDegraded
Last Transition Time: 2019-08-26T10:40:44Z
Message:
Reason:
Status: False
Type: Degraded
Last Transition Time: 2019-08-26T13:23:27Z
Message:
Reason:
Status: False
Type: Updated
Last Transition Time: 2019-08-26T13:23:27Z
Message:
Reason: All nodes are updating to rendered-worker-36092785698f39dbf9ca571648ed91f7
Status: True
Type: Updating
I didn't update machineconfigpool/worker in any case, just added the worker-rt, with the 2 labels as shown in the configuration.