Skip to content

Commit 58edb0e

Browse files
committed
Merge remote-tracking branch 'origin/main' into k0s-1-28-9
2 parents fd7c42d + 3fa8827 commit 58edb0e

File tree

5 files changed

+52
-22
lines changed

5 files changed

+52
-22
lines changed

.github/workflows/pull-request.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,27 @@ jobs:
204204
license: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE }}
205205
testim-access-token: ${{ secrets.TESTIM_ACCESS_TOKEN }}
206206
testim-branch: ${{ github.head_ref == 'main' && 'master' || github.head_ref }}
207+
208+
209+
# this job will validate that all the tests passed
210+
# it is used for the github branch protection rule
211+
validate-success:
212+
runs-on: ubuntu-20.04
213+
needs:
214+
- e2e
215+
- sanitize
216+
- tests
217+
if: always()
218+
steps:
219+
# https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context
220+
- name: fail if e2e job was not successful
221+
if: needs.e2e.result != 'success'
222+
run: exit 1
223+
- name: fail if sanitize job was not successful
224+
if: needs.sanitize.result != 'success'
225+
run: exit 1
226+
- name: fail if tests job was not successful
227+
if: needs.tests.result != 'success'
228+
run: exit 1
229+
- name: succeed if everything else passed
230+
run: echo "Validation succeeded"

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ require (
2828
k8s.io/api v0.30.0
2929
k8s.io/apimachinery v0.30.0
3030
oras.land/oras-go/v2 v2.5.0
31-
sigs.k8s.io/controller-runtime v0.18.1
31+
sigs.k8s.io/controller-runtime v0.18.2
3232
sigs.k8s.io/yaml v1.4.0
3333
)
3434

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,8 @@ k8s.io/utils v0.0.0-20231121161247-cf03d44ff3cf h1:iTzha1p7Fi83476ypNSz8nV9iR993
492492
k8s.io/utils v0.0.0-20231121161247-cf03d44ff3cf/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
493493
oras.land/oras-go/v2 v2.5.0 h1:o8Me9kLY74Vp5uw07QXPiitjsw7qNXi8Twd+19Zf02c=
494494
oras.land/oras-go/v2 v2.5.0/go.mod h1:z4eisnLP530vwIOUOJeBIj0aGI0L1C3d53atvCBqZHg=
495-
sigs.k8s.io/controller-runtime v0.18.1 h1:RpWbigmuiylbxOCLy0tGnq1cU1qWPwNIQzoJk+QeJx4=
496-
sigs.k8s.io/controller-runtime v0.18.1/go.mod h1:tuAt1+wbVsXIT8lPtk5RURxqAnq7xkpv2Mhttslg7Hw=
495+
sigs.k8s.io/controller-runtime v0.18.2 h1:RqVW6Kpeaji67CY5nPEfRz6ZfFMk0lWQlNrLqlNpx+Q=
496+
sigs.k8s.io/controller-runtime v0.18.2/go.mod h1:tuAt1+wbVsXIT8lPtk5RURxqAnq7xkpv2Mhttslg7Hw=
497497
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
498498
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
499499
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=

pkg/kotscli/kotscli.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func MaskKotsOutputForOnline() spinner.MaskFn {
134134
if strings.Contains(message, "Finished") {
135135
return message
136136
}
137-
return "Finalizing"
137+
return "Finalizing Admin Console"
138138
}
139139
}
140140

@@ -150,7 +150,7 @@ func MaskKotsOutputForAirgap() spinner.MaskFn {
150150
case strings.Contains(message, "Pushing embedded cluster artifacts"):
151151
current = message
152152
case strings.Contains(message, "Waiting for Admin Console"):
153-
current = "Finalizing"
153+
current = "Finalizing Admin Console"
154154
case strings.Contains(message, "Finished!"):
155155
current = message
156156
}

pkg/kubeutils/kubeutils.go

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66
"sort"
7-
"strings"
87
"time"
98

109
embeddedclusterv1beta1 "github.com/replicatedhq/embedded-cluster-kinds/apis/v1beta1"
@@ -131,7 +130,7 @@ func WaitForInstallation(ctx context.Context, cli client.Client, writer *spinner
131130
lastInstall := installs[0]
132131

133132
if writer != nil {
134-
writeStatusMessage(writer, lastInstall.Status)
133+
writeStatusMessage(writer, lastInstall)
135134
}
136135

137136
// check the status of the installation
@@ -148,27 +147,34 @@ func WaitForInstallation(ctx context.Context, cli client.Client, writer *spinner
148147
return nil
149148
}
150149

151-
func writeStatusMessage(writer *spinner.MessageWriter, status embeddedclusterv1beta1.InstallationStatus) {
152-
if status.State != embeddedclusterv1beta1.InstallationStatePendingChartCreation {
153-
writer.Infof("Waiting for additional components to be ready: %s", status.Reason)
150+
func writeStatusMessage(writer *spinner.MessageWriter, install embeddedclusterv1beta1.Installation) {
151+
if install.Status.State != embeddedclusterv1beta1.InstallationStatePendingChartCreation {
154152
return
155153
}
156154

157-
chartNames := ""
158-
if len(status.PendingCharts) == 0 {
155+
if install.Spec.Config == nil || install.Spec.Config.Extensions.Helm == nil {
159156
return
160-
} else if len(status.PendingCharts) == 1 {
161-
// A
162-
chartNames = status.PendingCharts[0]
163-
} else if len(status.PendingCharts) == 2 {
164-
// A and B
165-
chartNames = strings.Join(status.PendingCharts, " and ")
166-
} else {
167-
// A, B, and C
168-
chartNames = strings.Join(status.PendingCharts[:len(status.PendingCharts)-1], ", ") + " and " + status.PendingCharts[len(status.PendingCharts)-1]
157+
}
158+
numDesiredCharts := len(install.Spec.Config.Extensions.Helm.Charts)
159+
160+
pendingChartsMap := map[string]struct{}{}
161+
for _, chartName := range install.Status.PendingCharts {
162+
pendingChartsMap[chartName] = struct{}{}
169163
}
170164

171-
writer.Infof("Waiting for additional components %s to be ready", chartNames)
165+
numPendingCharts := 0
166+
for _, ch := range install.Spec.Config.Extensions.Helm.Charts {
167+
if _, ok := pendingChartsMap[ch.Name]; ok {
168+
numPendingCharts++
169+
}
170+
}
171+
numCompletedCharts := numDesiredCharts - numPendingCharts
172+
173+
if numCompletedCharts < numDesiredCharts {
174+
writer.Infof("Waiting for additional components to be ready (%d/%d)", numCompletedCharts, numDesiredCharts)
175+
} else {
176+
writer.Infof("Finalizing additional components")
177+
}
172178
}
173179

174180
func IsNamespaceReady(ctx context.Context, cli client.Client, ns string) (bool, error) {

0 commit comments

Comments
 (0)