From 6f5660b191b234ef3f710077c81246a81812d1e3 Mon Sep 17 00:00:00 2001 From: "andrew.greene" <1195-andrew.greene@users.noreply.gitlab.example.com> Date: Thu, 26 May 2022 00:53:13 +0000 Subject: [PATCH] feat: pipeline integration [SKIP INTEGRATION] --- CHANGELOG.md | 3 ++- Makefile | 21 ++++++++++++------- README.md | 6 +++--- chart/Chart.yaml | 2 +- .../apps_v1_deployment_virt-operator.yaml | 6 +++--- .../kubevirt.io_v1_kubevirt_kubevirt.yaml | 1 + chart/templates/tests/test-service.yaml | 13 ++++++++++++ chart/values.yaml | 3 ++- scripts/move-images.sh | 21 +++++++++++++++++++ scripts/readme-update.sh | 13 ++++++++++++ scripts/uninstall.sh | 6 ++++++ scripts/update-chart.sh | 8 +++++++ tests/test-values.yaml | 0 13 files changed, 86 insertions(+), 17 deletions(-) create mode 100644 chart/templates/tests/test-service.yaml create mode 100755 scripts/move-images.sh create mode 100755 scripts/readme-update.sh create mode 100755 scripts/uninstall.sh create mode 100755 scripts/update-chart.sh create mode 100644 tests/test-values.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index a5461b7..fa17b91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,4 +2,5 @@ Format: [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) -## [Unreleased] \ No newline at end of file +## [0.1.3-alpha-bb.0] - 2022-06-24 +- Initial Chart creation \ No newline at end of file diff --git a/Makefile b/Makefile index d1b3e23..0b0ea51 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,14 @@ +install: + helm install kv ./chart --create-namespace --namespace kubevirt + +move-images: + scripts/move-images.sh + update-chart: - #export VERSION=0.53.0 - curl -sSLO https://github.com/kubevirt/kubevirt/releases/download/v${VERSION}/kubevirt-operator.yaml - curl -sSLO https://github.com/kubevirt/kubevirt/releases/download/v${VERSION}/kubevirt-cr.yaml - kustomize build -o chart/templates - mv chart/templates/apiextensions.k8s.io_v1_customresourcedefinition_kubevirts.kubevirt.io.yaml chart/crds/ - -clean: - rm -rf kubevirt-operator.yaml kubevirt-cr.yaml \ No newline at end of file + scripts/update-chart.sh + +update-readme: + scripts/readme-update.sh + +uninstall: + scripts/uninstall.sh diff --git a/README.md b/README.md index 87454d3..75419f7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # kubevirt -   +   KubeVirt Big Bang package @@ -30,9 +30,9 @@ helm install kubevirt chart/ | Key | Type | Default | Description | |-----|------|---------|-------------| -| deployment.spec.replicas | int | `2` | | +| deployment.spec.replicas | int | `2` | replica count | | deployment.spec.template.spec.containers.image.name | string | `"virt-operator"` | | -| deployment.spec.template.spec.containers.image.registry | string | `"quay.io/kubevirt/"` | | +| deployment.spec.template.spec.containers.image.registry | string | `"registry.dso.mil/platform-one/big-bang/apps/third-party/kubevirt"` | | | deployment.spec.template.spec.containers.image.version | string | `"v0.53.0"` | | | deployment.spec.template.spec.containers.command.port | int | `8443` | | | deployment.spec.template.spec.containers.command.verbosity | int | `2` | | diff --git a/chart/Chart.yaml b/chart/Chart.yaml index b5fa319..4bfaed9 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: kubevirt description: KubeVirt Big Bang package type: application -version: 0.1.2-alpha-bb.0 +version: 0.1.3-alpha-bb.0 appVersion: "0.53.0" diff --git a/chart/templates/apps_v1_deployment_virt-operator.yaml b/chart/templates/apps_v1_deployment_virt-operator.yaml index 727a82a..3621e52 100644 --- a/chart/templates/apps_v1_deployment_virt-operator.yaml +++ b/chart/templates/apps_v1_deployment_virt-operator.yaml @@ -42,14 +42,14 @@ spec: - "{{ .command.verbosity }}" env: - name: OPERATOR_IMAGE - value: {{ .image.registry }}{{ .image.name }}:{{ .image.version }} + value: {{ .image.registry }}/{{ .image.name }}:{{ .image.version }} - name: WATCH_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.annotations['olm.targetNamespaces'] - image: {{ .image.registry }}{{ .image.name }}:{{ .image.version }} + image: {{ .image.registry }}/{{ .image.name }}:{{ .image.version }} imagePullPolicy: IfNotPresent - name: virt-operator + name: {{ .image.name }} ports: - containerPort: {{ .ports.metricsPort }} name: metrics diff --git a/chart/templates/kubevirt.io_v1_kubevirt_kubevirt.yaml b/chart/templates/kubevirt.io_v1_kubevirt_kubevirt.yaml index f4a3965..772fd71 100644 --- a/chart/templates/kubevirt.io_v1_kubevirt_kubevirt.yaml +++ b/chart/templates/kubevirt.io_v1_kubevirt_kubevirt.yaml @@ -10,6 +10,7 @@ spec: featureGates: [] customizeComponents: {} imagePullPolicy: IfNotPresent + imageRegistry: {{ .Values.deployment.spec.template.spec.containers.image.registry }} infra: replicas: {{ .Values.deployment.spec.replicas }} workloadUpdateStrategy: {} diff --git a/chart/templates/tests/test-service.yaml b/chart/templates/tests/test-service.yaml new file mode 100644 index 0000000..744dad0 --- /dev/null +++ b/chart/templates/tests/test-service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Pod +metadata: + name: kubevirt-service-test + annotations: + "helm.sh/hook": test +spec: + containers: + - command: ["/bin/sh"] + args: ["-c", "nc -w 3 virt-api.kubevirt.svc.cluster.local 443;exit $?;"] + image: registry.dso.mil/platform-one/big-bang/apps/third-party/kubevirt/busybox:latest + name: kubevirt-service-test + restartPolicy: Never diff --git a/chart/values.yaml b/chart/values.yaml index ff21232..cd2a49a 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -1,12 +1,13 @@ deployment: spec: + # -- replica count replicas: 2 template: spec: containers: image: name: virt-operator - registry: quay.io/kubevirt/ + registry: registry.dso.mil/platform-one/big-bang/apps/third-party/kubevirt version: v0.53.0 command: port: 8443 diff --git a/scripts/move-images.sh b/scripts/move-images.sh new file mode 100755 index 0000000..651c960 --- /dev/null +++ b/scripts/move-images.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Image Info +export IMGSRC_REPO=quay.io +export IMGSRC_PROJ=kubevirt +export IMGDST_REPO=registry.dso.mil +export IMGDST_PROJ=platform-one/big-bang/apps/third-party/kubevirt +export IMGTAG=v0.53.0 + +function pullTagPush() { + export IMGNAME=$1 + docker pull $IMGSRC_REPO/$IMGSRC_PROJ/$IMGNAME:$IMGTAG + docker tag $IMGSRC_REPO/$IMGSRC_PROJ/$IMGNAME:$IMGTAG $IMGDST_REPO/$IMGDST_PROJ/$IMGNAME:$IMGTAG + docker login $IMGDST_REPO + docker push $IMGDST_REPO/$IMGDST_PROJ/$IMGNAME:$IMGTAG +} + +pullTagPush virt-api +pullTagPush virt-launcher +pullTagPush virt-handler +pullTagPush virt-operator +pullTagPush virt-controller \ No newline at end of file diff --git a/scripts/readme-update.sh b/scripts/readme-update.sh new file mode 100755 index 0000000..4e88184 --- /dev/null +++ b/scripts/readme-update.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# source: https://repo1.dso.mil/platform-one/big-bang/apps/library-charts/gluon/-/blob/master/docs/bb-package-readme.md + +curl -sS -O https://repo1.dso.mil/platform-one/big-bang/apps/library-charts/gluon/-/raw/master/docs/README.md.gotmpl +curl -sS -O https://repo1.dso.mil/platform-one/big-bang/apps/library-charts/gluon/-/raw/master/docs/.helmdocsignore + +# Update to your helm-docs binary path +/usr/local/bin/helm-docs -s file -t `pwd`/README.md.gotmpl --dry-run > README.md +# Uncomment to use docker +# docker run --rm -v "`pwd`:/helm-docs" -u $(id -u) jnorwood/helm-docs:v1.5.0 -s file -t /helm-docs/README.md.gotmpl --dry-run > README.md + +rm README.md.gotmpl .helmdocsignore +git add README.md diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh new file mode 100755 index 0000000..f1e639a --- /dev/null +++ b/scripts/uninstall.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +kubectl delete -n kubevirt kubevirt kubevirt --wait=true +helm uninstall kubevirt --namespace=kubevirt +kubectl delete ns kubevirt +kubectl delete crd kubevirts.kubevirt.io \ No newline at end of file diff --git a/scripts/update-chart.sh b/scripts/update-chart.sh new file mode 100755 index 0000000..f5b8ead --- /dev/null +++ b/scripts/update-chart.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +export VERSION=0.53.0 +curl -sSLO https://github.com/kubevirt/kubevirt/releases/download/v${VERSION}/kubevirt-operator.yaml +curl -sSLO https://github.com/kubevirt/kubevirt/releases/download/v${VERSION}/kubevirt-cr.yaml +kustomize build -o chart/templates +mv chart/templates/apiextensions.k8s.io_v1_customresourcedefinition_kubevirts.kubevirt.io.yaml chart/crds/ +rm -rf kubevirt-operator.yaml kubevirt-cr.yaml \ No newline at end of file diff --git a/tests/test-values.yaml b/tests/test-values.yaml new file mode 100644 index 0000000..e69de29 -- GitLab