Skip to content

Commit f6a66fd

Browse files
authored
Respect the EC multi-node license option (#2097)
1 parent 6b4ea54 commit f6a66fd

Some content is hidden

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

44 files changed

+377
-210
lines changed

.github/actions/e2e/action.yml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,6 @@ inputs:
77
is-large-runner:
88
description: 'Whether the test is running on a large runner'
99
required: true
10-
airgap-license-id:
11-
description: 'airgap-enabled license id to use for e2e tests'
12-
required: true
13-
snapshot-license-id:
14-
description: 'snapshot-enabled license id to use for e2e tests'
15-
required: true
16-
snapshot-license:
17-
description: 'snapshot-enabled license (b64) to use for e2e tests'
18-
required: true
19-
license-id:
20-
description: 'license id to use for e2e tests'
21-
required: true
22-
airgap-snapshot-license-id:
23-
description: 'airgap-snapshot-enabled license id to use for e2e tests'
24-
required: true
25-
license:
26-
description: 'license (b64) to use for e2e tests'
27-
required: true
2810
dr-aws-access-key-id:
2911
description: 'Disaster Recovery AWS Access Key ID'
3012
required: true
@@ -96,12 +78,6 @@ runs:
9678
run: |
9779
export SHORT_SHA=${{ inputs.version-specifier }}
9880
echo "${SHORT_SHA}"
99-
export LICENSE_ID=${{ inputs.license-id }}
100-
export AIRGAP_LICENSE_ID=${{ inputs.airgap-license-id }}
101-
export SNAPSHOT_LICENSE_ID=${{ inputs.snapshot-license-id }}
102-
export AIRGAP_SNAPSHOT_LICENSE_ID=${{ inputs.airgap-snapshot-license-id }}
103-
echo "${{ inputs.license }}" | base64 --decode > e2e/license.yaml
104-
echo "${{ inputs.snapshot-license }}" | base64 --decode > e2e/snapshot-license.yaml
10581
export DR_AWS_S3_ENDPOINT=https://s3.amazonaws.com
10682
export DR_AWS_S3_REGION=us-east-1
10783
export DR_AWS_S3_BUCKET=kots-testim-snapshots

.github/workflows/ci.yaml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ jobs:
176176

177177
- uses: oras-project/setup-oras@v1
178178

179+
- uses: imjasonh/[email protected]
180+
179181
- name: Install dagger
180182
run: |
181183
curl -fsSL https://dl.dagger.io/dagger/install.sh | sh
@@ -248,6 +250,8 @@ jobs:
248250

249251
- uses: oras-project/setup-oras@v1
250252

253+
- uses: imjasonh/[email protected]
254+
251255
- name: Install dagger
252256
run: |
253257
curl -fsSL https://dl.dagger.io/dagger/install.sh | sh
@@ -355,6 +359,8 @@ jobs:
355359

356360
- uses: oras-project/setup-oras@v1
357361

362+
- uses: imjasonh/[email protected]
363+
358364
- name: Install dagger
359365
run: |
360366
curl -fsSL https://dl.dagger.io/dagger/install.sh | sh
@@ -682,17 +688,9 @@ jobs:
682688
password: ${{ secrets.DOCKERHUB_PASSWORD }}
683689
- name: Free up runner disk space
684690
uses: ./.github/actions/free-disk-space
685-
- name: Write license files
686-
run: |
687-
echo "${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE }}" | base64 --decode > e2e/license.yaml
688-
echo "${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE }}" | base64 --decode > e2e/snapshot-license.yaml
689691
- name: Run test
690692
env:
691693
SHORT_SHA: dev-${{ needs.git-sha.outputs.git_sha }}
692-
LICENSE_ID: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE_ID }}
693-
AIRGAP_LICENSE_ID: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_LICENSE_ID }}
694-
SNAPSHOT_LICENSE_ID: ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE_ID }}
695-
AIRGAP_SNAPSHOT_LICENSE_ID: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_SNAPSHOT_LICENSE_ID }}
696694
DR_AWS_S3_ENDPOINT: https://s3.amazonaws.com
697695
DR_AWS_S3_REGION: us-east-1
698696
DR_AWS_S3_BUCKET: kots-testim-snapshots
@@ -764,12 +762,6 @@ jobs:
764762
with:
765763
test-name: '${{ matrix.test }}'
766764
is-large-runner: ${{ matrix.runner == 'embedded-cluster-2' }}
767-
airgap-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_LICENSE_ID }}
768-
snapshot-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE_ID }}
769-
snapshot-license: ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE }}
770-
airgap-snapshot-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_SNAPSHOT_LICENSE_ID }}
771-
license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE_ID }}
772-
license: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE }}
773765
dr-aws-access-key-id: ${{ secrets.TESTIM_AWS_ACCESS_KEY_ID }}
774766
dr-aws-secret-access-key: ${{ secrets.TESTIM_AWS_SECRET_ACCESS_KEY }}
775767
k0s-version: ${{ needs.build-current.outputs.k0s_version }}
@@ -807,12 +799,6 @@ jobs:
807799
with:
808800
test-name: '${{ matrix.test }}'
809801
is-large-runner: ${{ matrix.runner == 'embedded-cluster-2' }}
810-
airgap-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_LICENSE_ID }}
811-
snapshot-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE_ID }}
812-
snapshot-license: ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE }}
813-
airgap-snapshot-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_SNAPSHOT_LICENSE_ID }}
814-
license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE_ID }}
815-
license: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE }}
816802
dr-aws-access-key-id: ${{ secrets.TESTIM_AWS_ACCESS_KEY_ID }}
817803
dr-aws-secret-access-key: ${{ secrets.TESTIM_AWS_SECRET_ACCESS_KEY }}
818804
k0s-version: ${{ needs.build-current.outputs.k0s_version }}

