Skip to content

Commit b828b4f

Browse files
committed
Merge remote-tracking branch 'origin/main' into k0s-1-29
2 parents 4322410 + b31b6ba commit b828b4f

File tree

17 files changed

+123
-687
lines changed

17 files changed

+123
-687
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -213,75 +213,6 @@ jobs:
213213
echo "K0S_VERSION=\"$K0S_VERSION\""
214214
echo "k0s_version=$K0S_VERSION" >> "$GITHUB_OUTPUT"
215215
216-
build-legacydr:
217-
name: Build legacy DR
218-
runs-on: embedded-cluster-2
219-
needs:
220-
- git-sha
221-
outputs:
222-
k0s_version: ${{ steps.export.outputs.k0s_version }}
223-
steps:
224-
- name: Checkout
225-
uses: actions/checkout@v4
226-
with:
227-
fetch-depth: 0
228-
229-
- name: Cache embedded bins
230-
uses: actions/cache@v4
231-
with:
232-
path: |
233-
output/bins
234-
key: bins-cache
235-
236-
- name: Setup go
237-
uses: actions/setup-go@v5
238-
with:
239-
go-version-file: go.mod
240-
cache-dependency-path: "**/*.sum"
241-
242-
- name: Install dagger
243-
run: |
244-
curl -fsSL https://dl.dagger.io/dagger/install.sh | sh
245-
sudo mv ./bin/dagger /usr/local/bin/dagger
246-
247-
- name: Build
248-
env:
249-
APP_CHANNEL_ID: 2cHXb1RCttzpR0xvnNWyaZCgDBP
250-
APP_CHANNEL_SLUG: ci
251-
RELEASE_YAML_DIR: e2e/kots-release-install-legacydr
252-
S3_BUCKET: "tf-staging-embedded-cluster-bin"
253-
USES_DEV_BUCKET: "0"
254-
AWS_ACCESS_KEY_ID: ${{ secrets.STAGING_EMBEDDED_CLUSTER_UPLOAD_IAM_KEY_ID }}
255-
AWS_SECRET_ACCESS_KEY: ${{ secrets.STAGING_EMBEDDED_CLUSTER_UPLOAD_IAM_SECRET }}
256-
AWS_REGION: "us-east-1"
257-
USE_CHAINGUARD: "1"
258-
UPLOAD_BINARIES: "1"
259-
SKIP_RELEASE: "1"
260-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
261-
run: |
262-
export K0S_VERSION=$(make print-K0S_VERSION)
263-
export EC_VERSION=$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')-legacydr
264-
export APP_VERSION=appver-dev-${{ needs.git-sha.outputs.git_sha }}-legacydr
265-
# avoid rate limiting
266-
export FIO_VERSION=$(gh release list --repo axboe/fio --json tagName,isLatest | jq -r '.[] | select(.isLatest==true)|.tagName' | cut -d- -f2)
267-
268-
./scripts/build-and-release.sh
269-
cp output/bin/embedded-cluster output/bin/embedded-cluster-legacydr
270-
271-
- name: Upload release
272-
uses: actions/upload-artifact@v4
273-
with:
274-
name: legacydr-release
275-
path: |
276-
output/bin/embedded-cluster-legacydr
277-
278-
- name: Export k0s version
279-
id: export
280-
run: |
281-
K0S_VERSION="$(make print-K0S_VERSION)"
282-
echo "K0S_VERSION=\"$K0S_VERSION\""
283-
echo "k0s_version=$K0S_VERSION" >> "$GITHUB_OUTPUT"
284-
285216
build-previous-k0s:
286217
name: Build previous k0s
287218
runs-on: embedded-cluster-2
@@ -518,7 +449,6 @@ jobs:
518449
needs:
519450
- git-sha
520451
- build-current
521-
- build-legacydr
522452
- build-previous-k0s
523453
- build-upgrade
524454
- find-previous-stable
@@ -591,7 +521,7 @@ jobs:
591521
./scripts/ci-release-app.sh
592522
593523
# promote a release with improved dr support
594-
export EC_VERSION="$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')-legacydr"
524+
export EC_VERSION="$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')"
595525
export APP_VERSION="appver-${SHORT_SHA}-legacydr"
596526
export RELEASE_YAML_DIR=e2e/kots-release-install-legacydr
597527
./scripts/ci-release-app.sh
@@ -636,12 +566,6 @@ jobs:
636566
export RELEASE_YAML_DIR=e2e/kots-release-install
637567
./scripts/ci-release-app.sh
638568
639-
# promote a release with improved dr support
640-
export EC_VERSION="$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')-legacydr"
641-
export APP_VERSION="appver-${SHORT_SHA}-legacydr"
642-
export RELEASE_YAML_DIR=e2e/kots-release-install-legacydr
643-
./scripts/ci-release-app.sh
644-
645569
# then a noop upgrade
646570
export EC_VERSION="$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')"
647571
export APP_VERSION="appver-${SHORT_SHA}-noop"
@@ -687,7 +611,6 @@ jobs:
687611
needs:
688612
- git-sha
689613
- build-current
690-
- build-legacydr
691614
- build-previous-k0s
692615
- build-upgrade
693616
- find-previous-stable
@@ -735,11 +658,6 @@ jobs:
735658
with:
736659
name: current-release
737660
path: output/bin
738-
- name: Download new DR binary
739-
uses: actions/download-artifact@v4
740-
with:
741-
name: legacydr-release
742-
path: output/bin
743661
- name: Setup go
744662
uses: actions/setup-go@v5
745663
with:
@@ -786,7 +704,6 @@ jobs:
786704
runs-on: ${{ matrix.runner || 'ubuntu-22.04' }}
787705
needs:
788706
- build-current
789-
- build-legacydr
790707
- build-previous-k0s
791708
- build-upgrade
792709
- find-previous-stable
@@ -854,7 +771,6 @@ jobs:
854771
runs-on: ${{ matrix.runner || 'ubuntu-22.04' }}
855772
needs:
856773
- build-current
857-
- build-legacydr
858774
- build-previous-k0s
859775
- build-upgrade
860776
- find-previous-stable

cmd/installer/cli/install.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ func preRunInstall(cmd *cobra.Command, flags *InstallCmdFlags) error {
220220
flags.isAirgap = flags.airgapBundle != ""
221221

222222
runtimeconfig.ApplyFlags(cmd.Flags())
223+
os.Setenv("KUBECONFIG", runtimeconfig.PathToKubeConfig()) // this is needed for restore as well since it shares this function
223224
os.Setenv("TMPDIR", runtimeconfig.EmbeddedClusterTmpSubDir())
224225

225226
if err := runtimeconfig.WriteToDisk(); err != nil {
@@ -616,9 +617,6 @@ func installAndStartCluster(ctx context.Context, networkInterface string, airgap
616617
return nil, fmt.Errorf("wait for node: %w", err)
617618
}
618619

619-
// init the kubeconfig
620-
os.Setenv("KUBECONFIG", runtimeconfig.PathToKubeConfig())
621-
622620
loading.Infof("Node installation finished!")
623621
return cfg, nil
624622
}

cmd/installer/cli/root.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"github.com/replicatedhq/embedded-cluster/pkg/dryrun"
1010
"github.com/replicatedhq/embedded-cluster/pkg/metrics"
11+
"github.com/sirupsen/logrus"
1112
"github.com/spf13/cobra"
1213
)
1314

