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
22 changes: 22 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,27 @@ 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.registry }}/{{ .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.registry }}/{{ .Values.envoyproxy.image.repository }}:{{ .Values.envoyproxy.image.tag }}\n\ \ \ \ \ \ \ \ - --contour-image={{ .Values.projectcontour.image.registry }}/{{ .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:
registry: ghcr.io
repository: projectcontour/contour
louiseschmidtgen marked this conversation as resolved.
Show resolved Hide resolved
tag: ${CONTOUR_VERSION}

envoyproxy:
image:
registry: docker.io
repository: envoyproxy/envoy
tag: ${CONTOUR_VERSION}
EOF

# Add Gateway Class
cat <<EOF >ck-gateway-contour/templates/ck-gateway-class.yaml
---
Expand All @@ -51,6 +72,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.28.2
target: ghcr.io/canonical/k8s-snap/envoyproxy/envoy:v1.28.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 added ck-gateway-contour-1.28.2.tgz
Binary file not shown.
14 changes: 12 additions & 2 deletions src/k8s/pkg/k8sd/features/contour/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,24 @@ var (
Namespace: "projectcontour",
ManifestPath: path.Join("charts", "ck-contour-common-1.28.2.tgz"),
}

// registry represents the registry (ghcr.io/canonical) to use for Contour images.
registry = "ghcr.io/canonical"

// envoyProxyImageRepo represents the image to use for envoy in the gateway.
envoyProxyImageRepo = "envoyproxy/envoy"

// envoyProxyImageTag is the tag to use for for envoy in the gateway.
envoyProxyImageTag = "v1.29.2"

// envoyImageRepo represents the image to use for the Contour Envoy proxy.
envoyImageRepo = "docker.io/bitnami/envoy"
envoyImageRepo = "bitnami/envoy"

// envoyImageTag is the tag to use for the Contour Envoy proxy image.
envoyImageTag = "1.28.2-debian-12-r0"

// contourImageRepo represents the image to use for Contour.
contourImageRepo = "docker.io/bitnami/contour"
contourImageRepo = "bitnami/contour"

// contourImageTag is the tag to use for the Contour image.
contourImageTag = "1.28.2-debian-12-r4"
Expand Down
19 changes: 18 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,24 @@ 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{
"registry": registry,
"repository": contourGatewayImageRepo,
"tag": contourGatewayImageTag,
},
},
"envoyproxy": map[string]any{
"image": map[string]any{
"registry": registry,
"repository": envoyProxyImageRepo,
"tag": envoyProxyImageTag,
},
},
}

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": registry,
louiseschmidtgen marked this conversation as resolved.
Show resolved Hide resolved
"repository": envoyImageRepo,
"tag": envoyImageTag,
},
},
"contour": map[string]any{
"manageCRDs": false,
"ingressClass": map[string]any{
"name": "ck-ingress",
"create": true,
"default": true,
},
"image": map[string]any{
"registry": registry,
"repository": contourImageRepo,
"tag": contourImageTag,
},
},
}

Expand Down
Loading