Skip to content

Commit

Permalink
Adds 1.27.2 rock
Browse files Browse the repository at this point in the history
Adds a rock for the mentioned version. Updated the rockcraft.yaml file
paths. Updated sanity tests to include both rock versions.
  • Loading branch information
claudiubelu committed Jul 19, 2024
1 parent ded9380 commit 4baa315
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 5 deletions.
File renamed without changes.
37 changes: 37 additions & 0 deletions 1.27.2/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: cluster-autoscaler
summary: ROCK for the cluster-autoscaler Project.
description: This ROCK is a drop-in replacement for the autoscaling/cluster-autoscaler image.
version: "1.27.2"
license: Apache-2.0

base: bare
build-base: [email protected]
platforms:
amd64:
arm64:

entrypoint-service: cluster-autoscaler
services:
cluster-autoscaler:
override: replace
summary: "cluster-autoscaler service"
startup: enabled
command: "/cluster-autoscaler [ --help ]"
on-failure: shutdown

parts:
cluster-autoscaler:
plugin: nil
source: https://github.com/kubernetes/autoscaler.git
source-type: git
source-tag: cluster-autoscaler-${CRAFT_PROJECT_VERSION}
source-depth: 1
build-snaps:
- go/1.20/stable
override-build: |
cd cluster-autoscaler
make build-arch-${CRAFT_PLATFORM}
cp cluster-autoscaler-${CRAFT_PLATFORM} ${CRAFT_PART_INSTALL}/cluster-autoscaler
prime:
- cluster-autoscaler

1 change: 1 addition & 0 deletions tests/requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ coverage[toml]==7.2.5
pytest==7.3.1
PyYAML==6.0.1
tenacity==8.2.3
git+https://github.com/canonical/k8s-test-harness.git@main
21 changes: 16 additions & 5 deletions tests/sanity/test_rock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,30 @@
# Copyright 2024 Canonical, Ltd.
#

import os
import subprocess

from k8s_test_harness.util import env_util


def _test_sanity(image_version):
rock = env_util.get_build_meta_info_for_rock_version(
"cluster-autoscaler", image_version, "amd64"
)
image = rock.image

def test_sanity():
image_variable = "ROCK_CLUSTER_AUTOSCALER"
entrypoint = "/cluster-autoscaler"
image = os.getenv(image_variable)
assert image is not None, f"${image_variable} is not set"
# assert we have the expected files
docker_run = subprocess.run(
["docker", "run", "--rm", "--entrypoint", entrypoint, image, "--help"],
capture_output=True,
text=True,
)
assert "Usage of /cluster-autoscaler:" in docker_run.stderr


def test_cluster_autoscaler_1_24_0():
_test_sanity("1.24.0")


def test_cluster_autoscaler_1_27_2():
_test_sanity("1.27.2")

0 comments on commit 4baa315

Please sign in to comment.