Skip to content

Commit 3b9bf80

Browse files
committed
Merge remote-tracking branch 'origin/main' into k0s-1-29
2 parents dbf0489 + 18724d7 commit 3b9bf80

File tree

130 files changed

+7014
-1151
lines changed

Some content is hidden

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

130 files changed

+7014
-1151
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -603,12 +603,12 @@ jobs:
603603
- name: Checkout
604604
uses: actions/checkout@v4
605605
- name: Download buildtools artifact
606-
uses: actions/download-artifact@v4
606+
uses: actions/download-artifact@v5
607607
with:
608608
name: buildtools
609609
path: output/bin
610610
- name: Download embedded-cluster artifact
611-
uses: actions/download-artifact@v4
611+
uses: actions/download-artifact@v5
612612
with:
613613
name: current-release
614614
path: output/bin
@@ -851,7 +851,7 @@ jobs:
851851
- name: Checkout
852852
uses: actions/checkout@v4
853853
- name: Download binary
854-
uses: actions/download-artifact@v4
854+
uses: actions/download-artifact@v5
855855
with:
856856
name: current-release
857857
path: output/bin
@@ -936,7 +936,7 @@ jobs:
936936
- name: Checkout
937937
uses: actions/checkout@v4
938938
- name: Download current binary
939-
uses: actions/download-artifact@v4
939+
uses: actions/download-artifact@v5
940940
with:
941941
name: current-release
942942
path: output/bin
@@ -974,7 +974,7 @@ jobs:
974974
- name: Checkout
975975
uses: actions/checkout@v4
976976
- name: Download current binary
977-
uses: actions/download-artifact@v4
977+
uses: actions/download-artifact@v5
978978
with:
979979
name: current-release
980980
path: output/bin
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Cleanup Resources
2+
3+
on:
4+
schedule:
5+
# Run every 12 hours
6+
- cron: '0 */12 * * *'
7+
workflow_dispatch: # Allow manual triggering
8+
9+
jobs:
10+
archive-instances:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Run archive instances script
18+
env:
19+
REPLICATED_APP: "embedded-cluster-smoke-test-staging-app"
20+
REPLICATED_API_TOKEN: ${{ secrets.STAGING_REPLICATED_API_TOKEN }}
21+
REPLICATED_API_ORIGIN: "https://api.staging.replicated.com"
22+
DRY_RUN: "false"
23+
run: |
24+
# Make script executable and run it
25+
chmod +x ./scripts/archive-instances.sh
26+
./scripts/archive-instances.sh
27+
28+
demote-channel-releases:
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Run demote channel releases script
36+
env:
37+
REPLICATED_APP: "embedded-cluster-smoke-test-staging-app"
38+
REPLICATED_API_TOKEN: ${{ secrets.STAGING_REPLICATED_API_TOKEN }}
39+
REPLICATED_API_ORIGIN: "https://api.staging.replicated.com"
40+
DRY_RUN: "false"
41+
run: |
42+
# Make script executable and run it
43+
chmod +x ./scripts/demote-channel-releases.sh
44+
./scripts/demote-channel-releases.sh

.github/workflows/image-deps-updater.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
uses: actions/checkout@v4
6464

6565
- name: Download buildtools artifact
66-
uses: actions/download-artifact@v4
66+
uses: actions/download-artifact@v5
6767
with:
6868
name: buildtools
6969
path: output/bin

.github/workflows/image-scan.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
cache-dependency-path: "**/*.sum"
8585

8686
- name: Download buildtools artifact
87-
uses: actions/download-artifact@v4
87+
uses: actions/download-artifact@v5
8888
with:
8989
name: buildtools
9090
path: output/bin

.github/workflows/release-prod.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ jobs:
158158
- uses: imjasonh/setup-crane@v0.4
159159

160160
- name: Download buildtools artifact
161-
uses: actions/download-artifact@v4
161+
uses: actions/download-artifact@v5
162162
with:
163163
name: buildtools
164164
path: output/bin
@@ -434,7 +434,7 @@ jobs:
434434
- embedded-cluster-release-builder
435435
steps:
436436
- name: Download embedded-cluster-release-builder
437-
uses: actions/download-artifact@v4
437+
uses: actions/download-artifact@v5
438438
with:
439439
name: embedded-cluster-release-builder
440440
path: output/bin
@@ -510,7 +510,7 @@ jobs:
510510
- name: Checkout
511511
uses: actions/checkout@v4
512512
- name: Download binary
513-
uses: actions/download-artifact@v4
513+
uses: actions/download-artifact@v5
514514
with:
515515
name: current-release
516516
path: output/bin
@@ -595,7 +595,7 @@ jobs:
595595
- name: Checkout
596596
uses: actions/checkout@v4
597597
- name: Download current binary
598-
uses: actions/download-artifact@v4
598+
uses: actions/download-artifact@v5
599599
with:
600600
name: current-release
601601
path: output/bin

.github/workflows/update-addons.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- name: Check out repo
5252
uses: actions/checkout@v4
5353
- name: Download buildtools artifact
54-
uses: actions/download-artifact@v4
54+
uses: actions/download-artifact@v5
5555
with:
5656
name: buildtools
5757
path: output/bin

api/controllers/app/install/controller.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type Controller interface {
2525
GetAppPreflightStatus(ctx context.Context) (types.Status, error)
2626
GetAppPreflightOutput(ctx context.Context) (*types.PreflightsOutput, error)
2727
GetAppPreflightTitles(ctx context.Context) ([]string, error)
28-
InstallApp(ctx context.Context) error
28+
InstallApp(ctx context.Context, ignoreAppPreflights bool) error
2929
GetAppInstallStatus(ctx context.Context) (types.AppInstall, error)
3030
}
3131

