Skip to content

Commit

Permalink
Sync Contour images (#516)
Browse files Browse the repository at this point in the history
* enable setting image in gateway chart

* ingress images

* hackery & sed wizardry gateway imgs

* better comments

* gateway img values

* upstream images update

* simplify

* fix registry/repo

* update envoyproxy img tag

* add note about envoy img version

* update img tag target

* add img in register.go

* rm separate registry value

* naming
  • Loading branch information
louiseschmidtgen committed Jul 3, 2024
1 parent ebc539f commit e96042b
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 16 deletions.
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
12 changes: 12 additions & 0 deletions 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
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),
)
}

0 comments on commit e96042b

Please sign in to comment.