Skip to content

Commit 056554d

Browse files
authored
chore(cloudbeaver):add networkpolicy (#39)
1 parent 16aacb7 commit 056554d

5 files changed

Lines changed: 74 additions & 7 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{{- /*
2+
Copyright Drycc Community.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{- if .Values.networkPolicy.enabled }}
7+
kind: NetworkPolicy
8+
apiVersion: {{ template "common.capabilities.networkPolicy.apiVersion" . }}
9+
metadata:
10+
name: {{ template "common.names.fullname" . }}
11+
namespace: {{ include "common.names.namespace" . | quote }}
12+
labels: {{- include "common.labels.standard" . | nindent 4 }}
13+
{{- if .Values.commonLabels }}
14+
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
15+
{{- end }}
16+
{{- if .Values.commonAnnotations }}
17+
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
18+
{{- end }}
19+
spec:
20+
podSelector:
21+
matchLabels:
22+
{{- include "common.labels.matchLabels" . | nindent 6 }}
23+
{{- if eq .Values.service.type "ClusterIP" }}
24+
ingress:
25+
# Allow inbound connections
26+
- ports:
27+
- port: {{ .Values.service.ports.http }}
28+
{{- if or .Values.networkPolicy.allowCurrentNamespace .Values.networkPolicy.allowNamespaces }}
29+
from:
30+
{{- if .Values.networkPolicy.allowCurrentNamespace }}
31+
- namespaceSelector:
32+
matchLabels:
33+
kubernetes.io/metadata.name: {{ .Release.Namespace }}
34+
{{- end }}
35+
{{- range $namespace := .Values.networkPolicy.allowNamespaces }}
36+
{{- if $namespace }}
37+
- namespaceSelector:
38+
matchLabels:
39+
kubernetes.io/metadata.name: {{ $namespace }}
40+
{{- end }}
41+
{{- end }}
42+
{{- end }}
43+
{{- end }}
44+
{{- if eq .Values.service.type "LoadBalancer" }}
45+
ingress:
46+
- {}
47+
{{- end}}
48+
{{- end }}

addons/cloudbeaver/23/chart/cloudbeaver/values.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,3 +514,20 @@ ingress:
514514
## name: http
515515
##
516516
extraRules: []
517+
## @section Network Policy
518+
519+
## MySQL Nework Policy configuration
520+
##
521+
networkPolicy:
522+
## @param networkPolicy.enabled Enable creation of NetworkPolicy resources
523+
##
524+
enabled: true
525+
## @param networkPolicy.allowExternal The Policy model to apply.
526+
## When set to false, only pods with the correct
527+
## client label will have network access to the port MySQL is listening
528+
## on. When true, MySQL will accept connections from any source
529+
## (with the correct destination port).
530+
##
531+
allowCurrentNamespace: true
532+
allowNamespaces: []
533+

addons/cloudbeaver/23/meta.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ tags: cloudbeaver
1313
bindable: true
1414
instances_retrievable: true
1515
bindings_retrievable: true
16-
plan_updateable: false
16+
plan_updateable: true
1717
allow_parameters:
18+
- name: "networkPolicy.allowNamespaces"
19+
required: false
20+
description: "networkPolicy allowNamespaces config for values.yaml"
1821
- name: "service.type"
1922
required: false
2023
description: "service type config for values.yaml"

addons/cloudbeaver/23/plans/standard-10/bind.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
credential:
22
{{- if (eq .Values.service.type "LoadBalancer") }}
3-
- name: HOST
3+
- name: EXTRANET_HOST
44
valueFrom:
55
serviceRef:
66
name: {{ include "common.names.fullname" . }}
77
jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
8-
{{- else if (eq .Values.service.type "ClusterIP") }}
8+
{{- end }}
99
- name: HOST
1010
valueFrom:
1111
serviceRef:
1212
name: {{ include "common.names.fullname" . }}
1313
jsonpath: '{ .spec.clusterIP }'
14-
{{- end }}
1514
- name: PORT
1615
valueFrom:
1716
serviceRef:
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: "standard-5"
1+
name: "standard-10"
22
id: 9d92b94d-c63e-47a8-ac91-352f511ef0a9
3-
description: "Cloudbeaver standard-5 plan: Disk 5Gi ,vCPUs 1 , RAM 2G"
4-
displayName: "standard-5"
3+
description: "Cloudbeaver standard-10 plan: Disk 10Gi ,vCPUs 1 , RAM 2G"
4+
displayName: "standard-10"
55
bindable: true
66
maximum_polling_duration: 1800

0 commit comments

Comments
 (0)