Skip to content

Commit eecc4d3

Browse files
committed
Merge remote-tracking branch 'origin/main' into k0s-1-29
2 parents a7a5093 + 4e008d4 commit eecc4d3

File tree

76 files changed

+1486
-812
lines changed

Some content is hidden

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

76 files changed

+1486
-812
lines changed

.github/workflows/ci.yaml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ jobs:
6262
int-tests:
6363
name: Integration tests
6464
runs-on: ubuntu-latest
65+
needs:
66+
- int-tests-kind
67+
- int-tests-manager
68+
steps:
69+
- name: Succeed if all tests passed
70+
run: echo "Integration tests succeeded"
71+
72+
int-tests-kind:
73+
name: Integration tests (kind)
74+
runs-on: ubuntu-latest
6575
steps:
6676
- name: Checkout
6777
uses: actions/checkout@v4
@@ -77,7 +87,22 @@ jobs:
7787
sudo mv ./kind /usr/local/bin/kind
7888
- name: Run tests
7989
run: |
80-
make -C tests/integration test
90+
make -C tests/integration test-kind
91+
92+
int-tests-manager:
93+
name: Integration tests (manager)
94+
runs-on: ubuntu-latest
95+
steps:
96+
- name: Checkout
97+
uses: actions/checkout@v4
98+
- name: Setup go
99+
uses: actions/setup-go@v5
100+
with:
101+
go-version-file: go.mod
102+
cache-dependency-path: "**/*.sum"
103+
- name: Run tests
104+
run: |
105+
make -C tests/integration test-manager
81106
82107
dryrun-tests:
83108
name: Dryrun tests

