mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-19 22:16:49 +00:00
Merge pull request #5024 from nextcloud/enh/noid/add-network-policy
helm: add network policy
This commit is contained in:
commit
00c41624ea
3 changed files with 45 additions and 0 deletions
20
nextcloud-aio-helm-chart/templates/nextcloud-aio-networkpolicy.yaml
Executable file
20
nextcloud-aio-helm-chart/templates/nextcloud-aio-networkpolicy.yaml
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
{{- if eq .Values.NETWORK_POLICY_ENABLED "yes" }}
|
||||
# https://github.com/ahmetb/kubernetes-network-policy-recipes/blob/master/04-deny-traffic-from-other-namespaces.md
|
||||
kind: NetworkPolicy
|
||||
apiVersion: networking.k8s.io/v1
|
||||
metadata:
|
||||
namespace: "{{ .Values.NAMESPACE }}"
|
||||
name: nextcloud-aio-deny-from-other-namespaces
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
ingress:
|
||||
- from:
|
||||
- podSelector: {}
|
||||
egress:
|
||||
- to:
|
||||
- podSelector: {}
|
||||
{{- end }}
|
||||
|
|
@ -315,6 +315,29 @@ find ./ -name '*talk-deployment.yaml' -exec sed -i "/^.*\- env:/r /tmp/additiona
|
|||
# shellcheck disable=SC1083
|
||||
find ./ -name '*deployment.yaml' -exec sed -i '/image: nextcloud/s/$/"/;s|image: nextcloud/|image: "{{ .Values.IMAGE_MIRROR_PREFIX }}{{ .Values.NEXTCLOUD_IMAGE_ORG }}/|;' \{} \;
|
||||
|
||||
cat << EOL > templates/nextcloud-aio-networkpolicy.yaml
|
||||
{{- if eq .Values.NETWORK_POLICY_ENABLED "yes" }}
|
||||
# https://github.com/ahmetb/kubernetes-network-policy-recipes/blob/master/04-deny-traffic-from-other-namespaces.md
|
||||
kind: NetworkPolicy
|
||||
apiVersion: networking.k8s.io/v1
|
||||
metadata:
|
||||
namespace: "{{ .Values.NAMESPACE }}"
|
||||
name: nextcloud-aio-deny-from-other-namespaces
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
ingress:
|
||||
- from:
|
||||
- podSelector: {}
|
||||
egress:
|
||||
- to:
|
||||
- podSelector: {}
|
||||
{{- end }}
|
||||
EOL
|
||||
|
||||
cd ../
|
||||
mkdir -p ../helm-chart/
|
||||
rm latest/Chart.yaml
|
||||
|
|
@ -355,6 +378,7 @@ cat << ADDITIONAL_CONFIG >> /tmp/sample.conf
|
|||
|
||||
NAMESPACE: default # By changing this, you can adjust the namespace of the installation which allows to install multiple instances on one kubernetes cluster
|
||||
NAMESPACE_DISABLED: "no" # By setting this to "yes", you can disabled the creation of the namespace so that you can use a pre-created one
|
||||
NETWORK_POLICY_ENABLED: "no" # By setting this to "yes", you can enable a network policy that limits network access to the same namespace. ⚠️ Attention: this breaks if you use an ingress!!! So it should be disabled if you do so!
|
||||
SUBSCRIPTION_KEY: # This allows to set the Nextcloud Enterprise key via ENV
|
||||
SERVERINFO_TOKEN: # This allows to set the serverinfo app token for monitoring your Nextcloud via the serverinfo app
|
||||
APPS_ALLOWLIST: # This allows to configure allowed apps that will be shown in Nextcloud's Appstore. You need to enter the app-IDs of the apps here and separate them with spaces. E.g. 'files richdocuments'
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ REDIS_STORAGE_SIZE: 1Gi # You can change the size of the redis volume that
|
|||
|
||||
NAMESPACE: default # By changing this, you can adjust the namespace of the installation which allows to install multiple instances on one kubernetes cluster
|
||||
NAMESPACE_DISABLED: "no" # By setting this to "yes", you can disabled the creation of the namespace so that you can use a pre-created one
|
||||
NETWORK_POLICY_ENABLED: "no" # By setting this to "yes", you can enable a network policy that limits network access to the same namespace. ⚠️ Attention: this breaks if you use an ingress!!! So it should be disabled if you do so!
|
||||
SUBSCRIPTION_KEY: # This allows to set the Nextcloud Enterprise key via ENV
|
||||
SERVERINFO_TOKEN: # This allows to set the serverinfo app token for monitoring your Nextcloud via the serverinfo app
|
||||
APPS_ALLOWLIST: # This allows to configure allowed apps that will be shown in Nextcloud's Appstore. You need to enter the app-IDs of the apps here and separate them with spaces. E.g. 'files richdocuments'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue