diff --git a/kubernetes/apps/kubevirt/cdi/ingress.yaml b/kubernetes/apps/cdi/cdi/app/ingress.yaml similarity index 100% rename from kubernetes/apps/kubevirt/cdi/ingress.yaml rename to kubernetes/apps/cdi/cdi/app/ingress.yaml diff --git a/kubernetes/apps/cdi/cdi/app/kustomization.yaml b/kubernetes/apps/cdi/cdi/app/kustomization.yaml new file mode 100644 index 00000000..0672c78b --- /dev/null +++ b/kubernetes/apps/cdi/cdi/app/kustomization.yaml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/kustomization.json +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + # Flux-Kustomizations + - ./ingress.yaml + - ./nixosdv.yaml + - ./storageprofile.yaml diff --git a/kubernetes/apps/cdi/cdi/app/nixosdv.yaml b/kubernetes/apps/cdi/cdi/app/nixosdv.yaml new file mode 100644 index 00000000..e6b8dfe1 --- /dev/null +++ b/kubernetes/apps/cdi/cdi/app/nixosdv.yaml @@ -0,0 +1,17 @@ +--- +# yaml-language-server: $schema=https://ks.hsn.dev/cdi.kubevirt.io/datavolume_v1beta1.json +apiVersion: cdi.kubevirt.io/v1beta1 +kind: DataVolume +metadata: + name: "nixos-minimal" +spec: + storage: + resources: + requests: + storage: 2Gi + storageClassName: "openebs-zfs" + accessModes: + - "ReadWriteOnce" + source: + http: + url: "https://channels.nixos.org/nixos-24.05/latest-nixos-minimal-x86_64-linux.iso" diff --git a/kubernetes/apps/cdi/cdi/app/storageprofile.yaml b/kubernetes/apps/cdi/cdi/app/storageprofile.yaml new file mode 100644 index 00000000..faf9ed5d --- /dev/null +++ b/kubernetes/apps/cdi/cdi/app/storageprofile.yaml @@ -0,0 +1,26 @@ +--- +# yaml-language-server: $schema=https://ks.hsn.dev/cdi.kubevirt.io/storageprofile_v1beta1.json +apiVersion: cdi.kubevirt.io/v1beta1 +kind: StorageProfile +metadata: + labels: + app: containerized-data-importer + app.kubernetes.io/component: storage + app.kubernetes.io/managed-by: cdi-controller + cdi.kubevirt.io: "" + name: openebs-zfs +spec: + claimPropertySets: + - accessModes: + - ReadWriteOnce + volumeMode: Block +status: + claimPropertySets: + - accessModes: + - ReadWriteOnce + volumeMode: Block + cloneStrategy: snapshot + dataImportCronSourceFormat: pvc + provisioner: zfs.csi.openebs.io + snapshotClass: openebs-zfs + storageClass: openebs-zfs diff --git a/kubernetes/apps/cdi/cdi/ks.yaml b/kubernetes/apps/cdi/cdi/ks.yaml new file mode 100644 index 00000000..f68fecfc --- /dev/null +++ b/kubernetes/apps/cdi/cdi/ks.yaml @@ -0,0 +1,73 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/main/kustomization-kustomize-v1.json +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: &app kubevirt-cdi + namespace: flux-system +spec: + targetNamespace: cdi + dependsOn: + - name: kubevirt + - name: openebs-cluster + path: ./deploy + prune: true + sourceRef: + kind: GitRepository + name: kubevirt-cdi + wait: true + interval: 30m + retryInterval: 1m + timeout: 5m + patches: + - patch: | + $patch: delete + apiVersion: v1 + kind: Namespace + metadata: + name: cdi + target: + kind: Namespace + name: cdi + - patch: | + apiVersion: cdi.kubevirt.io/v1beta1 + kind: CDI + metadata: + name: not-used + spec: + cloneStrategyOverride: snapshot + config: + featureGates: + - HonorWaitForFirstConsumer + customizeComponents: {} + imagePullPolicy: IfNotPresent + infra: + nodeSelector: + kubernetes.io/os: linux + tolerations: + - key: CriticalAddonsOnly + operator: Exists + workload: + nodeSelector: + kubernetes.io/os: linux + target: + group: cdi.kubevirt.io + kind: CDI +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/main/kustomization-kustomize-v1.json +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: &app kubevirt-cdi-addl + namespace: flux-system +spec: + targetNamespace: cdi + dependsOn: + - name: kubevirt-cdi + interval: 10m + path: "./kubernetes/apps/cdi/cdi/app/" + prune: true + sourceRef: + kind: GitRepository + name: homelab + wait: false diff --git a/kubernetes/apps/cdi/kustomization.yaml b/kubernetes/apps/cdi/kustomization.yaml new file mode 100644 index 00000000..9c17fbb7 --- /dev/null +++ b/kubernetes/apps/cdi/kustomization.yaml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/kustomization.json +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + # Pre Flux-Kustomizations + - ./namespace.yaml + # Flux-Kustomizations + - ./app/ks.yaml diff --git a/kubernetes/apps/cdi/namespace.yaml b/kubernetes/apps/cdi/namespace.yaml new file mode 100644 index 00000000..867f2410 --- /dev/null +++ b/kubernetes/apps/cdi/namespace.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: cdi + labels: + kustomize.toolkit.fluxcd.io/prune: disabled + volsync.backube/privileged-movers: "true" + cdi.kubevirt.io: "" diff --git a/kubernetes/apps/kubevirt/app/ks.yaml b/kubernetes/apps/kubevirt/app/ks.yaml new file mode 100644 index 00000000..cedfc098 --- /dev/null +++ b/kubernetes/apps/kubevirt/app/ks.yaml @@ -0,0 +1,46 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/main/kustomization-kustomize-v1.json +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: &app kubevirt + namespace: flux-system +spec: + targetNamespace: kubevirt + dependsOn: + - name: openebs-cluster + path: ./deploy + prune: true + sourceRef: + kind: GitRepository + name: kubevirt + wait: true + interval: 30m + retryInterval: 1m + timeout: 5m + patches: + # namespace is managed separately by main ks, no need for this ks to also manage it, KubeVirt bundles namespace into kubevirt-operator.yaml + - patch: | + $patch: delete + apiVersion: v1 + kind: Namespace + metadata: + name: kubevirt + target: + kind: Namespace + name: kubevirt + - patch: | + apiVersion: kubevirt.io/v1 + kind: KubeVirt + metadata: + name: not-used + spec: + configuration: + developerConfiguration: + featureGates: + - CPUNodeDiscovery + - ExpandDisks + vmStateStorageClass: openebs-zfs + target: + group: kubevirt.io + kind: KubeVirt diff --git a/kubernetes/apps/kubevirt/kustomization.yaml b/kubernetes/apps/kubevirt/kustomization.yaml index 7f43df74..14555fec 100644 --- a/kubernetes/apps/kubevirt/kustomization.yaml +++ b/kubernetes/apps/kubevirt/kustomization.yaml @@ -7,3 +7,5 @@ resources: - ./namespace.yaml # Flux-Kustomizations - ./manager/ks.yaml + - ./app/ks.yaml + - ./cdi/ks.yaml diff --git a/kubernetes/flux/repositories/git/kubevirt-cdi.yaml b/kubernetes/flux/repositories/git/kubevirt-cdi.yaml new file mode 100644 index 00000000..aee5a5ed --- /dev/null +++ b/kubernetes/flux/repositories/git/kubevirt-cdi.yaml @@ -0,0 +1,17 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/main/gitrepository-source-v1.json +apiVersion: source.toolkit.fluxcd.io/v1 +kind: GitRepository +metadata: + name: kubevirt-cdi + namespace: flux-system +spec: + interval: 30m + url: https://git.hsn.dev/jahanson/kubevirt-flux.git + ref: + branch: cdi-v1.59.0 + ignore: | + # exclude all + /* + # include files + !/deploy diff --git a/kubernetes/flux/repositories/git/kubevirt.yaml b/kubernetes/flux/repositories/git/kubevirt.yaml new file mode 100644 index 00000000..78d12ca3 --- /dev/null +++ b/kubernetes/flux/repositories/git/kubevirt.yaml @@ -0,0 +1,17 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/main/gitrepository-source-v1.json +apiVersion: source.toolkit.fluxcd.io/v1 +kind: GitRepository +metadata: + name: kubevirt + namespace: flux-system +spec: + interval: 30m + url: https://git.hsn.dev/jahanson/kubevirt-flux.git + ref: + branch: v1.2.2 + ignore: | + # exclude all + /* + # include files + !/deploy diff --git a/kubernetes/flux/repositories/git/kutomization.yaml b/kubernetes/flux/repositories/git/kutomization.yaml new file mode 100644 index 00000000..160bbf70 --- /dev/null +++ b/kubernetes/flux/repositories/git/kutomization.yaml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/kustomization.json +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - kubevirt.yaml + - kubevirt-cdi.yaml diff --git a/kubernetes/flux/repositories/kustomization.yaml b/kubernetes/flux/repositories/kustomization.yaml index 219c6e2e..196ac069 100644 --- a/kubernetes/flux/repositories/kustomization.yaml +++ b/kubernetes/flux/repositories/kustomization.yaml @@ -5,3 +5,4 @@ kind: Kustomization namespace: flux-system resources: - ./helm + - ./git