.github/workflows/release-prod.yaml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ jobs:
150150

151151
- uses: oras-project/setup-oras@v1
152152

153+
- uses: imjasonh/[email protected]
154+
153155
- name: Download buildtools artifact
154156
uses: actions/download-artifact@v4
155157
with:
@@ -427,7 +429,8 @@ jobs:
427429
path: output/bin
428430
- name: Download current binary
429431
env:
430-
LICENSE_ID: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE_ID }}
432+
# staging ci license id
433+
LICENSE_ID: 2cQCFfBxG7gXDmq1yAgPSM4OViF
431434
run: |
432435
export APP_VERSION="appver-${{ github.ref_name }}"
433436
curl --retry 5 --retry-all-errors -fL -o embedded-cluster-smoke-test-staging-app-ci.tgz "https://ec-e2e-replicated-app.testcluster.net/embedded/embedded-cluster-smoke-test-staging-app/ci/${APP_VERSION}" -H "Authorization: $LICENSE_ID"
@@ -514,17 +517,9 @@ jobs:
514517
password: ${{ secrets.DOCKERHUB_PASSWORD }}
515518
- name: Free up runner disk space
516519
uses: ./.github/actions/free-disk-space
517-
- name: Write license files
518-
run: |
519-
echo "${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE }}" | base64 --decode > e2e/license.yaml
520-
echo "${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE }}" | base64 --decode > e2e/snapshot-license.yaml
521520
- name: Run test
522521
env:
523522
SHORT_SHA: ${{ github.ref_name }}
524-
LICENSE_ID: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE_ID }}
525-
AIRGAP_LICENSE_ID: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_LICENSE_ID }}
526-
SNAPSHOT_LICENSE_ID: ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE_ID }}
527-
AIRGAP_SNAPSHOT_LICENSE_ID: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_SNAPSHOT_LICENSE_ID }}
528523
DR_AWS_S3_ENDPOINT: https://s3.amazonaws.com
529524
DR_AWS_S3_REGION: us-east-1
530525
DR_AWS_S3_BUCKET: kots-testim-snapshots
@@ -598,12 +593,6 @@ jobs:
598593
with:
599594
test-name: '${{ matrix.test }}'
600595
is-large-runner: ${{ matrix.runner == 'embedded-cluster-2' }}
601-
airgap-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_LICENSE_ID }}
602-
snapshot-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE_ID }}
603-
snapshot-license: ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE }}
604-
airgap-snapshot-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_SNAPSHOT_LICENSE_ID }}
605-
license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE_ID }}
606-
license: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE }}
607596
dr-aws-access-key-id: ${{ secrets.TESTIM_AWS_ACCESS_KEY_ID }}
608597
dr-aws-secret-access-key: ${{ secrets.TESTIM_AWS_SECRET_ACCESS_KEY }}
609598
version-specifier: ${{ github.ref_name }}

Makefile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ PREVIOUS_K0S_GO_VERSION ?= v1.29.9+k0s.0
1717
K0S_BINARY_SOURCE_OVERRIDE =
1818
TROUBLESHOOT_VERSION = v0.117.0
1919

