Skip to content

Commit

Permalink
Use PV and PVC backed volumes to store application charts (#1378)
Browse files Browse the repository at this point in the history
PV and PVC for helmer container and add permission in provider-kubeconfig.py for PV and PVC.
  • Loading branch information
SuyogShinde942 authored Dec 5, 2024
1 parent aa45ad0 commit 52b7b7a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
34 changes: 33 additions & 1 deletion deploy/kubeplus-chart/templates/kubeplus-components-6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,37 @@ spec:
selector:
app: kubeplus
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: kubeplus-pv
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/resource-policy: "keep"
spec:
capacity:
storage: 1Gi # Adjust the size as needed
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: /kubeplus # This can be a path on the host system where charts will be stored.
volumeMode: Filesystem
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: kubeplus-pvc
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/resource-policy: "keep"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi # Make sure this matches the PV size
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -387,7 +418,8 @@ spec:
- name: shared-data
emptyDir: {}
- name: chart-volume
emptyDir: {}
persistentVolumeClaim:
claimName: kubeplus-pvc
- name: webhook-certs
secret:
secretName: webhook-tls-certificates
Expand Down
13 changes: 13 additions & 0 deletions provider-kubeconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,18 @@ def _apply_provider_rbac(self, sa, namespace, kubeconfig):
ruleGroup22["verbs"] = verbsGroup22
all_resources.extend(resourceGroup22)

# PersistentVolumes and PersistentVolumeClaims for charts storage in helmer container
ruleGroup23 = {}
apiGroup23 = [""]
resourceGroup23 = ["persistentvolumes", "persistentvolumeclaims"]
verbsGroup23 = ["get", "watch", "list", "create", "delete", "update", "patch"]
ruleGroup23["apiGroups"] = apiGroup23
ruleGroup23["resources"] = resourceGroup23
ruleGroup23["verbs"] = verbsGroup23
all_resources.extend(resourceGroup23)



ruleList = []
ruleList.append(ruleGroup1)
ruleList.append(ruleGroup2)
Expand All @@ -483,6 +495,7 @@ def _apply_provider_rbac(self, sa, namespace, kubeconfig):
ruleList.append(ruleGroup20)
ruleList.append(ruleGroup21)
ruleList.append(ruleGroup22)
ruleList.append(ruleGroup23)

role["rules"] = ruleList

Expand Down

0 comments on commit 52b7b7a

Please sign in to comment.