Skip to content

Commit 9556c9d

Browse files
committed
Merge remote-tracking branch 'origin/main' into k0s-1-29
2 parents 7f94395 + 04e7357 commit 9556c9d

File tree

176 files changed

+7381
-5826
lines changed

Some content is hidden

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

176 files changed

+7381
-5826
lines changed

.github/workflows/ci.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ jobs:
181181
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
182182
run: |
183183
export K0S_VERSION=$(make print-K0S_VERSION)
184-
export EC_VERSION=$(git describe --tags --match='[0-9]*.[0-9]*.[0-9]*')
184+
export EC_VERSION=$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')
185185
export SHORT_SHA=dev-${{ needs.git-sha.outputs.git_sha }}
186186
export APP_VERSION=appver-dev-${{ needs.git-sha.outputs.git_sha }}
187187
# avoid rate limiting
@@ -254,7 +254,7 @@ jobs:
254254
run: |
255255
export K0S_VERSION=$(make print-PREVIOUS_K0S_VERSION)
256256
export K0S_GO_VERSION=$(make print-PREVIOUS_K0S_GO_VERSION)
257-
export EC_VERSION=$(git describe --tags --match='[0-9]*.[0-9]*.[0-9]*')-previous-k0s
257+
export EC_VERSION=$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')-previous-k0s
258258
export APP_VERSION=appver-dev-${{ needs.git-sha.outputs.git_sha }}-previous-k0s
259259
# avoid rate limiting
260260
export FIO_VERSION=$(gh release list --repo axboe/fio --json tagName,isLatest | jq -r '.[] | select(.isLatest==true)|.tagName' | cut -d- -f2)
@@ -357,7 +357,7 @@ jobs:
357357
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
358358
run: |
359359
export K0S_VERSION=$(make print-K0S_VERSION)
360-
export EC_VERSION=$(git describe --tags --match='[0-9]*.[0-9]*.[0-9]*')-upgrade
360+
export EC_VERSION=$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')-upgrade
361361
export APP_VERSION=appver-dev-${{ needs.git-sha.outputs.git_sha }}-upgrade
362362
# avoid rate limiting
363363
export FIO_VERSION=$(gh release list --repo axboe/fio --json tagName,isLatest | jq -r '.[] | select(.isLatest==true)|.tagName' | cut -d- -f2)
@@ -481,25 +481,25 @@ jobs:
481481
./scripts/ci-release-app.sh
482482
483483
# install the previous k0s version to ensure an upgrade occurs
484-
export EC_VERSION="$(git describe --tags --match='[0-9]*.[0-9]*.[0-9]*')-previous-k0s"
484+
export EC_VERSION="$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')-previous-k0s"
485485
export APP_VERSION="appver-${SHORT_SHA}-previous-k0s"
486486
export RELEASE_YAML_DIR=e2e/kots-release-install
487487
./scripts/ci-release-app.sh
488488
489489
# then install the current k0s version
490-
export EC_VERSION="$(git describe --tags --match='[0-9]*.[0-9]*.[0-9]*')"
490+
export EC_VERSION="$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')"
491491
export APP_VERSION="appver-${SHORT_SHA}"
492492
export RELEASE_YAML_DIR=e2e/kots-release-install
493493
./scripts/ci-release-app.sh
494494
495495
# then a noop upgrade
496-
export EC_VERSION="$(git describe --tags --match='[0-9]*.[0-9]*.[0-9]*')"
496+
export EC_VERSION="$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')"
497497
export APP_VERSION="appver-${SHORT_SHA}-noop"
498498
export RELEASE_YAML_DIR=e2e/kots-release-install
499499
./scripts/ci-release-app.sh
500500
501501
# and finally an app upgrade
502-
export EC_VERSION="$(git describe --tags --match='[0-9]*.[0-9]*.[0-9]*')-upgrade"
502+
export EC_VERSION="$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')-upgrade"
503503
export APP_VERSION="appver-${SHORT_SHA}-upgrade"
504504
export RELEASE_YAML_DIR=e2e/kots-release-upgrade
505505
./scripts/ci-release-app.sh
@@ -521,19 +521,19 @@ jobs:
521521
./scripts/ci-release-app.sh
522522
523523
# install the previous k0s version to ensure an upgrade occurs
524-
export EC_VERSION="$(git describe --tags --match='[0-9]*.[0-9]*.[0-9]*')-previous-k0s"
524+
export EC_VERSION="$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')-previous-k0s"
525525
export APP_VERSION="appver-${SHORT_SHA}-previous-k0s"
526526
export RELEASE_YAML_DIR=e2e/kots-release-install
527527
./scripts/ci-release-app.sh
528528
529529
# then install the current k0s version
530-
export EC_VERSION="$(git describe --tags --match='[0-9]*.[0-9]*.[0-9]*')"
530+
export EC_VERSION="$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')"
531531
export APP_VERSION="appver-${SHORT_SHA}"
532532
export RELEASE_YAML_DIR=e2e/kots-release-install
533533
./scripts/ci-release-app.sh
534534
535535
# and finally an app upgrade
536-
export EC_VERSION="$(git describe --tags --match='[0-9]*.[0-9]*.[0-9]*')-upgrade"
536+
export EC_VERSION="$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')-upgrade"
537537
export APP_VERSION="appver-${SHORT_SHA}-upgrade"
538538
export RELEASE_YAML_DIR=e2e/kots-release-upgrade
539539
./scripts/ci-release-app.sh
@@ -542,7 +542,7 @@ jobs:
542542
if: github.event_name == 'pull_request'
543543
run: |
544544
export SHORT_SHA=dev-${{ needs.git-sha.outputs.git_sha }}
545-
export EC_VERSION="$(git describe --tags --match='[0-9]*.[0-9]*.[0-9]*')"
545+
export EC_VERSION="$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')"
546546
export APP_VERSION="appver-${SHORT_SHA}"
547547
548548
echo "This PR has been released (on staging) and is available for download with a embedded-cluster-smoke-test-staging-app [license ID](https://vendor.staging.replicated.com/apps/embedded-cluster-smoke-test-staging-app/customers?sort=name-asc)." > download-link.txt

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,9 @@ go.work.sum
1818
/local-dev/
1919
*.tmp
2020
.envrc
21+
22+
# Ignore preflight bundles generated during local dev
23+
preflightbundle*
24+
25+
hack/release.tgz
26+
hack/release

