Skip to content

Commit

Permalink
Add RHCOS kernel options before installation (#129)
Browse files Browse the repository at this point in the history
Signed-off-by: Aishwarya Kamat <aishwarya.kamat@ibm.com>
  • Loading branch information
aishwaryabk authored Sep 22, 2021
1 parent 46d3274 commit 467ffb6
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 18 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ workdir: <Directory to use for creating OCP configs>
storage_type: <Storage type used in the cluster. Eg: nfs (Note: Currently NFS provisioner is not configured using this playbook. This variable is only used for setting up image registry to EmptyDir if storage_type is not nfs)>
log_level: <Option --log-level in openshift-install commands. Default is 'info'>
release_image_override: '<This is set to OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE while creating ign files. If you are using internal artifactory then ensure that you have added auth key to the pull_secret>'
rhcos_pre_kernel_options: <List of day-1 kernel options for RHCOS nodes eg: ["rd.multipath=default","root=/dev/disk/by-label/dm-mpath-root"]>
rhcos_kernel_options: <List of kernel options for RHCOS nodes eg: ["slub_max_order=0","loglevel=7"]>
```

Expand Down
2 changes: 2 additions & 0 deletions examples/install_vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ release_image_override: ""

node_connection_timeout: 2700

rhcos_pre_kernel_options: []

rhcos_kernel_options: []

setup_squid_proxy: false
Expand Down
35 changes: 18 additions & 17 deletions playbooks/roles/ocp-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,24 @@ Requirements
Role Variables
--------------

| Variable | Required | Default | Comments |
|-------------------------|----------|----------------|---------------------------------------------|
| workdir | no | ~/ocp4-workdir | Place for config generation and auth files |
| log_level | no | info | Option --log-level in openshift-install cmd |
| release_image_override | no | "" | OCP image overide variable |
| master_count | yes | | Number of master nodes |
| worker_count | yes | | Number of worker nodes |
| setup_squid_proxy | no | false | Flag for setting up squid proxy server on bastion node |
| proxy_url | no | "" | Proxy url eg: http://[user:passwd@]server:port (NA when setup_squid_proxy: true)|
| no_proxy | no | "" | Comma seperated string of domains/cidr to exclude proxy |
| enable_local_registry | no | false | Set to true to enable usage of local registry for restricted network install |
| chronyconfig.enabled | no | true | Set to true to enable chrony configuration on the bastion node during installation. This also configure the bastion as a NTP server for the cluster. |
| chronyconfig.content | no | "" | List of time NTP servers and options pair (see chronyconfig examples). If empty, bastion will try sync with some default ntp server (internet) AND local HW clock (with higher stratum). |
| chronyconfig.allow | no | "" | List of network cidr (X.X.X.X/Y) allowed to sync with bastion configured as NTP server |
| dhcp_shared_network | no | | Flag to update DHCP server work on a shared network. (Neither ACK nor NACK unknown clients) |
| cni_network_provider | no | OpenshiftSDN | Sets the default Container Network Interface (CNI) network provider for the cluster |
| cni_network_mtu | no | | MTU value to assign to the CNI network. Recommended values for OpenshiftSDN: <NIC MTU> - 50; OVNKubernetes: <NIC MTU> - 100 |
| Variable | Required | Default | Comments |
|-----------------------------|----------|----------------|---------------------------------------------|
| workdir | no | ~/ocp4-workdir | Place for config generation and auth files |
| log_level | no | info | Option --log-level in openshift-install cmd |
| release_image_override | no | "" | OCP image overide variable |
| master_count | yes | | Number of master nodes |
| worker_count | yes | | Number of worker nodes |
| setup_squid_proxy | no | false | Flag for setting up squid proxy server on bastion node |
| proxy_url | no | "" | Proxy url eg: http://[user:passwd@]server:port (NA when setup_squid_proxy: true)|
| no_proxy | no | "" | Comma seperated string of domains/cidr to exclude proxy |
| enable_local_registry | no | false | Set to true to enable usage of local registry for restricted network install |
| chronyconfig.enabled | no | true | Set to true to enable chrony configuration on the bastion node during installation. This also configure the bastion as a NTP server for the cluster. |
| chronyconfig.content | no | "" | List of time NTP servers and options pair (see chronyconfig examples). If empty, bastion will try sync with some default ntp server (internet) AND local HW clock (with higher stratum). |
| chronyconfig.allow | no | "" | List of network cidr (X.X.X.X/Y) allowed to sync with bastion configured as NTP server |
| dhcp_shared_network | no | | Flag to update DHCP server work on a shared network. (Neither ACK nor NACK unknown clients) |
| cni_network_provider | no | OpenshiftSDN | Sets the default Container Network Interface (CNI) network provider for the cluster |
| cni_network_mtu | no | | MTU value to assign to the CNI network. Recommended values for OpenshiftSDN: <NIC MTU> - 50; OVNKubernetes: <NIC MTU> - 100 |
| rhcos_pre_kernel_options | no | [] | List of day-1 kernel options for RHCOS nodes eg: ["rd.multipath=default","root=/dev/disk/by-label/dm-mpath-root"] |

*chronyconfig variable example *

Expand Down
1 change: 1 addition & 0 deletions playbooks/roles/ocp-config/defaults/main/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# defaults file

workdir: ~/ocp4-workdir
rhcos_pre_kernel_options: []
log_level: info
release_image_override: ""
proxy_url: ""
Expand Down
6 changes: 5 additions & 1 deletion playbooks/roles/ocp-config/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@
src: ../templates/cluster-network-03-config.yml.j2
dest: "{{ workdir }}/manifests/cluster-network-03-config.yml"
when: cni_network_mtu is defined


- name: Configure RHCOS kernel options via MachineConfig before installation
when: rhcos_pre_kernel_options | length > 0
import_tasks: preinstall-kernel.yaml

- name: Remove the machine yaml files
file:
path: "{{ item }}"
Expand Down
9 changes: 9 additions & 0 deletions playbooks/roles/ocp-config/tasks/preinstall-kernel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- name: Create kernel arguments
vars:
role_n: '{{ item }}'
template:
src: preinstall-node-kargs.yaml.j2
dest: "{{ workdir }}/manifests/preinstall-{{ item }}-kargs.yaml"
with_items:
- master
- worker
11 changes: 11 additions & 0 deletions playbooks/roles/ocp-config/templates/preinstall-node-kargs.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: '{{ role_n }}'
name: 'preinstall-{{ role_n }}-kargs'
spec:
kernelArguments:
{% for option in rhcos_pre_kernel_options %}
- '{{ option }}'
{% endfor %}

0 comments on commit 467ffb6

Please sign in to comment.