Skip to content

Commit

Permalink
fix: Use the latest image of vm-console-proxy
Browse files Browse the repository at this point in the history
- Updated release script to change vm-console-proxy image tag.
- csv-generator uses VM_CONSOLE_PROXY_IMAGE env variable to set the image.

Signed-off-by: Andrej Krejcir <[email protected]>
  • Loading branch information
akrejcir committed Aug 8, 2023
1 parent fc1d67c commit 803a13f
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release-vm-console-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
OUTPUT_FILE=./data/vm-console-proxy-bundle/vm-console-proxy.yaml
mkdir -p ./data/vm-console-proxy-bundle
curl -L https://github.com/kubevirt/vm-console-proxy/releases/download/${RELEASE_VERSION}/vm-console-proxy.yaml > ${OUTPUT_FILE}
sed -i "s/defaultVmConsoleProxyImageTag = .*$/defaultVmConsoleProxyImageTag = \"${RELEASE_VERSION}\"/" ./internal/operands/vm-console-proxy/defaults.go
- name: Create pull request
if: ${{ github.event.client_payload.release_version }} != ''
Expand Down
1 change: 1 addition & 0 deletions config/manager/manager.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ spec:
- name: OPERATOR_VERSION
- name: TEKTON_TASKS_IMAGE
- name: TEKTON_TASKS_DISK_VIRT_IMAGE
- name: VM_CONSOLE_PROXY_IMAGE
image: controller:latest
name: manager
resources:
Expand Down
14 changes: 14 additions & 0 deletions hack/csv-generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type generatorFlags struct {
tektonTasksImage string
tektonTasksDiskVirtImage string
virtioImage string
vmConsoleProxyImage string
}

var (
Expand Down Expand Up @@ -83,6 +84,7 @@ func init() {
rootCmd.Flags().StringVar(&f.tektonTasksImage, "tekton-tasks-image", "", "Link to tekton tasks image")
rootCmd.Flags().StringVar(&f.tektonTasksDiskVirtImage, "tekton-tasks-disk-virt-image", "", "Link to tekton tasks disk virt image")
rootCmd.Flags().StringVar(&f.virtioImage, "virtio-image", "", "Link to virtio image")
rootCmd.Flags().StringVar(&f.vmConsoleProxyImage, "vm-console-proxy-image", "", "Link to VM console proxy image")
rootCmd.Flags().Int32Var(&f.webhookPort, "webhook-port", 0, "Container port for the admission webhook")
rootCmd.Flags().BoolVar(&f.removeCerts, "webhook-remove-certs", false, "Remove the webhook certificate volume and mount")
rootCmd.Flags().BoolVar(&f.dumpCRDs, "dump-crds", false, "Dump crds to stdout")
Expand Down Expand Up @@ -216,6 +218,14 @@ func buildRelatedImages(flags generatorFlags) ([]interface{}, error) {
relatedImages = append(relatedImages, relatedImage)
}

if flags.vmConsoleProxyImage != "" {
relatedImage, err := buildRelatedImage(flags.vmConsoleProxyImage, "vm-console-proxy")
if err != nil {
return nil, err
}
relatedImages = append(relatedImages, relatedImage)
}

return relatedImages, nil
}

Expand Down Expand Up @@ -271,6 +281,10 @@ func updateContainerEnvVars(flags generatorFlags, container v1.Container) []v1.E
if flags.virtioImage != "" {
envVariable.Value = flags.virtioImage
}
case common.VmConsoleProxyImageKey:
if flags.vmConsoleProxyImage != "" {
envVariable.Value = flags.vmConsoleProxyImage
}
}

updatedVariables = append(updatedVariables, envVariable)
Expand Down
4 changes: 4 additions & 0 deletions hack/csv-generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var _ = Describe("csv generator", func() {
tektonTasksImage: "testTektonTasksImage",
tektonTasksDiskVirtImage: "testTektonTasksDiskVirtImage",
virtioImage: "testVirtioImage",
vmConsoleProxyImage: "testVmConsoleProxyImage",
}
envValues := []v1.EnvVar{
{Name: common.TemplateValidatorImageKey},
Expand Down Expand Up @@ -90,6 +91,9 @@ var _ = Describe("csv generator", func() {
if envVariable.Name == common.VirtioImageKey {
Expect(envVariable.Value).To(Equal(flags.virtioImage))
}
if envVariable.Name == common.VmConsoleProxyImageKey {
Expect(envVariable.Value).To(Equal(flags.vmConsoleProxyImage))
}
}
break
}
Expand Down
1 change: 1 addition & 0 deletions internal/common/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const (
TektonTasksImageKey = "TEKTON_TASKS_IMAGE"
TektonTasksDiskVirtImageKey = "TEKTON_TASKS_DISK_VIRT_IMAGE"
VirtioImageKey = "VIRTIO_IMG"
VmConsoleProxyImageKey = "VM_CONSOLE_PROXY_IMAGE"

DefaultTektonTasksIMG = "quay.io/kubevirt/tekton-tasks:" + TektonTasksVersion
DeafultTektonTasksDiskVirtIMG = "quay.io/kubevirt/tekton-tasks-disk-virt:" + TektonTasksVersion
Expand Down
6 changes: 6 additions & 0 deletions internal/operands/vm-console-proxy/defaults.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package vm_console_proxy

const (
defaultVmConsoleProxyImageTag = "v0.3.0"
defaultVmConsoleProxyImage = "quay.io/kubevirt/vm-console-proxy:" + defaultVmConsoleProxyImageTag
)
2 changes: 1 addition & 1 deletion internal/operands/vm-console-proxy/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func getVmConsoleProxyNamespace(request *common.Request) string {
}

func getVmConsoleProxyImage() string {
return common.EnvOrDefault("VM_CONSOLE_PROXY_IMAGE", "quay.io/kubevirt/vm-console-proxy:v0.1.0")
return common.EnvOrDefault(common.VmConsoleProxyImageKey, defaultVmConsoleProxyImage)
}

func findResourcesUsingLabels[PtrL interface {
Expand Down
7 changes: 6 additions & 1 deletion tests/e2e-test-csv-generator.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

olm_output=$(podman run --rm --entrypoint=/csv-generator quay.io/kubevirt/ssp-operator:latest \
--csv-version=9.9.9 --namespace=namespace-test --operator-version=8.8.8 --validator-image=validator-test --dump-crds \
--csv-version=9.9.9 --namespace=namespace-test --operator-version=8.8.8 --validator-image=validator-test --vm-console-proxy-image=proxy-test --dump-crds \
--operator-image=operator-test)

if [ $(echo $olm_output | grep 'ClusterServiceVersion' | wc -l) -eq 0 ]; then
Expand All @@ -19,6 +19,11 @@ if [ $(echo $olm_output | grep 'value: validator-test'| wc -l) -eq 0 ]; then
exit 1
fi

if [ $(echo $olm_output | grep 'value: proxy-test'| wc -l) -eq 0 ]; then
echo "output doesn't contain correct proxy-image"
exit 1
fi

if [ $(echo $olm_output | grep 'value: 8.8.8'| wc -l) -eq 0 ]; then
echo "output doesn't contain correct operator-version"
exit 1
Expand Down

0 comments on commit 803a13f

Please sign in to comment.