Skip to content

Commit

Permalink
Add network policy and labelling updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mpgxvii committed Nov 30, 2023
1 parent a3e94b2 commit 684df41
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 16 deletions.
1 change: 1 addition & 0 deletions charts/radar-oura-connector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ A Helm chart for RADAR-base oura connector. This application collects data from
| readinessProbe.timeoutSeconds | int | `5` | Timeout seconds for readinessProbe |
| readinessProbe.successThreshold | int | `1` | Success threshold for readinessProbe |
| readinessProbe.failureThreshold | int | `3` | Failure threshold for readinessProbe |
| networkpolicy | object | check `values.yaml` | Network policy defines who can access this application and who this applications has access to |
| zookeeper | string | `"cp-zookeeper-headless:2181"` | URI of Zookeeper instances of the cluster |
| kafka | string | `"PLAINTEXT://cp-kafka-headless:9092"` | URI of Kafka brokers of the cluster |
| kafka_num_brokers | string | `"3"` | Number of Kafka brokers. This is used to validate the cluster availability at connector init. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ kind: ConfigMap
metadata:
name: {{ template "radar-oura-connector.fullname" . }}-properties
labels:
app: {{ template "radar-oura-connector.name" . }}
chart: {{ template "radar-oura-connector.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{ include "radar-fitbit-connector.labels" . | indent 4 }}
data:
source-oura.properties: |
name=radar-oura-source
Expand Down
5 changes: 1 addition & 4 deletions charts/radar-oura-connector/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ kind: Deployment
metadata:
name: {{ include "radar-oura-connector.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "radar-oura-connector.name" . }}
helm.sh/chart: {{ include "radar-oura-connector.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{ include "radar-fitbit-connector.labels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
Expand Down
12 changes: 12 additions & 0 deletions charts/radar-oura-connector/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.networkpolicy }}
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: {{ template "radar-oura-connector.fullname" . }}
labels:
{{ include "radar-oura-connector.labels" . | indent 4 }}
spec:
podSelector:
{{ include "radar-oura-connector.labels" . | indent 4 }}
{{- tpl (toYaml .Values.networkpolicy) . | nindent 2 }}
{{- end -}}
5 changes: 1 addition & 4 deletions charts/radar-oura-connector/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ apiVersion: v1
metadata:
name: {{ template "radar-oura-connector.fullname" . }}
labels:
app: "{{ template "radar-oura-connector.fullname" . }}"
chart: "{{ template "radar-oura-connector.chart" . }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{ include "radar-fitbit-connector.labels" . | indent 4 }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
Expand Down
5 changes: 1 addition & 4 deletions charts/radar-oura-connector/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ kind: Service
metadata:
name: {{ include "radar-oura-connector.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "radar-oura-connector.name" . }}
helm.sh/chart: {{ include "radar-oura-connector.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{ include "radar-fitbit-connector.labels" . | indent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
Expand Down
57 changes: 57 additions & 0 deletions charts/radar-oura-connector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,63 @@ readinessProbe:
# -- Failure threshold for readinessProbe
failureThreshold: 3

# -- Network policy defines who can access this application and who this applications has access to
# @default -- check `values.yaml`
networkpolicy:
policyTypes:
- Egress
egress:
- to:
- ipBlock:
cidr: 0.0.0.0/0
except:
- 10.0.0.0/8
- 192.168.0.0/16
- 172.16.0.0/20
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: '{{ .Release.Namespace }}'
podSelector:
matchLabels:
app.kubernetes.io/name: 'cp-zookeeper'
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: '{{ .Release.Namespace }}'
podSelector:
matchLabels:
app.kubernetes.io/name: 'cp-kafka'
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: '{{ .Release.Namespace }}'
podSelector:
matchLabels:
app.kubernetes.io/name: 'cp-schema-registry'
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: '{{ .Release.Namespace }}'
podSelector:
matchLabels:
app.kubernetes.io/name: 'radar-rest-sources-backend'
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: '{{ .Release.Namespace }}'
podSelector:
matchLabels:
app.kubernetes.io/name: 'management-portal'
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP

# -- URI of Zookeeper instances of the cluster
zookeeper: cp-zookeeper-headless:2181
# -- URI of Kafka brokers of the cluster
Expand Down

0 comments on commit 684df41

Please sign in to comment.