Skip to content

Commit b27eb12

Browse files
committed
f
1 parent 33b0440 commit b27eb12

File tree

6 files changed

+38
-0
lines changed

6 files changed

+38
-0
lines changed

.github/workflows/image-deps-updater.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@ jobs:
4242
with:
4343
apko-config: deploy/images/calico-node/apko.yaml
4444
image-name: ttl.sh/ec/calico-node:${{ steps.get-tags.outputs.calico-tag }}
45+
# registry-username: ${{ secrets.REGISTRY_USERNAME_STAGING }}
46+
# registry-password: ${{ secrets.REGISTRY_PASSWORD_STAGING }}
4547
overwrite: ${{ github.event.inputs.overwrite }}

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ VERSION ?= $(shell git describe --tags --dirty)
22
UNAME := $(shell uname)
33
ARCH := $(shell uname -m)
44
APP_NAME = embedded-cluster
5+
CALICO_NODE_IMAGE = ttl.sh/ec/calico-node
6+
CALICO_NODE_VERSION = 3.28.0-r5
57
ADMIN_CONSOLE_CHART_REPO_OVERRIDE =
68
ADMIN_CONSOLE_CHART_VERSION = 1.111.0
79
ADMIN_CONSOLE_IMAGE_OVERRIDE =
@@ -35,6 +37,8 @@ LD_FLAGS = -X github.com/replicatedhq/embedded-cluster/pkg/defaults.K0sVersion=$
3537
-X github.com/replicatedhq/embedded-cluster/pkg/defaults.TroubleshootVersion=$(TROUBLESHOOT_VERSION) \
3638
-X github.com/replicatedhq/embedded-cluster/pkg/defaults.KubectlVersion=$(KUBECTL_VERSION) \
3739
-X github.com/replicatedhq/embedded-cluster/pkg/defaults.LocalArtifactMirrorImage=$(LOCAL_ARTIFACT_MIRROR_IMAGE_LOCATION) \
40+
-X github.com/replicatedhq/embedded-cluster/pkg/config/images.CalicoNodeImage=$(CALICO_NODE_IMAGE) \
41+
-X github.com/replicatedhq/embedded-cluster/pkg/config/images.CalicoNodeVersion=$(CALICO_NODE_VERSION) \
3842
-X github.com/replicatedhq/embedded-cluster/pkg/addons/adminconsole.ChartRepoOverride=$(ADMIN_CONSOLE_CHART_REPO_OVERRIDE) \
3943
-X github.com/replicatedhq/embedded-cluster/pkg/addons/adminconsole.Version=$(ADMIN_CONSOLE_CHART_VERSION) \
4044
-X github.com/replicatedhq/embedded-cluster/pkg/addons/adminconsole.ImageOverride=$(ADMIN_CONSOLE_IMAGE_OVERRIDE) \

cmd/embedded-cluster/install.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ func ensureK0sConfig(c *cli.Context) (*k0sconfig.ClusterConfig, error) {
319319
return nil, fmt.Errorf("unable to create directory: %w", err)
320320
}
321321
cfg := config.RenderK0sConfig()
322+
if err := config.OverrideK0sImages(cfg); err != nil {
323+
return nil, fmt.Errorf("unable to override k0s images: %w", err)
324+
}
322325
if c.String("pod-cidr") != "" {
323326
cfg.Spec.Network.PodCIDR = c.String("pod-cidr")
324327
}

cmd/embedded-cluster/version.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ func gatherVersionMetadata() (*types.ReleaseMetadata, error) {
146146

147147
// Render k0s config to get the images contained within
148148
k0sConfig := config.RenderK0sConfig()
149+
if err := config.OverrideK0sImages(k0sConfig); err != nil {
150+
return nil, fmt.Errorf("unable to override k0s images: %w", err)
151+
}
149152
meta.K0sImages = airgap.GetImageURIs(k0sConfig.Spec, true)
150153

151154
additionalImages, err := applier.GetAdditionalImages()

pkg/config/images.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package config
2+
3+
import (
4+
k0sv1beta1 "github.com/k0sproject/k0s/pkg/apis/k0s/v1beta1"
5+
"github.com/replicatedhq/embedded-cluster/pkg/config/images"
6+
)
7+
8+
func OverrideK0sImages(cfg *k0sv1beta1.ClusterConfig) error {
9+
if cfg.Spec.Images == nil {
10+
cfg.Spec.Images = &k0sv1beta1.ClusterImages{}
11+
}
12+
if images.CalicoNodeImage != "" {
13+
cfg.Spec.Images.Calico.Node.Image = images.CalicoNodeImage
14+
}
15+
if images.CalicoNodeVersion != "" {
16+
cfg.Spec.Images.Calico.Node.Version = images.CalicoNodeVersion
17+
}
18+
return nil
19+
}

pkg/config/images/images.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package images
2+
3+
// Overwritten by -ldflags in Makefile
4+
var (
5+
CalicoNodeImage = ""
6+
CalicoNodeVersion = ""
7+
)

0 commit comments

Comments
 (0)