.gitignore

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
bundle
2-
pkg/goods/bins/*
3-
!pkg/goods/bins/.placeholder
4-
pkg/goods/internal/bins/*
5-
!pkg/goods/internal/bins/.placeholder
6-
pkg/goods/images
2+
cmd/installer/goods/bins/*
3+
!cmd/installer/goods/bins/.placeholder
4+
cmd/installer/goods/internal/bins/*
5+
!cmd/installer/goods/internal/bins/.placeholder
6+
cmd/installer/goods/images
77
.pre-commit-config.yaml
88
vendor
99
e2e/kots-release-install/license.yaml
@@ -24,3 +24,6 @@ preflightbundle*
2424

2525
hack/release.tgz
2626
hack/release
27+
28+
# Test binary, built with `go test -c`
29+
*.test

Makefile

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ default: build-ttl.sh
6969
split-hyphen = $(word $2,$(subst -, ,$1))
7070
random-string = $(shell LC_ALL=C tr -dc 'A-Za-z0-9' < /dev/urandom | head -c6)
7171

72-
.PHONY: pkg/goods/bins/k0s
73-
pkg/goods/bins/k0s:
72+
.PHONY: cmd/installer/goods/bins/k0s
73+
cmd/installer/goods/bins/k0s:
7474
$(MAKE) output/bins/k0s-$(K0S_VERSION)-$(ARCH)
75-
mkdir -p pkg/goods/bins
75+
mkdir -p cmd/installer/goods/bins
7676
cp output/bins/k0s-$(K0S_VERSION)-$(ARCH) $@
7777

7878
output/bins/k0s-%:
@@ -85,10 +85,10 @@ output/bins/k0s-%:
8585
chmod +x $@
8686
touch $@
8787

88-
.PHONY: pkg/goods/bins/kubectl-support_bundle
89-
pkg/goods/bins/kubectl-support_bundle:
88+
.PHONY: cmd/installer/goods/bins/kubectl-support_bundle
89+
cmd/installer/goods/bins/kubectl-support_bundle:
9090
$(MAKE) output/bins/kubectl-support_bundle-$(TROUBLESHOOT_VERSION)-$(ARCH)
91-
mkdir -p pkg/goods/bins
91+
mkdir -p cmd/installer/goods/bins
9292
cp output/bins/kubectl-support_bundle-$(TROUBLESHOOT_VERSION)-$(ARCH) $@
9393

9494
output/bins/kubectl-support_bundle-%:
@@ -100,10 +100,10 @@ output/bins/kubectl-support_bundle-%:
100100
rm -rf output/tmp
101101
touch $@
102102

103-
.PHONY: pkg/goods/bins/kubectl-preflight
104-
pkg/goods/bins/kubectl-preflight:
103+
.PHONY: cmd/installer/goods/bins/kubectl-preflight
104+
cmd/installer/goods/bins/kubectl-preflight:
105105
$(MAKE) output/bins/kubectl-preflight-$(TROUBLESHOOT_VERSION)-$(ARCH)
106-
mkdir -p pkg/goods/bins
106+
mkdir -p cmd/installer/goods/bins
107107
cp output/bins/kubectl-preflight-$(TROUBLESHOOT_VERSION)-$(ARCH) $@
108108

109109
output/bins/kubectl-preflight-%:
@@ -115,9 +115,9 @@ output/bins/kubectl-preflight-%:
115115
rm -rf output/tmp
116116
touch $@
117117

118-
.PHONY: pkg/goods/bins/local-artifact-mirror
119-
pkg/goods/bins/local-artifact-mirror:
120-
mkdir -p pkg/goods/bins
118+
.PHONY: cmd/installer/goods/bins/local-artifact-mirror
119+
cmd/installer/goods/bins/local-artifact-mirror:
120+
mkdir -p cmd/installer/goods/bins
121121
$(MAKE) -C local-artifact-mirror build OS=$(OS) ARCH=$(ARCH)
122122
cp local-artifact-mirror/bin/local-artifact-mirror-$(OS)-$(ARCH) $@
123123
touch $@
@@ -134,24 +134,24 @@ output/bins/fio-%:
134134
docker rm -f fio
135135
touch $@
136136

137-
.PHONY: pkg/goods/bins/fio
138-
pkg/goods/bins/fio:
137+
.PHONY: cmd/installer/goods/bins/fio
138+
cmd/installer/goods/bins/fio:
139139
ifneq ($(DISABLE_FIO_BUILD),1)
140140
$(MAKE) output/bins/fio-$(FIO_VERSION)-$(ARCH)
141-
mkdir -p pkg/goods/bins
141+
mkdir -p cmd/installer/goods/bins
142142
cp output/bins/fio-$(FIO_VERSION)-$(ARCH) $@
143143
endif
144144

145-
.PHONY: pkg/goods/bins/manager
146-
pkg/goods/bins/manager:
147-
mkdir -p pkg/goods/bins
148-
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o output/bins/manager ./cmd/manager
145+
.PHONY: cmd/installer/goods/bins/manager
146+
cmd/installer/goods/bins/manager:
147+
mkdir -p cmd/installer/goods/bins
148+
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -ldflags="-s -w $(LD_FLAGS) -extldflags=-static" -o output/bins/manager ./cmd/manager
149149
cp output/bins/manager $@
150150
touch $@
151151

152-
.PHONY: pkg/goods/internal/bins/kubectl-kots
153-
pkg/goods/internal/bins/kubectl-kots:
154-
mkdir -p pkg/goods/internal/bins
152+
.PHONY: cmd/installer/goods/internal/bins/kubectl-kots
153+
cmd/installer/goods/internal/bins/kubectl-kots:
154+
mkdir -p cmd/installer/goods/internal/bins
155155
if [ "$(KOTS_BINARY_URL_OVERRIDE)" != "" ]; then \
156156
$(MAKE) output/bins/kubectl-kots-override ; \
157157
cp output/bins/kubectl-kots-override $@ ; \
@@ -189,6 +189,7 @@ output/bin/embedded-cluster-release-builder:
189189
initial-release: export EC_VERSION = $(VERSION)-$(CURRENT_USER)
190190
initial-release: export APP_VERSION = appver-dev-$(call random-string)
191191
initial-release: export RELEASE_YAML_DIR = e2e/kots-release-install
192+
initial-release: export V2_ENABLED = 0
192193
initial-release: check-env-EC_VERSION check-env-APP_VERSION
193194
UPLOAD_BINARIES=0 \
194195
./scripts/build-and-release.sh
@@ -205,6 +206,7 @@ rebuild-release: check-env-EC_VERSION check-env-APP_VERSION
205206
upgrade-release: RANDOM_STRING = $(call random-string)
206207
upgrade-release: export EC_VERSION = $(VERSION)-$(CURRENT_USER)-upgrade-$(RANDOM_STRING)
207208
upgrade-release: export APP_VERSION = appver-dev-$(call random-string)-upgrade-$(RANDOM_STRING)
209+
upgrade-release: export V2_ENABLED = 0
208210
upgrade-release: check-env-EC_VERSION check-env-APP_VERSION
209211
UPLOAD_BINARIES=1 \
210212
RELEASE_YAML_DIR=e2e/kots-release-upgrade \
@@ -216,24 +218,24 @@ go.mod: Makefile
216218
go mod tidy
217219

218220
.PHONY: static
219-
static: pkg/goods/bins/k0s \
220-
pkg/goods/bins/kubectl-preflight \
221-
pkg/goods/bins/kubectl-support_bundle \
222-
pkg/goods/bins/local-artifact-mirror \
223-
pkg/goods/bins/fio \
224-
pkg/goods/bins/manager \
225-
pkg/goods/internal/bins/kubectl-kots
221+
static: cmd/installer/goods/bins/k0s \
222+
cmd/installer/goods/bins/kubectl-preflight \
223+
cmd/installer/goods/bins/kubectl-support_bundle \
224+
cmd/installer/goods/bins/local-artifact-mirror \
225+
cmd/installer/goods/bins/fio \
226+
cmd/installer/goods/bins/manager \
227+
cmd/installer/goods/internal/bins/kubectl-kots
226228

227229
.PHONY: static-dryrun
228230
static-dryrun:
229-
@mkdir -p pkg/goods/bins pkg/goods/internal/bins
230-
@touch pkg/goods/bins/k0s \
231-
pkg/goods/bins/kubectl-preflight \
232-
pkg/goods/bins/kubectl-support_bundle \
233-
pkg/goods/bins/local-artifact-mirror \
234-
pkg/goods/bins/fio \
235-
pkg/goods/bins/manager \
236-
pkg/goods/internal/bins/kubectl-kots
231+
@mkdir -p cmd/installer/goods/bins cmd/installer/goods/internal/bins
232+
@touch cmd/installer/goods/bins/k0s \
233+
cmd/installer/goods/bins/kubectl-preflight \
234+
cmd/installer/goods/bins/kubectl-support_bundle \
235+
cmd/installer/goods/bins/local-artifact-mirror \
236+
cmd/installer/goods/bins/fio \
237+
cmd/installer/goods/bins/manager \
238+
cmd/installer/goods/internal/bins/kubectl-kots
237239

238240
.PHONY: embedded-cluster-linux-amd64
239241
embedded-cluster-linux-amd64: export OS = linux
@@ -270,8 +272,8 @@ envtest:
270272

271273
.PHONY: unit-tests
272274
unit-tests: envtest
273-
mkdir -p pkg/goods/bins pkg/goods/internal/bins
274-
touch pkg/goods/bins/BUILD pkg/goods/internal/bins/BUILD # compilation will fail if no files are present
275+
mkdir -p cmd/installer/goods/bins cmd/installer/goods/internal/bins
276+
touch cmd/installer/goods/bins/BUILD cmd/installer/goods/internal/bins/BUILD # compilation will fail if no files are present
275277
KUBEBUILDER_ASSETS="$(shell ./operator/bin/setup-envtest use $(ENVTEST_K8S_VERSION) --bin-dir $(shell pwd)/operator/bin -p path)" \
276278
go test -tags exclude_graphdriver_btrfs -v ./pkg/... ./cmd/...
277279
$(MAKE) -C operator test
@@ -303,8 +305,8 @@ build-ttl.sh:
303305
.PHONY: clean
304306
clean:
305307
rm -rf output
306-
rm -rf pkg/goods/bins/*
307-
rm -rf pkg/goods/internal/bins/*
308+
rm -rf cmd/installer/goods/bins/*
309+
rm -rf cmd/installer/goods/internal/bins/*
308310
rm -rf build
309311
rm -rf bin
310312

@@ -327,8 +329,8 @@ scan:
327329

328330
.PHONY: buildtools
329331
buildtools:
330-
mkdir -p pkg/goods/bins pkg/goods/internal/bins
331-
touch pkg/goods/bins/BUILD pkg/goods/internal/bins/BUILD # compilation will fail if no files are present
332+
mkdir -p cmd/installer/goods/bins cmd/installer/goods/internal/bins
333+
touch cmd/installer/goods/bins/BUILD cmd/installer/goods/internal/bins/BUILD # compilation will fail if no files are present
332334
go build -tags exclude_graphdriver_btrfs -o ./output/bin/buildtools ./cmd/buildtools
333335

334336
.PHONY: list-distros
@@ -371,7 +373,7 @@ delete-node%:
371373
@dev/scripts/down.sh $*
372374

373375
.PHONY: test-lam-e2e
374-
test-lam-e2e: pkg/goods/bins/local-artifact-mirror
376+
test-lam-e2e: cmd/installer/goods/bins/local-artifact-mirror
375377
sudo go test ./cmd/local-artifact-mirror/e2e/... -v
376378

377379
.PHONY: bin/installer

cmd/installer/cli/adminconsole_resetpassword.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"os"
77

8-
"github.com/replicatedhq/embedded-cluster/pkg/kotscli"
8+
"github.com/replicatedhq/embedded-cluster/cmd/installer/kotscli"
99
rcutil "github.com/replicatedhq/embedded-cluster/pkg/runtimeconfig/util"
1010
"github.com/sirupsen/logrus"
1111
"github.com/spf13/cobra"

cmd/installer/cli/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"time"
1212

1313
k0sconfig "github.com/k0sproject/k0s/pkg/apis/k0s/v1beta1"
14+
"github.com/replicatedhq/embedded-cluster/cmd/installer/goods"
1415
eckinds "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
1516
ecv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
1617
"github.com/replicatedhq/embedded-cluster/kinds/types"
@@ -21,7 +22,6 @@ import (
2122
"github.com/replicatedhq/embedded-cluster/pkg/config"
2223
"github.com/replicatedhq/embedded-cluster/pkg/configutils"
2324
"github.com/replicatedhq/embedded-cluster/pkg/dryrun"
24-
"github.com/replicatedhq/embedded-cluster/pkg/goods"
2525
"github.com/replicatedhq/embedded-cluster/pkg/helpers"
2626
"github.com/replicatedhq/embedded-cluster/pkg/helpers/systemd"
2727
"github.com/replicatedhq/embedded-cluster/pkg/k0s"

cmd/installer/cli/install2.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import (
99

1010
k0sconfig "github.com/k0sproject/k0s/pkg/apis/k0s/v1beta1"
1111
k0sv1beta1 "github.com/k0sproject/k0s/pkg/apis/k0s/v1beta1"
12+
"github.com/replicatedhq/embedded-cluster/cmd/installer/kotscli"
1213
ecv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
1314
"github.com/replicatedhq/embedded-cluster/pkg/addons2"
1415
"github.com/replicatedhq/embedded-cluster/pkg/configutils"
1516
"github.com/replicatedhq/embedded-cluster/pkg/extensions"
1617
"github.com/replicatedhq/embedded-cluster/pkg/helpers"
1718
"github.com/replicatedhq/embedded-cluster/pkg/k0s"
18-
"github.com/replicatedhq/embedded-cluster/pkg/kotscli"
1919
"github.com/replicatedhq/embedded-cluster/pkg/kubeutils"
2020
"github.com/replicatedhq/embedded-cluster/pkg/metrics"
2121
"github.com/replicatedhq/embedded-cluster/pkg/netutils"
@@ -24,6 +24,7 @@ import (
2424
"github.com/replicatedhq/embedded-cluster/pkg/release"
2525
"github.com/replicatedhq/embedded-cluster/pkg/runtimeconfig"
2626
"github.com/replicatedhq/embedded-cluster/pkg/spinner"
27+
"github.com/replicatedhq/embedded-cluster/pkg/support"
2728
kotsv1beta1 "github.com/replicatedhq/kotskinds/apis/kots/v1beta1"
2829
"github.com/sirupsen/logrus"
2930
"github.com/spf13/cobra"
@@ -250,6 +251,16 @@ func runInstall2(cmd *cobra.Command, args []string, name string, flags Install2C
250251
ConfigValuesFile: flags.configValues,
251252
ServiceCIDR: flags.cidrCfg.ServiceCIDR,
252253
DisasterRecoveryEnabled: disasterRecoveryEnabled,
254+
KotsInstaller: func(msg *spinner.MessageWriter) error {
255+
opts := kotscli.InstallOptions{
256+
AppSlug: flags.license.Spec.AppSlug,
257+
LicenseFile: flags.licenseFile,
258+
Namespace: runtimeconfig.KotsadmNamespace,
259+
AirgapBundle: flags.airgapBundle,
260+
ConfigValuesFile: flags.configValues,
261+
}
262+
return kotscli.Install(opts, msg)
263+
},
253264
}); err != nil {
254265
metrics.ReportApplyFinished(cmd.Context(), "", flags.license, err)
255266
return err
@@ -267,7 +278,7 @@ func runInstall2(cmd *cobra.Command, args []string, name string, flags Install2C
267278
return err
268279
}
269280

270-
if err = kotscli.CreateHostSupportBundle(); err != nil {
281+
if err = support.CreateHostSupportBundle(); err != nil {
271282
logrus.Warnf("unable to create host support bundle: %v", err)
272283
}
273284

cmd/installer/cli/install_runpreflights.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import (
88
"strings"
99
"time"
1010

11+
"github.com/replicatedhq/embedded-cluster/cmd/installer/goods"
12+
"github.com/replicatedhq/embedded-cluster/cmd/installer/kotscli"
1113
ecv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
1214
"github.com/replicatedhq/embedded-cluster/pkg/addons"
1315
"github.com/replicatedhq/embedded-cluster/pkg/airgap"
1416
"github.com/replicatedhq/embedded-cluster/pkg/configutils"
1517
"github.com/replicatedhq/embedded-cluster/pkg/dryrun"
16-
"github.com/replicatedhq/embedded-cluster/pkg/goods"
1718
"github.com/replicatedhq/embedded-cluster/pkg/helpers"
1819
"github.com/replicatedhq/embedded-cluster/pkg/metrics"
1920
"github.com/replicatedhq/embedded-cluster/pkg/preflights"
@@ -279,7 +280,17 @@ func getAddonsApplier(cmd *cobra.Command, opts addonsApplierOpts, adminConsolePw
279280
}
280281

281282
addonOpts = append(addonOpts, addons.WithLicense(license))
282-
addonOpts = append(addonOpts, addons.WithLicenseFile(opts.license))
283+
284+
addonOpts = append(addonOpts, addons.WithKotsInstaller(func(msg *spinner.MessageWriter) error {
285+
opts := kotscli.InstallOptions{
286+
AppSlug: license.Spec.AppSlug,
287+
LicenseFile: opts.license,
288+
Namespace: runtimeconfig.KotsadmNamespace,
289+
AirgapBundle: opts.airgapBundle,
290+
ConfigValuesFile: opts.configValues,
291+
}
292+
return kotscli.Install(opts, msg)
293+
}))
283294
}
284295

285296
if opts.airgapBundle != "" {

cmd/installer/cli/materialize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"fmt"
66
"os"
77

8+
"github.com/replicatedhq/embedded-cluster/cmd/installer/goods"
89
ecv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
9-
"github.com/replicatedhq/embedded-cluster/pkg/goods"
1010
"github.com/replicatedhq/embedded-cluster/pkg/runtimeconfig"
1111
"github.com/spf13/cobra"
1212
)

cmd/installer/cli/restore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/aws/aws-sdk-go/aws/session"
1818
"github.com/aws/aws-sdk-go/service/s3"
1919
k0sv1beta1 "github.com/k0sproject/k0s/pkg/apis/k0s/v1beta1"
20+
"github.com/replicatedhq/embedded-cluster/cmd/installer/kotscli"
2021
ecv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
2122
"github.com/replicatedhq/embedded-cluster/pkg/addons"
2223
"github.com/replicatedhq/embedded-cluster/pkg/addons/adminconsole"
@@ -28,7 +29,6 @@ import (
2829
"github.com/replicatedhq/embedded-cluster/pkg/disasterrecovery"
2930
"github.com/replicatedhq/embedded-cluster/pkg/helpers"
3031
"github.com/replicatedhq/embedded-cluster/pkg/k0s"
31-
"github.com/replicatedhq/embedded-cluster/pkg/kotscli"
3232
"github.com/replicatedhq/embedded-cluster/pkg/kubeutils"
3333
"github.com/replicatedhq/embedded-cluster/pkg/netutils"
3434
"github.com/replicatedhq/embedded-cluster/pkg/prompts"

cmd/installer/cli/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"os"
77

8-
"github.com/replicatedhq/embedded-cluster/pkg/kotscli"
8+
"github.com/replicatedhq/embedded-cluster/cmd/installer/kotscli"
99
"github.com/replicatedhq/embedded-cluster/pkg/release"
1010
"github.com/replicatedhq/embedded-cluster/pkg/runtimeconfig"
1111
rcutil "github.com/replicatedhq/embedded-cluster/pkg/runtimeconfig/util"

0 commit comments

Comments
 (0)