Skip to content

Commit ca9ab68

Browse files
committed
Stop using kots
1 parent f76601b commit ca9ab68

File tree

81 files changed

+5277
-3114
lines changed

Some content is hidden

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

81 files changed

+5277
-3114
lines changed

.github/workflows/ci.yaml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,31 @@ jobs:
267267
with:
268268
go-version-file: go.mod
269269
cache-dependency-path: "**/*.sum"
270-
- name: Free up runner disk space
271-
run: *free-disk-space
270+
- name: Free up runner disk space # this is much faster than .github/actions/free-disk-space
271+
run: |
272+
df -h
273+
sudo rm -rf \
274+
/usr/share/swift \
275+
/usr/share/dotnet \
276+
/usr/lib/jvm \
277+
/usr/local/share/boost \
278+
/usr/local/lib/heroku \
279+
/usr/local/julia* \
280+
/usr/local/.ghcup \
281+
/usr/local/share/powershell \
282+
/usr/local/bin/aliyun \
283+
/usr/local/bin/azcopy \
284+
/usr/local/bin/bicep \
285+
/usr/local/bin/cpack \
286+
/usr/local/bin/hub \
287+
/usr/local/bin/minikube \
288+
/usr/local/bin/packer \
289+
/usr/local/bin/pulumi* \
290+
/usr/local/bin/sam \
291+
/usr/local/bin/stack \
292+
/usr/local/bin/terraform \
293+
/usr/local/bin/oc
294+
df -h
272295
- name: Install kind
273296
uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab
274297
with:
@@ -284,8 +307,6 @@ jobs:
284307
steps:
285308
- name: Checkout
286309
uses: actions/checkout@v6
287-
- name: Free up runner disk space
288-
run: *free-disk-space
289310
- name: Go cache
290311
uses: actions/cache@v4
291312
with:
@@ -435,7 +456,7 @@ jobs:
435456
- name: Checkout
436457
uses: actions/checkout@v6
437458

438-
- name: Free up runner disk space
459+
- name: Free up runner disk space # this is much faster than .github/actions/free-disk-space
439460
run: *free-disk-space
440461

441462
- name: Cache embedded bins
@@ -591,7 +612,7 @@ jobs:
591612
- name: Checkout
592613
uses: actions/checkout@v6
593614

594-
- name: Free up runner disk space
615+
- name: Free up runner disk space # this is much faster than .github/actions/free-disk-space
595616
run: *free-disk-space
596617

597618
- name: Cache embedded bins

