Skip to content

Commit 14602fc

Browse files
committed
Merge remote-tracking branch 'origin/main' into k0s-1-31
2 parents 1c9fb9d + 1a47019 commit 14602fc

File tree

75 files changed

+8076
-807
lines changed

Some content is hidden

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

75 files changed

+8076
-807
lines changed

.github/workflows/ci.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,11 @@ jobs:
449449
MANGLE_METADATA: "1"
450450
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
451451
run: |
452-
export K0S_VERSION=$(make print-PREVIOUS_K0S_VERSION)
453-
export K0S_GO_VERSION=$(make print-PREVIOUS_K0S_GO_VERSION)
452+
k0s_minor_version=$(make print-PREVIOUS_K0S_VERSION | sed 's/v[0-9]*\.\([0-9]*\).*/\1/')
453+
454+
# update k0s dep version to previous k0s version
455+
./scripts/update-k0s-dep-version.sh "$k0s_minor_version"
456+
454457
export EC_VERSION=$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')-previous-k0s
455458
export APP_VERSION=appver-dev-${{ needs.git-sha.outputs.git_sha }}-previous-k0s
456459
# avoid rate limiting
@@ -469,7 +472,8 @@ jobs:
469472
- name: Export k0s version
470473
id: export
471474
run: |
472-
K0S_VERSION="$(make print-PREVIOUS_K0S_VERSION)"
475+
# K0S_VERSION is now the previous k0s version
476+
K0S_VERSION="$(make print-K0S_VERSION)"
473477
echo "K0S_VERSION=\"$K0S_VERSION\""
474478
echo "k0s_version=$K0S_VERSION" >> "$GITHUB_OUTPUT"
475479

.github/workflows/dependencies.yaml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ on:
33
schedule:
44
# everyday at midnight.
55
- cron: '0 0 * * *'
6-
workflow_dispatch: {}
6+
workflow_dispatch:
7+
inputs:
8+
k0s_minor_version:
9+
description: 'The minor version of k0s to update the dependencies for'
10+
required: false
711

