2022-08-24 11:18:49 +00:00
|
|
|
# -*- mode: Python -*-
|
|
|
|
|
|
|
|
BASE_IMAGE_MINIMAL="gcr.io/distroless/base"
|
2022-10-13 12:17:50 +00:00
|
|
|
BASE_IMAGE_FULL="debian:bullseye-slim"
|
2024-08-30 12:44:54 +00:00
|
|
|
BUILDER_IMAGE="golang:1.23-bookworm"
|
2022-08-24 11:18:49 +00:00
|
|
|
HOSTMOUNT_PREFIX="/host-"
|
|
|
|
IMAGE_TAG_NAME = os.getenv('IMAGE_TAG_NAME', "master")
|
|
|
|
IMAGE_REGISTRY = os.getenv('IMAGE_REGISTRY', "gcr.io/k8s-staging-nfd")
|
|
|
|
IMAGE_NAME = os.getenv('IMAGE_NAME', "node-feature-discovery")
|
|
|
|
|
|
|
|
# Get the image name in the following format
|
2022-09-12 08:21:12 +00:00
|
|
|
# registry.k8s.io/nfd/node-feature-discovery:master
|
2022-08-24 11:18:49 +00:00
|
|
|
IMAGE = "/".join([IMAGE_REGISTRY, IMAGE_NAME])
|
|
|
|
TAGGED_IMAGE = ":".join([IMAGE, IMAGE_TAG_NAME])
|
2024-08-07 12:42:14 +00:00
|
|
|
allow_k8s_contexts('kubernetes-admin@kubernetes')
|
2022-08-24 11:18:49 +00:00
|
|
|
|
|
|
|
# Builds container image
|
|
|
|
def build_image():
|
|
|
|
docker_build(
|
|
|
|
TAGGED_IMAGE,
|
|
|
|
context='.',
|
|
|
|
build_args={
|
|
|
|
"BUILDER_IMAGE": BUILDER_IMAGE,
|
|
|
|
"BASE_IMAGE_MINIMAL": BASE_IMAGE_MINIMAL,
|
|
|
|
"BASE_IMAGE_FULL": BASE_IMAGE_FULL,
|
|
|
|
"HOSTMOUNT_PREFIX": HOSTMOUNT_PREFIX,
|
|
|
|
},
|
|
|
|
target="full",
|
|
|
|
ignore=['./docs/', './examples/', './demo/']
|
|
|
|
)
|
|
|
|
|
|
|
|
# Deploys manifests with kustomize
|
|
|
|
def deploy_nfd():
|
|
|
|
k8s_yaml(
|
|
|
|
kustomize('deployment/overlays/default/')
|
|
|
|
)
|
|
|
|
|
|
|
|
# Actual calls to the functions
|
|
|
|
build_image()
|
2022-10-13 12:13:05 +00:00
|
|
|
deploy_nfd()
|