Skip to content

Commit

Permalink
feat: proxy envoy image (#883)
Browse files Browse the repository at this point in the history
  • Loading branch information
emosbaugh authored Jul 29, 2024
1 parent 80df54c commit 9e58677
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
12 changes: 11 additions & 1 deletion pkg/config/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,17 @@ func overrideK0sImages(cfg *k0sv1beta1.ClusterConfig) {
cfg.Spec.Images.Pause.Image = helpers.AddonImageFromComponentName("pause")
cfg.Spec.Images.Pause.Version = Metadata.Images["pause"]

// TODO (salah): uncomment when upstream PR for digest support is released: https://github.com/k0sproject/k0s/pull/4792
// 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 &&
cfg.Spec.Network.NodeLocalLoadBalancing != nil &&
cfg.Spec.Network.NodeLocalLoadBalancing.EnvoyProxy != nil &&
cfg.Spec.Network.NodeLocalLoadBalancing.EnvoyProxy.Image != nil &&
cfg.Spec.Network.NodeLocalLoadBalancing.EnvoyProxy.Image.Image != "" {
cfg.Spec.Network.NodeLocalLoadBalancing.EnvoyProxy.Image.Image = fmt.Sprintf(
"proxy.replicated.com/anonymous/%s",
cfg.Spec.Network.NodeLocalLoadBalancing.EnvoyProxy.Image.Image,
)
}
// if cfg.Spec.Network == nil {
// cfg.Spec.Network = &k0sv1beta1.Network{}
// }
Expand Down
16 changes: 13 additions & 3 deletions pkg/config/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,20 @@ func TestListK0sImages(t *testing.T) {
}
}
if !foundKubeRouter {
t.Errorf("ListK0sImages() = %v, want to contain kube-router", original)
t.Errorf("airgap.GetImageURIs() = %v, want to contain kube-router", original)
}
if !foundCNINode {
t.Errorf("ListK0sImages() = %v, want to contain kube-router", original)
t.Errorf("airgap.GetImageURIs() = %v, want to contain kube-router", original)
}
if !foundKonnectivity {
t.Errorf("ListK0sImages() = %v, want to contain apiserver-network-proxy-agent", original)
t.Errorf("airgap.GetImageURIs() = %v, want to contain apiserver-network-proxy-agent", original)
}

filtered := ListK0sImages(RenderK0sConfig())
if len(filtered) == 0 {
t.Errorf("ListK0sImages() = %v, want not empty", filtered)
}
var foundEnvoyProxy bool
for _, image := range filtered {
if strings.Contains(image, "kube-router") {
t.Errorf("ListK0sImages() = %v, want not to contain kube-router", filtered)
Expand All @@ -52,5 +53,14 @@ func TestListK0sImages(t *testing.T) {
if strings.Contains(image, constant.KubePauseContainerImage) {
t.Errorf("ListK0sImages() = %v, want the ec pause image", filtered)
}
if strings.Contains(image, "envoy-distroless") {
foundEnvoyProxy = true
if !strings.HasPrefix(image, "proxy.replicated.com/anonymous/") {
t.Errorf("ListK0sImages() = %v, want envoy-distroless to be proxied", filtered)
}
}
}
if !foundEnvoyProxy {
t.Errorf("ListK0sImages() = %v, want to contain envoy-distroless", filtered)
}
}

0 comments on commit 9e58677

Please sign in to comment.