812
jobs:
913
update-dependencies:
@@ -16,29 +20,16 @@ jobs:
1620
with:
1721
go-version-file: go.mod
1822
cache-dependency-path: "**/*.sum"
19-
- name: Kubectl
20-
run: |
21-
export VERSION=`curl -L -s https://dl.k8s.io/release/stable.txt`
22-
sed -i "/^KUBECTL_VERSION/c\KUBECTL_VERSION = $VERSION" Makefile
2323
- name: K0s
2424
env:
2525
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2626
run: |
27-
# Remove the '-ec.X' suffix and only update if the prefix (upstream k0s release) has changed.
28-
export CURVERSION=$(make print-K0S_VERSION)
29-
export CURMAJMIN=$(echo $CURVERSION | awk -F'.' '{print $1 "." $2}')
30-
31-
# pin to the latest release for the current major.minor version
32-
export VERSION=$(gh release list --repo k0sproject/k0s --exclude-pre-releases --json name,isLatest | \
33-
jq -r "[.[] | select(.name | startswith(\"$CURMAJMIN\"))] | first | .name")
34-
35-
if [ "$CURVERSION" != "$VERSION" ]; then
36-
sed -i "/^K0S_VERSION/c\K0S_VERSION = $VERSION" Makefile
37-
sed -i "/^K0S_GO_VERSION/c\K0S_GO_VERSION = $VERSION" Makefile
38-
# replace the first occurrence of K0S_BINARY_SOURCE_OVERRIDE
39-
sed -i '0,/K0S_BINARY_SOURCE_OVERRIDE =.*/s/K0S_BINARY_SOURCE_OVERRIDE =.*/K0S_BINARY_SOURCE_OVERRIDE =/' Makefile
40-
make go.mod
27+
cur_minor="$INPUT_K0S_MINOR_VERSION"
28+
if [ -z "$cur_minor" ]; then
29+
cur_minor=$(make print-K0S_VERSION | awk -F'.' '{print $2}')
4130
fi
31+
32+
./scripts/update-k0s-dep-version.sh "$cur_minor"
4233
- name: Troubleshoot
4334
env:
4435
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ cover.out
3838
# e2e test runs locally
3939
e2e/playwright*.tar.gz
4040
e2e/support-bundle*.tar.gz
41+
42+
# Local Netlify folder
43+
.netlify

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ ADMIN_CONSOLE_CHART_REPO_OVERRIDE =
1010
ADMIN_CONSOLE_IMAGE_OVERRIDE =
1111
ADMIN_CONSOLE_MIGRATIONS_IMAGE_OVERRIDE =
1212
ADMIN_CONSOLE_KURL_PROXY_IMAGE_OVERRIDE =
13-
K0S_VERSION = v1.31.11+k0s.0
14-
K0S_GO_VERSION = v1.31.11+k0s.0
15-
PREVIOUS_K0S_VERSION ?= v1.30.9+k0s.0
16-
PREVIOUS_K0S_GO_VERSION ?= v1.30.9+k0s.0
13+
K0S_VERSION = v1.32.7+k0s.0
14+
K0S_GO_VERSION = v1.32.7+k0s.0
15+
PREVIOUS_K0S_VERSION ?= v1.31.11+k0s.0
16+
PREVIOUS_K0S_GO_VERSION ?= v1.31.11+k0s.0
1717
K0S_BINARY_SOURCE_OVERRIDE =
1818
TROUBLESHOOT_VERSION = v0.121.2
1919

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,56 @@ make ssh-node0
290290
```bash
291291
make kurl-proxy-down-ec
292292
```
293+
294+
## Upgrading K0s Minor Version
295+
296+
To upgrade the K0s minor version in Embedded Cluster, you can use the provided update script ./scripts/update-k0s-dep-version.sh.
297+
This script will update the K0s dependency version across the project and regenerate necessary files.
298+
299+
### Using the Update Script
300+
301+
The update script automates the process of upgrading K0s to a new minor version:
302+
303+
```bash
304+
./scripts/update-k0s-dep-version.sh [TARGET_MINOR]
305+
```
306+
307+
**Parameters:**
308+
- `[TARGET_MINOR]` - The target K0s minor version (e.g., `1.28`, `1.29`, `1.30`)
309+
310+
**Examples:**
311+
```bash
312+
# Upgrade to K0s 1.29.x
313+
./scripts/update-k0s-dep-version.sh 1.29
314+
315+
# Upgrade to K0s 1.30.x
316+
./scripts/update-k0s-dep-version.sh 1.30
317+
```
318+
319+
### What the Script Does
320+
321+
The update script performs the following operations:
322+
323+
1. **Updates Go module dependencies** - Modifies `go.mod` files to use the new K0s version
324+
2. **Regenerates CRDs** - Updates Custom Resource Definitions for the new K0s version
325+
3. **Updates build configurations** - Modifies build scripts and Dockerfiles as needed
326+
4. **Regenerates manifests** - Updates Kubernetes manifests and deployment files
327+
328+
### After Running the Script
329+
330+
1. **Review changes** - The script will show you what files were modified
331+
2. **Test the build** - Verify that the project builds successfully:
332+
```bash
333+
make build
334+
```
335+
3. **Run tests** - Ensure all tests pass with the new version:
336+
```bash
337+
make unit-tests
338+
make test-integration
339+
```
340+
4. **Test installation** - Verify that installation works with the new K0s version:
341+
```bash
342+
make initial-release
343+
make create-node0
344+
# Test installation process
345+
```

api/controllers/app/install/controller.go

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import (
1414
"github.com/replicatedhq/embedded-cluster/api/pkg/logger"
1515
"github.com/replicatedhq/embedded-cluster/api/types"
1616
"github.com/replicatedhq/embedded-cluster/pkg/release"
17+
kotsv1beta1 "github.com/replicatedhq/kotskinds/apis/kots/v1beta1"
1718
"github.com/sirupsen/logrus"
19+
kyaml "sigs.k8s.io/yaml"
1820
)
1921