@@ -33,7 +34,8 @@ func InitAndExecute(ctx context.Context, name string) {
3334
err := cmd.Execute()
3435
if err != nil {
3536
if !errors.As(err, &ErrorNothingElseToAdd{}) {
36-
fmt.Fprintln(os.Stderr, err)
37+
// Logrus Fatal level logs to stderr and gets sent to the log file.
38+
logrus.Fatal(err)
3739
}
3840
os.Exit(1)
3941
}

e2e/restore_test.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,21 @@ func TestSingleNodeLegacyDisasterRecovery(t *testing.T) {
127127
}
128128

129129
tc := docker.NewCluster(&docker.ClusterInput{
130-
T: t,
131-
Nodes: 1,
132-
Distro: "debian-bookworm",
133-
LicensePath: "snapshot-license.yaml",
134-
ECBinaryPath: "../output/bin/embedded-cluster-legacydr",
130+
T: t,
131+
Nodes: 1,
132+
Distro: "debian-bookworm",
135133
})
136134
defer tc.Cleanup()
137135

136+
appVersion := fmt.Sprintf("appver-%s-legacydr", os.Getenv("SHORT_SHA"))
137+
t.Logf("%s: downloading embedded-cluster on node 0", time.Now().Format(time.RFC3339))
138+
line := []string{"vandoor-prepare.sh", appVersion, os.Getenv("SNAPSHOT_LICENSE_ID"), "false"}
139+
if stdout, stderr, err := tc.RunCommandOnNode(0, line); err != nil {
140+
t.Fatalf("fail to download embedded-cluster on node 0: %v: %s: %s", err, stdout, stderr)
141+
}
142+
138143
t.Logf("%s: installing embedded-cluster on node 0", time.Now().Format(time.RFC3339))
139-
line := []string{"single-node-install.sh", "ui", os.Getenv("SHORT_SHA")}
144+
line = []string{"single-node-install.sh", "ui", os.Getenv("SHORT_SHA")}
140145
if stdout, stderr, err := tc.RunCommandOnNode(0, line); err != nil {
141146
t.Fatalf("fail to install embedded-cluster on node 0: %v: %s: %s", err, stdout, stderr)
142147
}
@@ -148,8 +153,6 @@ func TestSingleNodeLegacyDisasterRecovery(t *testing.T) {
148153
t.Fatalf("fail to run playwright test deploy-app: %v", err)
149154
}
150155

151-
appVersion := fmt.Sprintf("appver-%s-legacydr", os.Getenv("SHORT_SHA"))
152-
153156
t.Logf("%s: checking installation state", time.Now().Format(time.RFC3339))
154157
line = []string{"check-installation-state.sh", appVersion, k8sVersion()}
155158
if stdout, stderr, err := tc.RunCommandOnNode(0, line); err != nil {

pkg/addons/adminconsole/static/values.tpl.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ images:
77
{{- end }}
88
isHA: false
99
isHelmManaged: false
10-
isEC2Install: true
1110
kurlProxy:
1211
enabled: true
1312
nodePort: 30000

pkg/addons/highavailability.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/replicatedhq/embedded-cluster/pkg/helm"
1313
"github.com/replicatedhq/embedded-cluster/pkg/kubeutils"
1414
"github.com/replicatedhq/embedded-cluster/pkg/spinner"
15+
"github.com/sirupsen/logrus"
1516
corev1 "k8s.io/api/core/v1"
1617
k8serrors "k8s.io/apimachinery/pkg/api/errors"
1718
"k8s.io/apimachinery/pkg/types"
@@ -46,6 +47,8 @@ func EnableHA(ctx context.Context, kcli client.Client, hcli helm.Client, isAirga
4647
loading := spinner.Start()
4748
defer loading.Close()
4849

50+
logrus.Debugf("Enabling high availability")
51+
4952
if isAirgap {
5053
loading.Infof("Enabling high availability")
5154

@@ -58,30 +61,40 @@ func EnableHA(ctx context.Context, kcli client.Client, hcli helm.Client, isAirga
5861
return errors.Wrap(err, "check if seaweedfs release exists")
5962
}
6063
if !exists {
64+
logrus.Debugf("Installing seaweedfs")
6165
if err := sw.Install(ctx, kcli, hcli, addOnOverrides(sw, cfgspec, nil), nil); err != nil {
6266
return errors.Wrap(err, "install seaweedfs")
6367
}
68+
logrus.Debugf("Seaweedfs installed!")
69+
} else {
70+
logrus.Debugf("Seaweedfs already installed")
6471
}
6572

6673
// TODO (@salah): add support for end user overrides
6774
reg := &registry.Registry{
6875
ServiceCIDR: serviceCIDR,
6976
IsHA: true,
7077
}
78+
logrus.Debugf("Migrating registry data")
7179
if err := reg.Migrate(ctx, kcli, loading); err != nil {
7280
return errors.Wrap(err, "migrate registry data")
7381
}
82+
logrus.Debugf("Registry migration complete!")
83+
logrus.Debugf("Upgrading registry")
7484
if err := reg.Upgrade(ctx, kcli, hcli, addOnOverrides(reg, cfgspec, nil)); err != nil {
7585
return errors.Wrap(err, "upgrade registry")
7686
}
87+
logrus.Debugf("Registry upgraded!")
7788
}
7889

7990
loading.Infof("Updating the Admin Console for high availability")
8091

92+
logrus.Debugf("Enabling admin console high availability")
8193
err := EnableAdminConsoleHA(ctx, kcli, hcli, isAirgap, serviceCIDR, proxy, cfgspec)
8294
if err != nil {
8395
return errors.Wrap(err, "enable admin console high availability")
8496
}
97+
logrus.Debugf("Admin console high availability enabled!")
8598

8699
in, err := kubeutils.GetLatestInstallation(ctx, kcli)
87100
if err != nil {
@@ -94,6 +107,8 @@ func EnableHA(ctx context.Context, kcli client.Client, hcli helm.Client, isAirga
94107
return errors.Wrap(err, "update installation")
95108
}
96109

110+
logrus.Debugf("High availability enabled!")
111+
97112
loading.Infof("High availability enabled!")
98113
return nil
99114
}

pkg/addons/registry/migrate.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/pkg/errors"
1919
"github.com/replicatedhq/embedded-cluster/pkg/addons/seaweedfs"
2020
"github.com/replicatedhq/embedded-cluster/pkg/spinner"
21+
"github.com/sirupsen/logrus"
2122
"golang.org/x/sync/errgroup"
2223
corev1 "k8s.io/api/core/v1"
2324
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -41,9 +42,11 @@ func (r *Registry) Migrate(ctx context.Context, kcli client.Client, progressWrit
4142
return errors.Wrap(err, "get s3 client")
4243
}
4344

45+
logrus.Debug("Ensuring registry bucket")
4446
if err := ensureRegistryBucket(ctx, s3Client); err != nil {
4547
return errors.Wrap(err, "ensure registry bucket")
4648
}
49+
logrus.Debug("Registry bucket ensured!")
4750

4851
pipeReader, pipeWriter := io.Pipe()
4952
g, ctx := errgroup.WithContext(ctx)
@@ -57,9 +60,11 @@ func (r *Registry) Migrate(ctx context.Context, kcli client.Client, progressWrit
5760
return writeRegistryData(ctx, pipeReader, s3manager.NewUploader(s3Client), progressWriter)
5861
})
5962

63+
logrus.Debug("Copying registry data")
6064
if err := g.Wait(); err != nil {
6165
return err
6266
}
67+
logrus.Debug("Registry data copied!")
6368

6469
return nil
6570
}

pkg/addons/registry/upgrade.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const (
1919
s3SecretName = "seaweedfs-s3-rw"
2020
)
2121

22+
// Upgrade upgrades the registry chart to the latest version.
2223
func (r *Registry) Upgrade(ctx context.Context, kcli client.Client, hcli helm.Client, overrides []string) error {
2324
exists, err := hcli.ReleaseExists(ctx, namespace, releaseName)
2425
if err != nil {

pkg/dryrun/kubeutils.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ func (k *KubeUtils) WaitForInstallation(ctx context.Context, cli client.Client,
4040
return nil
4141
}
4242

43-
func (k *KubeUtils) WaitForHAInstallation(ctx context.Context, cli client.Client) error {
44-
return nil
45-
}
46-
4743
func (k *KubeUtils) WaitForNodes(ctx context.Context, cli client.Client) error {
4844
return nil
4945
}

pkg/helm/client.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,10 @@ func cleanUpMapValue(v interface{}) interface{} {
545545
switch v := v.(type) {
546546
case []interface{}:
547547
return cleanUpInterfaceArray(v)
548+
case []map[string]interface{}:
549+
return cleanUpGenericMapArray(v)
550+
case []map[interface{}]interface{}:
551+
return cleanUpInterfaceMapArray(v)
548552
case map[string]interface{}:
549553
return cleanUpGenericMap(v)
550554
case map[interface{}]interface{}:
@@ -571,6 +575,24 @@ func cleanUpInterfaceArray(in []interface{}) []interface{} {
571575
return result
572576
}
573577

578+
// Cleans up a slice of map to interface into slice of actual values
579+
func cleanUpGenericMapArray(in []map[string]interface{}) []map[string]interface{} {
580+
result := make([]map[string]interface{}, len(in))
581+
for i, v := range in {
582+
result[i] = cleanUpGenericMap(v)
583+
}
584+
return result
585+
}
586+
587+
// Cleans up a slice of map to interface into slice of actual values
588+
func cleanUpInterfaceMapArray(in []map[interface{}]interface{}) []map[string]interface{} {
589+
result := make([]map[string]interface{}, len(in))
590+
for i, v := range in {
591+
result[i] = cleanUpInterfaceMap(v)
592+
}
593+
return result
594+
}
595+
574596
// Cleans up the map keys to be strings
575597
func cleanUpInterfaceMap(in map[interface{}]interface{}) map[string]interface{} {
576598
result := make(map[string]interface{})

0 commit comments

Comments
 (0)