Skip to content

Commit

Permalink
WAC-108 fix: Refactor volumes (#25)
Browse files Browse the repository at this point in the history
* fix: removed duplicated storages

* fix: merge local and azure volume decorations

* fix: merge local and aws and azure volume decorations

* fix: bad jinja template typo

* fix: bad jinja template typo AGAIN

* fix: use old azure volume sizes as can't shrink exisiting ones

* fix: restore RWO for aws

* fix: don't change the provisioner

* fix: correct ansible ternary syntax

* chore: tidy ordering, restore non-azure sizings
  • Loading branch information
cooper667 authored Aug 19, 2024
1 parent 72c90e2 commit 1273e7c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 126 deletions.
2 changes: 1 addition & 1 deletion roles/ckan/tasks/azure-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
--command "kubectl create namespace {{ application_namespace }}"
- set_fact:
storage_class_name: managed-csi # Azure
storage_class_name: azureblob-nfs-premium # Azure. This can actually be anything as we create a custom StorageClass with this name

- name: Get datalake info
azure.azcollection.azure_rm_storageaccount_info:
Expand Down
55 changes: 0 additions & 55 deletions roles/ckan/templates/kubernetes/aks/ckan_volumes.yaml

This file was deleted.

16 changes: 2 additions & 14 deletions roles/ckan/templates/kubernetes/ckan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ spec:
name: ckan-webassets
- mountPath: /var/lib/ckan/resources
name: ckan-resources
- name: ckan-configs
mountPath: /etc/ckan
- mountPath: /etc/ckan
name: ckan-configs
readOnly: true

{% if fjelltopp_env_type == 'local' %}
Expand All @@ -208,17 +208,6 @@ spec:
{% endif %}
restartPolicy: Always
volumes:
{% if fjelltopp_cloud_provider == 'azure' %}
- name: ckan-storage
persistentVolumeClaim:
claimName: ckan-storage-blob
- name: ckan-webassets
persistentVolumeClaim:
claimName: ckan-webassets-blob
- name: ckan-resources
persistentVolumeClaim:
claimName: ckan-resources-blob
{% else %}
- name: ckan-storage
persistentVolumeClaim:
claimName: ckan-storage
Expand All @@ -228,7 +217,6 @@ spec:
- name: ckan-resources
persistentVolumeClaim:
claimName: ckan-resources
{% endif %}

{% if fjelltopp_env_type == 'local' %}
- name: localckan
Expand Down
89 changes: 33 additions & 56 deletions roles/ckan/templates/kubernetes/ckan_volumes.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
{% if fjelltopp_env_type == 'local' %}
# Setup Azure Storage Class
{% if fjelltopp_cloud_provider == 'azure' %}
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: "{{ storage_class_name }}"
provisioner: blob.csi.azure.com
volumeBindingMode: Immediate
allowVolumeExpansion: true
mountOptions:
- uid=900
- gid=900
{% endif %}

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ckan-storage
creationTimestamp: null
labels:
app: ckan
name: ckan-storage
spec:
{% if fjelltopp_env_type != 'local' %}
storageClassName: "{{ storage_class_name }}"
{% endif %}
accessModes:
- ReadWriteOnce
- "{{ (fjelltopp_cloud_provider == 'azure') | ternary('ReadWriteMany', 'ReadWriteOnce') }}" # Azure supports ReadWriteMany and it's required for rolling deployments
resources:
requests:
storage: 100Mi
status: {}

storage: "{{ (fjelltopp_cloud_provider == 'azure') | ternary('1Gi', '100Mi') }}"
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -24,12 +39,14 @@ metadata:
app: ckan
name: ckan-webassets
spec:
{% if fjelltopp_env_type != 'local' %}
storageClassName: "{{ storage_class_name }}"
{% endif %}
accessModes:
- ReadWriteOnce
- "{{ (fjelltopp_cloud_provider == 'azure') | ternary('ReadWriteMany', 'ReadWriteOnce') }}"
resources:
requests:
storage: 100Mi
status: {}
storage: "{{ (fjelltopp_cloud_provider == 'azure') | ternary('1Gi', '100Mi') }}"

---
apiVersion: v1
Expand All @@ -40,14 +57,18 @@ metadata:
app: ckan
name: ckan-resources
spec:
{% if fjelltopp_env_type != 'local' %}
storageClassName: "{{ storage_class_name }}"
{% endif %}
accessModes:
- ReadWriteOnce
- "{{ (fjelltopp_cloud_provider == 'azure') | ternary('ReadWriteMany', 'ReadWriteOnce') }}"
resources:
requests:
storage: 100Mi
storage: "{{ (fjelltopp_cloud_provider == 'azure') | ternary('1Gi', '100Mi') }}"
status: {}


# Local Only Volumes
{% if fjelltopp_env_type == 'local' %}
---
apiVersion: v1
kind: PersistentVolume
Expand Down Expand Up @@ -84,48 +105,4 @@ spec:
storage: 20Gi
volumeName: localckan
status: {}

{% else %}
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: ckan-storage
spec:
storageClassName: "{{ storage_class_name }}"
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1000Mi
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: ckan-webassets
spec:
storageClassName: "{{ storage_class_name }}"
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1000Mi

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: ckan
name: ckan-resources
spec:
storageClassName: "{{ storage_class_name }}"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
status: {}

{% endif %}

0 comments on commit 1273e7c

Please sign in to comment.