Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added longhorn addon #1204

Merged
merged 6 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/tests/addons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ volsync:

spegel:
enabled: true

longhorn:
enabled: true
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./namespace.yaml
#% if longhorn.enabled | default(false) %#
- ./longhorn/ks.yaml
#% endif %#
- ./openebs/ks.yaml
#% if volsync.enabled | default(false) %#
- ./volsync/ks.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#% if longhorn.enabled | default(false) %#
---
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: longhorn
spec:
interval: 30m
chart:
spec:
chart: longhorn
version: 1.5.3
sourceRef:
kind: HelmRepository
name: longhorn
namespace: flux-system
maxHistory: 2
install:
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
retries: 3
uninstall:
keepHistory: false
values:
monitoring:
enabled: true
createPrometheusRules: true
defaultSettings:
defaultReplicaCount: 3
backupstorePollInterval: 0
createDefaultDiskLabeledNodes: true
restoreVolumeRecurringJobs: true
storageOverProvisioningPercentage: 100
storageMinimalAvailablePercentage: 1
guaranteedEngineManagerCPU: 20
guaranteedReplicaManagerCPU: 20
orphanAutoDeletion: true
concurrentAutomaticEngineUpgradePerNodeLimit: 3
defaultLonghornStaticStorageClass: longhorn
nodeDownPodDeletionPolicy: delete-both-statefulset-and-deployment-pod
ingress:
enabled: true
ingressClassName: internal
host: longhorn.${SECRET_DOMAIN}
tls: true
#% endif %#
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#% if longhorn.enabled | default(false) %#
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
- ./snapshot.yaml
#% endif %#
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#% if longhorn.enabled | default(false) %#
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
reclaimPolicy: Delete
provisioner: driver.longhorn.io
parameters:
# used for volsync to copy from.
# we set this to 1 replica for faster restores from the snapclass
dataLocality: disabled
numberOfReplicas: "1"
replicaAutoBalance: best-effort
staleReplicaTimeout: "30"
allowVolumeExpansion: true
volumeBindingMode: Immediate
metadata:
name: longhorn-snapshot
#% endif %#
22 changes: 22 additions & 0 deletions bootstrap/templates/kubernetes/apps/storage/longhorn/ks.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#% if longhorn.enabled | default(false) %#
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app longhorn
namespace: flux-system
spec:
targetNamespace: storage
commonMetadata:
labels:
app.kubernetes.io/name: *app
path: ./kubernetes/apps/storage/longhorn/app
prune: true
sourceRef:
kind: GitRepository
name: home-kubernetes
wait: false # no flux ks dependents
interval: 30m
retryInterval: 1m
timeout: 5m
#% endif %#
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ spec:
commonMetadata:
labels:
app.kubernetes.io/name: *app
#% if longhorn.enabled | default(false) %#
dependsOn:
- name: longhorn
#% endif %#
path: ./kubernetes/apps/storage/volsync/snapshot-controller
prune: true
sourceRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ spec:
keepHistory: false
values:
controller:
#% if longhorn.enabled | default(false) %#
volumeSnapshotClasses:
- name: longhorn-snapclass
annotations:
snapshot.storage.kubernetes.io/is-default-class: "true"
driver: driver.longhorn.io
deletionPolicy: Delete
parameters:
# needed for successful VolumeSnapshots
# see: https://github.com/longhorn/longhorn/issues/2534#issuecomment-1010508714
type: snap
#% endif %#
serviceMonitor:
create: true
webhook:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ resources:
- ./jetstack.yaml
- ./k8s-gateway.yaml
- ./kubernetes-dashboard.yaml
- ./longhorn.yaml
- ./metrics-server.yaml
- ./openebs.yaml
- ./piraeus.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: longhorn
namespace: flux-system
spec:
interval: 30m
url: https://charts.longhorn.io
timeout: 3m
4 changes: 4 additions & 0 deletions bootstrap/vars/addons.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@ volsync:
spegel:
# Note: This only applies to k0s at the moment
enabled: false

# https://github.com/longhorn/longhorn
longhorn:
enabled: false