@@ -159,6 +159,7 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
159159
if controller.appPreflightManager == nil {
160160
controller.appPreflightManager = apppreflightmanager.NewAppPreflightManager(
161161
apppreflightmanager.WithLogger(controller.logger),
162+
apppreflightmanager.WithAppPreflightStore(controller.store.AppPreflightStore()),
162163
)
163164
}
164165

@@ -181,6 +182,7 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
181182
appinstallmanager.WithReleaseData(controller.releaseData),
182183
appinstallmanager.WithClusterID(controller.clusterID),
183184
appinstallmanager.WithAirgapBundle(controller.airgapBundle),
185+
appinstallmanager.WithAppInstallStore(controller.store.AppInstallStore()),
184186
)
185187
if err != nil {
186188
return nil, fmt.Errorf("create app install manager: %w", err)

api/controllers/app/install/controller_mock.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ func (m *MockController) GetAppPreflightTitles(ctx context.Context) ([]string, e
6969
}
7070

7171
// InstallApp mocks the InstallApp method
72-
func (m *MockController) InstallApp(ctx context.Context) error {
73-
args := m.Called(ctx)
72+
func (m *MockController) InstallApp(ctx context.Context, ignoreAppPreflights bool) error {
73+
args := m.Called(ctx, ignoreAppPreflights)
7474
return args.Error(0)
7575
}
7676

api/controllers/app/install/install.go

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@ package install
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"runtime/debug"
78

89
states "github.com/replicatedhq/embedded-cluster/api/internal/states/install"
910
"github.com/replicatedhq/embedded-cluster/api/types"
1011
)
1112

13+
var (
14+
ErrAppPreflightChecksFailed = errors.New("app preflight checks failed")
15+
)
16+
1217
// InstallApp triggers app installation with proper state transitions and panic handling
13-
func (c *InstallController) InstallApp(ctx context.Context) (finalErr error) {
18+
func (c *InstallController) InstallApp(ctx context.Context, ignoreAppPreflights bool) (finalErr error) {
1419
lock, err := c.stateMachine.AcquireLock()
1520
if err != nil {
1621
return types.NewConflictError(err)
@@ -25,6 +30,18 @@ func (c *InstallController) InstallApp(ctx context.Context) (finalErr error) {
2530
}
2631
}()
2732

33+
// Check if app preflights have failed and if we should ignore them
34+
if c.stateMachine.CurrentState() == states.StateAppPreflightsFailed {
35+
allowIgnoreAppPreflights := true // TODO: implement once we check for strict app preflights
36+
if !ignoreAppPreflights || !allowIgnoreAppPreflights {
37+
return types.NewBadRequestError(ErrAppPreflightChecksFailed)
38+
}
39+
err = c.stateMachine.Transition(lock, states.StateAppPreflightsFailedBypassed)
40+
if err != nil {
41+
return fmt.Errorf("failed to transition states: %w", err)
42+
}
43+
}
44+
2845
if err := c.stateMachine.ValidateTransition(lock, states.StateAppInstalling); err != nil {
2946
return types.NewConflictError(err)
3047
}
@@ -48,21 +65,18 @@ func (c *InstallController) InstallApp(ctx context.Context) (finalErr error) {
4865

4966
defer func() {
5067
if r := recover(); r != nil {
51-
finalErr = fmt.Errorf("panic installing app: %v: %s", r, string(debug.Stack()))
68+
finalErr = fmt.Errorf("panic: %v: %s", r, string(debug.Stack()))
5269
}
53-
// Handle errors from app installation
5470
if finalErr != nil {
5571
c.logger.Error(finalErr)
5672

5773
if err := c.stateMachine.Transition(lock, states.StateAppInstallFailed); err != nil {
5874
c.logger.Errorf("failed to transition states: %w", err)
5975
}
60-
return
61-
}
62-
63-
// Transition to succeeded state on successful app installation
64-
if err := c.stateMachine.Transition(lock, states.StateSucceeded); err != nil {
65-
c.logger.Errorf("failed to transition states: %w", err)
76+
} else {
77+
if err := c.stateMachine.Transition(lock, states.StateSucceeded); err != nil {
78+
c.logger.Errorf("failed to transition states: %w", err)
79+
}
6680
}
6781
}()
6882

@@ -78,23 +92,6 @@ func (c *InstallController) InstallApp(ctx context.Context) (finalErr error) {
7892
return nil
7993
}
8094

81-
// TODO: remove this once we have endpoints to trigger app installation and report status
82-
// and the app installation is decoupled from the infra installation
83-
func (c *InstallController) InstallAppNoState(ctx context.Context) error {
84-
// Get config values for app installation
85-
configValues, err := c.appConfigManager.GetKotsadmConfigValues()
86-
if err != nil {
87-
return fmt.Errorf("get kotsadm config values for app install: %w", err)
88-
}
89-
90-
// Install the app using the app install manager
91-
if err := c.appInstallManager.Install(ctx, configValues); err != nil {
92-
return fmt.Errorf("install app: %w", err)
93-
}
94-
95-
return nil
96-
}
97-
9895
func (c *InstallController) GetAppInstallStatus(ctx context.Context) (types.AppInstall, error) {
9996
return c.appInstallManager.GetStatus()
10097
}

0 commit comments

Comments
 (0)