Skip to content

Commit 63a7128

Browse files
committed
Merge remote-tracking branch 'origin/main' into k0s-1-29
2 parents 20c0003 + bc9b934 commit 63a7128

39 files changed

+450
-173
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ K0S_GO_VERSION = v1.29.13+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.116.1
18+
TROUBLESHOOT_VERSION = v0.116.3
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

cmd/buildtools/adminconsole.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ var updateAdminConsoleAddonCommand = &cli.Command{
7171

7272
logrus.Infof("extracting images from chart")
7373
withproto := fmt.Sprintf("oci://%s", upstream)
74-
images, err := helm.ExtractImagesFromOCIChart(hcli, withproto, "adminconsole", latest, values)
74+
images, err := helm.ExtractImagesFromChart(hcli, withproto, latest, values)
7575
if err != nil {
7676
return fmt.Errorf("failed to get images from admin console chart: %w", err)
7777
}

cmd/buildtools/embeddedclusteroperator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func updateOperatorAddonImages(ctx context.Context, hcli helm.Client, chartURL s
125125
}
126126

127127
logrus.Infof("extracting images from chart version %s", chartVersion)
128-
images, err := helm.ExtractImagesFromOCIChart(hcli, chartURL, "embeddedclusteroperator", chartVersion, values)
128+
images, err := helm.ExtractImagesFromChart(hcli, chartURL, chartVersion, values)
129129
if err != nil {
130130
return fmt.Errorf("failed to get images from embedded cluster operator chart: %w", err)
131131
}

cmd/buildtools/metadata.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"log"
77
"os"
88
"sort"
9-
"strings"
109

1110
k0sv1beta1 "github.com/k0sproject/k0s/pkg/apis/k0s/v1beta1"
1211
embeddedclusterv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
@@ -125,9 +124,5 @@ func extractImagesFromChart(hcli helm.Client, chart embeddedclusterv1beta1.Chart
125124
}
126125
}
127126

128-
if strings.HasPrefix(chart.ChartName, "oci://") {
129-
return helm.ExtractImagesFromOCIChart(hcli, chart.ChartName, chart.Name, chart.Version, values)
130-
}
131-
parts := strings.SplitN(chart.ChartName, "/", 2)
132-
return helm.ExtractImagesFromChart(hcli, parts[0], parts[1], chart.Version, values)
127+
return helm.ExtractImagesFromChart(hcli, chart.ChartName, chart.Version, values)
133128
}

cmd/buildtools/openebs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func updateOpenEBSAddonImages(ctx context.Context, hcli helm.Client, chartURL st
134134
}
135135

136136
logrus.Infof("extracting images from chart version %s", chartVersion)
137-
images, err := helm.ExtractImagesFromOCIChart(hcli, chartURL, "openebs", chartVersion, values)
137+
images, err := helm.ExtractImagesFromChart(hcli, chartURL, chartVersion, values)
138138
if err != nil {
139139
return fmt.Errorf("failed to get images from openebs chart: %w", err)
140140
}

