-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add kubernetes-autoscaler-addon-resizer
Signed-off-by: Furkan Türkal <[email protected]> Co-authored-by: Batuhan <[email protected]> Signed-off-by: Furkan Türkal <[email protected]>
- Loading branch information
1 parent
3aa86bd
commit 7a70bcd
Showing
6 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!--monopod:start--> | ||
# kubernetes-autoscaler-addon-resizer | ||
| | | | ||
| - | - | | ||
| **OCI Reference** | `cgr.dev/chainguard/kubernetes-autoscaler-addon-resizer` | | ||
|
||
|
||
* [View Image in Chainguard Academy](https://edu.chainguard.dev/chainguard/chainguard-images/reference/kubernetes-autoscaler-addon-resizer/overview/) | ||
* [View Image Catalog](https://console.enforce.dev/images/catalog) for a full list of available tags. | ||
* [Contact Chainguard](https://www.chainguard.dev/chainguard-images) for enterprise support, SLAs, and access to older tags.* | ||
|
||
--- | ||
<!--monopod:end--> | ||
|
||
<!--overview:start--> | ||
Addon-resizer is a container that vertically scales a Deployment based on the number of nodes in your cluster. | ||
<!--overview:end--> | ||
|
||
<!--getting:start--> | ||
## Download this Image | ||
The image is available on `cgr.dev`: | ||
|
||
``` | ||
docker pull cgr.dev/chainguard/kubernetes-autoscaler-addon-resizer:latest | ||
``` | ||
<!--getting:end--> | ||
|
||
<!--body:start--> | ||
## Usage | ||
|
||
```bash | ||
kubectl apply -f https://raw.githubusercontent.com/kubernetes/autoscaler/master/addon-resizer/deploy/example.yaml | ||
kubectl set image deployment/nanny-v1 pod-nanny=cgr.dev/chainguard/kubernetes-autoscaler-addon-resizer:latest | ||
``` | ||
|
||
Find more on the [official documentation](https://github.com/kubernetes/autoscaler/blob/master/addon-resizer/README.md)! | ||
<!--body:end--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
variable "extra_packages" { | ||
description = "Additional packages to install." | ||
type = list(string) | ||
default = ["addon-resizer", "addon-resizer-compat"] | ||
} | ||
|
||
module "accts" { source = "../../../tflib/accts" } | ||
|
||
output "config" { | ||
value = jsonencode({ | ||
contents = { | ||
packages = var.extra_packages | ||
} | ||
accounts = module.accts.block | ||
cmd = "/pod_nanny" | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
terraform { | ||
required_providers { | ||
oci = { source = "chainguard-dev/oci" } | ||
} | ||
} | ||
|
||
variable "target_repository" { | ||
description = "The docker repo into which the image and attestations should be published." | ||
} | ||
|
||
module "config" { source = "./config" } | ||
|
||
module "kubernetes-autoscaler-addon-resizer" { | ||
source = "../../tflib/publisher" | ||
name = basename(path.module) | ||
target_repository = var.target_repository | ||
config = module.config.config | ||
build-dev = true | ||
} | ||
|
||
module "test" { | ||
source = "./tests" | ||
digest = module.kubernetes-autoscaler-addon-resizer.image_ref | ||
} | ||
|
||
resource "oci_tag" "latest" { | ||
depends_on = [module.test] | ||
digest_ref = module.kubernetes-autoscaler-addon-resizer.image_ref | ||
tag = "latest" | ||
} | ||
|
||
resource "oci_tag" "latest-dev" { | ||
depends_on = [module.test] | ||
digest_ref = module.kubernetes-autoscaler-addon-resizer.dev_ref | ||
tag = "latest-dev" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: kubernetes-autoscaler-addon-resizer | ||
image: cgr.dev/chainguard/kubernetes-autoscaler-addon-resizer | ||
logo: https://storage.googleapis.com/chainguard-academy/logos/kubernetes-autoscaler-addon-resizer.svg | ||
endoflife: "" | ||
console_summary: "" | ||
short_description: Addon-resizer is a container that vertically scales a Deployment based on the number of nodes in your cluster. | ||
compatibility_notes: "" | ||
readme_file: README.md | ||
upstream_url: https://github.com/kubernetes/autoscaler/tree/master/addon-resizer | ||
keywords: | ||
- application | ||
- kubernetes | ||
- autoscaler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
terraform { | ||
required_providers { | ||
oci = { source = "chainguard-dev/oci" } | ||
imagetest = { source = "chainguard-dev/imagetest" } | ||
} | ||
} | ||
|
||
variable "digest" { | ||
description = "The image digest to run tests over." | ||
} | ||
|
||
data "oci_string" "ref" { input = var.digest } | ||
|
||
data "oci_exec_test" "help" { | ||
digest = var.digest | ||
script = "docker run --rm $IMAGE_NAME pod_nanny -h" | ||
} | ||
|
||
data "imagetest_inventory" "this" {} | ||
|
||
resource "imagetest_harness_k3s" "this" { | ||
name = "kubernetes-autoscaler-addon-resizer" | ||
inventory = data.imagetest_inventory.this | ||
} | ||
|
||
resource "imagetest_feature" "basic" { | ||
harness = imagetest_harness_k3s.this | ||
name = "Basic" | ||
description = "Basic functionality of the kubernetes-autoscaler-addon-resizer." | ||
|
||
steps = [ | ||
{ | ||
name = "Deploy" | ||
cmd = <<EOF | ||
kubectl apply -f https://raw.githubusercontent.com/kubernetes/autoscaler/master/addon-resizer/deploy/example.yaml | ||
kubectl set image deployment/nanny-v1 pod-nanny="${data.oci_string.ref.registry_repo}:${data.oci_string.ref.pseudo_tag}" | ||
EOF | ||
}, | ||
{ | ||
name = "Ensure it comes up healthy" | ||
cmd = <<EOF | ||
kubectl rollout status deployment/nanny-v1 --timeout=120s | ||
kubectl wait --for=condition=ready pod --selector k8s-app=nanny | ||
EOF | ||
retry = { attempts = 3, delay = "2s", factor = 2 } | ||
}, | ||
{ | ||
name = "Check logs" | ||
cmd = "kubectl logs deployment/nanny-v1 | grep -qi 'Watching namespace'" | ||
} | ||
] | ||
|
||
labels = { | ||
type = "k8s" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters