Skip to content

Commit 1b2424d

Browse files
committed
release flow updated
1 parent e603f19 commit 1b2424d

File tree

8 files changed

+106
-71
lines changed

8 files changed

+106
-71
lines changed

.dockerignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,4 @@
33
bin/
44
testbin/
55

6-
neonvm/neonvm.yaml
7-
neonvm/neonvm-vxlan.yaml
8-
neonvm/multus.yaml
9-
neonvm/multus-eks.yaml
6+
rendered_manifests

.github/workflows/release.yaml

+30-33
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ jobs:
4242
with:
4343
go-version-file: 'go.mod'
4444

45+
- name: check everything builds
46+
run: go build ./...
47+
4548
- name: build binaries
46-
run: make VERSION=${{ steps.get_vcs_info.outputs.version }} VM_INFORMANT_IMG=${{ env.INFORMANT_IMAGE }}:${{ steps.get_vcs_info.outputs.version }} build
49+
run: make VM_INFORMANT_IMG=${{ env.INFORMANT_IMAGE }}:${{ steps.get_vcs_info.outputs.version }} build
4750

4851
- name: docker - install qemu
4952
uses: docker/setup-qemu-action@v2
@@ -90,61 +93,56 @@ jobs:
9093
file: neonvm/tools/vxlan/Dockerfile
9194
tags: ${{ env.IMG_VXLAN }}:${{ steps.get_vcs_info.outputs.version }}
9295

93-
- name: render kubernetes resources
94-
uses: stefanprodan/kube-tools@v1
95-
with:
96-
kustomize: ${{ env.KUSTOMIZE_VERSION }}
97-
command: |
98-
kustomize version --short
99-
cd ${GITHUB_WORKSPACE}/neonvm/config/common/controller && kustomize edit set image controller=${{ env.IMG }}:${{ steps.get_vcs_info.outputs.version }}
100-
cd ${GITHUB_WORKSPACE}/neonvm/config/default-vxlan/vxlan-controller && kustomize edit set image vxlan-controller=${{ env.IMG_VXLAN }}:${{ steps.get_vcs_info.outputs.version }}
101-
cd ${GITHUB_WORKSPACE}/neonvm/config/default-vxlan/vxlan-ipam && kustomize edit set image vxlan-controller=${{ env.IMG_VXLAN }}:${{ steps.get_vcs_info.outputs.version }}
102-
cd ${GITHUB_WORKSPACE}/neonvm/
103-
kustomize build config/default-vxlan/multus --output multus.yaml
104-
kustomize build config/default-vxlan/multus-eks --output multus-eks.yaml
105-
kustomize build config/default-vxlan --output neonvm-vxlan.yaml
106-
107-
# note: We *could* use something like kustomize for this. But there's extra steps (e.g.,
108-
# adding kustomization.yaml) and sed is simple; so we can deal with this for now.
109-
- name: modify deploy files to use current image(s)
110-
run: |
111-
# check that the images are present:
112-
grep -q ${{ env.LOCAL_AGENT_IMAGE }} deploy/autoscaler-agent.yaml
113-
grep -q ${{ env.LOCAL_SCHED_IMAGE }} deploy/autoscale-scheduler.yaml
114-
sed -i -e s^${{ env.LOCAL_AGENT_IMAGE }}^${{ env.AGENT_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}^g deploy/autoscaler-agent.yaml
115-
sed -i -e s^${{ env.LOCAL_SCHED_IMAGE }}^${{ env.SCHED_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}^g deploy/autoscale-scheduler.yaml
116-
117-
- name: check everything builds
118-
run: go build ./...
119-
12096
- name: build and push autoscale-scheduler image
12197
uses: docker/build-push-action@v3
12298
with:
12399
context: .
100+
platforms: linux/amd64
124101
push: true
125102
file: build/autoscale-scheduler/Dockerfile
126103
tags: ${{ env.SCHED_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
127104
build-args: |
128105
GIT_INFO=${{ steps.get_vcs_info.outputs.git_info }}
106+
129107
- name: build and push autoscaler-agent image
130108
uses: docker/build-push-action@v3
131109
with:
132110
context: .
111+
platforms: linux/amd64
133112
push: true
134113
file: build/autoscaler-agent/Dockerfile
135114
tags: ${{ env.AGENT_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
136115
build-args: |
137116
GIT_INFO=${{ steps.get_vcs_info.outputs.git_info }}
117+
138118
- name: build and push vm-informant image
139119
uses: docker/build-push-action@v3
140120
with:
141121
context: .
122+
platforms: linux/amd64
142123
push: true
143124
file: build/vm-informant/Dockerfile
144125
tags: ${{ env.INFORMANT_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
145126
build-args: |
146127
GIT_INFO=${{ steps.get_vcs_info.outputs.git_info }}
147128
129+
- name: render kubernetes resources
130+
uses: stefanprodan/kube-tools@v1
131+
with:
132+
kustomize: ${{ env.KUSTOMIZE_VERSION }}
133+
command: |
134+
kustomize version --short
135+
cd ${GITHUB_WORKSPACE}/neonvm/config/common/controller && kustomize edit set image controller=${{ env.IMG }}:${{ steps.get_vcs_info.outputs.version }}
136+
cd ${GITHUB_WORKSPACE}/neonvm/config/default-vxlan/vxlan-controller && kustomize edit set image vxlan-controller=${{ env.IMG_VXLAN }}:${{ steps.get_vcs_info.outputs.version }}
137+
cd ${GITHUB_WORKSPACE}/deploy && kustomize edit set image autoscale-scheduler=${{ env.SCHED_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
138+
cd ${GITHUB_WORKSPACE}/deploy && kustomize edit set image autoscaler-agent=${{ env.AGENT_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
139+
cd ${GITHUB_WORKSPACE}
140+
mkdir -p rendered_manifests
141+
kustomize build neonvm/config/default-vxlan/multus-eks > rendered_manifests/multus-eks.yaml
142+
kustomize build neonvm/config/default-vxlan/multus > rendered_manifests/multus.yaml
143+
kustomize build neonvm/config/default-vxlan > rendered_manifests/neonvm.yaml
144+
kustomize build deploy > rendered_manifests/autoscaler.yaml
145+
148146
# Because we want a docker image for the VM informant, the easiest way for us to also provide
149147
# a binary is by just extracting it from the container image itself.
150148
- name: extract vm-informant binary
@@ -161,8 +159,7 @@ jobs:
161159
bin/vm-builder
162160
bin/vm-builder-generic
163161
bin/vm-informant
164-
deploy/autoscale-scheduler.yaml
165-
deploy/autoscaler-agent.yaml
166-
neonvm/multus.yaml
167-
neonvm/multus-eks.yaml
168-
neonvm/neonvm-vxlan.yaml
162+
rendered_manifests/autoscaler.yaml
163+
rendered_manifests/neonvm.yaml
164+
rendered_manifests/multus.yaml
165+
rendered_manifests/multus-eks.yaml

.gitignore

+2-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,5 @@ testbin/*
2525

2626
*.qcow2
2727
neonvm/hack/vmlinuz
28-
neonvm/neonvm.yaml
29-
neonvm/neonvm-vxlan.yaml
30-
neonvm/multus.yaml
31-
neonvm/multus-eks.yaml
28+
29+
rendered_manifests

Makefile

+57-25
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ e2e-tools: kind kubectl kuttl
103103
.PHONE: e2e
104104
e2e: ## Run e2e kuttl tests
105105
$(KUTTL) test --config tests/e2e/kuttl-test.yaml
106+
rm -f kubeconfig
106107

107108
.PHONY: test
108109
test: fmt vet envtest ## Run tests.
@@ -149,6 +150,15 @@ vm-informant: ## Build vm-informant image
149150
.PHONY: docker-build
150151
docker-build: docker-build-controller docker-build-runner docker-build-vxlan-controller docker-build-autoscaler-agent docker-build-scheduler ## Build docker images for NeonVM controllers, NeonVM runner, autoscaler-agent, and scheduler
151152

153+
.PHONY: docker-push
154+
docker-push: docker-build
155+
docker push -q ${IMG_CONTROLLER}
156+
docker push -q ${IMG_RUNNER}
157+
docker push -q ${IMG_VXLAN}
158+
docker push -q ${AUTOSCALER_SCHEDULER_IMG}
159+
docker push -q ${AUTOSCALER_AGENT_IMG}
160+
docker push -q ${VM_INFORMANT_IMG}
161+
152162
.PHONY: docker-build-controller
153163
docker-build-controller: ## Build docker image for NeonVM controller
154164
docker build --build-arg VM_RUNNER_IMAGE=$(IMG_RUNNER) -t $(IMG_CONTROLLER) -f neonvm/Dockerfile .
@@ -248,37 +258,59 @@ install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~
248258
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
249259
$(KUSTOMIZE) build neonvm/config/common/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
250260

251-
DEPLOYTS := $(shell date +%s)
261+
BUILDTS := $(shell date +%s)
262+
RENDERED ?= $(shell pwd)/rendered_manifests
263+
$(RENDERED):
264+
mkdir -p $(RENDERED)
265+
.PHONY: render-manifests
266+
render-manifests: $(RENDERED) kustomize
267+
cd neonvm/config/common/controller && $(KUSTOMIZE) edit set image controller=$(IMG_CONTROLLER) && $(KUSTOMIZE) edit add annotation buildtime:$(BUILDTS) --force
268+
cd neonvm/config/default-vxlan/vxlan-controller && $(KUSTOMIZE) edit set image vxlan-controller=$(IMG_VXLAN) && $(KUSTOMIZE) edit add annotation buildtime:$(BUILDTS) --force
269+
cd deploy && $(KUSTOMIZE) edit set image autoscale-scheduler=$(AUTOSCALER_SCHEDULER_IMG) && $(KUSTOMIZE) edit add annotation buildtime:$(BUILDTS) --force
270+
cd deploy && $(KUSTOMIZE) edit set image autoscaler-agent=$(AUTOSCALER_AGENT_IMG) && $(KUSTOMIZE) edit add annotation buildtime:$(BUILDTS) --force
271+
$(KUSTOMIZE) build neonvm/config/default-vxlan/multus-eks > $(RENDERED)/multus-eks.yaml
272+
$(KUSTOMIZE) build neonvm/config/default-vxlan/multus > $(RENDERED)/multus.yaml
273+
$(KUSTOMIZE) build neonvm/config/default-vxlan > $(RENDERED)/neonvm.yaml
274+
$(KUSTOMIZE) build deploy > $(RENDERED)/autoscaler.yaml
275+
cd neonvm/config/common/controller && $(KUSTOMIZE) edit set image controller=controller:dev && $(KUSTOMIZE) edit remove annotation buildtime --ignore-non-existence
276+
cd neonvm/config/default-vxlan/vxlan-controller && $(KUSTOMIZE) edit set image vxlan-controller=vxlan-controller:dev && $(KUSTOMIZE) edit remove annotation buildtime --ignore-non-existence
277+
cd deploy && $(KUSTOMIZE) edit set image autoscale-scheduler=autoscale-scheduler:dev && $(KUSTOMIZE) edit remove annotation buildtime --ignore-non-existence
278+
cd deploy && $(KUSTOMIZE) edit set image autoscaler-agent=autoscaler-agent:dev && $(KUSTOMIZE) edit remove annotation buildtime --ignore-non-existence
279+
280+
render-release: $(RENDERED) kustomize
281+
cd neonvm/config/common/controller && $(KUSTOMIZE) edit set image controller=$(IMG_CONTROLLER)
282+
cd neonvm/config/default-vxlan/vxlan-controller && $(KUSTOMIZE) edit set image vxlan-controller=$(IMG_VXLAN)
283+
cd deploy && $(KUSTOMIZE) edit set image autoscale-scheduler=$(AUTOSCALER_SCHEDULER_IMG)
284+
cd deploy && $(KUSTOMIZE) edit set image autoscaler-agent=$(AUTOSCALER_AGENT_IMG)
285+
$(KUSTOMIZE) build neonvm/config/default-vxlan/multus-eks > $(RENDERED)/multus-eks.yaml
286+
$(KUSTOMIZE) build neonvm/config/default-vxlan/multus > $(RENDERED)/multus.yaml
287+
$(KUSTOMIZE) build neonvm/config/default-vxlan > $(RENDERED)/neonvm.yaml
288+
$(KUSTOMIZE) build deploy > $(RENDERED)/autoscaler.yaml
289+
cd neonvm/config/common/controller && $(KUSTOMIZE) edit set image controller=controller:dev
290+
cd neonvm/config/default-vxlan/vxlan-controller && $(KUSTOMIZE) edit set image vxlan-controller=vxlan-controller:dev
291+
cd deploy && $(KUSTOMIZE) edit set image autoscale-scheduler=autoscale-scheduler:dev
292+
cd deploy && $(KUSTOMIZE) edit set image autoscaler-agent=autoscaler-agent:dev
293+
252294
.PHONY: deploy
253-
deploy: kind-load manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
254-
cd neonvm/config/common/controller && $(KUSTOMIZE) edit set image controller=$(IMG_CONTROLLER) && $(KUSTOMIZE) edit add annotation deploytime:$(DEPLOYTS) --force
255-
cd neonvm/config/default-vxlan/vxlan-controller && $(KUSTOMIZE) edit set image vxlan-controller=$(IMG_VXLAN) && $(KUSTOMIZE) edit add annotation deploytime:$(DEPLOYTS) --force
256-
$(KUSTOMIZE) build neonvm/config/default-vxlan/multus > neonvm/multus.yaml
257-
$(KUSTOMIZE) build neonvm/config/default-vxlan > neonvm/neonvm.yaml
258-
cd neonvm/config/common/controller && $(KUSTOMIZE) edit remove annotation deploytime
259-
cd neonvm/config/default-vxlan/vxlan-controller && $(KUSTOMIZE) edit remove annotation deploytime
260-
kubectl apply -f neonvm/multus.yaml
295+
deploy: kind-load manifests render-manifests ## Deploy controller to the K8s cluster specified in ~/.kube/config.
296+
kubectl apply -f $(RENDERED)
297+
kubectl apply -f $(RENDERED)/multus.yaml
261298
kubectl -n kube-system rollout status daemonset kube-multus-ds
262-
kubectl apply -f neonvm/neonvm.yaml
263-
kubectl -n neonvm-system rollout status daemonset neonvm-vxlan-controller
264-
kubectl -n neonvm-system rollout status deployment neonvm-controller
265-
266-
kubectl apply -f deploy/autoscale-scheduler.yaml
267-
kubectl apply -f deploy/autoscaler-agent.yaml
299+
kubectl apply -f $(RENDERED)/neonvm.yaml
300+
kubectl -n neonvm-system rollout status daemonset neonvm-vxlan-controller
301+
kubectl -n neonvm-system rollout status deployment neonvm-controller
302+
kubectl apply -f $(RENDERED)/autoscaler.yaml
303+
kubectl -n kube-system rollout status daemonset autoscaler-agent
304+
kubectl -n kube-system rollout status deployment autoscale-scheduler
268305

269306
.PHONY: deploy-controller
270-
deploy-controller: kind-load manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
271-
cd neonvm/config/common/controller && $(KUSTOMIZE) edit set image controller=$(IMG_CONTROLLER) && $(KUSTOMIZE) edit add annotation deploytime:$(DEPLOYTS) --force
272-
$(KUSTOMIZE) build neonvm/config/default-vxlan > neonvm/neonvm.yaml
273-
cd neonvm/config/common/controller && $(KUSTOMIZE) edit remove annotation deploytime
274-
kubectl apply -f neonvm/neonvm.yaml
307+
deploy-controller: $(RENDERED) kind-load manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
308+
cd neonvm/config/common/controller && $(KUSTOMIZE) edit set image controller=$(IMG_CONTROLLER) && $(KUSTOMIZE) edit add annotation buildtime:$(BUILDTS) --force
309+
$(KUSTOMIZE) build neonvm/config/default-vxlan > $(RENDERED)/neonvm.yaml
310+
cd neonvm/config/common/controller && $(KUSTOMIZE) edit set image controller=controller:dev && $(KUSTOMIZE) edit remove annotation buildtime --ignore-non-existence
311+
kubectl apply -f $(RENDERED)/neonvm.yaml
275312
kubectl -n neonvm-system rollout status deployment neonvm-controller
276313

277-
.PHONY: undeploy
278-
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
279-
$(KUSTOMIZE) build neonvm/config/default-vxlan | kubectl delete --ignore-not-found=$(ignore-not-found) -f - || true
280-
$(KUSTOMIZE) build neonvm/config/default-vxlan/multus | kubectl delete --ignore-not-found=$(ignore-not-found) -f - || true
281-
282314
##@ Local cluster
283315

284316
.PHONY: local-cluster

deploy/autoscale-scheduler.yaml

-5
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ roleRef:
7979
apiGroup: rbac.authorization.k8s.io
8080
name: extension-apiserver-authentication-reader
8181
---
82-
apiVersion: v1
83-
kind: Namespace
84-
metadata:
85-
name: autoscaler-config
86-
---
8782
apiVersion: rbac.authorization.k8s.io/v1
8883
kind: RoleBinding
8984
metadata:

deploy/kustomization.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
resources:
5+
- autoscale-scheduler.yaml
6+
- autoscaler-agent.yaml
7+
8+
images:
9+
- name: autoscale-scheduler
10+
newName: autoscale-scheduler
11+
newTag: dev
12+
- name: autoscaler-agent
13+
newName: autoscaler-agent
14+
newTag: dev

tests/e2e/autoscaling/01-upscale.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ kind: Pod
77
metadata:
88
name: workload
99
spec:
10+
terminationGracePeriodSeconds: 1
1011
initContainers:
1112
- name: wait-for-pg
1213
image: postgres:15-bullseye

tests/e2e/vm-migration/00-prepare.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ kind: Pod
99
metadata:
1010
name: workload
1111
spec:
12+
terminationGracePeriodSeconds: 1
1213
initContainers:
1314
- name: wait-for-pg
1415
image: postgres:15-bullseye

0 commit comments

Comments
 (0)