Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
emosbaugh committed Jul 15, 2024
1 parent 33b0440 commit b27eb12
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/image-deps-updater.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ jobs:
with:
apko-config: deploy/images/calico-node/apko.yaml
image-name: ttl.sh/ec/calico-node:${{ steps.get-tags.outputs.calico-tag }}
# registry-username: ${{ secrets.REGISTRY_USERNAME_STAGING }}
# registry-password: ${{ secrets.REGISTRY_PASSWORD_STAGING }}
overwrite: ${{ github.event.inputs.overwrite }}
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ VERSION ?= $(shell git describe --tags --dirty)
UNAME := $(shell uname)
ARCH := $(shell uname -m)
APP_NAME = embedded-cluster
CALICO_NODE_IMAGE = ttl.sh/ec/calico-node
CALICO_NODE_VERSION = 3.28.0-r5
ADMIN_CONSOLE_CHART_REPO_OVERRIDE =
ADMIN_CONSOLE_CHART_VERSION = 1.111.0
ADMIN_CONSOLE_IMAGE_OVERRIDE =
Expand Down Expand Up @@ -35,6 +37,8 @@ LD_FLAGS = -X github.com/replicatedhq/embedded-cluster/pkg/defaults.K0sVersion=$
-X github.com/replicatedhq/embedded-cluster/pkg/defaults.TroubleshootVersion=$(TROUBLESHOOT_VERSION) \
-X github.com/replicatedhq/embedded-cluster/pkg/defaults.KubectlVersion=$(KUBECTL_VERSION) \
-X github.com/replicatedhq/embedded-cluster/pkg/defaults.LocalArtifactMirrorImage=$(LOCAL_ARTIFACT_MIRROR_IMAGE_LOCATION) \
-X github.com/replicatedhq/embedded-cluster/pkg/config/images.CalicoNodeImage=$(CALICO_NODE_IMAGE) \
-X github.com/replicatedhq/embedded-cluster/pkg/config/images.CalicoNodeVersion=$(CALICO_NODE_VERSION) \
-X github.com/replicatedhq/embedded-cluster/pkg/addons/adminconsole.ChartRepoOverride=$(ADMIN_CONSOLE_CHART_REPO_OVERRIDE) \
-X github.com/replicatedhq/embedded-cluster/pkg/addons/adminconsole.Version=$(ADMIN_CONSOLE_CHART_VERSION) \
-X github.com/replicatedhq/embedded-cluster/pkg/addons/adminconsole.ImageOverride=$(ADMIN_CONSOLE_IMAGE_OVERRIDE) \
Expand Down
3 changes: 3 additions & 0 deletions cmd/embedded-cluster/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ func ensureK0sConfig(c *cli.Context) (*k0sconfig.ClusterConfig, error) {
return nil, fmt.Errorf("unable to create directory: %w", err)
}
cfg := config.RenderK0sConfig()
if err := config.OverrideK0sImages(cfg); err != nil {
return nil, fmt.Errorf("unable to override k0s images: %w", err)
}
if c.String("pod-cidr") != "" {
cfg.Spec.Network.PodCIDR = c.String("pod-cidr")
}
Expand Down
3 changes: 3 additions & 0 deletions cmd/embedded-cluster/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ func gatherVersionMetadata() (*types.ReleaseMetadata, error) {

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

additionalImages, err := applier.GetAdditionalImages()
Expand Down
19 changes: 19 additions & 0 deletions pkg/config/images.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package config

import (
k0sv1beta1 "github.com/k0sproject/k0s/pkg/apis/k0s/v1beta1"
"github.com/replicatedhq/embedded-cluster/pkg/config/images"
)

func OverrideK0sImages(cfg *k0sv1beta1.ClusterConfig) error {
if cfg.Spec.Images == nil {
cfg.Spec.Images = &k0sv1beta1.ClusterImages{}
}
if images.CalicoNodeImage != "" {
cfg.Spec.Images.Calico.Node.Image = images.CalicoNodeImage
}
if images.CalicoNodeVersion != "" {
cfg.Spec.Images.Calico.Node.Version = images.CalicoNodeVersion
}
return nil
}
7 changes: 7 additions & 0 deletions pkg/config/images/images.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package images

// Overwritten by -ldflags in Makefile
var (
CalicoNodeImage = ""
CalicoNodeVersion = ""
)

0 comments on commit b27eb12

Please sign in to comment.