Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-4.16] Enable swap on the node #924

Open
wants to merge 1 commit into
base: release-4.16
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions 99-kubelet-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: machineconfiguration.openshift.io/v1
kind: KubeletConfig
metadata:
name: swap-config
spec:
machineConfigPoolSelector:
matchLabels:
pools.operator.machineconfiguration.openshift.io/master: ""
kubeletConfig:
failSwapOn: false
memorySwap:
swapBehavior: UnlimitedSwap
12 changes: 12 additions & 0 deletions 99-openshift-machineconfig-master-swap-count.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: master
name: 99-kernel-swapcount-arg
spec:
config:
ignition:
version: 3.4.0
kernelArguments:
- swapaccount=1
44 changes: 44 additions & 0 deletions 99-openshift-machineconfig-master-swap-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: master
name: 99-openshift-machineconfig-master-swap-service
spec:
config:
ignition:
version: 3.4.0
systemd:
units:
- contents: |
[Unit]
Description=Create 4GB swap partition
Before=var-crc-swapfile1.swap

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/mkdir -p /var/crc
ExecStart=/usr/bin/fallocate -l 4096m /var/crc/swapfile1
ExecStart=/usr/bin/chmod 600 /var/crc/swapfile1
ExecStart=/usr/sbin/mkswap /var/crc/swapfile1

[Install]
WantedBy=multi-user.target
enabled: false
name: swap-partition.service
- contents: |
[Unit]
Description=Turn on the swap

[Swap]
What=/var/crc/swapfile1

[Install]
WantedBy=multi-user.target
enabled: false
name: var-crc-swapfile1.swap
networkd: {}
passwd: {}
storage: {}
osImageURL: ""
12 changes: 12 additions & 0 deletions 99_feature-gate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: config.openshift.io/v1
kind: FeatureGate
metadata:
name: cluster
spec:
customNoUpgrade:
enabled:
- NodeSwap
- BuildCSIVolumes
featureSet: CustomNoUpgrade
status:
featureGates: null
3 changes: 3 additions & 0 deletions createdisk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ if [ ${BUNDLE_TYPE} != "microshift" ]; then

# Stop the kubelet service so it will not reprovision the pods
${SSH} core@${VM_IP} -- sudo systemctl stop kubelet
# Enable swap partition and swap service
${SSH} core@${VM_IP} -- sudo systemctl enable swap-partition.service
${SSH} core@${VM_IP} -- sudo systemctl enable var-crc-swapfile1.swap
fi

# Enable the system and user level podman.socket service for API V2
Expand Down
7 changes: 6 additions & 1 deletion snc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ INSTALL_DIR=crc-tmp-install-data
SNC_PRODUCT_NAME=${SNC_PRODUCT_NAME:-crc}
SNC_CLUSTER_MEMORY=${SNC_CLUSTER_MEMORY:-14336}
SNC_CLUSTER_CPUS=${SNC_CLUSTER_CPUS:-6}
CRC_VM_DISK_SIZE=${CRC_VM_DISK_SIZE:-31}
CRC_VM_DISK_SIZE=${CRC_VM_DISK_SIZE:-35}
BASE_DOMAIN=${CRC_BASE_DOMAIN:-testing}
CRC_PV_DIR="/mnt/pv-data"
SSH="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i id_ecdsa_crc"
Expand Down Expand Up @@ -147,6 +147,11 @@ cp cluster-network-03-config.yaml ${INSTALL_DIR}/manifests/
cp 99_master-chronyd-mask.yaml $INSTALL_DIR/openshift/
# Add dummy network unit file
cp 99-openshift-machineconfig-master-dummy-networks.yaml $INSTALL_DIR/openshift/
cp 99-openshift-machineconfig-master-swap-count.yaml $INSTALL_DIR/openshift/
cp 99-openshift-machineconfig-master-swap-service.yaml $INSTALL_DIR/openshift/
cp 99-kubelet-config.yaml $INSTALL_DIR/openshift/
cp 99_feature-gate.yaml $INSTALL_DIR/openshift/

# Add kubelet config resource to make change in kubelet
DYNAMIC_DATA=$(base64 -w0 node-sizing-enabled.env) envsubst < 99_master-node-sizing-enabled-env.yaml.in > $INSTALL_DIR/openshift/99_master-node-sizing-enabled-env.yaml
# Add codeReadyContainer as invoker to identify it with telemeter
Expand Down