Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync Contour images #516

Merged
merged 14 commits into from
Jul 3, 2024
20 changes: 20 additions & 0 deletions build-scripts/hack/update-contour-components.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF >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 <<EOF >ck-gateway-contour/templates/ck-gateway-class.yaml
---
Expand All @@ -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

Expand Down
13 changes: 12 additions & 1 deletion build-scripts/hack/upstream-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -49,4 +61,3 @@ sync:
- source: registry.k8s.io/sig-storage/csi-snapshotter:v8.0.1
target: ghcr.io/canonical/k8s-snap/sig-storage/csi-snapshotter:v8.0.1
type: image

Binary file modified k8s/manifests/charts/ck-gateway-contour-1.28.2.tgz
Binary file not shown.
33 changes: 21 additions & 12 deletions src/k8s/pkg/k8sd/features/contour/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
17 changes: 16 additions & 1 deletion src/k8s/pkg/k8sd/features/contour/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
12 changes: 12 additions & 0 deletions src/k8s/pkg/k8sd/features/contour/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,25 @@ 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{
"name": "ck-ingress",
"create": true,
"default": true,
},
"image": map[string]any{
"registry": "",
"repository": contourIngressContourImageRepo,
"tag": contourIngressContourImageTag,
},
},
}

Expand Down
7 changes: 4 additions & 3 deletions src/k8s/pkg/k8sd/features/contour/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
}
Loading