diff --git a/README.md b/README.md index 413fce73..038d97cf 100644 --- a/README.md +++ b/README.md @@ -213,12 +213,75 @@ kubectl get hr -A #### Configure Storage +``` +alias linstor='kubectl exec -n cozy-linstor deploy/linstor-controller -- linstor' +``` + TODO + +Create default storage classes: + +``` +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: local + annotations: + storageclass.kubernetes.io/is-default-class: "true" +provisioner: linstor.csi.linbit.com +parameters: + linstor.csi.linbit.com/storagePool: "data" + linstor.csi.linbit.com/layerList: "storage" + linstor.csi.linbit.com/allowRemoteVolumeAccess: "false" +volumeBindingMode: WaitForFirstConsumer +allowVolumeExpansion: true +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: replicated +provisioner: linstor.csi.linbit.com +parameters: + linstor.csi.linbit.com/storagePool: "data" + linstor.csi.linbit.com/autoPlace: "3" + linstor.csi.linbit.com/layerList: "drbd storage" + linstor.csi.linbit.com/allowRemoteVolumeAccess: "true" + property.linstor.csi.linbit.com/DrbdOptions/auto-quorum: suspend-io + property.linstor.csi.linbit.com/DrbdOptions/Resource/on-no-data-accessible: suspend-io + property.linstor.csi.linbit.com/DrbdOptions/Resource/on-suspended-primary-outdated: force-secondary + property.linstor.csi.linbit.com/DrbdOptions/Net/rr-conflict: retry-connect +volumeBindingMode: WaitForFirstConsumer +allowVolumeExpansion: true +``` + #### Configure Networking interconnection TODO +``` +--- +apiVersion: metallb.io/v1beta1 +kind: L2Advertisement +metadata: + name: cozystack + namespace: cozy-metallb +spec: + ipAddressPools: + - cozy-public +--- +apiVersion: metallb.io/v1beta1 +kind: IPAddressPool +metadata: + name: cozystack + namespace: cozy-metallb +spec: + addresses: + - 192.168.100.200-192.168.100.250 + autoAssign: true + avoidBuggyIPs: false +``` + #### Setup basic applications Get token from `tenant-root`: diff --git a/TODO b/TODO index f16e9167..3c910996 100644 --- a/TODO +++ b/TODO @@ -27,3 +27,4 @@ fullnameOverride kamaji-etcd specify nip.io domain by default automatically delete provisioned services with the cluster replicated storageclass +replicated and local storageclasses diff --git a/packages/apps/kubernetes/values.schema.json b/packages/apps/kubernetes/values.schema.json index ed62398a..bd786482 100644 --- a/packages/apps/kubernetes/values.schema.json +++ b/packages/apps/kubernetes/values.schema.json @@ -4,8 +4,8 @@ "properties": { "host": { "type": "string", - "form": true, - "title": "Domain name for this tenant", + "required": false, + "title": "Domain name for this kubernetes cluster", "description": "This host will be used for all apps deployed in this tenant" } } diff --git a/packages/apps/virtual-machine/templates/NOTES.txt b/packages/apps/virtual-machine/templates/NOTES.txt deleted file mode 100644 index 3deba5d8..00000000 --- a/packages/apps/virtual-machine/templates/NOTES.txt +++ /dev/null @@ -1,2 +0,0 @@ -IP: 10.66.0.23 -login: fedora diff --git a/packages/apps/virtual-machine/templates/secret.yaml b/packages/apps/virtual-machine/templates/secret.yaml deleted file mode 100644 index 62fa1d7c..00000000 --- a/packages/apps/virtual-machine/templates/secret.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: password -stringData: - root: asdasdasd diff --git a/packages/apps/virtual-machine/templates/service.yaml b/packages/apps/virtual-machine/templates/service.yaml new file mode 100644 index 00000000..8c49685e --- /dev/null +++ b/packages/apps/virtual-machine/templates/service.yaml @@ -0,0 +1,27 @@ +{{- if .Values.external }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "virtual-machine.fullname" . }} + labels: + {{- include "virtual-machine.labels" . | nindent 4 }} +spec: + {{- if .Values.external }} + type: LoadBalancer + externalTrafficPolicy: Local + allocateLoadBalancerNodePorts: false + {{- end }} + selector: + {{- include "virtual-machine.labels" . | nindent 4 }} + ports: + - name: ssh + port: 22 + targetPort: 22 + - name: http + port: 80 + targetPort: 80 + - name: https + port: 443 + targetPort: 443 +{{- end }} diff --git a/packages/apps/virtual-machine/templates/vm.yaml b/packages/apps/virtual-machine/templates/vm.yaml index bf83d73f..05885500 100644 --- a/packages/apps/virtual-machine/templates/vm.yaml +++ b/packages/apps/virtual-machine/templates/vm.yaml @@ -1,5 +1,4 @@ ---- -apiVersion: kubevirt.io/v1 +apiVersion: kubevirt.io/v1alpha3 kind: VirtualMachine metadata: name: {{ include "virtual-machine.fullname" . }} @@ -7,6 +6,29 @@ metadata: {{- include "virtual-machine.labels" . | nindent 4 }} spec: running: true + dataVolumeTemplates: + - metadata: + name: {{ include "virtual-machine.fullname" . }} + spec: + pvc: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.disk | quote }} + storageClassName: replicated + source: + http: + {{- if eq .Values.image "cirros" }} + url: https://download.cirros-cloud.net/0.6.2/cirros-0.6.2-x86_64-disk.img + {{- else if eq .Values.image "ubuntu" }} + url: https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img + {{- else if eq .Values.image "fedora" }} + url: https://mirror.karneval.cz/pub/linux/fedora/linux/releases/39/Cloud/x86_64/images/Fedora-Cloud-Base-39-1.5.x86_64.qcow2 + {{- else if eq .Values.image "alpine" }} + url: https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/x86_64/alpine-virt-3.19.1-x86_64.iso + {{- end }} + template: metadata: annotations: @@ -16,33 +38,28 @@ spec: spec: domain: cpu: - threads: 1 - cores: 2 - sockets: 1 - memory: - guest: {{ .Values.resources.memory | quote }} + cores: {{ .Values.resources.cpu }} devices: disks: - disk: - bus: virtio - name: containerdisk + bus: scsi + name: systemdisk - disk: bus: virtio name: cloudinitdisk - interfaces: - - name: default - bridge: {} - networks: - - name: default - pod: {} + machine: + type: "" + resources: + requests: + memory: {{ .Values.resources.memory | quote }} terminationGracePeriodSeconds: 30 volumes: - - containerDisk: - image: kubevirt/fedora-cloud-container-disk-demo:latest - name: containerdisk + - dataVolume: + name: {{ include "virtual-machine.fullname" . }} + name: systemdisk - cloudInitNoCloud: userData: |- #cloud-config - password: fedora + password: {{ .Values.password }} chpasswd: { expire: False } name: cloudinitdisk diff --git a/packages/apps/virtual-machine/values.schema.json b/packages/apps/virtual-machine/values.schema.json index e7fb3739..0915a5e5 100644 --- a/packages/apps/virtual-machine/values.schema.json +++ b/packages/apps/virtual-machine/values.schema.json @@ -4,22 +4,25 @@ "properties": { "running": { "type": "boolean", - "title": "Running", - "form": "useSelfHostedDatabase" + "title": "Running" + }, + "external": { + "type": "boolean", + "title": "Enable external Access" }, "image": { "type": "string", "form": true, - "enum": ["ubuntu", "centos", "alpine", "fedora"], - "title": "Database Type", - "description": "Choose image" + "enum": ["ubuntu", "cirros", "alpine", "fedora"], + "title": "Choose image" + }, + "password": { + "type": "string", + "title": "Password" }, "disk": { "type": "string", - "title": "Disk Size", - "x-display": "slider", - "minimum": 1, - "maximum": 100 + "title": "Disk Size" }, "resources": { "type": "object", diff --git a/packages/apps/virtual-machine/values.yaml b/packages/apps/virtual-machine/values.yaml index d20abdd0..6ba783de 100644 --- a/packages/apps/virtual-machine/values.yaml +++ b/packages/apps/virtual-machine/values.yaml @@ -1,5 +1,8 @@ -image: fedora -disk: 10Gi +external: false +running: true +password: hackme +image: ubuntu +disk: 5Gi resources: - cpu: 2 + cpu: 1 memory: 1024M diff --git a/packages/core/installer/images/installer.json b/packages/core/installer/images/installer.json index 2c30c054..2921b2d2 100644 --- a/packages/core/installer/images/installer.json +++ b/packages/core/installer/images/installer.json @@ -1,14 +1,14 @@ { - "containerimage.config.digest": "sha256:09f4e6e5841f426c8816bf416e55c36c07994895438253ef532ae411c5c13d25", + "containerimage.config.digest": "sha256:4e65da7e421b109937f549285f453934de37a88f3100cc046d75d5e5cfdc1ef5", "containerimage.descriptor": { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:443d8daa9f826e128ff013d43c5598bb2cf1915c427b5157e6c9f3f9c791db0f", + "digest": "sha256:f5a78fff1dc9241a707c16a3d719c2ebfbdbc81dba704ff2c80e24fd820307dd", "size": 2074, "platform": { "architecture": "amd64", "os": "linux" } }, - "containerimage.digest": "sha256:443d8daa9f826e128ff013d43c5598bb2cf1915c427b5157e6c9f3f9c791db0f", + "containerimage.digest": "sha256:f5a78fff1dc9241a707c16a3d719c2ebfbdbc81dba704ff2c80e24fd820307dd", "image.name": "ghcr.io/aenix-io/cozystack/installer:latest" } \ No newline at end of file diff --git a/packages/system/linstor/templates/sc.yaml b/packages/system/linstor/templates/sc.yaml index 95004695..63a5c81e 100644 --- a/packages/system/linstor/templates/sc.yaml +++ b/packages/system/linstor/templates/sc.yaml @@ -1,7 +1,7 @@ apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: - name: linstor-lvm + name: local annotations: storageclass.kubernetes.io/is-default-class: "true" provisioner: linstor.csi.linbit.com @@ -14,23 +14,6 @@ allowVolumeExpansion: true --- apiVersion: storage.k8s.io/v1 kind: StorageClass -metadata: - name: linstor-drbd-lvm -provisioner: linstor.csi.linbit.com -parameters: - linstor.csi.linbit.com/storagePool: "data" - linstor.csi.linbit.com/autoPlace: "3" - linstor.csi.linbit.com/layerList: "drbd storage" - linstor.csi.linbit.com/allowRemoteVolumeAccess: "false" - property.linstor.csi.linbit.com/DrbdOptions/auto-quorum: suspend-io - property.linstor.csi.linbit.com/DrbdOptions/Resource/on-no-data-accessible: suspend-io - property.linstor.csi.linbit.com/DrbdOptions/Resource/on-suspended-primary-outdated: force-secondary - property.linstor.csi.linbit.com/DrbdOptions/Net/rr-conflict: retry-connect -volumeBindingMode: WaitForFirstConsumer -allowVolumeExpansion: true ---- -apiVersion: storage.k8s.io/v1 -kind: StorageClass metadata: name: replicated provisioner: linstor.csi.linbit.com