.github/workflows/dependencies.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
env:
4646
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4747
run: |
48-
version=$(gh release list --repo helm/helm --json tagName,createdAt | jq -r '.[] | select(.tagName | startswith("v3.")) | .tagName' | head -1)
48+
version=$(gh release list --repo helm/helm --json tagName,isLatest | jq -r '.[] | select(.isLatest) | .tagName')
4949
echo "helm version: $version"
5050
sed -i "/^HELM_VERSION/c\HELM_VERSION = $version" versions.mk
5151

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -476,32 +476,32 @@ dagger call with-one-password --service-account=env:OP_SERVICE_ACCOUNT_TOKEN \
476476
477477
## Releasing
478478
479-
Embedded Cluster maintains support for the current and two previous k8s minor versions, ensuring backward compatibility while supporting the latest features.
480-
All supported versions are released simultaneously from the main branch using a structured tagging approach that combines the application version with the supported k8s version.
479+
Embedded Cluster maintains support for the current and two previous K0s minor versions, ensuring backward compatibility while supporting the latest features.
480+
All supported versions are released simultaneously from the main branch using a structured tagging approach that combines the application version with the supported K0s version.
481481
482482
### Release Tagging Strategy
483483
484-
Releases follow the format: `{APP_VERSION}+k8s-{K0S_MINOR_VERSION}`
484+
Releases follow the format: `{APP_VERSION}+k0s-{K0S_MINOR_VERSION}`
485485
486486
**Examples:**
487-
- `2.10.0+k8s-1.33` - Application version 2.10.0 with k8s 1.33.x support
488-
- `2.10.0+k8s-1.32` - Application version 2.10.0 with k8s 1.32.x support
489-
- `2.10.0+k8s-1.31` - Application version 2.10.0 with k8s 1.31.x support
487+
- `2.10.0+k0s-1.33` - Application version 2.10.0 with K0s 1.33.x support
488+
- `2.10.0+k0s-1.32` - Application version 2.10.0 with K0s 1.32.x support
489+
- `2.10.0+k0s-1.31` - Application version 2.10.0 with K0s 1.31.x support
490490
491491
### Release Process
492492
493493
1. **Prepare the release commit** - Ensure all changes are committed and tested
494-
2. **Create annotated tags** - Tag the same commit with all supported k8s minor versions using annotated tags with descriptive messages:
494+
2. **Create annotated tags** - Tag the same commit with all supported K0s minor versions using annotated tags with descriptive messages:
495495
```bash
496-
# Tag for k8s 1.33.x support
497-
git tag -a 2.10.0+k8s-1.33 -m "Release 2.10.0+k8s-1.33"
498-
git push origin 2.10.0+k8s-1.33
496+
# Tag for K0s 1.33.x support
497+
git tag -a 2.10.0+k0s-1.33 -m "Release 2.10.0+k0s-1.33"
498+
git push origin 2.10.0+k0s-1.33
499499
500-
# Tag for k8s 1.32.x support
501-
git tag -a 2.10.0+k8s-1.32 -m "Release 2.10.0+k8s-1.32"
502-
git push origin 2.10.0+k8s-1.32
500+
# Tag for K0s 1.32.x support
501+
git tag -a 2.10.0+k0s-1.32 -m "Release 2.10.0+k0s-1.32"
502+
git push origin 2.10.0+k0s-1.32
503503
504-
# Tag for k8s 1.31.x support
505-
git tag -a 2.10.0+k8s-1.31 -m "Release 2.10.0+k8s-1.31"
506-
git push origin 2.10.0+k8s-1.31
504+
# Tag for K0s 1.31.x support
505+
git tag -a 2.10.0+k0s-1.31 -m "Release 2.10.0+k0s-1.31"
506+
git push origin 2.10.0+k0s-1.31
507507
```

