Skip to content

Commit

Permalink
Drop custom tigera operator patches (#3)
Browse files Browse the repository at this point in the history
The Tigera operator expects the ImageSet specs to contain the original
image names, not the custom ones. We'll drop our custom patches and
update the integration tests accordingly.

We need to remove "calico-ctl" from the image spec as the Tigera
operator does not expect it and is going to throw an error.

While at it, we'll avoid using the "match" expression since it's
unsupported on 22.04.
  • Loading branch information
petrutlucian94 authored Dec 6, 2024
1 parent 33f3dff commit 4122057
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 88 deletions.
23 changes: 12 additions & 11 deletions tests/integration/test_calico.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@

def get_image_platform():
arch = platform.machine()
match arch:
case "x86_64":
return "amd64"
case "aarch64":
return "arm64"
case _:
raise Exception(f"Unsupported cpu platform: {arch}")
if arch == "x86_64":
return "amd64"
elif arch == "aarch64":
return "arm64"
raise Exception(f"Unsupported cpu platform: {arch}")


IMG_PLATFORM = get_image_platform()
Expand All @@ -45,7 +43,8 @@ def get_image_platform():
def get_installation_spec(registry, repo):
return f"""
# This section includes base Calico installation configuration.
# For more information, see: https://docs.tigera.io/calico/latest/reference/installation/api#operator.tigera.io/v1.Installation
# For more information, see:
# https://docs.tigera.io/calico/latest/reference/installation/api#operator.tigera.io/v1.Installation
apiVersion: operator.tigera.io/v1
kind: Installation
metadata:
Expand Down Expand Up @@ -92,7 +91,6 @@ def get_imageset_spec(operator_version, calico_version):
"calico-kube-controllers",
"calico-csi",
"calico-apiserver",
"calico-ctl",
"calico-pod2daemon-flexvol",
"calico-key-cert-provisioner",
"calico-node-driver-registrar",
Expand All @@ -105,11 +103,14 @@ def get_imageset_spec(operator_version, calico_version):
image, version, IMG_PLATFORM
)
sha256_digest = get_image_sha256_digest(rock.image)
prefix = rock.image.split("/")[1]

# We're supposed to pass the original image names and new hashes.
orig_image = image.replace("calico-tigera-", "tigera/")
orig_image = orig_image.replace("calico-", "calico/")

spec["spec"]["images"].append(
{
"image": f"{prefix}/{image}",
"image": orig_image,
"digest": sha256_digest,
}
)
Expand Down
12 changes: 5 additions & 7 deletions tests/sanity/test_calico.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@

def get_image_platform():
arch = platform.machine()
match arch:
case "x86_64":
return "amd64"
case "aarch64":
return "arm64"
case _:
raise Exception(f"Unsupported cpu platform: {arch}")
if arch == "x86_64":
return "amd64"
elif arch == "aarch64":
return "arm64"
raise Exception(f"Unsupported cpu platform: {arch}")


IMG_PLATFORM = get_image_platform()
Expand Down
38 changes: 0 additions & 38 deletions tigera-operator/v1.34.0/fix_image_component_handling.patch

This file was deleted.

30 changes: 0 additions & 30 deletions tigera-operator/v1.34.0/fix_imageset_checks.patch

This file was deleted.

2 changes: 0 additions & 2 deletions tigera-operator/v1.34.0/rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ parts:
- PACKAGE_NAME: github.com/tigera/operator
override-build: |
export EMAIL=root@localhost
git am --ignore-whitespace $CRAFT_PROJECT_DIR/fix_image_component_handling.patch
git am --ignore-whitespace $CRAFT_PROJECT_DIR/fix_imageset_checks.patch
LDFLAGS="-X ${PACKAGE_NAME}/version.VERSION=${GIT_VERSION} -s -w"
Expand Down

0 comments on commit 4122057

Please sign in to comment.