Skip to content

Commit

Permalink
Merge pull request #5544 from k0sproject/backport-5540-to-release-1.30
Browse files Browse the repository at this point in the history
[Backport release-1.30] Handle pushgateway image as any other image
  • Loading branch information
twz123 authored Feb 6, 2025
2 parents 25f929f + c54c364 commit 01781bd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
15 changes: 9 additions & 6 deletions pkg/airgap/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,10 @@ import (
"runtime"

"github.com/k0sproject/k0s/pkg/apis/k0s/v1beta1"
"github.com/k0sproject/k0s/pkg/constant"
)

// GetImageURIs returns all image tags
func GetImageURIs(spec *v1beta1.ClusterSpec, all bool) []string {
pauseImage := v1beta1.ImageSpec{
Image: constant.KubePauseContainerImage,
Version: constant.KubePauseContainerImageVersion,
}

imageURIs := []string{
spec.Images.Calico.CNI.URI(),
Expand All @@ -40,7 +35,15 @@ func GetImageURIs(spec *v1beta1.ClusterSpec, all bool) []string {
spec.Images.KubeRouter.CNI.URI(),
spec.Images.KubeRouter.CNIInstaller.URI(),
spec.Images.MetricsServer.URI(),
pauseImage.URI(),
spec.Images.Pause.URI(),
}

if all {
// Currently we can't determine if the user has enabled the PushGateway via
// config so include it only if all is requested
imageURIs = append(imageURIs,
spec.Images.PushGateway.URI(),
)
}

if spec.Network != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/k0s/v1beta1/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func (ci *ClusterImages) overrideImageRepositories() {
override(&ci.KubeRouter.CNI)
override(&ci.KubeRouter.CNIInstaller)
override(&ci.Pause)
override(&ci.PushGateway)
}

// CalicoImageSpec config group for calico related image settings
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/k0s/v1beta1/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func TestImagesRepoOverrideInConfiguration(t *testing.T) {
require.Equal(t, fmt.Sprintf("my.repo/k0sproject/kube-router:%s", constant.KubeRouterCNIImageVersion), testingConfig.Spec.Images.KubeRouter.CNI.URI())
require.Equal(t, fmt.Sprintf("my.repo/k0sproject/cni-node:%s", constant.KubeRouterCNIInstallerImageVersion), testingConfig.Spec.Images.KubeRouter.CNIInstaller.URI())
require.Equal(t, fmt.Sprintf("my.repo/pause:%s", constant.KubePauseContainerImageVersion), testingConfig.Spec.Images.Pause.URI())
require.Equal(t, fmt.Sprintf("my.repo/k0sproject/pushgateway-ttl:%s", constant.PushGatewayImageVersion), testingConfig.Spec.Images.PushGateway.URI())
})
t.Run("config_with_custom_images", func(t *testing.T) {
cfg := DefaultClusterConfig()
Expand Down

0 comments on commit 01781bd

Please sign in to comment.