Skip to content

Commit 057e017

Browse files
committed
merge main
2 parents 1dd8035 + 3fac959 commit 057e017

File tree

97 files changed

+8449
-5532
lines changed

Some content is hidden

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

97 files changed

+8449
-5532
lines changed

.cursor/BUGBOT.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Embedded Cluster Bugbot Rules
2+
3+
This file provides project-specific guidance for AI code reviews in the Embedded Cluster repository.
4+
5+
## Documentation Reference
6+
7+
For comprehensive development guidance, coding standards, and project architecture, refer to the detailed documentation in the `.cursor/rules/` directory, including:
8+
9+
- **[Project Overview](file://.cursor/rules/project-overview.mdc)** - Complete project description, technology stack, and architecture
10+
- **[Go Best Practices](file://.cursor/rules/go-best-practices.mdc)** - Go coding standards, patterns, and conventions
11+
- **[Go Testing](file://.cursor/rules/go-testing.mdc)** - Testing patterns, mock usage, and test organization
12+
- **[Go API Architecture](file://.cursor/rules/go-ec-api-architecture.mdc)** - API implementation guidelines and patterns
13+
- **[Frontend Rules](file://.cursor/rules/frontend-rules.mdc)** - React/TypeScript standards and testing patterns
14+
- **[Clean Code](file://.cursor/rules/clean-code.mdc)** - Code formatting and comment standards
15+
- **[Code Quality Checks](file://.cursor/rules/code-quality-checks.mdc)** - Essential quality checks to run after changes

.github/workflows/ci.yaml

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,45 @@ jobs:
8484
run: |
8585
make unit-tests
8686
87+
should-run-int-tests-kind:
88+
name: Should run integration tests (kind)
89+
runs-on: ubuntu-latest
90+
outputs:
91+
run: ${{ steps.changed-files.outputs.any_changed }}
92+
steps:
93+
- name: Checkout
94+
uses: actions/checkout@v4
95+
96+
- name: Get changed files
97+
id: changed-files
98+
uses: tj-actions/[email protected]
99+
with:
100+
files: |
101+
kinds/**
102+
pkg/**
103+
pkg-new/**
104+
tests/integration/**
105+
87106
int-tests:
88107
name: Integration tests
89108
runs-on: ubuntu-latest
90109
needs:
91110
- int-tests-api
92111
- int-tests-kind
93112
- int-tests-kind-ha-registry
113+
if: ${{ !cancelled() }}
94114
steps:
95-
- name: Succeed if all tests passed
115+
# https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context
116+
- name: fail if int-tests-api job was not successful
117+
if: needs.int-tests-api.result != 'success' && needs.int-tests-api.result != 'skipped'
118+
run: exit 1
119+
- name: fail if int-tests-kind job was not successful
120+
if: needs.int-tests-kind.result != 'success' && needs.int-tests-kind.result != 'skipped'
121+
run: exit 1
122+
- name: fail if int-tests-kind-ha-registry job was not successful
123+
if: needs.int-tests-kind-ha-registry.result != 'success' && needs.int-tests-kind-ha-registry.result != 'skipped'
124+
run: exit 1
125+
- name: succeed if everything else passed
96126
run: echo "Integration tests succeeded"
97127

98128
int-tests-api:
@@ -117,6 +147,7 @@ jobs:
117147
int-tests-kind:
118148
name: Integration tests (kind)
119149
runs-on: ubuntu-latest
150+
if: needs.should-run-int-tests-kind.outputs.run == 'true'
120151
steps:
121152
- name: Checkout
122153
uses: actions/checkout@v4
@@ -139,6 +170,7 @@ jobs:
139170
int-tests-kind-ha-registry:
140171
name: Integration tests (kind) HA registry
141172
runs-on: ubuntu-latest
173+
if: needs.should-run-int-tests-kind.outputs.run == 'true'
142174
steps:
143175
- name: Checkout
144176
uses: actions/checkout@v4
@@ -248,7 +280,7 @@ jobs:
248280
name: Should run e2e
249281
runs-on: ubuntu-latest
250282
outputs:
251-
run-e2e: ${{ steps.changed-files.outputs.any_changed }}
283+
run: ${{ steps.changed-files.outputs.any_changed }}
252284
steps:
253285
- name: Checkout
254286
uses: actions/checkout@v4
@@ -284,7 +316,7 @@ jobs:
284316
needs:
285317
- git-sha
286318
- should-run-e2e
287-
if: needs.should-run-e2e.outputs.run-e2e == 'true'
319+
if: needs.should-run-e2e.outputs.run == 'true'
288320
outputs:
289321
k0s_version: ${{ steps.export.outputs.k0s_version }}
290322
steps:
@@ -365,7 +397,7 @@ jobs:
365397
needs:
366398
- git-sha
367399
- should-run-e2e
368-
if: needs.should-run-e2e.outputs.run-e2e == 'true'
400+
if: needs.should-run-e2e.outputs.run == 'true'
369401
outputs:
370402
k0s_version: ${{ steps.export.outputs.k0s_version }}
371403
steps:
@@ -447,7 +479,7 @@ jobs:
447479
needs:
448480
- git-sha
449481
- should-run-e2e
450-
if: needs.should-run-e2e.outputs.run-e2e == 'true'
482+
if: needs.should-run-e2e.outputs.run == 'true'
451483
outputs:
452484
ec_version: ${{ steps.export.outputs.ec_version }}
453485
k0s_version: ${{ steps.export.outputs.k0s_version }}
@@ -483,7 +515,7 @@ jobs:
483515
needs:
484516
- git-sha
485517
- should-run-e2e
486-
if: needs.should-run-e2e.outputs.run-e2e == 'true'
518+
if: needs.should-run-e2e.outputs.run == 'true'
487519
outputs:
488520
k0s_version: ${{ steps.export.outputs.k0s_version }}
489521
steps:
@@ -604,7 +636,7 @@ jobs:
604636
needs:
605637
- git-sha
606638
- should-run-e2e
607-
if: needs.should-run-e2e.outputs.run-e2e == 'true'
639+
if: needs.should-run-e2e.outputs.run == 'true'
608640
outputs:
609641
version_specifier: ${{ steps.export-version-specifier.outputs.version_specifier }}
610642
steps:
@@ -964,6 +996,9 @@ jobs:
964996
name: Validate success # this name is used by .github/workflows/automated-prs-manager.yaml
965997
runs-on: ubuntu-latest
966998
needs:
999+
- build-current
1000+
- build-previous-k0s
1001+
- build-upgrade
9671002
- e2e
9681003
- e2e-main
9691004
- e2e-docker
@@ -987,6 +1022,15 @@ jobs:
9871022
- name: fail if e2e-docker job was not successful
9881023
if: needs.e2e-docker.result != 'success' && needs.e2e-docker.result != 'skipped'
9891024
run: exit 1
1025+
- name: fail if build-current job was not successful
1026+
if: needs.build-current.result != 'success' && needs.build-current.result != 'skipped'
1027+
run: exit 1
1028+
- name: fail if build-previous-k0s job was not successful
1029+
if: needs.build-previous-k0s.result != 'success' && needs.build-previous-k0s.result != 'skipped'
1030+
run: exit 1
1031+
- name: fail if build-upgrade job was not successful
1032+
if: needs.build-upgrade.result != 'success' && needs.build-upgrade.result != 'skipped'
1033+
run: exit 1
9901034
- name: fail if sanitize job was not successful
9911035
if: needs.sanitize.result != 'success'
9921036
run: exit 1

.github/workflows/dependencies.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,17 @@ jobs:
2626
run: |
2727
# Remove the '-ec.X' suffix and only update if the prefix (upstream k0s release) has changed.
2828
export CURVERSION=$(make print-K0S_VERSION)
29-
export VERSION=$(gh release list --repo k0sproject/k0s --json name,isLatest | jq -r '.[] | select(.isLatest)|.name')
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+
3035
if [ "$CURVERSION" != "$VERSION" ]; then
3136
sed -i "/^K0S_VERSION/c\K0S_VERSION = $VERSION" Makefile
32-
sed -i "/^K0S_BINARY_SOURCE_OVERRIDE/c\K0S_BINARY_SOURCE_OVERRIDE =" 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
3340
make go.mod
3441
fi
3542
- name: Troubleshoot

GEMINI.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# GEMINI.md
2+
3+
This file provides guidance to Gemini when working with code in this repository.
4+
5+
## Documentation Reference
6+
7+
For comprehensive development guidance, coding standards, and project architecture, refer to the detailed documentation in the `.cursor/rules/` directory, including but not limited to:
8+
9+
- **[Project Overview](file://.cursor/rules/project-overview.mdc)** - Complete project description, technology stack, and architecture
10+
- **[Go Best Practices](file://.cursor/rules/go-best-practices.mdc)** - Go coding standards, patterns, and conventions
11+
- **[Go Testing](file://.cursor/rules/go-testing.mdc)** - Testing patterns, mock usage, and test organization
12+
- **[Go API Architecture](file://.cursor/rules/go-ec-api-architecture.mdc)** - API implementation guidelines and patterns
13+
- **[Frontend Rules](file://.cursor/rules/frontend-rules.mdc)** - React/TypeScript standards and testing patterns
14+
- **[Clean Code](file://.cursor/rules/clean-code.mdc)** - Code formatting and comment standards
15+
- **[Code Quality Checks](file://.cursor/rules/code-quality-checks.mdc)** - Essential quality checks to run after changes

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ K0S_GO_VERSION = v1.29.14+k0s.0
1515
PREVIOUS_K0S_VERSION ?= v1.28.14+k0s.0-ec.0
1616
PREVIOUS_K0S_GO_VERSION ?= v1.28.14+k0s.0
1717
K0S_BINARY_SOURCE_OVERRIDE =
18-
TROUBLESHOOT_VERSION = v0.120.3
18+
TROUBLESHOOT_VERSION = v0.121.2
1919

2020
KOTS_VERSION = v$(shell awk '/^version/{print $$2}' pkg/addons/adminconsole/static/metadata.yaml | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+)(-ec\.[0-9]+)?.*/\1\2/')
2121
# If KOTS_BINARY_URL_OVERRIDE is set to a ttl.sh artifact, there's NO need to update the KOTS_VERSION above as it will be dynamically generated
@@ -202,7 +202,7 @@ initial-release: check-env-EC_VERSION check-env-APP_VERSION
202202

203203
.PHONY: rebuild-release
204204
rebuild-release: export EC_VERSION = $(VERSION)-$(CURRENT_USER)
205-
rebuild-release: export RELEASE_YAML_DIR = e2e/kots-release-install
205+
rebuild-release: export RELEASE_YAML_DIR = $(if $(filter 1,$(ENABLE_V3)),e2e/kots-release-install-v3,e2e/kots-release-install)
206206
rebuild-release: check-env-EC_VERSION check-env-APP_VERSION
207207
UPLOAD_BINARIES=0 \
208208
SKIP_RELEASE=1 \

api/client/client.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ type Client interface {
1616
ConfigureLinuxInstallation(config types.LinuxInstallationConfig) (types.Status, error)
1717
SetupLinuxInfra(ignoreHostPreflights bool) (types.Infra, error)
1818
GetLinuxInfraStatus() (types.Infra, error)
19-
GetLinuxAppConfig() (types.AppConfig, error)
2019
GetLinuxAppConfigValues() (types.AppConfigValues, error)
2120
PatchLinuxAppConfigValues(types.AppConfigValues) (types.AppConfigValues, error)
2221
TemplateLinuxAppConfig(values types.AppConfigValues) (types.AppConfig, error)
@@ -26,7 +25,6 @@ type Client interface {
2625
GetKubernetesInstallationStatus() (types.Status, error)
2726
SetupKubernetesInfra() (types.Infra, error)
2827
GetKubernetesInfraStatus() (types.Infra, error)
29-
GetKubernetesAppConfig() (types.AppConfig, error)
3028
GetKubernetesAppConfigValues() (types.AppConfigValues, error)
3129
PatchKubernetesAppConfigValues(types.AppConfigValues) (types.AppConfigValues, error)
3230
TemplateKubernetesAppConfig(values types.AppConfigValues) (types.AppConfig, error)

api/client/client_test.go

Lines changed: 0 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -585,128 +585,6 @@ func TestErrorFromResponse(t *testing.T) {
585585
assert.Contains(t, err.Error(), "unexpected response")
586586
}
587587

588-
func TestLinuxGetAppConfig(t *testing.T) {
589-
// Define expected config once
590-
expectedConfig := types.AppConfig{
591-
Groups: []kotsv1beta1.ConfigGroup{
592-
{
593-
Name: "test-group",
594-
Title: "Test Group",
595-
Items: []kotsv1beta1.ConfigItem{
596-
{
597-
Name: "test-item",
598-
Type: "text",
599-
Title: "Test Item",
600-
Default: multitype.FromString("default"),
601-
Value: multitype.FromString("value"),
602-
},
603-
},
604-
},
605-
},
606-
}
607-
608-
// Create a test server
609-
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
610-
assert.Equal(t, "GET", r.Method)
611-
assert.Equal(t, "/api/linux/install/app/config", r.URL.Path)
612-
613-
assert.Equal(t, "application/json", r.Header.Get("Content-Type"))
614-
assert.Equal(t, "Bearer test-token", r.Header.Get("Authorization"))
615-
616-
// Return successful response
617-
w.WriteHeader(http.StatusOK)
618-
json.NewEncoder(w).Encode(expectedConfig)
619-
}))
620-
defer server.Close()
621-
622-
// Test successful get
623-
c := New(server.URL, WithToken("test-token"))
624-
config, err := c.GetLinuxAppConfig()
625-
assert.NoError(t, err)
626-
assert.Equal(t, expectedConfig, config)
627-
628-
// Test error response
629-
errorServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
630-
w.WriteHeader(http.StatusInternalServerError)
631-
json.NewEncoder(w).Encode(types.APIError{
632-
StatusCode: http.StatusInternalServerError,
633-
Message: "Internal Server Error",
634-
})
635-
}))
636-
defer errorServer.Close()
637-
638-
c = New(errorServer.URL, WithToken("test-token"))
639-
config, err = c.GetLinuxAppConfig()
640-
assert.Error(t, err)
641-
assert.Equal(t, types.AppConfig{}, config)
642-
643-
apiErr, ok := err.(*types.APIError)
644-
require.True(t, ok, "Expected err to be of type *types.APIError")
645-
assert.Equal(t, http.StatusInternalServerError, apiErr.StatusCode)
646-
assert.Equal(t, "Internal Server Error", apiErr.Message)
647-
}
648-
649-
func TestKubernetesGetAppConfig(t *testing.T) {
650-
// Define expected config once
651-
expectedConfig := types.AppConfig{
652-
Groups: []kotsv1beta1.ConfigGroup{
653-
{
654-
Name: "test-group",
655-
Title: "Test Group",
656-
Items: []kotsv1beta1.ConfigItem{
657-
{
658-
Name: "test-item",
659-
Type: "text",
660-
Title: "Test Item",
661-
Default: multitype.FromString("default"),
662-
Value: multitype.FromString("value"),
663-
},
664-
},
665-
},
666-
},
667-
}
668-
669-
// Create a test server
670-
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
671-
assert.Equal(t, "GET", r.Method)
672-
assert.Equal(t, "/api/kubernetes/install/app/config", r.URL.Path)
673-
674-
assert.Equal(t, "application/json", r.Header.Get("Content-Type"))
675-
assert.Equal(t, "Bearer test-token", r.Header.Get("Authorization"))
676-
677-
// Return successful response
678-
w.WriteHeader(http.StatusOK)
679-
json.NewEncoder(w).Encode(expectedConfig)
680-
}))
681-
defer server.Close()
682-
683-
// Test successful get
684-
c := New(server.URL, WithToken("test-token"))
685-
config, err := c.GetKubernetesAppConfig()
686-
assert.NoError(t, err)
687-
assert.Equal(t, expectedConfig, config)
688-
689-
// Test error response
690-
errorServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
691-
w.WriteHeader(http.StatusInternalServerError)
692-
json.NewEncoder(w).Encode(types.APIError{
693-
StatusCode: http.StatusInternalServerError,
694-
Message: "Internal Server Error",
695-
})
696-
}))
697-
defer errorServer.Close()
698-
699-
c = New(errorServer.URL, WithToken("test-token"))
700-
config, err = c.GetKubernetesAppConfig()
701-
assert.Error(t, err)
702-
assert.Equal(t, types.AppConfig{}, config)
703-
704-
apiErr, ok := err.(*types.APIError)
705-
require.True(t, ok, "Expected err to be of type *types.APIError")
706-
assert.Equal(t, http.StatusInternalServerError, apiErr.StatusCode)
707-
assert.Equal(t, "Internal Server Error", apiErr.Message)
708-
}
709-
710588
func TestLinuxGetAppConfigValues(t *testing.T) {
711589
// Define expected values once
712590
expectedValues := types.AppConfigValues{

0 commit comments

Comments
 (0)