Skip to content

Commit

Permalink
Disable some RKE2 charts
Browse files Browse the repository at this point in the history
Disable the following RKE2 charts introduced in RKE2 v1.25.7:

- rke2-snapshot-controller
- rke2-snapshot-controller-crd
- rke2-snapshot-validation-webhook

These charts are managed as Harvester dependency charts. Thus we don't
want RKE2 to deploy them.

There are two situations  RKE2 might restart and load configuration files:
- A node is promoted.
- A node is upgraded from the previous version.

Add proper configuration files in these two cases.

Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
  • Loading branch information
bk201 authored and guangbochen committed Jun 1, 2023
1 parent aec02d9 commit 704921c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions deploy/charts/harvester/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ data:
audit-policy-file: /etc/rancher/rke2/config.yaml.d/92-harvester-kube-audit-policy.yaml
EOF
# Disable snapshot-controller related charts because we manage them in Harvester.
# RKE2 enables these charts by default after v1.25.7 (https://github.com/rancher/rke2/releases/tag/v1.25.7%2Brke2r1)
cat > /host/etc/rancher/rke2/config.yaml.d/40-disable-charts.yaml <<EOF
disable:
- rke2-snapshot-controller
- rke2-snapshot-controller-crd
- rke2-snapshot-validation-webhook
EOF
# For how to promote nodes, see: https://github.com/rancher/rancher/issues/36480#issuecomment-1039253499
ROLE_LABELS="rke.cattle.io/control-plane-role=true rke.cattle.io/etcd-role=true"
$KUBECTL label --overwrite -n fleet-local machines.cluster.x-k8s.io $CUSTOM_MACHINE $ROLE_LABELS
Expand Down
13 changes: 13 additions & 0 deletions package/upgrade/upgrade_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ command_pre_drain() {
patch_logging_event_audit

remove_rke2_canal_config
disable_rke2_charts
}

get_node_rke2_version() {
Expand Down Expand Up @@ -428,6 +429,17 @@ remove_rke2_canal_config() {
rm -f "$HOST_DIR/var/lib/rancher/rke2/server/manifests/rke2-canal-config.yaml"
}

# Disable snapshot-controller related charts because we manage them in Harvester.
# RKE2 enables these charts by default after v1.25.7 (https://github.com/rancher/rke2/releases/tag/v1.25.7%2Brke2r1)
disable_rke2_charts() {
cat > "$HOST_DIR/etc/rancher/rke2/config.yaml.d/40-disable-charts.yaml" <<EOF
disable:
- rke2-snapshot-controller
- rke2-snapshot-controller-crd
- rke2-snapshot-validation-webhook
EOF
}

convert_nodenetwork_to_vlanconfig() {
# sometimes (e.g. apiserver is busy/not ready), the kubectl may fail, use the saved value
if [ -z "$UPGRADE_PREVIOUS_VERSION" ]; then
Expand Down Expand Up @@ -587,6 +599,7 @@ command_single_node_upgrade() {
detect_repo

remove_rke2_canal_config
disable_rke2_charts

# Copy OS things, we need to shutdown repo VMs.
NEW_OS_SQUASHFS_IMAGE_FILE=$(mktemp -p $UPGRADE_TMP_DIR)
Expand Down

0 comments on commit 704921c

Please sign in to comment.