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

Add capability to use swap, requires Kube 1.22 #8241

Merged
Merged
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
5 changes: 5 additions & 0 deletions .gitlab-ci/packet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ packet_fedora34-calico-selinux:
extends: .packet_periodic
when: on_success

packet_fedora35-calico-swap-selinux:
stage: deploy-part2
extends: .packet_pr
when: manual

packet_amazon-linux-2-aio:
stage: deploy-part2
extends: .packet_pr
Expand Down
2 changes: 1 addition & 1 deletion docs/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ debian11 | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
debian9 | :x: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :x: | :x: |
fedora33 | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
fedora34 | :white_check_mark: | :x: | :x: | :x: | :white_check_mark: | :x: | :x: | :x: | :x: |
fedora35 | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :x: | :x: | :x: |
fedora35 | :white_check_mark: | :x: | :x: | :x: | :x: | :white_check_mark: | :x: | :x: | :x: |
opensuse | :x: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
oracle7 | :x: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
ubuntu16 | :x: | :white_check_mark: | :x: | :white_check_mark: | :x: | :white_check_mark: | :x: | :x: | :x: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,7 @@ eventRecordQPS: {{ kubelet_event_record_qps }}
shutdownGracePeriod: {{ kubelet_shutdown_grace_period }}
shutdownGracePeriodCriticalPods: {{ kubelet_shutdown_grace_period_critical_pods }}
{% endif %}
{% if not kubelet_fail_swap_on|default(true) %}
memorySwap:
swapBehavior: {{ kubelet_swap_behavior|default("LimitedSwap") }}
{% endif %}
10 changes: 8 additions & 2 deletions roles/kubernetes/preinstall/tasks/0010-swapoff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@
command: /sbin/swapon -s
register: swapon
changed_when: no

- name: Disable swap
command: /sbin/swapoff -a
when: swapon.stdout
when:
- swapon.stdout
- kubelet_fail_swap_on | default(True)
ignore_errors: "{{ ansible_check_mode }}" # noqa ignore-errors

- name: Disable swapOnZram for Fedora
command: touch /etc/systemd/zram-generator.conf
when: swapon.stdout and ansible_distribution in ['Fedora']
when:
- swapon.stdout
- ansible_distribution in ['Fedora']
- kubelet_fail_swap_on | default(True)
floryut marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 15 additions & 0 deletions tests/files/packet_fedora35-calico-swap-selinux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# Instance settings
cloud_image: fedora-35
mode: default

# Kubespray settings
auto_renew_certificates: true

# Test with SELinux in enforcing mode
preinstall_selinux_state: enforcing

# Test Alpha swap feature by leveraging zswap default config in Fedora 35
kubelet_fail_swap_on: False
kube_feature_gates:
- "NodeSwap=True"