Skip to content

Commit

Permalink
Use original pause image but proxy it (#911)
Browse files Browse the repository at this point in the history
* Use original pause image but proxy it
  • Loading branch information
sgalsaleh authored Aug 1, 2024
1 parent ce25152 commit 52b8846
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 32 deletions.
9 changes: 0 additions & 9 deletions cmd/buildtools/k0s.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var k0sImageComponents = map[string]string{
"registry.k8s.io/metrics-server/metrics-server": "metrics-server",
"quay.io/k0sproject/kube-proxy": "kube-proxy",
"quay.io/k0sproject/envoy-distroless": "envoy-distroless",
"registry.k8s.io/pause": "pause",
}

var k0sComponents = map[string]addonComponent{
Expand Down Expand Up @@ -60,14 +59,6 @@ var k0sComponents = map[string]addonComponent{
return fmt.Sprintf("envoy-%d.%d", opts.upstreamVersion.Major(), opts.upstreamVersion.Minor())
},
},
"pause": {
getWolfiPackageName: func(opts addonComponentOptions) string {
return fmt.Sprintf("kubernetes-pause-%d.%d", opts.upstreamVersion.Major(), opts.upstreamVersion.Minor())
},
getWolfiPackageVersionComparison: func(opts addonComponentOptions) string {
return latestPatchComparison(opts.k0sVersion) // pause package version follows the k8s version
},
},
}

var updateK0sImagesCommand = &cli.Command{
Expand Down
20 changes: 0 additions & 20 deletions deploy/images/pause/apko.tmpl.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions pkg/config/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ func overrideK0sImages(cfg *k0sv1beta1.ClusterConfig) {
cfg.Spec.Images.KubeProxy.Image = helpers.AddonImageFromComponentName("kube-proxy")
cfg.Spec.Images.KubeProxy.Version = Metadata.Images["kube-proxy"]

cfg.Spec.Images.Pause.Image = helpers.AddonImageFromComponentName("pause")
cfg.Spec.Images.Pause.Version = Metadata.Images["pause"]
cfg.Spec.Images.Pause.Image = fmt.Sprintf("proxy.replicated.com/anonymous/%s", cfg.Spec.Images.Pause.Image)

// TODO (salah): remove the following and uncomment when upstream PR for digest support is released: https://github.com/k0sproject/k0s/pull/4792
if cfg.Spec.Network != nil &&
Expand Down
9 changes: 8 additions & 1 deletion pkg/config/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func TestListK0sImages(t *testing.T) {
if len(filtered) == 0 {
t.Errorf("ListK0sImages() = %v, want not empty", filtered)
}
var foundPause bool
var foundEnvoyProxy bool
for _, image := range filtered {
if strings.Contains(image, "kube-router") {
Expand All @@ -51,7 +52,10 @@ func TestListK0sImages(t *testing.T) {
t.Errorf("ListK0sImages() = %v, want not to contain apiserver-network-proxy-agent", filtered)
}
if strings.Contains(image, constant.KubePauseContainerImage) {
t.Errorf("ListK0sImages() = %v, want the ec pause image", filtered)
foundPause = true
if !strings.HasPrefix(image, "proxy.replicated.com/anonymous/") {
t.Errorf("ListK0sImages() = %v, want pause to be proxied", filtered)
}
}
if strings.Contains(image, "envoy-distroless") {
foundEnvoyProxy = true
Expand All @@ -60,6 +64,9 @@ func TestListK0sImages(t *testing.T) {
}
}
}
if !foundPause {
t.Errorf("ListK0sImages() = %v, want to contain pause", filtered)
}
if !foundEnvoyProxy {
t.Errorf("ListK0sImages() = %v, want to contain envoy-distroless", filtered)
}
Expand Down

0 comments on commit 52b8846

Please sign in to comment.