diff --git a/build-scripts/hack/update-contour-components.sh b/build-scripts/hack/update-contour-components.sh index 98d9dba53..33557f957 100755 --- a/build-scripts/hack/update-contour-components.sh +++ b/build-scripts/hack/update-contour-components.sh @@ -41,6 +41,25 @@ cp contour-src/examples/gateway-provisioner/01-roles.yaml ck-gateway-contour/tem cp contour-src/examples/gateway-provisioner/02-rolebindings.yaml ck-gateway-contour/templates/ cp contour-src/examples/gateway-provisioner/03-gateway-provisioner.yaml ck-gateway-contour/templates/ +# change gateway provisioner image to use the values from values.yaml +sed -i "s|image: ghcr.io/projectcontour/contour:${CONTOUR_VERSION}|image: \"{{ .Values.projectcontour.image.repository }}:{{ .Values.projectcontour.image.tag }}\"|" ck-gateway-contour/templates/03-gateway-provisioner.yaml + +# Add image args to the gateway provisioner +sed -i '/^ - --enable-leader-election$/a\ \ \ \ \ \ \ \ - --envoy-image={{ .Values.envoyproxy.image.repository }}:{{ .Values.envoyproxy.image.tag }}\n\ \ \ \ \ \ \ \ - --contour-image={{ .Values.projectcontour.image.repository }}:{{ .Values.projectcontour.image.tag }}' ck-gateway-contour/templates/03-gateway-provisioner.yaml + +# Add values.yaml +cat <ck-gateway-contour/values.yaml +projectcontour: + image: + repository: ghcr.io/projectcontour/contour + tag: ${CONTOUR_VERSION} + +envoyproxy: + image: + repository: docker.io/envoyproxy/envoy + tag: ${CONTOUR_VERSION} +EOF + # Add Gateway Class cat <ck-gateway-contour/templates/ck-gateway-class.yaml --- @@ -51,6 +70,7 @@ metadata: spec: controllerName: projectcontour.io/gateway-controller EOF + # Remove the Namespace resource from 00-common.yaml sed -i '1,5d' ck-gateway-contour/templates/00-common.yaml diff --git a/build-scripts/hack/upstream-images.yaml b/build-scripts/hack/upstream-images.yaml index 1ca5817e5..fbc74a75a 100644 --- a/build-scripts/hack/upstream-images.yaml +++ b/build-scripts/hack/upstream-images.yaml @@ -7,6 +7,18 @@ sync: - source: registry.k8s.io/pause:3.10 target: ghcr.io/canonical/k8s-snap/pause:3.10 type: image + - source: docker.io/bitnami/contour:1.28.2-debian-12-r4 + target: ghcr.io/canonical/k8s-snap/bitnami/contour:1.28.2-debian-12-r4 + type: image + - source: docker.io/bitnami/envoy:1.28.2-debian-12-r0 + target: ghcr.io/canonical/k8s-snap/bitnami/envoy:1.28.2-debian-12-r0 + type: image + - source: ghcr.io/projectcontour/contour:v1.28.2 + target: ghcr.io/canonical/k8s-snap/projectcontour/contour:v1.28.2 + type: image + - source: docker.io/envoyproxy/envoy:v1.29.2 + target: ghcr.io/canonical/k8s-snap/envoyproxy/envoy:v1.29.2 + type: image - source: docker.io/calico/apiserver:v3.28.0 target: ghcr.io/canonical/k8s-snap/calico/apiserver:v3.28.0 type: image diff --git a/k8s/manifests/charts/ck-gateway-contour-1.28.2.tgz b/k8s/manifests/charts/ck-gateway-contour-1.28.2.tgz index bb9974bc4..9e90e56b0 100644 Binary files a/k8s/manifests/charts/ck-gateway-contour-1.28.2.tgz and b/k8s/manifests/charts/ck-gateway-contour-1.28.2.tgz differ diff --git a/src/k8s/pkg/k8sd/features/contour/chart.go b/src/k8s/pkg/k8sd/features/contour/chart.go index 47d7f356d..a54b406b7 100644 --- a/src/k8s/pkg/k8sd/features/contour/chart.go +++ b/src/k8s/pkg/k8sd/features/contour/chart.go @@ -33,21 +33,30 @@ var ( Namespace: "projectcontour", ManifestPath: path.Join("charts", "ck-contour-common-1.28.2.tgz"), } - // envoyImageRepo represents the image to use for the Contour Envoy proxy. - envoyImageRepo = "docker.io/bitnami/envoy" - // envoyImageTag is the tag to use for the Contour Envoy proxy image. - envoyImageTag = "1.28.2-debian-12-r0" + // contourGatewayProvisionerEnvoyImageRepo represents the image to use for envoy in the gateway. + contourGatewayProvisionerEnvoyImageRepo = "ghcr.io/canonical/k8s-snap/envoyproxy/envoy" - // contourImageRepo represents the image to use for Contour. - contourImageRepo = "docker.io/bitnami/contour" + // NOTE: The image version is v1.29.2 instead of 1.28.2 + // to follow the upstream configuration for the contour gateway provisioner. + // contourGatewayProvisionerEnvoyImageTag is the tag to use for for envoy in the gateway. + contourGatewayProvisionerEnvoyImageTag = "v1.29.2" - // contourImageTag is the tag to use for the Contour image. - contourImageTag = "1.28.2-debian-12-r4" + // contourIngressEnvoyImageRepo represents the image to use for the Contour Envoy proxy. + contourIngressEnvoyImageRepo = "ghcr.io/canonical/k8s-snap/bitnami/envoy" - // contourGatewayImageRepo represents the image to use for the Contour Gateway Provisioner. - contourGatewayImageRepo = "ghcr.io/projectcontour/contour" + // contourIngressEnvoyImageTag is the tag to use for the Contour Envoy proxy image. + contourIngressEnvoyImageTag = "1.28.2-debian-12-r0" - // contourGatewayImageTag is the tag to use for the Contour Gateway Provisioner image. - contourGatewayImageTag = "v1.28.2" + // contourIngressContourImageRepo represents the image to use for Contour. + contourIngressContourImageRepo = "ghcr.io/canonical/k8s-snap/bitnami/contour" + + // contourIngressContourImageTag is the tag to use for the Contour image. + contourIngressContourImageTag = "1.28.2-debian-12-r4" + + // contourGatewayProvisionerContourImageRepo represents the image to use for the Contour Gateway Provisioner. + contourGatewayProvisionerContourImageRepo = "ghcr.io/canonical/k8s-snap/projectcontour/contour" + + // contourGatewayProvisionerContourImageTag is the tag to use for the Contour Gateway Provisioner image. + contourGatewayProvisionerContourImageTag = "v1.28.2" ) diff --git a/src/k8s/pkg/k8sd/features/contour/gateway.go b/src/k8s/pkg/k8sd/features/contour/gateway.go index b46575148..10149170a 100644 --- a/src/k8s/pkg/k8sd/features/contour/gateway.go +++ b/src/k8s/pkg/k8sd/features/contour/gateway.go @@ -33,7 +33,22 @@ func ApplyGateway(ctx context.Context, snap snap.Snap, gateway types.Gateway, ne return fmt.Errorf("failed to wait for required contour common CRDs to be available: %w", err) } - if _, err := m.Apply(ctx, chartGateway, helm.StatePresent, nil); err != nil { + values := map[string]any{ + "projectcontour": map[string]any{ + "image": map[string]any{ + "repository": contourGatewayProvisionerContourImageRepo, + "tag": contourGatewayProvisionerContourImageTag, + }, + }, + "envoyproxy": map[string]any{ + "image": map[string]any{ + "repository": contourGatewayProvisionerEnvoyImageRepo, + "tag": contourGatewayProvisionerEnvoyImageTag, + }, + }, + } + + if _, err := m.Apply(ctx, chartGateway, helm.StatePresent, values); err != nil { return fmt.Errorf("failed to install the contour gateway chart: %w", err) } diff --git a/src/k8s/pkg/k8sd/features/contour/ingress.go b/src/k8s/pkg/k8sd/features/contour/ingress.go index 5bde24222..9a1a08785 100644 --- a/src/k8s/pkg/k8sd/features/contour/ingress.go +++ b/src/k8s/pkg/k8sd/features/contour/ingress.go @@ -40,6 +40,13 @@ func ApplyIngress(ctx context.Context, snap snap.Snap, ingress types.Ingress, _ values = map[string]any{ "envoy-service-namespace": "projectcontour", "envoy-service-name": "envoy", + "envoy": map[string]any{ + "image": map[string]any{ + "registry": "", + "repository": contourIngressEnvoyImageRepo, + "tag": contourIngressEnvoyImageTag, + }, + }, "contour": map[string]any{ "manageCRDs": false, "ingressClass": map[string]any{ @@ -47,6 +54,11 @@ func ApplyIngress(ctx context.Context, snap snap.Snap, ingress types.Ingress, _ "create": true, "default": true, }, + "image": map[string]any{ + "registry": "", + "repository": contourIngressContourImageRepo, + "tag": contourIngressContourImageTag, + }, }, } diff --git a/src/k8s/pkg/k8sd/features/contour/register.go b/src/k8s/pkg/k8sd/features/contour/register.go index 3a7e1627b..4c3797032 100644 --- a/src/k8s/pkg/k8sd/features/contour/register.go +++ b/src/k8s/pkg/k8sd/features/contour/register.go @@ -8,8 +8,9 @@ import ( func init() { images.Register( - fmt.Sprintf("%s:%s", envoyImageRepo, envoyImageTag), - fmt.Sprintf("%s:%s", contourImageRepo, contourImageTag), - fmt.Sprintf("%s:%s", contourGatewayImageRepo, contourGatewayImageTag), + fmt.Sprintf("%s:%s", contourIngressEnvoyImageRepo, contourIngressEnvoyImageTag), + fmt.Sprintf("%s:%s", contourIngressContourImageRepo, contourIngressContourImageTag), + fmt.Sprintf("%s:%s", contourGatewayProvisionerContourImageRepo, contourGatewayProvisionerContourImageTag), + fmt.Sprintf("%s:%s", contourGatewayProvisionerEnvoyImageRepo, contourGatewayProvisionerEnvoyImageTag), ) }