api/controllers/app/controller.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
kotsv1beta1 "github.com/replicatedhq/kotskinds/apis/kots/v1beta1"
2121
"github.com/sirupsen/logrus"
2222
helmcli "helm.sh/helm/v3/pkg/cli"
23+
"k8s.io/client-go/metadata"
2324
"sigs.k8s.io/controller-runtime/pkg/client"
2425
kyaml "sigs.k8s.io/yaml"
2526
)
@@ -32,7 +33,7 @@ type Controller interface {
3233
GetAppPreflightStatus(ctx context.Context) (types.Status, error)
3334
GetAppPreflightOutput(ctx context.Context) (*types.PreflightsOutput, error)
3435
GetAppPreflightTitles(ctx context.Context) ([]string, error)
35-
InstallApp(ctx context.Context, ignoreAppPreflights bool) error
36+
InstallApp(ctx context.Context, opts InstallAppOptions) error
3637
GetAppInstallStatus(ctx context.Context) (types.AppInstall, error)
3738
UpgradeApp(ctx context.Context, ignoreAppPreflights bool) error
3839
GetAppUpgradeStatus(ctx context.Context) (types.AppUpgrade, error)
@@ -52,6 +53,7 @@ type AppController struct {
5253
releaseData *release.ReleaseData
5354
hcli helm.Client
5455
kcli client.Client
56+
mcli metadata.Interface
5557
preflightRunner preflights.PreflightRunnerInterface
5658
kubernetesEnvSettings *helmcli.EnvSettings
5759
store store.Store
@@ -129,6 +131,12 @@ func WithKubeClient(kcli client.Client) AppControllerOption {
129131
}
130132
}
131133

134+
func WithMetadataClient(mcli metadata.Interface) AppControllerOption {
135+
return func(c *AppController) {
136+
c.mcli = mcli
137+
}
138+
}
139+
132140
func WithKubernetesEnvSettings(envSettings *helmcli.EnvSettings) AppControllerOption {
133141
return func(c *AppController) {
134142
c.kubernetesEnvSettings = envSettings
@@ -262,7 +270,9 @@ func NewAppController(opts ...AppControllerOption) (*AppController, error) {
262270
appinstallmanager.WithAirgapBundle(controller.airgapBundle),
263271
appinstallmanager.WithAppInstallStore(controller.store.AppInstallStore()),
264272
appinstallmanager.WithKubeClient(controller.kcli),
273+
appinstallmanager.WithMetadataClient(controller.mcli),
265274
appinstallmanager.WithKubernetesEnvSettings(controller.kubernetesEnvSettings),
275+
appinstallmanager.WithHelmClient(controller.hcli),
266276
)
267277
if err != nil {
268278
return nil, fmt.Errorf("create app install manager: %w", err)

api/controllers/app/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, ignoreAppPreflights bool) error {
73-
args := m.Called(ctx, ignoreAppPreflights)
72+
func (m *MockController) InstallApp(ctx context.Context, opts InstallAppOptions) error {
73+
args := m.Called(ctx, opts)
7474
return args.Error(0)
7575
}
7676

api/controllers/app/install.go

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,22 @@ import (
99

1010
"github.com/replicatedhq/embedded-cluster/api/internal/states"
1111
"github.com/replicatedhq/embedded-cluster/api/types"
12+
ecv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
1213
)
1314

1415
var (
1516
ErrAppPreflightChecksFailed = errors.New("app preflight checks failed")
1617
)
1718

19+
type InstallAppOptions struct {
20+
IgnoreAppPreflights bool
21+
ProxySpec *ecv1beta1.ProxySpec
22+
RegistrySettings *types.RegistrySettings
23+
HostCABundlePath string
24+
}
25+
1826
// InstallApp triggers app installation with proper state transitions and panic handling
19-
func (c *AppController) InstallApp(ctx context.Context, ignoreAppPreflights bool) (finalErr error) {
27+
func (c *AppController) InstallApp(ctx context.Context, opts InstallAppOptions) (finalErr error) {
2028
logger := c.logger.WithField("operation", "install-app")
2129

2230
lock, err := c.stateMachine.AcquireLock()
@@ -45,7 +53,7 @@ func (c *AppController) InstallApp(ctx context.Context, ignoreAppPreflights bool
4553
}
4654

4755
allowIgnoreAppPreflights := true // TODO: implement if we decide to support a ignore-app-preflights CLI flag for V3
48-
if !ignoreAppPreflights || !allowIgnoreAppPreflights {
56+
if !opts.IgnoreAppPreflights || !allowIgnoreAppPreflights {
4957
return types.NewBadRequestError(ErrAppPreflightChecksFailed)
5058
}
5159

@@ -60,9 +68,15 @@ func (c *AppController) InstallApp(ctx context.Context, ignoreAppPreflights bool
6068
}
6169

6270
// Get config values for app installation
63-
configValues, err := c.appConfigManager.GetKotsadmConfigValues()
71+
appConfigValues, err := c.GetAppConfigValues(ctx)
72+
if err != nil {
73+
return fmt.Errorf("get app config values for app install: %w", err)
74+
}
75+
76+
// Extract installable Helm charts from release manager
77+
installableCharts, err := c.appReleaseManager.ExtractInstallableHelmCharts(ctx, appConfigValues, opts.ProxySpec, opts.RegistrySettings)
6478
if err != nil {
65-
return fmt.Errorf("get kotsadm config values for app install: %w", err)
79+
return fmt.Errorf("extract installable helm charts: %w", err)
6680
}
6781

6882
err = c.stateMachine.Transition(lock, states.StateAppInstalling, nil)
@@ -97,8 +111,8 @@ func (c *AppController) InstallApp(ctx context.Context, ignoreAppPreflights bool
97111
return fmt.Errorf("set status to running: %w", err)
98112
}
99113

100-
// Install the app
101-
err := c.appInstallManager.Install(ctx, configValues)
114+
// Install the app with installable charts
115+
err = c.appInstallManager.Install(ctx, installableCharts, opts.RegistrySettings, opts.HostCABundlePath)
102116
if err != nil {
103117
return fmt.Errorf("install app: %w", err)
104118
}

0 commit comments

Comments
 (0)