Makefile

Lines changed: 79 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ K0S_GO_VERSION = v1.29.10+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.109.0
18+
TROUBLESHOOT_VERSION = v0.112.1
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]+).*/\1/')
2121
# When updating KOTS_BINARY_URL_OVERRIDE, also update the KOTS_VERSION above or
@@ -140,6 +140,13 @@ ifneq ($(DISABLE_FIO_BUILD),1)
140140
cp output/bins/fio-$(FIO_VERSION)-$(ARCH) $@
141141
endif
142142

143+
.PHONY: pkg/goods/bins/manager
144+
pkg/goods/bins/manager:
145+
mkdir -p pkg/goods/bins
146+
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o output/bins/manager ./cmd/manager
147+
cp output/bins/manager $@
148+
touch $@
149+
143150
.PHONY: pkg/goods/internal/bins/kubectl-kots
144151
pkg/goods/internal/bins/kubectl-kots:
145152
mkdir -p pkg/goods/internal/bins
@@ -191,8 +198,9 @@ rebuild-release: check-env-EC_VERSION check-env-APP_VERSION
191198
./scripts/build-and-release.sh
192199

193200
.PHONY: upgrade-release
194-
upgrade-release: export EC_VERSION = $(VERSION)-$(CURRENT_USER)-upgrade
195-
upgrade-release: export APP_VERSION = appver-dev-$(call random-string)-upgrade
201+
upgrade-release: RANDOM_STRING = $(call random-string)
202+
upgrade-release: export EC_VERSION = $(VERSION)-$(CURRENT_USER)-upgrade-$(RANDOM_STRING)
203+
upgrade-release: export APP_VERSION = appver-dev-$(call random-string)-upgrade-$(RANDOM_STRING)
196204
upgrade-release: check-env-EC_VERSION check-env-APP_VERSION
197205
UPLOAD_BINARIES=1 \
198206
RELEASE_YAML_DIR=e2e/kots-release-upgrade \
@@ -209,6 +217,7 @@ static: pkg/goods/bins/k0s \
209217
pkg/goods/bins/kubectl-support_bundle \
210218
pkg/goods/bins/local-artifact-mirror \
211219
pkg/goods/bins/fio \
220+
pkg/goods/bins/manager \
212221
pkg/goods/internal/bins/kubectl-kots
213222