cmd/buildtools/registry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ var updateRegistryAddonCommand = &cli.Command{
7272

7373
logrus.Infof("extracting images from chart")
7474
withproto := fmt.Sprintf("oci://%s", upstream)
75-
images, err := helm.ExtractImagesFromOCIChart(hcli, withproto, "docker-registry", latest, values)
75+
images, err := helm.ExtractImagesFromChart(hcli, withproto, latest, values)
7676
if err != nil {
7777
return fmt.Errorf("failed to get images from chart: %w", err)
7878
}

cmd/buildtools/seaweedfs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func updateSeaweedFSAddonImages(ctx context.Context, hcli helm.Client, chartURL
122122
}
123123

124124
logrus.Infof("extracting images from chart version %s", chartVersion)
125-
images, err := helm.ExtractImagesFromOCIChart(hcli, chartURL, "seaweedfs", chartVersion, values)
125+
images, err := helm.ExtractImagesFromChart(hcli, chartURL, chartVersion, values)
126126
if err != nil {
127127
return fmt.Errorf("failed to get images from seaweedfs chart: %w", err)
128128
}

cmd/buildtools/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ func MirrorChart(hcli helm.Client, repo *repo.Entry, name, ver string) error {
452452
dst := fmt.Sprintf("oci://%s", os.Getenv("CHARTS_DESTINATION"))
453453
chartURL := fmt.Sprintf("%s/%s", dst, name)
454454
logrus.Infof("verifying if destination tag already exists")
455-
dstMeta, err := helm.GetOCIChartMetadata(hcli, chartURL, name, ver)
455+
dstMeta, err := helm.GetChartMetadata(hcli, chartURL, ver)
456456
if err != nil && !strings.HasSuffix(err.Error(), "not found") {
457457
return fmt.Errorf("verify tag exists: %w", err)
458458
} else if err == nil {

cmd/buildtools/velero.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func findVeleroVersionFromChart(ctx context.Context, hcli helm.Client, chartURL
171171
if err != nil {
172172
return "", fmt.Errorf("failed to get velero values: %v", err)
173173
}
174-
images, err := helm.ExtractImagesFromOCIChart(hcli, chartURL, "velero", chartVersion, values)
174+
images, err := helm.ExtractImagesFromChart(hcli, chartURL, chartVersion, values)
175175
if err != nil {
176176
return "", fmt.Errorf("failed to get images from velero chart: %w", err)
177177
}
@@ -216,7 +216,7 @@ func updateVeleroAddonImages(ctx context.Context, hcli helm.Client, chartURL str
216216
}
217217

218218
logrus.Infof("extracting images from chart version %s", chartVersion)
219-
images, err := helm.ExtractImagesFromOCIChart(hcli, chartURL, "velero", chartVersion, values)
219+
images, err := helm.ExtractImagesFromChart(hcli, chartURL, chartVersion, values)
220220
if err != nil {
221221
return fmt.Errorf("failed to get images from velero chart: %w", err)
222222
}

cmd/installer/cli/install.go

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ func installAndStartCluster(ctx context.Context, networkInterface string, airgap
608608
return nil, fmt.Errorf("create config file: %w", err)
609609
}
610610
logrus.Debugf("creating systemd unit files")
611-
if err := createSystemdUnitFiles(false, proxy); err != nil {
611+
if err := createSystemdUnitFiles(ctx, false, proxy); err != nil {
612612
return nil, fmt.Errorf("create systemd unit files: %w", err)
613613
}
614614

@@ -769,7 +769,7 @@ func validateAdminConsolePassword(password, passwordCheck string) bool {
769769

770770
// createSystemdUnitFiles links the k0s systemd unit file. this also creates a new
771771
// systemd unit file for the local artifact mirror service.
772-
func createSystemdUnitFiles(isWorker bool, proxy *ecv1beta1.ProxySpec) error {
772+
func createSystemdUnitFiles(ctx context.Context, isWorker bool, proxy *ecv1beta1.ProxySpec) error {
773773
dst := systemdUnitFileName()
774774
if _, err := os.Lstat(dst); err == nil {
775775
if err := os.Remove(dst); err != nil {
@@ -793,7 +793,7 @@ func createSystemdUnitFiles(isWorker bool, proxy *ecv1beta1.ProxySpec) error {
793793
if _, err := helpers.RunCommand("systemctl", "daemon-reload"); err != nil {
794794
return fmt.Errorf("unable to get reload systemctl daemon: %w", err)
795795
}
796-
if err := installAndEnableLocalArtifactMirror(); err != nil {
796+
if err := installAndEnableLocalArtifactMirror(ctx); err != nil {
797797
return fmt.Errorf("unable to install and enable local artifact mirror: %w", err)
798798
}
799799
return nil
@@ -828,7 +828,7 @@ Environment="NO_PROXY=%s"`, httpProxy, httpsProxy, noProxy)
828828
// installAndEnableLocalArtifactMirror installs and enables the local artifact mirror. This
829829
// service is responsible for serving on localhost, through http, all files that are used
830830
// during a cluster upgrade.
831-
func installAndEnableLocalArtifactMirror() error {
831+
func installAndEnableLocalArtifactMirror(ctx context.Context) error {
832832
materializer := goods.NewMaterializer()
833833
if err := materializer.LocalArtifactMirrorUnitFile(); err != nil {
834834
return fmt.Errorf("failed to materialize artifact mirror unit: %w", err)
@@ -839,15 +839,50 @@ func installAndEnableLocalArtifactMirror() error {
839839
if _, err := helpers.RunCommand("systemctl", "daemon-reload"); err != nil {
840840
return fmt.Errorf("unable to get reload systemctl daemon: %w", err)
841841
}
842+
if _, err := helpers.RunCommand("systemctl", "enable", "local-artifact-mirror"); err != nil {
843+
return fmt.Errorf("unable to enable the local artifact mirror service: %w", err)
844+
}
845+
logrus.Debugf("Starting local artifact mirror")
842846
if _, err := helpers.RunCommand("systemctl", "start", "local-artifact-mirror"); err != nil {
843847
return fmt.Errorf("unable to start the local artifact mirror: %w", err)
844848
}
845-
if _, err := helpers.RunCommand("systemctl", "enable", "local-artifact-mirror"); err != nil {
846-
return fmt.Errorf("unable to start the local artifact mirror service: %w", err)
849+
if err := waitForLocalArtifactMirror(ctx); err != nil {
850+
return fmt.Errorf("unable to wait for the local artifact mirror: %w", err)
847851
}
852+
logrus.Debugf("Local artifact mirror started!")
848853
return nil
849854
}
850855

856+
func waitForLocalArtifactMirror(ctx context.Context) error {
857+
consecutiveSuccesses := 0
858+
requiredSuccesses := 3
859+
maxAttempts := 30
860+
checkInterval := 2 * time.Second
861+
862+
var lastErr error
863+
for attempt := 0; attempt < maxAttempts; attempt++ {
864+
_, err := helpers.RunCommand("systemctl", "status", "local-artifact-mirror")
865+
if err == nil {
866+
consecutiveSuccesses++
867+
if consecutiveSuccesses >= requiredSuccesses {
868+
return nil
869+
}
870+
} else {
871+
consecutiveSuccesses = 0
872+
lastErr = err
873+
}
874+
875+
select {
876+
case <-ctx.Done():
877+
return ctx.Err()
878+
case <-time.After(checkInterval):
879+
continue
880+
}
881+
}
882+
883+
return lastErr
884+
}
885+
851886
const (
852887
localArtifactMirrorDropInFileContents = `[Service]
853888
Environment="LOCAL_ARTIFACT_MIRROR_PORT=%d"

cmd/installer/cli/join.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ func installAndJoinCluster(ctx context.Context, jcmd *kotsadm.JoinCommandRespons
299299

300300
logrus.Debugf("creating systemd unit files")
301301
// both controller and worker nodes will have 'worker' in the join command
302-
if err := createSystemdUnitFiles(!strings.Contains(jcmd.K0sJoinCommand, "controller"), jcmd.InstallationSpec.Proxy); err != nil {
302+
isWorker := !strings.Contains(jcmd.K0sJoinCommand, "controller")
303+
if err := createSystemdUnitFiles(ctx, isWorker, jcmd.InstallationSpec.Proxy); err != nil {
303304
return fmt.Errorf("unable to create systemd unit files: %w", err)
304305
}
305306

cmd/installer/cli/join_runpreflights.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ func runJoinPreflights(ctx context.Context, jcmd *kotsadm.JoinCommandResponse, f
108108
IgnoreHostPreflights: flags.ignoreHostPreflights,
109109
AssumeYes: flags.assumeYes,
110110
TCPConnectionsRequired: jcmd.TCPConnectionsRequired,
111+
IsJoin: true,
111112
}); err != nil {
112113
return err
113114
}

cmd/installer/kotscli/kotscli.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ func Install(opts InstallOptions, msg *spinner.MessageWriter) error {
7676
defer msg.SetLineBreaker(nil)
7777

7878
runCommandOptions := helpers.RunCommandOptions{
79-
Stdout: msg,
79+
Stdout: msg,
80+
LogOnSuccess: true,
8081
Env: map[string]string{
8182
"EMBEDDED_CLUSTER_ID": metrics.ClusterID().String(),
8283
},
8384
}
84-
if err := helpers.RunCommandWithOptions(runCommandOptions, kotsBinPath, installArgs...); err != nil {
85+
err = helpers.RunCommandWithOptions(runCommandOptions, kotsBinPath, installArgs...)
86+
if err != nil {
8587
return fmt.Errorf("unable to install the application: %w", err)
8688
}
8789

e2e/kots-release-install-failing-preflights/cluster-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,23 @@ spec:
5050
namespace: ingress-nginx
5151
version: "4.11.3"
5252
values: |
53+
global:
54+
image:
55+
registry: proxy.replicated.com/anonymous/registry.k8s.io
5356
controller:
5457
service:
5558
type: NodePort
5659
nodePorts:
5760
http: "80"
5861
https: "443"
5962
image:
63+
registry: proxy.replicated.com/anonymous/registry.k8s.io
6064
digest: ""
6165
digestChroot: ""
6266
admissionWebhooks:
6367
patch:
6468
image:
69+
registry: proxy.replicated.com/anonymous/registry.k8s.io
6570
digest: ""
6671
- chartname: okgolove/goldpinger
6772
name: goldpinger

e2e/kots-release-install-legacydr/cluster-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,23 @@ spec:
5050
namespace: ingress-nginx
5151
version: "4.11.3"
5252
values: |
53+
global:
54+
image:
55+
registry: proxy.replicated.com/anonymous/registry.k8s.io
5356
controller:
5457
service:
5558
type: NodePort
5659
nodePorts:
5760
http: "80"
5861
https: "443"
5962
image:
63+
registry: proxy.replicated.com/anonymous/registry.k8s.io
6064
digest: ""
6165
digestChroot: ""
6266
admissionWebhooks:
6367
patch:
6468
image:
69+
registry: proxy.replicated.com/anonymous/registry.k8s.io
6570
digest: ""
6671
- chartname: okgolove/goldpinger
6772
name: goldpinger

e2e/kots-release-install-stable/cluster-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,23 @@ spec:
4848
namespace: ingress-nginx
4949
version: "4.8.3"
5050
values: |
51+
global:
52+
image:
53+
registry: proxy.replicated.com/anonymous/registry.k8s.io
5154
controller:
5255
service:
5356
type: NodePort
5457
nodePorts:
5558
http: "80"
5659
https: "443"
5760
image:
61+
registry: proxy.replicated.com/anonymous/registry.k8s.io
5862
digest: ""
5963
digestChroot: ""
6064
admissionWebhooks:
6165
patch:
6266
image:
67+
registry: proxy.replicated.com/anonymous/registry.k8s.io
6368
digest: ""
6469
- chartname: okgolove/goldpinger
6570
name: goldpinger

e2e/kots-release-install-warning-preflights/cluster-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,23 @@ spec:
5050
namespace: ingress-nginx
5151
version: "4.11.3"
5252
values: |
53+
global:
54+
image:
55+
registry: proxy.replicated.com/anonymous/registry.k8s.io
5356
controller:
5457
service:
5558
type: NodePort
5659
nodePorts:
5760
http: "80"
5861
https: "443"
5962
image:
63+
registry: proxy.replicated.com/anonymous/registry.k8s.io
6064
digest: ""
6165
digestChroot: ""
6266
admissionWebhooks:
6367
patch:
6468
image:
69+
registry: proxy.replicated.com/anonymous/registry.k8s.io
6570
digest: ""
6671
- chartname: okgolove/goldpinger
6772
name: goldpinger

e2e/kots-release-install/cluster-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,23 @@ spec:
5050
namespace: ingress-nginx
5151
version: "4.11.3"
5252
values: |
53+
global:
54+
image:
55+
registry: proxy.replicated.com/anonymous/registry.k8s.io
5356
controller:
5457
service:
5558
type: NodePort
5659
nodePorts:
5760
http: "80"
5861
https: "443"
5962
image:
63+
registry: proxy.replicated.com/anonymous/registry.k8s.io
6064
digest: ""
6165
digestChroot: ""
6266
admissionWebhooks:
6367
patch:
6468
image:
69+
registry: proxy.replicated.com/anonymous/registry.k8s.io
6570
digest: ""
6671
- chartname: okgolove/goldpinger
6772
name: goldpinger

e2e/kots-release-upgrade/cluster-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ spec:
5656
namespace: ingress-nginx
5757
version: "4.12.0-beta.0"
5858
values: |
59+
global:
60+
image:
61+
registry: proxy.replicated.com/anonymous/registry.k8s.io
5962
controller:
6063
service:
6164
type: NodePort
@@ -65,11 +68,13 @@ spec:
6568
annotations:
6669
test-upgrade-annotation: test-upgrade-value
6770
image:
71+
registry: proxy.replicated.com/anonymous/registry.k8s.io
6872
digest: ""
6973
digestChroot: ""
7074
admissionWebhooks:
7175
patch:
7276
image:
77+
registry: proxy.replicated.com/anonymous/registry.k8s.io
7378
digest: ""
7479
- chartname: okgolove/goldpinger
7580
name: goldpinger

0 commit comments

Comments
 (0)