Skip to content

Commit 8f02ff1

Browse files
committed
Merge remote-tracking branch 'origin/main' into laverya/sc-100503/cleanup-outdated-helm-chart-files
2 parents e17d129 + ca051f0 commit 8f02ff1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1776
-335
lines changed

.github/actions/e2e/action.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ inputs:
77
airgap-license-id:
88
description: 'airgap-enabled license id to use for e2e tests'
99
required: true
10+
snapshot-license-id:
11+
description: 'snapshot-enabled license id to use for e2e tests'
12+
required: true
1013
license-id:
1114
description: 'license id to use for e2e tests'
1215
required: true
@@ -23,6 +26,12 @@ inputs:
2326
runs:
2427
using: composite
2528
steps:
29+
- name: Remove MS repo
30+
shell: bash
31+
run: |
32+
apt-add-repository --list
33+
sudo apt-add-repository -y -r deb [arch=amd64,arm64,armhf] https://packages.microsoft.com/ubuntu/22.04/prod jammy main
34+
apt-add-repository --list
2635
- name: Move Docker aside
2736
shell: bash
2837
run: |
@@ -51,13 +60,23 @@ runs:
5160
sudo rm -rf /usr/local/lib/android
5261
sudo rm -rf /opt/hostedtoolcache/CodeQL
5362
sudo rm -rf /opt/hostedtoolcache/Python
63+
- name: Set AppArmor mode to complain
64+
shell: bash
65+
run: |
66+
sudo apt-get update -y
67+
sudo apt install apparmor-utils -y
68+
sudo aa-complain /etc/apparmor.d/*
5469
- name: E2E
5570
shell: bash
5671
run: |
5772
export SHORT_SHA=dev-$(git rev-parse --short=7 HEAD)
5873
export LICENSE_ID=${{ inputs.license-id }}
5974
export AIRGAP_LICENSE_ID=${{ inputs.airgap-license-id }}
75+
export SNAPSHOT_LICENSE_ID=${{ inputs.snapshot-license-id }}
6076
echo "${{ inputs.license }}" | base64 --decode > e2e/license.yaml
6177
export TESTIM_ACCESS_TOKEN=${{ inputs.testim-access-token }}
6278
export TESTIM_BRANCH=${{ inputs.testim-branch }}
6379
make e2e-test TEST_NAME=${{ inputs.test-name }}
80+
# - name: Setup upterm session (ssh)
81+
# uses: lhotari/action-upterm@v1
82+
# if: always()

.github/workflows/dependencies.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ jobs:
4747
run: |
4848
export VERSION=`curl https://api.github.com/repos/distribution/distribution/tags | jq -r '.[].name' | tr -d v | grep -v alpha | grep -v beta | head -n 1`
4949
sed -i "/^REGISTRY_IMAGE_VERSION/c\REGISTRY_IMAGE_VERSION = $VERSION" Makefile
50+
- name: Velero Chart
51+
run: |
52+
export VERSION=`curl https://api.github.com/repos/vmware-tanzu/helm-charts/tags | jq -r '.[].name' | grep velero | tr -d 'velero-' | head -n 1`
53+
sed -i "/^VELERO_CHART_VERSION/c\VELERO_CHART_VERSION = $VERSION" Makefile
54+
- name: Velero Image
55+
run: |
56+
export VERSION=`curl https://api.github.com/repos/vmware-tanzu/velero/tags | jq -r '.[].name' | grep -v 'rc' | head -n 1`
57+
sed -i "/^VELERO_IMAGE_VERSION/c\VELERO_IMAGE_VERSION = $VERSION" Makefile
58+
- name: Velero AWS Plugin Image
59+
run: |
60+
export VERSION=`curl https://api.github.com/repos/vmware-tanzu/velero-plugin-for-aws/tags | jq -r '.[].name' | grep -v 'rc' | head -n 1`
61+
sed -i "/^VELERO_AWS_PLUGIN_IMAGE_VERSION/c\VELERO_AWS_PLUGIN_IMAGE_VERSION = $VERSION" Makefile
5062
- name: Kubectl
5163
run: |
5264
export VERSION=`curl -L -s https://dl.k8s.io/release/stable.txt`
@@ -59,7 +71,7 @@ jobs:
5971
if [ "$CURVERSION" != "$VERSION" ]; then
6072
sed -i "/^K0S_VERSION/c\K0S_VERSION = $VERSION" Makefile
6173
sed -i "/^K0S_BINARY_SOURCE_OVERRIDE/c\K0S_BINARY_SOURCE_OVERRIDE =" Makefile
62-
go get github.com/k0sproject/k0s@${VERSION}
74+
make go.mod
6375
fi
6476
- name: Troubleshoot
6577
run: |

.github/workflows/pull-request.yaml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,23 @@ jobs:
4141
build:
4242
name: Build
4343
runs-on: ubuntu-latest
44+
permissions:
45+
pull-requests: write
4446
steps:
4547
- name: Checkout
4648
uses: actions/checkout@v4
4749
- name: Setup Go
4850
uses: actions/setup-go@v5
4951
with:
5052
go-version: "1.21.0"
51-
- name: Build Linux AMD64
53+
- name: Build Linux AMD64 and Output Metadata
5254
run: |
5355
export SHORT_SHA=dev-$(git rev-parse --short=7 HEAD)
54-
make embedded-cluster-linux-amd64 VERSION="${SHORT_SHA}"
56+
make -B embedded-cluster-linux-amd64 K0S_VERSION=$(make print-PREVIOUS_K0S_VERSION) VERSION="${SHORT_SHA}-previous-k0s"
57+
tar -C output/bin -czvf embedded-cluster-linux-amd64-previous-k0s.tgz embedded-cluster
58+
./output/bin/embedded-cluster version metadata > metadata-previous-k0s.json
59+
make -B embedded-cluster-linux-amd64 VERSION="${SHORT_SHA}"
5560
tar -C output/bin -czvf embedded-cluster-linux-amd64.tgz embedded-cluster
56-
- name: Output Metadata
57-
run: |
5861
./output/bin/embedded-cluster version metadata > metadata.json
5962
- name: Install Replicated CLI
6063
run: |
@@ -91,7 +94,9 @@ jobs:
9194
echo "versionLabel: \"appver-${SHORT_SHA}\"" >> e2e/kots-release-install/release.yaml
9295
cat e2e/kots-release-install/release.yaml
9396
cp output/bin/embedded-cluster output/bin/embedded-cluster-original
94-
make embedded-release VERSION="${SHORT_SHA}" # this is done after the metadata.json is generated so as to not include additional charts
97+
make -B embedded-release K0S_VERSION=$(make print-PREVIOUS_K0S_VERSION) VERSION="${SHORT_SHA}-previous-k0s"
98+
mv output/bin/embedded-cluster output/bin/embedded-cluster-previous-k0s
99+
make -B embedded-release VERSION="${SHORT_SHA}" # this is done after the metadata.json is generated so as to not include additional charts
95100
- name: Cache files for integration test
96101
env:
97102
S3_BUCKET: "tf-staging-embedded-cluster-bin"
@@ -103,6 +108,7 @@ jobs:
103108
export EC_VERSION="v${SHORT_SHA}"
104109
./scripts/cache-files.sh
105110
./scripts/create-upgrade-release.sh
111+
./scripts/create-previous-k0s-release.sh
106112
107113
- name: Create Airgap Release
108114
env:
@@ -112,11 +118,34 @@ jobs:
112118
run: |
113119
export SHORT_SHA=dev-$(git rev-parse --short=7 HEAD)
114120
echo "${SHORT_SHA}"
115-
sed -i "s/__version_string__/${SHORT_SHA}/g" e2e/kots-release-install/cluster-config.yaml
116-
sed -i "s/__version_string__/${SHORT_SHA}-upgrade/g" e2e/kots-release-upgrade/cluster-config.yaml
121+
# airgap tests install the previous k0s version to ensure an upgrade occurs
122+
sed -i "s/${SHORT_SHA}/${SHORT_SHA}-previous-k0s/g" e2e/kots-release-install/cluster-config.yaml
117123
118124
rm e2e/kots-release-install/release.yaml
119125
replicated release create --yaml-dir e2e/kots-release-install --promote CI-airgap --version "appver-${SHORT_SHA}"
126+
replicated release create --yaml-dir e2e/kots-release-upgrade --promote CI-airgap --version "appver-${SHORT_SHA}-upgrade"
127+
128+
- name: Create download link message text
129+
run: |
130+
export SHORT_SHA=dev-$(git rev-parse --short=7 HEAD)
131+
132+
echo "This PR has been released (on staging) and is available for download with a embedded-cluster-smoke-test-staging-app [license ID](https://vendor.staging.replicated.com/apps/embedded-cluster-smoke-test-staging-app/customers?sort=name-asc)." > download-link.txt
133+
echo "" >> download-link.txt
134+
echo "Online Installer:" >> download-link.txt
135+
echo "\`\`\`" >> download-link.txt
136+
echo "curl \"https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci/appver-${SHORT_SHA}\" -H \"Authorization: \$EC_SMOKE_TEST_LICENSE_ID\" -o embedded-cluster-smoke-test-staging-app-ci.tgz" >> download-link.txt
137+
echo "\`\`\`" >> download-link.txt
138+
echo "Airgap Installer (may take a few minutes before the airgap bundle is built):" >> download-link.txt
139+
echo "\`\`\`" >> download-link.txt
140+
echo "curl \"https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci-airgap/appver-${SHORT_SHA}?airgap=true\" -H \"Authorization: \$EC_SMOKE_TEST_LICENSE_ID\" -o embedded-cluster-smoke-test-staging-app-ci.tgz" >> download-link.txt
141+
echo "\`\`\`" >> download-link.txt
142+
echo "Happy debugging!" >> download-link.txt
143+
cat download-link.txt
144+
145+
- name: comment download link
146+
uses: mshick/add-pr-comment@v2
147+
with:
148+
message-path: download-link.txt
120149

121150
- name: upload binary
122151
uses: actions/upload-artifact@v4
@@ -125,6 +154,7 @@ jobs:
125154
path: |
126155
output/bin/embedded-cluster
127156
output/bin/embedded-cluster-original
157+
output/bin/embedded-cluster-previous-k0s
128158
output/bin/embedded-cluster-release-builder
129159
130160
e2e:
@@ -148,11 +178,13 @@ jobs:
148178
- TestInstallWithoutEmbed
149179
- TestInstallFromReplicatedApp
150180
- TestResetAndReinstall
181+
- TestResetAndReinstallAirgap
151182
- TestCollectSupportBundle
152183
- TestOldVersionUpgrade
153184
- TestMaterialize
154185
- TestLocalArtifactMirror
155-
- TestSingleNodeAirgapInstallationUbuntuJammy
186+
- TestSingleNodeAirgapUpgradeUbuntuJammy
187+
- TestInstallSnapshotFromReplicatedApp
156188
steps:
157189
- name: Checkout
158190
uses: actions/checkout@v4
@@ -161,10 +193,12 @@ jobs:
161193
with:
162194
name: embedded-release
163195
path: output/bin
196+
164197
- uses: ./.github/actions/e2e
165198
with:
166199
test-name: '${{ matrix.tests }}'
167200
airgap-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_LICENSE_ID }}
201+
snapshot-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE_ID }}
168202
license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE_ID }}
169203
license: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE }}
170204
testim-access-token: ${{ secrets.TESTIM_ACCESS_TOKEN }}

.github/workflows/release-dev.yaml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ jobs:
1717
uses: actions/setup-go@v5
1818
with:
1919
go-version: "1.21"
20-
- name: Build Linux AMD64
20+
- name: Build Linux AMD64 and Output Metadata
2121
run: |
2222
export SHORT_SHA=dev-$(git rev-parse --short=7 HEAD)
23-
make embedded-cluster-linux-amd64 VERSION="${SHORT_SHA}"
23+
make -B embedded-cluster-linux-amd64 K0S_VERSION=$(make print-PREVIOUS_K0S_VERSION) VERSION="${SHORT_SHA}-previous-k0s"
24+
tar -C output/bin -czvf embedded-cluster-linux-amd64-previous-k0s.tgz embedded-cluster
25+
./output/bin/embedded-cluster version metadata > metadata-previous-k0s.json
26+
make -B embedded-cluster-linux-amd64 VERSION="${SHORT_SHA}"
2427
tar -C output/bin -czvf embedded-cluster-linux-amd64.tgz embedded-cluster
25-
- name: Output Metadata
26-
run: |
2728
./output/bin/embedded-cluster version metadata > metadata.json
2829
- name: Publish development release
2930
uses: marvinpinto/action-automatic-releases@latest
@@ -70,7 +71,9 @@ jobs:
7071
echo "versionLabel: \"appver-${SHORT_SHA}\"" >> e2e/kots-release-install/release.yaml
7172
cat e2e/kots-release-install/release.yaml
7273
cp output/bin/embedded-cluster output/bin/embedded-cluster-original
73-
make embedded-release VERSION="${SHORT_SHA}" # this is done after the metadata.json is generated so as to not include additional charts
74+
make -B embedded-release K0S_VERSION=$(make print-PREVIOUS_K0S_VERSION) VERSION="${SHORT_SHA}-previous-k0s"
75+
mv output/bin/embedded-cluster output/bin/embedded-cluster-previous-k0s
76+
make -B embedded-release VERSION="${SHORT_SHA}" # this is done after the metadata.json is generated so as to not include additional charts
7477
- name: Cache files for integration test
7578
env:
7679
S3_BUCKET: "tf-staging-embedded-cluster-bin"
@@ -82,6 +85,7 @@ jobs:
8285
export EC_VERSION="v${SHORT_SHA}"
8386
./scripts/cache-files.sh
8487
./scripts/create-upgrade-release.sh
88+
./scripts/create-previous-k0s-release.sh
8589
- name: Create Airgap Release
8690
env:
8791
REPLICATED_APP: "embedded-cluster-smoke-test-staging-app"
@@ -90,11 +94,12 @@ jobs:
9094
run: |
9195
export SHORT_SHA=dev-$(git rev-parse --short=7 HEAD)
9296
echo "${SHORT_SHA}"
93-
sed -i "s/__version_string__/${SHORT_SHA}/g" e2e/kots-release-install/cluster-config.yaml
94-
sed -i "s/__version_string__/${SHORT_SHA}-upgrade/g" e2e/kots-release-upgrade/cluster-config.yaml
97+
# airgap tests install the previous k0s version to ensure an upgrade occurs
98+
sed -i "s/${SHORT_SHA}/${SHORT_SHA}-previous-k0s/g" e2e/kots-release-install/cluster-config.yaml
9599
96100
rm e2e/kots-release-install/release.yaml
97101
replicated release create --yaml-dir e2e/kots-release-install --promote CI-airgap --version "appver-${SHORT_SHA}"
102+
replicated release create --yaml-dir e2e/kots-release-upgrade --promote CI-airgap --version "appver-${SHORT_SHA}-upgrade"
98103
99104
- name: upload binary
100105
uses: actions/upload-artifact@v4
@@ -103,6 +108,7 @@ jobs:
103108
path: |
104109
output/bin/embedded-cluster
105110
output/bin/embedded-cluster-original
111+
output/bin/embedded-cluster-previous-k0s
106112
output/bin/embedded-cluster-release-builder
107113
e2e:
108114
runs-on: ubuntu-latest
@@ -125,11 +131,13 @@ jobs:
125131
- TestInstallWithoutEmbed
126132
- TestInstallFromReplicatedApp
127133
- TestResetAndReinstall
134+
- TestResetAndReinstallAirgap
128135
- TestCollectSupportBundle
129136
- TestOldVersionUpgrade
130137
- TestMaterialize
131138
- TestLocalArtifactMirror
132-
- TestSingleNodeAirgapInstallationUbuntuJammy
139+
- TestSingleNodeAirgapUpgradeUbuntuJammy
140+
- TestInstallSnapshotFromReplicatedApp
133141
steps:
134142
- name: Checkout
135143
uses: actions/checkout@v4
@@ -142,6 +150,7 @@ jobs:
142150
with:
143151
test-name: '${{ matrix.tests }}'
144152
airgap-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_LICENSE_ID }}
153+
snapshot-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE_ID }}
145154
license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE_ID }}
146155
license: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE }}
147156
testim-access-token: ${{ secrets.TESTIM_ACCESS_TOKEN }}

Makefile

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ ARCH := $(shell uname -m)
44
APP_NAME = embedded-cluster
55
ADMIN_CONSOLE_CHART_URL = oci://registry.replicated.com/library
66
ADMIN_CONSOLE_CHART_NAME = admin-console
7-
ADMIN_CONSOLE_CHART_VERSION = 1.108.3-build.1
7+
ADMIN_CONSOLE_CHART_VERSION = 1.108.9-build.1
88
ADMIN_CONSOLE_IMAGE_OVERRIDE =
99
ADMIN_CONSOLE_MIGRATIONS_IMAGE_OVERRIDE =
1010
EMBEDDED_OPERATOR_CHART_URL = oci://registry.replicated.com/library
1111
EMBEDDED_OPERATOR_CHART_NAME = embedded-cluster-operator
12-
EMBEDDED_OPERATOR_CHART_VERSION = 0.26.1
12+
EMBEDDED_OPERATOR_CHART_VERSION = 0.28.2
1313
EMBEDDED_OPERATOR_UTILS_IMAGE = busybox:1.36.1
14+
EMBEDDED_CLUSTER_OPERATOR_IMAGE_OVERRIDE =
1415
OPENEBS_CHART_URL = https://openebs.github.io/charts
1516
OPENEBS_CHART_NAME = openebs/openebs
1617
OPENEBS_CHART_VERSION = 3.10.0
@@ -19,10 +20,16 @@ REGISTRY_CHART_URL = https://helm.twun.io
1920
REGISTRY_CHART_NAME = twuni/docker-registry
2021
REGISTRY_CHART_VERSION = 2.2.3
2122
REGISTRY_IMAGE_VERSION = 2.8.3
22-
KUBECTL_VERSION = v1.29.3
23-
K0S_VERSION = v1.29.2+k0s.0
23+
VELERO_CHART_URL = https://vmware-tanzu.github.io/helm-charts
24+
VELERO_CHART_NAME = vmware-tanzu/velero
25+
VELERO_CHART_VERSION = 6.0.0
26+
VELERO_IMAGE_VERSION = v1.13.2
27+
VELERO_AWS_PLUGIN_IMAGE_VERSION = v1.9.2
28+
KUBECTL_VERSION = v1.30.0
29+
K0S_VERSION = v1.29.4+k0s.0
30+
PREVIOUS_K0S_VERSION ?= v1.28.9+k0s.0
2431
K0S_BINARY_SOURCE_OVERRIDE =
25-
TROUBLESHOOT_VERSION = v0.84.1
32+
TROUBLESHOOT_VERSION = v0.88.1
2633
KOTS_VERSION = v$(shell echo $(ADMIN_CONSOLE_CHART_VERSION) | sed 's/\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/')
2734
LD_FLAGS = -X github.com/replicatedhq/embedded-cluster/pkg/defaults.K0sVersion=$(K0S_VERSION) \
2835
-X github.com/replicatedhq/embedded-cluster/pkg/defaults.Version=$(VERSION) \
@@ -38,14 +45,20 @@ LD_FLAGS = -X github.com/replicatedhq/embedded-cluster/pkg/defaults.K0sVersion=$
3845
-X github.com/replicatedhq/embedded-cluster/pkg/addons/embeddedclusteroperator.ChartName=$(EMBEDDED_OPERATOR_CHART_NAME) \
3946
-X github.com/replicatedhq/embedded-cluster/pkg/addons/embeddedclusteroperator.Version=$(EMBEDDED_OPERATOR_CHART_VERSION) \
4047
-X github.com/replicatedhq/embedded-cluster/pkg/addons/embeddedclusteroperator.UtilsImage=$(EMBEDDED_OPERATOR_UTILS_IMAGE) \
48+
-X github.com/replicatedhq/embedded-cluster/pkg/addons/embeddedclusteroperator.ImageOverride=$(EMBEDDED_CLUSTER_OPERATOR_IMAGE_OVERRIDE) \
4149
-X github.com/replicatedhq/embedded-cluster/pkg/addons/openebs.ChartURL=$(OPENEBS_CHART_URL) \
4250
-X github.com/replicatedhq/embedded-cluster/pkg/addons/openebs.ChartName=$(OPENEBS_CHART_NAME) \
4351
-X github.com/replicatedhq/embedded-cluster/pkg/addons/openebs.Version=$(OPENEBS_CHART_VERSION) \
4452
-X github.com/replicatedhq/embedded-cluster/pkg/addons/openebs.UtilsVersion=$(OPENEBS_UTILS_VERSION) \
4553
-X github.com/replicatedhq/embedded-cluster/pkg/addons/registry.ChartURL=$(REGISTRY_CHART_URL) \
4654
-X github.com/replicatedhq/embedded-cluster/pkg/addons/registry.ChartName=$(REGISTRY_CHART_NAME) \
4755
-X github.com/replicatedhq/embedded-cluster/pkg/addons/registry.Version=$(REGISTRY_CHART_VERSION) \
48-
-X github.com/replicatedhq/embedded-cluster/pkg/addons/registry.ImageVersion=$(REGISTRY_IMAGE_VERSION)
56+
-X github.com/replicatedhq/embedded-cluster/pkg/addons/registry.ImageVersion=$(REGISTRY_IMAGE_VERSION) \
57+
-X github.com/replicatedhq/embedded-cluster/pkg/addons/velero.ChartURL=$(VELERO_CHART_URL) \
58+
-X github.com/replicatedhq/embedded-cluster/pkg/addons/velero.ChartName=$(VELERO_CHART_NAME) \
59+
-X github.com/replicatedhq/embedded-cluster/pkg/addons/velero.Version=$(VELERO_CHART_VERSION) \
60+
-X github.com/replicatedhq/embedded-cluster/pkg/addons/velero.VeleroTag=$(VELERO_IMAGE_VERSION) \
61+
-X github.com/replicatedhq/embedded-cluster/pkg/addons/velero.AwsPluginTag=$(VELERO_AWS_PLUGIN_IMAGE_VERSION)
4962

5063
.DEFAULT_GOAL := default
5164
default: embedded-cluster-linux-amd64
@@ -147,6 +160,7 @@ e2e-test:
147160
clean:
148161
rm -rf output
149162
rm -rf pkg/goods/bins
163+
rm -rf pkg/goods/internal/bins
150164

151165
.PHONY: lint
152166
lint:
@@ -164,3 +178,6 @@ scan:
164178
--severity="HIGH,CRITICAL" \
165179
--ignore-unfixed \
166180
./
181+
182+
print-%:
183+
@echo -n $($*)

cmd/embedded-cluster/install.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,35 @@ func installAndEnableLocalArtifactMirror() error {
4949
return nil
5050
}
5151

52+
// configureNetworkManager configures the network manager (if the host is using it) to ignore
53+
// the calico interfaces. This function restarts the NetworkManager service if the configuration
54+
// was changed.
55+
func configureNetworkManager(c *cli.Context) error {
56+
if active, err := helpers.IsSystemdServiceActive(c.Context, "NetworkManager"); err != nil {
57+
return fmt.Errorf("unable to check if NetworkManager is active: %w", err)
58+
} else if !active {
59+
logrus.Debugf("NetworkManager is not active, skipping configuration")
60+
return nil
61+
}
62+
63+
dir := "/etc/NetworkManager/conf.d"
64+
if _, err := os.Stat(dir); err != nil {
65+
logrus.Debugf("skiping NetworkManager config (%s): %v", dir, err)
66+
return nil
67+
}
68+
69+
logrus.Debugf("creating NetworkManager config file")
70+
if err := goods.MaterializeCalicoNetworkManagerConfig(); err != nil {
71+
return fmt.Errorf("unable to materialize configuration: %w", err)
72+
}
73+
74+
logrus.Debugf("network manager config created, restarting the service")
75+
if _, err := helpers.RunCommand("systemctl", "restart", "NetworkManager"); err != nil {
76+
return fmt.Errorf("unable to restart network manager: %w", err)
77+
}
78+
return nil
79+
}
80+
5281
// runPostInstall is a helper function that run things just after the k0s install
5382
// command ran.
5483
func runPostInstall() error {
@@ -417,6 +446,10 @@ var installCommand = &cli.Command{
417446
return ErrNothingElseToAdd
418447
}
419448
metrics.ReportApplyStarted(c)
449+
logrus.Debugf("configuring network manager")
450+
if err := configureNetworkManager(c); err != nil {
451+
return fmt.Errorf("unable to configure network manager: %w", err)
452+
}
420453
logrus.Debugf("checking license matches")
421454
if err := checkLicenseMatches(c); err != nil {
422455
metricErr := fmt.Errorf("unable to check license: %w", err)

0 commit comments

Comments
 (0)