214223
.PHONY: static-dryrun
@@ -219,6 +228,7 @@ static-dryrun:
219228
pkg/goods/bins/kubectl-support_bundle \
220229
pkg/goods/bins/local-artifact-mirror \
221230
pkg/goods/bins/fio \
231+
pkg/goods/bins/manager \
222232
pkg/goods/internal/bins/kubectl-kots
223233

224234
.PHONY: embedded-cluster-linux-amd64
@@ -248,13 +258,18 @@ embedded-cluster:
248258
-tags osusergo,netgo \
249259
-ldflags="-s -w $(LD_FLAGS) -extldflags=-static" \
250260
-o ./build/embedded-cluster-$(OS)-$(ARCH) \
251-
./cmd/embedded-cluster
261+
./cmd/installer
262+
263+
.PHONY: envtest
264+
envtest:
265+
$(MAKE) -C operator manifests envtest
252266

253267
.PHONY: unit-tests
254-
unit-tests:
268+
unit-tests: envtest
255269
mkdir -p pkg/goods/bins pkg/goods/internal/bins
256270
touch pkg/goods/bins/BUILD pkg/goods/internal/bins/BUILD # compilation will fail if no files are present
257-
go test -tags exclude_graphdriver_btrfs -v ./pkg/... ./cmd/...
271+
KUBEBUILDER_ASSETS="$(shell ./operator/bin/setup-envtest use $(ENVTEST_K8S_VERSION) --bin-dir $(shell pwd)/operator/bin -p path)" \
272+
go test -tags exclude_graphdriver_btrfs -v ./pkg/... ./cmd/...
258273
$(MAKE) -C operator test
259274

260275
.PHONY: vet
@@ -263,11 +278,11 @@ vet: static
263278

264279
.PHONY: e2e-tests
265280
e2e-tests: embedded-release
266-
go test -timeout 60m -ldflags="$(LD_FLAGS)" -parallel 1 -failfast -v ./e2e
281+
go test -tags exclude_graphdriver_btrfs -timeout 60m -ldflags="$(LD_FLAGS)" -parallel 1 -failfast -v ./e2e
267282

268283
.PHONY: e2e-test
269284
e2e-test:
270-
go test -timeout 60m -ldflags="$(LD_FLAGS)" -v ./e2e -run ^$(TEST_NAME)$$
285+
go test -tags exclude_graphdriver_btrfs -timeout 60m -ldflags="$(LD_FLAGS)" -v ./e2e -run ^$(TEST_NAME)$$
271286

