From deb87ba1459f4234e8cb3e18e1a8a99c9568a01e Mon Sep 17 00:00:00 2001 From: Martin Jackson Date: Thu, 24 Oct 2024 09:36:49 -0500 Subject: [PATCH 1/4] Do not install VMs by default and include via override --- .../templates/rhel8-kiosk-with-svc.yaml | 182 ------------------ charts/hub/edge-gitops-vms/values.yaml | 5 +- overrides/values-egv-vms.yaml | 5 + values-hub.yaml | 1 + 4 files changed, 7 insertions(+), 186 deletions(-) delete mode 100644 charts/hub/edge-gitops-vms/templates/rhel8-kiosk-with-svc.yaml create mode 100644 overrides/values-egv-vms.yaml diff --git a/charts/hub/edge-gitops-vms/templates/rhel8-kiosk-with-svc.yaml b/charts/hub/edge-gitops-vms/templates/rhel8-kiosk-with-svc.yaml deleted file mode 100644 index 92cca464..00000000 --- a/charts/hub/edge-gitops-vms/templates/rhel8-kiosk-with-svc.yaml +++ /dev/null @@ -1,182 +0,0 @@ -apiVersion: template.openshift.io/v1 -kind: Template -metadata: - annotations: - argocd.argoproj.io/sync-wave: "2" - defaults.template.kubevirt.io/disk: rootdisk - description: Template for Red Hat Enterprise Linux 8 VM or newer. A PVC with the - RHEL disk image must be available. - iconClass: icon-rhel - name.os.template.kubevirt.io/rhel8.0: Red Hat Enterprise Linux 8.0 or higher - name.os.template.kubevirt.io/rhel8.1: Red Hat Enterprise Linux 8.0 or higher - name.os.template.kubevirt.io/rhel8.2: Red Hat Enterprise Linux 8.0 or higher - name.os.template.kubevirt.io/rhel8.3: Red Hat Enterprise Linux 8.0 or higher - name.os.template.kubevirt.io/rhel8.4: Red Hat Enterprise Linux 8.0 or higher - name.os.template.kubevirt.io/rhel8.5: Red Hat Enterprise Linux 8.0 or higher - openshift.io/display-name: Red Hat Enterprise Linux 8.0+ VM - openshift.io/documentation-url: https://github.com/kubevirt/common-templates - openshift.io/provider-display-name: KubeVirt - openshift.io/support-url: https://github.com/kubevirt/common-templates/issues - operator-sdk/primary-resource: openshift-cnv/ssp-kubevirt-hyperconverged - operator-sdk/primary-resource-type: SSP.ssp.kubevirt.io - tags: hidden,kubevirt,virtualmachine,linux,rhel - template.kubevirt.io/editable: | - /objects[0].spec.template.spec.domain.cpu.sockets - /objects[0].spec.template.spec.domain.cpu.cores - /objects[0].spec.template.spec.domain.cpu.threads - /objects[0].spec.template.spec.domain.resources.requests.memory - /objects[0].spec.template.spec.domain.devices.disks - /objects[0].spec.template.spec.volumes - /objects[0].spec.template.spec.networks - template.kubevirt.io/provider: Red Hat - template.kubevirt.io/provider-support-level: Full - template.kubevirt.io/provider-url: https://www.redhat.com - template.kubevirt.io/version: v1alpha1 - template.openshift.io/bindable: "false" - creationTimestamp: "2022-05-24T14:47:18Z" - labels: - app.kubernetes.io/component: templating - app.kubernetes.io/managed-by: ssp-operator - app.kubernetes.io/name: common-templates - app.kubernetes.io/part-of: hyperconverged-cluster - app.kubernetes.io/version: 4.10.1 - flavor.template.kubevirt.io/medium: "true" - os.template.kubevirt.io/rhel8.0: "true" - os.template.kubevirt.io/rhel8.1: "true" - os.template.kubevirt.io/rhel8.2: "true" - os.template.kubevirt.io/rhel8.3: "true" - os.template.kubevirt.io/rhel8.4: "true" - os.template.kubevirt.io/rhel8.5: "true" - template.kubevirt.io/type: base - template.kubevirt.io/version: v0.19.4 - workload.template.kubevirt.io/desktop: "true" - name: rhel8-kiosk-with-svc - namespace: edge-gitops-vms -objects: -- apiVersion: kubevirt.io/v1 - kind: VirtualMachine - metadata: - annotations: - vm.kubevirt.io/validations: | - [ - { - "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.memory", - "rule": "integer", - "message": "This VM requires more memory.", - "min": 1610612736 - } - ] - labels: - app: ${NAME} - edge-gitops-role: kiosk - vm.kubevirt.io/template: rhel8-desktop-medium - vm.kubevirt.io/template.revision: "1" - vm.kubevirt.io/template.version: v0.19.4 - name: ${NAME} - spec: - dataVolumeTemplates: - - apiVersion: cdi.kubevirt.io/v1beta1 - kind: DataVolume - metadata: - name: ${NAME} - spec: - sourceRef: - kind: DataSource - name: ${DATA_SOURCE_NAME} - namespace: ${DATA_SOURCE_NAMESPACE} - storage: - resources: - requests: - storage: 30Gi - running: true - template: - metadata: - annotations: - vm.kubevirt.io/flavor: medium - vm.kubevirt.io/os: rhel8 - vm.kubevirt.io/workload: desktop - labels: - kubevirt.io/domain: ${NAME} - vm.kubevirt.io/name: ${NAME} - kubevirt.io/size: medium - spec: - domain: - cpu: - cores: 1 - sockets: 1 - threads: 1 - devices: - disks: - - disk: - bus: virtio - name: ${NAME} - - disk: - bus: virtio - name: cloudinitdisk - inputs: - - bus: virtio - name: tablet - type: tablet - interfaces: - - masquerade: {} - name: default - networkInterfaceMultiqueue: true - rng: {} - machine: - type: pc-q35-rhel8.4.0 - resources: - requests: - memory: 4Gi - evictionStrategy: LiveMigrate - networks: - - name: default - pod: {} - terminationGracePeriodSeconds: 180 - volumes: - - dataVolume: - name: ${NAME} - name: ${NAME} - - cloudInitNoCloud: - userData: |- - #cloud-config - user: cloud-user - password: ${CLOUD_USER_PASSWORD} - chpasswd: { expire: False } - name: cloudinitdisk -- apiVersion: v1 - kind: Service - metadata: - name: ${NAME} - spec: - ipFamilies: - - IPv4 - ipFamilyPolicy: SingleStack - ports: - - name: ssh - port: 22 - protocol: TCP - targetPort: 22 - - name: rdp - port: 3389 - protocol: TCP - targetPort: 3389 - selector: - vm.kubevirt.io/name: ${NAME} - sessionAffinity: None - type: NodePort -parameters: -- description: VM name - from: rhel8-kiosk-[a-z0-9]{4} - generate: expression - name: NAME -- description: Name of the DataSource to clone - name: DATA_SOURCE_NAME - value: rhel8 -- description: Namespace of the DataSource - name: DATA_SOURCE_NAMESPACE - value: openshift-virtualization-os-images -- description: Randomized password for the cloud-init user cloud-user - from: '[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}' - generate: expression - name: CLOUD_USER_PASSWORD diff --git a/charts/hub/edge-gitops-vms/values.yaml b/charts/hub/edge-gitops-vms/values.yaml index 6b5dc089..24f650c1 100644 --- a/charts/hub/edge-gitops-vms/values.yaml +++ b/charts/hub/edge-gitops-vms/values.yaml @@ -38,10 +38,7 @@ vmDefaults: protocol: TCP targetPort: 22 -vms: - kiosk: - count: 2 - role: kiosk +vms: {} serviceAccountName: ansible-edge-gitops-sa rbac: diff --git a/overrides/values-egv-vms.yaml b/overrides/values-egv-vms.yaml new file mode 100644 index 00000000..b9ea7005 --- /dev/null +++ b/overrides/values-egv-vms.yaml @@ -0,0 +1,5 @@ +--- +vms: + kiosk: + count: 2 + role: kiosk diff --git a/values-hub.yaml b/values-hub.yaml index b54dd9f0..fb4f61b9 100644 --- a/values-hub.yaml +++ b/values-hub.yaml @@ -106,6 +106,7 @@ clusterGroup: project: hub path: charts/hub/edge-gitops-vms extraValueFiles: + - '$patternref/overrides/values-egv-vms.yaml' - '$patternref/overrides/values-egv-{{ $.Values.global.clusterVersion }}.yaml' # Only the hub cluster here - managed entities are edge nodes From 83f6a973bb03228e1255af36003b267ee4f8cefa Mon Sep 17 00:00:00 2001 From: Martin Jackson Date: Thu, 24 Oct 2024 09:39:11 -0500 Subject: [PATCH 2/4] Add changelog note --- Changes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changes.md b/Changes.md index 9de79fc8..afa78fcf 100644 --- a/Changes.md +++ b/Changes.md @@ -64,3 +64,5 @@ the end of its maintenance support lifecycle. * Refactor installation mechannism to use standard configuration-as-code approach, which will make it easier to drop in a new config-as-code repository. +* Move VM definitions outside of edge-gitops-vms chart so that derived patterns do not inherit the HMI kiosks. Kiosk + VMs now defined by default in overrides. From 83f490da0f1b24ab41e7ba9db00f6dceae49941b Mon Sep 17 00:00:00 2001 From: Martin Jackson Date: Thu, 24 Oct 2024 09:56:56 -0500 Subject: [PATCH 3/4] Document vm creation process a bit better --- charts/hub/edge-gitops-vms/values.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/hub/edge-gitops-vms/values.yaml b/charts/hub/edge-gitops-vms/values.yaml index 24f650c1..d8f7fb68 100644 --- a/charts/hub/edge-gitops-vms/values.yaml +++ b/charts/hub/edge-gitops-vms/values.yaml @@ -38,6 +38,8 @@ vmDefaults: protocol: TCP targetPort: 22 +# Define the VMs you want to create with any specific attributes from vmDefaults +# in an overrides file. vms: {} serviceAccountName: ansible-edge-gitops-sa From b1c8ced3805b86899a34feaa558180a2d30402da Mon Sep 17 00:00:00 2001 From: Martin Jackson Date: Thu, 24 Oct 2024 10:42:41 -0500 Subject: [PATCH 4/4] Update override for new convention --- overrides/values-egv-4.13.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/overrides/values-egv-4.13.yaml b/overrides/values-egv-4.13.yaml index 8c58752c..0275b9f4 100644 --- a/overrides/values-egv-4.13.yaml +++ b/overrides/values-egv-4.13.yaml @@ -1,2 +1,3 @@ --- -defaultStorageClassName: "ocs-storagecluster-ceph-rbd" +vmDefaults: + storageClassName: "ocs-storagecluster-ceph-rbd"