2022
type Controller interface {
@@ -32,18 +34,20 @@ type Controller interface {
3234
var _ Controller = (*InstallController)(nil)
3335

3436
type InstallController struct {
35-
appConfigManager appconfig.AppConfigManager
36-
appInstallManager appinstallmanager.AppInstallManager
37-
appPreflightManager apppreflightmanager.AppPreflightManager
38-
appReleaseManager appreleasemanager.AppReleaseManager
39-
stateMachine statemachine.Interface
40-
logger logrus.FieldLogger
41-
license []byte
42-
releaseData *release.ReleaseData
43-
store store.Store
44-
configValues types.AppConfigValues
45-
clusterID string
46-
airgapBundle string
37+
appConfigManager appconfig.AppConfigManager
38+
appInstallManager appinstallmanager.AppInstallManager
39+
appPreflightManager apppreflightmanager.AppPreflightManager
40+
appReleaseManager appreleasemanager.AppReleaseManager
41+
stateMachine statemachine.Interface
42+
logger logrus.FieldLogger
43+
license []byte
44+
releaseData *release.ReleaseData
45+
store store.Store
46+
configValues types.AppConfigValues
47+
clusterID string
48+
airgapBundle string
49+
privateCACertConfigMapName string
50+
registrySettings *types.RegistrySettings
4751
}
4852

4953
type InstallControllerOption func(*InstallController)
@@ -120,6 +124,18 @@ func WithAirgapBundle(airgapBundle string) InstallControllerOption {
120124
}
121125
}
122126

127+
func WithRegistrySettings(registrySettings *types.RegistrySettings) InstallControllerOption {
128+
return func(c *InstallController) {
129+
c.registrySettings = registrySettings
130+
}
131+
}
132+
133+
func WithPrivateCACertConfigMapName(configMapName string) InstallControllerOption {
134+
return func(c *InstallController) {
135+
c.privateCACertConfigMapName = configMapName
136+
}
137+
}
138+
123139
func NewInstallController(opts ...InstallControllerOption) (*InstallController, error) {
124140
controller := &InstallController{
125141
logger: logger.NewDiscardLogger(),
@@ -133,11 +149,22 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
133149
return nil, err
134150
}
135151

152+
var license *kotsv1beta1.License
153+
if len(controller.license) > 0 {
154+
license = &kotsv1beta1.License{}
155+
if err := kyaml.Unmarshal(controller.license, license); err != nil {
156+
return nil, fmt.Errorf("parse license: %w", err)
157+
}
158+
}
159+
136160
if controller.appConfigManager == nil {
137161
appConfigManager, err := appconfig.NewAppConfigManager(
138162
*controller.releaseData.AppConfig,
139163
appconfig.WithLogger(controller.logger),
140164
appconfig.WithAppConfigStore(controller.store.AppConfigStore()),
165+
appconfig.WithReleaseData(controller.releaseData),
166+
appconfig.WithLicense(license),
167+
appconfig.WithPrivateCACertConfigMapName(controller.privateCACertConfigMapName),
141168
)
142169
if err != nil {
143170
return nil, fmt.Errorf("failed to create app config manager: %w", err)
@@ -164,10 +191,20 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
164191
}
165192

166193
if controller.appReleaseManager == nil {
167-
appReleaseManager, err := appreleasemanager.NewAppReleaseManager(
168-
*controller.releaseData.AppConfig,
194+
var appReleaseManagerOpts []appreleasemanager.AppReleaseManagerOption
195+
appReleaseManagerOpts = append(appReleaseManagerOpts,
169196
appreleasemanager.WithLogger(controller.logger),
170197
appreleasemanager.WithReleaseData(controller.releaseData),
198+
appreleasemanager.WithLicense(license),
199+
appreleasemanager.WithPrivateCACertConfigMapName(controller.privateCACertConfigMapName),
200+
)
201+
202+
// Add registry settings if available
203+
appReleaseManagerOpts = append(appReleaseManagerOpts, appreleasemanager.WithRegistrySettings(controller.registrySettings))
204+
205+
appReleaseManager, err := appreleasemanager.NewAppReleaseManager(
206+
*controller.releaseData.AppConfig,
207+
appReleaseManagerOpts...,
171208
)
172209
if err != nil {
173210
return nil, fmt.Errorf("create app release manager: %w", err)
@@ -178,8 +215,8 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
178215
if controller.appInstallManager == nil {
179216
appInstallManager, err := appinstallmanager.NewAppInstallManager(
180217
appinstallmanager.WithLogger(controller.logger),
181-
appinstallmanager.WithLicense(controller.license),
182218
appinstallmanager.WithReleaseData(controller.releaseData),
219+
appinstallmanager.WithLicense(controller.license),
183220
appinstallmanager.WithClusterID(controller.clusterID),
184221
appinstallmanager.WithAirgapBundle(controller.airgapBundle),
185222
appinstallmanager.WithAppInstallStore(controller.store.AppInstallStore()),

api/controllers/kubernetes/install/controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
191191
appcontroller.WithReleaseData(controller.releaseData),
192192
appcontroller.WithConfigValues(controller.configValues),
193193
appcontroller.WithAirgapBundle(controller.airgapBundle),
194+
appcontroller.WithPrivateCACertConfigMapName(""), // Private CA ConfigMap functionality not yet implemented for Kubernetes installations
194195
)
195196
if err != nil {
196197
return nil, fmt.Errorf("create app install controller: %w", err)

api/controllers/linux/install/controller.go

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ import (
1616
"github.com/replicatedhq/embedded-cluster/api/types"
1717
ecv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
1818
"github.com/replicatedhq/embedded-cluster/pkg-new/hostutils"
19+
"github.com/replicatedhq/embedded-cluster/pkg/addons/adminconsole"
1920
"github.com/replicatedhq/embedded-cluster/pkg/airgap"
2021
"github.com/replicatedhq/embedded-cluster/pkg/metrics"
2122
"github.com/replicatedhq/embedded-cluster/pkg/release"
2223
"github.com/replicatedhq/embedded-cluster/pkg/runtimeconfig"
24+
kotsv1beta1 "github.com/replicatedhq/kotskinds/apis/kots/v1beta1"
2325
"github.com/sirupsen/logrus"
26+
"sigs.k8s.io/yaml"
2427
)
2528

2629
type Controller interface {
@@ -253,7 +256,8 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
253256

254257
// Initialize the app controller with the state machine first
255258
if controller.InstallController == nil {
256-
appInstallController, err := appcontroller.NewInstallController(
259+
var appControllerOpts []appcontroller.InstallControllerOption
260+
appControllerOpts = append(appControllerOpts,
257261
appcontroller.WithStateMachine(controller.stateMachine),
258262
appcontroller.WithLogger(controller.logger),
259263
appcontroller.WithStore(controller.store),
@@ -262,7 +266,26 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
262266
appcontroller.WithConfigValues(controller.configValues),
263267
appcontroller.WithClusterID(controller.clusterID),
264268
appcontroller.WithAirgapBundle(controller.airgapBundle),
269+
appcontroller.WithPrivateCACertConfigMapName(adminconsole.PrivateCASConfigMapName), // Linux installations use the ConfigMap
265270
)
271+
272+
// Detect registry settings and pass to app controller
273+
var license *kotsv1beta1.License
274+
if controller.license != nil {
275+
// Parse license from bytes
276+
var parsedLicense kotsv1beta1.License
277+
if err := yaml.Unmarshal(controller.license, &parsedLicense); err != nil {
278+
return nil, fmt.Errorf("failed to parse license data: %w", err)
279+
}
280+
license = &parsedLicense
281+
}
282+
registrySettings, err := controller.detectRegistrySettings(license)
283+
if err != nil {
284+
return nil, fmt.Errorf("failed to detect registry settings: %w", err)
285+
}
286+
appControllerOpts = append(appControllerOpts, appcontroller.WithRegistrySettings(registrySettings))
287+
288+
appInstallController, err := appcontroller.NewInstallController(appControllerOpts...)
266289
if err != nil {
267290
return nil, fmt.Errorf("create app install controller: %w", err)
268291
}

api/controllers/linux/install/controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ func TestSetupInfra(t *testing.T) {
11991199
appcontroller.WithStateMachine(sm),
12001200
appcontroller.WithStore(mockStore),
12011201
appcontroller.WithReleaseData(getTestReleaseData(&appConfig)),
1202-
appcontroller.WithLicense([]byte("test-license")),
1202+
appcontroller.WithLicense([]byte("spec:\n licenseID: test-license\n")),
12031203
appcontroller.WithAppConfigManager(mockAppConfigManager),
12041204
appcontroller.WithAppPreflightManager(mockAppPreflightManager),
12051205
appcontroller.WithAppReleaseManager(mockAppReleaseManager),
@@ -1216,7 +1216,7 @@ func TestSetupInfra(t *testing.T) {
12161216
WithAllowIgnoreHostPreflights(tt.serverAllowIgnoreHostPreflights),
12171217
WithMetricsReporter(mockMetricsReporter),
12181218
WithReleaseData(getTestReleaseData(&appConfig)),
1219-
WithLicense([]byte("test-license")),
1219+
WithLicense([]byte("spec:\n licenseID: test-license\n")),
12201220
WithStore(mockStore),
12211221
)
12221222
require.NoError(t, err)

0 commit comments

Comments
 (0)