Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Replace CRI-RM binary with NRI balloons plugin #267

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "nri-plugins"]
path = nri-plugins
url = https://github.com/containers/nri-plugins
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"hideSystemGoroutines": true,
"env": {
// Comment/Uncomment if configMap cannot be read.
"EXTENSION_CONFIGMAP_NAMESPACE": "extension-cri-resmgr-extension-9htbx",
"EXTENSION_CONFIGMAP_NAMESPACE": "extension-cri-resmgr-extension-c6qp5",
"LEADER_ELECTION_NAMESPACE": "garden",
},
"console": "internalConsole",
Expand Down
16 changes: 1 addition & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,6 @@ RUN CGO_ENABLED=0 go install -ldflags="-X github.com/intel/gardener-extension-cr
# sha256:262ae336f8e9291f8edc9a71a61d5d568466edc1ea4818752d4af3d230a7f9ef Created Jan 1, 1, 1:24:00 AM
FROM gcr.io/distroless/static@sha256:262ae336f8e9291f8edc9a71a61d5d568466edc1ea4818752d4af3d230a7f9ef AS gardener-extension-cri-resmgr

COPY charts/internal /charts/internal
COPY charts/internal/balloons /charts/internal/balloons
COPY --from=builder /go/bin/gardener-extension-cri-resmgr /
ENTRYPOINT ["/gardener-extension-cri-resmgr"]


### agnet and installation joined
FROM debian:12.5 as gardener-extension-cri-resmgr-installation-and-agent

WORKDIR /gardener-extension-cri-resmgr-installation-and-agent
# Please keep this in sync with CRI_RM_VERSION from Makefile!
COPY --from=intel/cri-resmgr-agent:v0.9.0 /bin/* /bin/
COPY Makefile .
RUN apt update -y && apt upgrade -y && apt --no-install-recommends -y install make=4.3-4.1 wget=1.21.3-1+b2 && apt-get clean && rm -rf /var/lib/apt/lists/* && make _install-binaries && apt remove -y make wget && apt -y autoremove

ARG COMMIT=unset
ARG VERSION=unset
RUN bash -c "echo ${VERSION} >/VERSION" && bash -c "echo ${COMMIT} >/COMMIT"
19 changes: 7 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

REGISTRY := localhost:5001/
EXTENSION_IMAGE_NAME := gardener-extension-cri-resmgr
INSTALLATION_IMAGE_NAME := gardener-extension-cri-resmgr-installation-and-agent
TAG := latest

# Please keep it up to date with agent image in charts/images.yaml
Expand All @@ -35,20 +34,22 @@ COMMIT:=`git rev-parse HEAD`
DIRTY:=`git diff --quiet || echo '-dirty'`
VERSION:=`git tag | sort -V | tail -1`

_go_generate:
rm -rf ./pkg/consts/charts
go generate ./...
build: _go_generate _build _build_tests

_build:
echo "Building ${VERSION}-${COMMIT}${DIRTY}"
CGO_ENABLED=0 go build -ldflags="-X github.com/intel/gardener-extension-cri-resmgr/pkg/consts.Commit=${COMMIT}${DIRTY} -X github.com/intel/gardener-extension-cri-resmgr/pkg/consts.Version=${VERSION}" -v ./cmd/gardener-extension-cri-resmgr

_go_generate:
@echo 'Remember "git submodule update --init --recursive" to init "cri-plugins" submodule.'
rm -rf ./pkg/consts/charts
go generate ./...

_build_tests:
go test -c -v ./test/e2e/cri-resmgr-extension/. -o gardener-extension-cri-resmgr.e2e-tests
go test -c -v ./pkg/controller/lifecycle -o ./gardener-extension-cri-resmgr.actuator.test
go test -c -v ./pkg/configs -o ./gardener-extension-cri-resmgr.configs.test

build: _go_generate _build _build_tests

test:
go generate ./...
Expand Down Expand Up @@ -88,7 +89,6 @@ _install-binaries:

clean-images:
docker image rm $(REGISTRY)$(EXTENSION_IMAGE_NAME):$(TAG)
docker image rm $(REGISTRY)$(INSTALLATION_IMAGE_NAME):$(TAG)

regenerate-charts:
rm -rf ./pkg/consts/charts
Expand All @@ -97,19 +97,14 @@ regenerate-charts:
_build-extension-image:
@echo "Building extension image: commit=${COMMIT}${DIRTY} version=${VERSION} target=$(REGISTRY)$(EXTENSION_IMAGE_NAME):$(TAG)"
docker build --build-arg COMMIT=${COMMIT}${DIRTY} --build-arg VERSION=${VERSION} -t $(REGISTRY)$(EXTENSION_IMAGE_NAME):$(TAG) -f Dockerfile --target $(EXTENSION_IMAGE_NAME) .
_build-installation-image:
@echo "Building installation image: commit=${COMMIT}${DIRTY} version=${VERSION} target=$(REGISTRY)$(INSTALLATION_IMAGE_NAME):$(TAG)"
docker build --build-arg COMMIT=${COMMIT}${DIRTY} --build-arg VERSION=${VERSION} -t $(REGISTRY)$(INSTALLATION_IMAGE_NAME):$(TAG) -f Dockerfile --target $(INSTALLATION_IMAGE_NAME) .

dist: build build-images

build-images: regenerate-charts _build-extension-image _build-installation-image
build-images: regenerate-charts _build-extension-image
echo "Building ${VERSION}-${COMMIT}${DIRTY} done."


push-images:
docker push $(REGISTRY)$(EXTENSION_IMAGE_NAME):$(TAG)
docker push $(REGISTRY)$(INSTALLATION_IMAGE_NAME):$(TAG)
echo "Images ${VERSION}-${COMMIT}${DIRTY} pushed."

generate-mocks:
Expand Down
7 changes: 2 additions & 5 deletions charts/gardener-extension-cri-resmgr/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,9 @@ vpa:
### Please do not uncomment those, unless you want to just try "helm template ." without extension.
# imageVectorOverwrite: |
# images:
# - name: gardener-extension-cri-resmgr-installation
# - name: balloons
# tag: latest
# repository: localhost:5001/gardener-extension-cri-resmgr-installation
# - name: gardener-extension-cri-resmgr-agent
# tag: latest
# repository: localhost:5001/gardener-extension-cri-resmgr-agent
# repository: ghcr.io/containers/nri-plugins/nri-resource-policy-balloons
# configs:
# fallback: |
# policy:
Expand Down
13 changes: 5 additions & 8 deletions charts/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
#
# Default values for image location internal installation and agent. Use localhost:5001 (local provider registry) until images will be published.
images:
- name: gardener-extension-cri-resmgr-installation
sourceRepository: https://github.com/intel/gardener-extension-cri-resmgr
repository: localhost:5001/gardener-extension-cri-resmgr-installation-and-agent
tag: latest
- name: gardener-extension-cri-resmgr-agent
sourceRepository: https://github.com/intel/cri-resource-manager
repository: localhost:5001/gardener-extension-cri-resmgr-installation-and-agent
tag: latest
- name: balloons
sourceRepository: https://github.com/containers/nri-plugins/
repository: ghcr.io/containers/nri-plugins/nri-resource-policy-balloons
tag: latest
# tag: unstable
1 change: 1 addition & 0 deletions charts/internal/balloons
19 changes: 0 additions & 19 deletions charts/internal/cri-resmgr-installation/Chart.yaml

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading