Skip to content

Commit 0223537

Browse files
committed
Merge remote-tracking branch 'origin/main' into k0s-1-29
2 parents 8bc8e7f + d0cd9aa commit 0223537

File tree

16 files changed

+95
-38
lines changed

16 files changed

+95
-38
lines changed

cmd/buildtools/embeddedclusteroperator.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ var operatorImageComponents = map[string]addonComponent{
2121
"docker.io/library/busybox": {
2222
name: "utils",
2323
},
24+
"docker.io/bloomberg/goldpinger": {
25+
name: "goldpinger",
26+
useUpstreamImage: true,
27+
},
2428
}
2529

2630
var updateOperatorAddonCommand = &cli.Command{
@@ -130,9 +134,9 @@ func updateOperatorAddonImages(ctx context.Context, hcli helm.Client, chartURL s
130134
return fmt.Errorf("failed to get images from embedded cluster operator chart: %w", err)
131135
}
132136

133-
// make sure we include the operator util image as it does not show up when rendering the helm
134-
// chart.
137+
// make sure we include the operator util and goldpinger images as they don't show up when rendering the helm chart.
135138
images = append(images, "docker.io/library/busybox:latest")
139+
images = append(images, "docker.io/bloomberg/goldpinger:latest")
136140

137141
metaImages, err := UpdateImages(ctx, operatorImageComponents, embeddedclusteroperator.Metadata.Images, images)
138142
if err != nil {

cmd/installer/cli/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ func waitForNode(ctx context.Context) error {
976976
if err != nil {
977977
return fmt.Errorf("get hostname: %w", err)
978978
}
979-
if err := kubeutils.WaitForControllerNode(ctx, kcli, hostname); err != nil {
979+
if err := kubeutils.WaitForNode(ctx, kcli, hostname, false); err != nil {
980980
return fmt.Errorf("wait for node: %w", err)
981981
}
982982
return nil

cmd/installer/cli/join.go

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,26 @@ func runJoin(ctx context.Context, name string, flags JoinCmdFlags, jcmd *kotsadm
182182
return err
183183
}
184184

185-
if isWorker {
186-
logrus.Debugf("worker node join finished")
187-
return nil
188-
}
189-
190185
kcli, err := kubeutils.KubeClient()
191186
if err != nil {
192187
return fmt.Errorf("unable to get kube client: %w", err)
193188
}
194189

190+
hostname, err := os.Hostname()
191+
if err != nil {
192+
return fmt.Errorf("unable to get hostname: %w", err)
193+
}
194+
195+
logrus.Debugf("waiting for node to join cluster")
196+
if err := waitForNodeToJoin(ctx, kcli, hostname, isWorker); err != nil {
197+
return fmt.Errorf("unable to wait for node: %w", err)
198+
}
199+
200+
if isWorker {
201+
logrus.Debugf("worker node join finished")
202+
return nil
203+
}
204+
195205
airgapChartsPath := ""
196206
if flags.isAirgap {
197207
airgapChartsPath = runtimeconfig.EmbeddedClusterChartsSubDir()
@@ -207,15 +217,6 @@ func runJoin(ctx context.Context, name string, flags JoinCmdFlags, jcmd *kotsadm
207217
}
208218
defer hcli.Close()
209219

210-
hostname, err := os.Hostname()
211-
if err != nil {
212-
return fmt.Errorf("unable to get hostname: %w", err)
213-
}
214-
215-
if err := waitForNodeToJoin(ctx, kcli, hostname); err != nil {
216-
return fmt.Errorf("unable to wait for node: %w", err)
217-
}
218-
219220
if flags.enableHighAvailability {
220221
if err := maybeEnableHA(ctx, kcli, hcli, flags.isAirgap, cidrCfg.ServiceCIDR, jcmd.InstallationSpec.Proxy, jcmd.InstallationSpec.Config); err != nil {
221222
return fmt.Errorf("unable to enable high availability: %w", err)
@@ -246,7 +247,12 @@ func runJoinVerifyAndPrompt(name string, flags JoinCmdFlags, jcmd *kotsadm.JoinC
246247
}
247248

248249
runtimeconfig.Set(jcmd.InstallationSpec.RuntimeConfig)
249-
os.Setenv("KUBECONFIG", runtimeconfig.PathToKubeConfig())
250+
isWorker := !strings.Contains(jcmd.K0sJoinCommand, "controller")
251+
if isWorker {
252+
os.Setenv("KUBECONFIG", runtimeconfig.PathToKubeletConfig())
253+
} else {
254+
os.Setenv("KUBECONFIG", runtimeconfig.PathToKubeConfig())
255+
}
250256
os.Setenv("TMPDIR", runtimeconfig.EmbeddedClusterTmpSubDir())
251257

252258
if err := runtimeconfig.WriteToDisk(); err != nil {
@@ -476,11 +482,11 @@ func runK0sInstallCommand(networkInterface string, fullcmd string) error {
476482
return nil
477483
}
478484

479-
func waitForNodeToJoin(ctx context.Context, kcli client.Client, hostname string) error {
485+
func waitForNodeToJoin(ctx context.Context, kcli client.Client, hostname string, isWorker bool) error {
480486
loading := spinner.Start()
481487
defer loading.Close()
482488
loading.Infof("Waiting for node to join the cluster")
483-
if err := kubeutils.WaitForControllerNode(ctx, kcli, hostname); err != nil {
489+
if err := kubeutils.WaitForNode(ctx, kcli, hostname, isWorker); err != nil {
484490
return fmt.Errorf("unable to wait for node: %w", err)
485491
}
486492
loading.Infof("Node has joined the cluster!")

e2e/scripts/enable-squid-whitelist.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function main() {
7676
maybe_install curl curl
7777

7878
# update the squid config to disable allow access from local networks
79-
sed -i 's/http_access allow localnet/# http_access allow localnet/' /etc/squid/conf.d/ec.conf
79+
sed -i 's/^http_access allow localnet$/http_access allow localnet whitelist/' /etc/squid/conf.d/ec.conf
8080

8181
# restart the squid service
8282
squid -k reconfigure

e2e/scripts/install-and-configure-squid.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ acl step1 at_step SslBump1
99
ssl_bump peek step1
1010
ssl_bump bump all
1111
12+
acl whitelist dstdomain \"/etc/squid/sites.whitelist.txt\"
13+
14+
# this will allow all access to the internet from local IPs
1215
http_access allow localnet
1316
14-
acl whitelist dstdomain \"/etc/squid/sites.whitelist.txt\"
15-
http_access allow whitelist
17+
# to restrict access so only local IPs can access the internet and only sites on the whitelist, instead use
18+
# http_access allow localnet whitelist
1619
"
1720

1821
whitelist_txt="

operator/charts/embedded-cluster-operator/templates/embedded-cluster-lam-service-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ data:
2323
podSpec:
2424
containers:
2525
- image: {{ .Values.utilsImage }}
26-
imagePullPolicy: Always
26+
imagePullPolicy: IfNotPresent
2727
args: ["chroot","/host","cat","/etc/systemd/system/local-artifact-mirror.service.d/embedded-cluster.conf"]
2828
name: debugger
2929
resources: {}

operator/charts/embedded-cluster-operator/templates/embedded-cluster-logs-collector.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ data:
2323
podSpec:
2424
containers:
2525
- image: {{ .Values.utilsImage }}
26-
imagePullPolicy: Always
26+
imagePullPolicy: IfNotPresent
2727
args: ["chroot","/host","journalctl","-u","k0scontroller","--no-pager","--since","2 days ago"]
2828
name: debugger
2929
resources: {}
@@ -52,7 +52,7 @@ data:
5252
podSpec:
5353
containers:
5454
- image: {{ .Values.utilsImage }}
55-
imagePullPolicy: Always
55+
imagePullPolicy: IfNotPresent
5656
args: ["chroot","/host","journalctl","-u","k0sworker","--no-pager","--since","2 days ago"]
5757
name: debugger
5858
resources: {}
@@ -81,7 +81,7 @@ data:
8181
podSpec:
8282
containers:
8383
- image: {{ .Values.utilsImage }}
84-
imagePullPolicy: Always
84+
imagePullPolicy: IfNotPresent
8585
args: ["chroot","/host","journalctl","-u","local-artifact-mirror","--no-pager","--since","2 days ago"]
8686
name: debugger
8787
resources: {}

operator/charts/embedded-cluster-operator/templates/embedded-cluster-troubleshoot-goldpinger.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ data:
1919
collectors:
2020
- goldpinger:
2121
namespace: goldpinger
22-
image: proxy.replicated.com/anonymous/bloomberg/goldpinger@sha256:70416f19f1cbeedd344d37b08e64114779976b99905e0d018e71c437cde750dc
22+
image: {{ .Values.goldpingerImage }}
2323
podLaunchOptions:
24-
image: proxy.replicated.com/anonymous/library/busybox@sha256:768e5c6f5cb6db0794eec98dc7a967f40631746c32232b78a3105fb946f3ab83
24+
image: {{ .Values.utilsImage }}
2525
exclude: {{ .Values.isAirgap }}
2626
analyzers:
2727
- goldpinger:

operator/charts/embedded-cluster-operator/values.yaml.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ image:
1313
pullPolicy: IfNotPresent
1414

1515
utilsImage: busybox:latest
16+
goldpingerImage: bloomberg/goldpinger:latest
1617

1718
extraEnv: []
1819
# - name: HTTP_PROXY

pkg/addons/embeddedclusteroperator/static/metadata.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ images:
1313
tag:
1414
amd64: v1.19.0-k8s-1.30
1515
arm64: v1.19.0-k8s-1.30
16+
goldpinger:
17+
repo: proxy.replicated.com/anonymous/bloomberg/goldpinger
18+
tag:
19+
amd64: latest
20+
arm64: latest
1621
utils:
1722
repo: proxy.replicated.com/anonymous/replicated/ec-utils
1823
tag:

0 commit comments

Comments
 (0)