20-
KOTS_VERSION = v$(shell awk '/^version/{print $$2}' pkg/addons/adminconsole/static/metadata.yaml | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
20+
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
2222
KOTS_BINARY_URL_OVERRIDE =
2323
# If KOTS_BINARY_FILE_OVERRIDE is set, there's NO need to update the KOTS_VERSION above as it will be dynamically generated
@@ -68,6 +68,7 @@ export PATH := $(shell pwd)/bin:$(PATH)
6868
default: build-ttl.sh
6969

7070
split-hyphen = $(word $2,$(subst -, ,$1))
71+
split-underscore = $(word $2,$(subst _, ,$1))
7172
random-string = $(shell LC_ALL=C tr -dc 'A-Za-z0-9' < /dev/urandom | head -c6)
7273

7374
.PHONY: cmd/installer/goods/bins/k0s
@@ -158,18 +159,16 @@ cmd/installer/goods/internal/bins/kubectl-kots:
158159
elif [ "$(KOTS_BINARY_FILE_OVERRIDE)" != "" ]; then \
159160
cp $(KOTS_BINARY_FILE_OVERRIDE) $@ ; \
160161
else \
161-
$(MAKE) output/bins/kubectl-kots-$(KOTS_VERSION)-$(ARCH) ; \
162-
cp output/bins/kubectl-kots-$(KOTS_VERSION)-$(ARCH) $@ ; \
162+
$(MAKE) output/bins/kubectl-kots-$(KOTS_VERSION)_$(ARCH) ; \
163+
cp output/bins/kubectl-kots-$(KOTS_VERSION)_$(ARCH) $@ ; \
163164
fi
164165
touch $@
165166

166167
output/bins/kubectl-kots-%:
167168
mkdir -p output/bins
168169
mkdir -p output/tmp
169-
curl --retry 5 --retry-all-errors -fL -o output/tmp/kots.tar.gz \
170-
"https://github.com/replicatedhq/kots/releases/download/$(call split-hyphen,$*,1)/kots_$(OS)_$(call split-hyphen,$*,2).tar.gz"
171-
tar -xzf output/tmp/kots.tar.gz -C output/tmp
172-
mv output/tmp/kots $@
170+
crane export kotsadm/kotsadm:$(call split-underscore,$*,1) --platform linux/$(call split-underscore,$*,2) - | tar -Oxf - kots > $@
171+
chmod +x $@
173172
touch $@
174173

175174
.PHONY: output/bins/kubectl-kots-override

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Additionally, it includes a Registry when deployed in air gap mode, and SeaweedF
2424
- shasum
2525
- jq
2626
- oras
27+
- crane
2728
- Kubectl (for integration tests)
2829
- Kind (for integration tests)
2930

cmd/buildtools/adminconsole.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ var updateAdminConsoleAddonCommand = &cli.Command{
5050
}
5151
logrus.Infof("latest tag found: %s", latest)
5252
latest = strings.TrimPrefix(latest, "v")
53+
latest = strings.Split(latest, "+")[0] // trim the commit sha
5354

5455
current := adminconsole.Metadata
5556
if current.Version == latest && !c.Bool("force") {

cmd/buildtools/utils.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,10 @@ func GetLatestKotsHelmTag(ctx context.Context) (string, error) {
234234
logrus.Infof("tag does not have same prefix: %s", tag.GetName())
235235
break
236236
}
237+
if strings.Contains(tag.GetName(), "-ec.") {
238+
logrus.Infof("tag is a ec tag, returning: %s", tag.GetName())
239+
return tag.GetName(), nil
240+
}
237241
if strings.Contains(tag.GetName(), "-build.") {
238242
logrus.Infof("tag is a build tag, returning: %s", tag.GetName())
239243
return tag.GetName(), nil

cmd/installer/cli/enable_ha.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,5 @@ func runEnableHA(ctx context.Context) error {
9191
loading := spinner.Start()
9292
defer loading.Close()
9393

94-
return addons.EnableHA(ctx, kcli, kclient, hcli, in.Spec.AirGap, in.Spec.Network.ServiceCIDR, in.Spec.Proxy, in.Spec.Config, loading)
94+
return addons.EnableHA(ctx, kcli, kclient, hcli, in.Spec.Network.ServiceCIDR, in.Spec, loading)
9595
}

cmd/installer/cli/install.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,7 @@ func runInstall(ctx context.Context, name string, flags InstallCmdFlags, metrics
318318
errCh := kubeutils.WaitForKubernetes(ctx, kcli)
319319
defer logKubernetesErrors(errCh)
320320

321-
disasterRecoveryEnabled, err := helpers.DisasterRecoveryEnabled(flags.license)
322-
if err != nil {
323-
return fmt.Errorf("unable to check if disaster recovery is enabled: %w", err)
324-
}
325-
326-
in, err := recordInstallation(ctx, kcli, flags, k0sCfg, disasterRecoveryEnabled)
321+
in, err := recordInstallation(ctx, kcli, flags, k0sCfg, flags.license)
327322
if err != nil {
328323
return fmt.Errorf("unable to record installation: %w", err)
329324
}
@@ -380,7 +375,8 @@ func runInstall(ctx context.Context, name string, flags InstallCmdFlags, metrics
380375
Proxy: flags.proxy,
381376
PrivateCAs: flags.privateCAs,
382377
ServiceCIDR: flags.cidrCfg.ServiceCIDR,
383-
DisasterRecoveryEnabled: disasterRecoveryEnabled,
378+
DisasterRecoveryEnabled: flags.license.Spec.IsDisasterRecoverySupported,
379+
IsMultiNodeEnabled: flags.license.Spec.IsEmbeddedClusterMultiNodeEnabled,
384380
EmbeddedConfigSpec: embCfgSpec,
385381
EndUserConfigSpec: euCfgSpec,
386382
KotsInstaller: func(msg *spinner.MessageWriter) error {
@@ -1020,7 +1016,7 @@ func waitForNode(ctx context.Context) error {
10201016
return nil
10211017
}
10221018

1023-
func recordInstallation(ctx context.Context, kcli client.Client, flags InstallCmdFlags, k0sCfg *k0sv1beta1.ClusterConfig, disasterRecoveryEnabled bool) (*ecv1beta1.Installation, error) {
1019+
func recordInstallation(ctx context.Context, kcli client.Client, flags InstallCmdFlags, k0sCfg *k0sv1beta1.ClusterConfig, license *kotsv1beta1.License) (*ecv1beta1.Installation, error) {
10241020
// ensure that the embedded-cluster namespace exists
10251021
if err := createECNamespace(ctx, kcli); err != nil {
10261022
return nil, fmt.Errorf("create embedded-cluster namespace: %w", err)
@@ -1067,7 +1063,8 @@ func recordInstallation(ctx context.Context, kcli client.Client, flags InstallCm
10671063
EndUserK0sConfigOverrides: euOverrides,
10681064
BinaryName: runtimeconfig.BinaryName(),
10691065
LicenseInfo: &ecv1beta1.LicenseInfo{
1070-
IsDisasterRecoverySupported: disasterRecoveryEnabled,
1066+
IsDisasterRecoverySupported: license.Spec.IsDisasterRecoverySupported,
1067+
IsMultiNodeEnabled: license.Spec.IsEmbeddedClusterMultiNodeEnabled,
10711068
},
10721069
},
10731070
}

cmd/installer/cli/join.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,8 @@ func maybeEnableHA(ctx context.Context, kcli client.Client, flags JoinCmdFlags,
578578
kcli,
579579
kclient,
580580
hcli,
581-
flags.isAirgap,
582581
serviceCIDR,
583-
jcmd.InstallationSpec.Proxy,
584-
jcmd.InstallationSpec.Config,
582+
jcmd.InstallationSpec,
585583
loading,
586584
)
587585
}

cmd/installer/cli/restore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ func runRestoreEnableAdminConsoleHA(ctx context.Context, flags InstallCmdFlags,
579579
}
580580
defer hcli.Close()
581581

582-
err = addons.EnableAdminConsoleHA(ctx, kcli, hcli, flags.isAirgap, flags.cidrCfg.ServiceCIDR, flags.proxy, in.Spec.Config)
582+
err = addons.EnableAdminConsoleHA(ctx, kcli, hcli, flags.isAirgap, flags.cidrCfg.ServiceCIDR, flags.proxy, in.Spec.Config, in.Spec.LicenseInfo)
583583
if err != nil {
584584
return err
585585
}

e2e/host-support-bundle_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func TestHostCollectSupportBundleInCluster(t *testing.T) {
1616
T: t,
1717
Nodes: 1,
1818
Distro: "debian-bookworm",
19-
LicensePath: "license.yaml",
19+
LicensePath: "licenses/license.yaml",
2020
ECBinaryPath: "../output/bin/embedded-cluster",
2121
})
2222
defer tc.Cleanup()

0 commit comments

Comments
 (0)