272287
.PHONY: dryrun-tests
273288
dryrun-tests: export DRYRUN_MATCH = Test
@@ -354,3 +369,59 @@ delete-node%:
354369
.PHONY: test-lam-e2e
355370
test-lam-e2e: pkg/goods/bins/local-artifact-mirror
356371
sudo go test ./cmd/local-artifact-mirror/e2e/... -v
372+
373+
.PHONY: bin/installer
374+
bin/installer:
375+
@mkdir -p bin
376+
go build -o bin/installer ./cmd/installer
377+
378+
.PHONY: bin/manager
379+
bin/manager:
380+
go build -o bin/manager ./cmd/manager
381+
382+
# make test-embed channel=<channelid> app=<appslug>
383+
.PHONY: test-embed
384+
test-emded: export OS=linux
385+
test-embed: export ARCH=amd64
386+
test-embed: VERSION=1.19.0+k8s-1.30
387+
test-embed: static embedded-cluster
388+
@echo "Cleaning up previous release directory..."
389+
rm -rf ./hack/release
390+
@echo "Creating release directory..."
391+
mkdir -p ./hack/release
392+
393+
@echo "Fetching channel JSON for channel: $(channel)"
394+
$(eval CHANNEL_JSON := $(shell replicated channel inspect $(channel) --output json))
395+
@echo "CHANNEL_JSON: $(CHANNEL_JSON)"
396+
397+
@echo "Extracting release label, sequence, and channel slug..."
398+
$(eval RELEASE_LABEL := $(shell echo '$(CHANNEL_JSON)' | jq -r '.releaseLabel'))
399+
$(eval RELEASE_SEQUENCE := $(shell echo '$(CHANNEL_JSON)' | jq -r '.releaseSequence'))
400+
$(eval CHANNEL_SLUG := $(shell echo '$(CHANNEL_JSON)' | jq -r '.channelSlug'))
401+
$(eval CHANNEL_ID := $(shell echo '$(CHANNEL_JSON)' | jq -r '.id'))
402+
403+
@echo "Extracted values:"
404+
@echo " RELEASE_LABEL: $(RELEASE_LABEL)"
405+
@echo " RELEASE_SEQUENCE: $(RELEASE_SEQUENCE)"
406+
@echo " CHANNEL_SLUG: $(CHANNEL_SLUG)"
407+
408+
@echo "Downloading release sequence $(RELEASE_SEQUENCE) for app $(app)..."
409+
replicated release download $(RELEASE_SEQUENCE) --app=$(app) -d ./hack/release || { echo "Error: Failed to download release. Check RELEASE_SEQUENCE or app name."; exit 1; }
410+
411+
@echo "Writing release.yaml..."
412+
@mkdir -p ./hack/release # Ensure directory exists
413+
@echo '# channel release object' > ./hack/release/release.yaml
414+
@echo 'channelID: "${CHANNEL_ID}"' >> ./hack/release/release.yaml
415+
@echo 'channelSlug: "${CHANNEL_SLUG}"' >> ./hack/release/release.yaml
416+
@echo 'appSlug: "$(app)"' >> ./hack/release/release.yaml
417+
@echo 'versionLabel: "${RELEASE_LABEL}"' >> ./hack/release/release.yaml
418+
419+
@echo "Creating tarball of the release directory..."
420+
tar czvf ./hack/release.tgz -C ./hack/release .
421+
422+
@echo "Embedding release into binary..."
423+
go run ./hack/dev-embed.go --binary ./build/embedded-cluster-linux-amd64 --release ./hack/release.tgz --output ./build/$(app) \
424+
--label $(RELEASE_LABEL) --sequence $(RELEASE_SEQUENCE) --channel $(CHANNEL_SLUG)
425+
426+
chmod +x ./build/$(app)
427+
@echo "Test embed completed successfully."

cmd/embedded-cluster/main.go

Lines changed: 0 additions & 30 deletions
This file was deleted.

cmd/installer/cli/adminconsole.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package cli
2+
3+
import (
4+
"context"
5+
"fmt"
6+
7+
"github.com/spf13/cobra"
8+
)
9+
10+
func AdminConsoleCmd(ctx context.Context, name string) *cobra.Command {
11+
cmd := &cobra.Command{
12+
Use: "admin-console",
13+
Short: fmt.Sprintf("Manage the %s Admin Console", name),
14+
RunE: func(cmd *cobra.Command, args []string) error {
15+
return nil
16+
},
17+
}
18+
19+
cmd.AddCommand(AdminConsoleResetPasswordCmd(ctx, name))
20+
21+
return cmd
22+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package cli
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"os"
7+
8+
"github.com/replicatedhq/embedded-cluster/pkg/kotscli"
9+
rcutil "github.com/replicatedhq/embedded-cluster/pkg/runtimeconfig/util"
10+
"github.com/sirupsen/logrus"
11+
"github.com/spf13/cobra"
12+
)
13+
14+
func AdminConsoleResetPasswordCmd(ctx context.Context, name string) *cobra.Command {
15+
cmd := &cobra.Command{
16+
Use: "reset-password",
17+
Short: fmt.Sprintf("Reset the %s Admin Console password", name),
18+
PreRunE: func(cmd *cobra.Command, args []string) error {
19+
if os.Getuid() != 0 {
20+
return fmt.Errorf("reset-password command must be run as root")
21+
}
22+
if len(args) != 1 {
23+
return fmt.Errorf("expected admin console password as argument")
24+
}
25+
26+
return nil
27+
},
28+
RunE: func(cmd *cobra.Command, args []string) error {
29+
if err := rcutil.InitRuntimeConfigFromCluster(ctx); err != nil {
30+
return fmt.Errorf("failed to init runtime config from cluster: %w", err)
31+
}
32+
33+
password := args[0]
34+
if !validateAdminConsolePassword(password, password) {
35+
return ErrNothingElseToAdd
36+
}
37+
38+
if err := kotscli.ResetPassword(password); err != nil {
39+
return err
40+
}
41+
42+
logrus.Info("Admin Console password reset successfully")
43+
return nil
44+
},
45+
}
46+
47+
return cmd
48+
}

0 commit comments

Comments
 (0)