Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added network policy to radar applications #107

Merged
merged 5 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/app-config-frontend/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.2
version: 1.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
3 changes: 2 additions & 1 deletion charts/app-config-frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# app-config-frontend
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/app-config-frontend)](https://artifacthub.io/packages/helm/radar-base/app-config-frontend)

![Version: 1.0.2](https://img.shields.io/badge/Version-1.0.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.5.0](https://img.shields.io/badge/AppVersion-0.5.0-informational?style=flat-square)
![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.5.0](https://img.shields.io/badge/AppVersion-0.5.0-informational?style=flat-square)

A Helm chart for the frontend application of RADAR-base application config (app-config).

Expand Down Expand Up @@ -70,6 +70,7 @@ A Helm chart for the frontend application of RADAR-base application config (app-
| 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 |
| authUrl | string | `"http://localhost/managementportal/oauth"` | Authorization URL of the IDP |
| authCallbackUrl | string | `"http://localhost/appconfig/login"` | Callback URL to where authorization-code should be returned |
| backendUrl | string | `"/appconfig/api"` | Base-URL of the App Config backend service |
12 changes: 12 additions & 0 deletions charts/app-config-frontend/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 "app-config-frontend.fullname" . }}
labels:
{{ include "app-config-frontend.labels" . | indent 4 }}
spec:
podSelector:
{{ include "app-config-frontend.labels" . | indent 4 }}
{{- tpl (toYaml .Values.networkpolicy) . | nindent 2 }}
{{- end -}}
27 changes: 27 additions & 0 deletions charts/app-config-frontend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,33 @@ 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:
- Ingress
- Egress
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: '{{ .Release.Namespace }}'
podSelector:
matchLabels:
app.kubernetes.io/name: ingress-nginx
egress:
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP

# -- Authorization URL of the IDP
authUrl: http://localhost/managementportal/oauth
Expand Down
2 changes: 1 addition & 1 deletion charts/app-config/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "0.5.0"
description: A Helm chart for RADAR-base application config (app-config) backend service which is used as mobile app configuration engine with per-project and per-user configuration.
name: app-config
version: 1.0.3
version: 1.1.0
icon: "http://radar-base.org/wp-content/uploads/2022/09/Logo_RADAR-Base-RGB.png"
sources:
- https://github.com/RADAR-base/radar-helm-charts/tree/main/charts/app-config
Expand Down
3 changes: 2 additions & 1 deletion charts/app-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# app-config
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/app-config)](https://artifacthub.io/packages/helm/radar-base/app-config)

![Version: 1.0.3](https://img.shields.io/badge/Version-1.0.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.5.0](https://img.shields.io/badge/AppVersion-0.5.0-informational?style=flat-square)
![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.5.0](https://img.shields.io/badge/AppVersion-0.5.0-informational?style=flat-square)

A Helm chart for RADAR-base application config (app-config) backend service which is used as mobile app configuration engine with per-project and per-user configuration.

Expand Down Expand Up @@ -72,6 +72,7 @@ A Helm chart for RADAR-base application config (app-config) backend service whic
| 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 |
| javaOpts | string | `"-Xmx550m"` | Standard JAVA_OPTS that should be passed to this service |
| clientId | string | `"radar_appconfig"` | OAuth2 client id |
| clientSecret | string | `"secret"` | OAuth2 client secret |
Expand Down
12 changes: 12 additions & 0 deletions charts/app-config/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 "app-config.fullname" . }}
labels:
{{ include "app-config.labels" . | indent 4 }}
spec:
podSelector:
{{ include "app-config.labels" . | indent 4 }}
{{- tpl (toYaml .Values.networkpolicy) . | nindent 2 }}
{{- end -}}
41 changes: 41 additions & 0 deletions charts/app-config/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,47 @@ 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:
- Ingress
- Egress
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: '{{ .Release.Namespace }}'
podSelector:
matchLabels:
app.kubernetes.io/name: ingress-nginx
egress:
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: '{{ .Release.Namespace }}'
podSelector:
matchLabels:
app.kubernetes.io/name: management-portal
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: '{{ .Release.Namespace }}'
podSelector:
matchLabels:
app.kubernetes.io/name: postgresql
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP

# -- Standard JAVA_OPTS that should be passed to this service
javaOpts: "-Xmx550m"
# -- OAuth2 client id
Expand Down
2 changes: 1 addition & 1 deletion charts/catalog-server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "0.8.2"
description: A Helm chart for RADAR-base catalogue server. This application creates RADAR-base topics in Kafka, registers schemas in Schema Registry and keeps a catalog of available source types.
name: catalog-server
version: 0.4.8
version: 0.5.0
icon: "http://radar-base.org/wp-content/uploads/2022/09/Logo_RADAR-Base-RGB.png"
sources:
- https://github.com/RADAR-base/radar-helm-charts/tree/main/charts/catalog-server
Expand Down
3 changes: 2 additions & 1 deletion charts/catalog-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# catalog-server
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/catalog-server)](https://artifacthub.io/packages/helm/radar-base/catalog-server)

![Version: 0.4.8](https://img.shields.io/badge/Version-0.4.8-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.8.2](https://img.shields.io/badge/AppVersion-0.8.2-informational?style=flat-square)
![Version: 0.5.0](https://img.shields.io/badge/Version-0.5.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.8.2](https://img.shields.io/badge/AppVersion-0.8.2-informational?style=flat-square)

A Helm chart for RADAR-base catalogue server. This application creates RADAR-base topics in Kafka, registers schemas in Schema Registry and keeps a catalog of available source types.

Expand Down Expand Up @@ -65,6 +65,7 @@ A Helm chart for RADAR-base catalogue server. This application creates RADAR-bas
| 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 |
| kafka_num_brokers | int | `3` | number of Kafka brokers to look for |
| kafka | string | `"cp-kafka-headless:9092"` | URI of Kafka brokers |
| schema_registry | string | `"http://cp-schema-registry:8081"` | URL of the confluent schema registry |
Expand Down
12 changes: 12 additions & 0 deletions charts/catalog-server/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 "catalog-server.fullname" . }}
labels:
{{ include "catalog-server.labels" . | indent 4 }}
spec:
podSelector:
{{ include "catalog-server.labels" . | indent 4 }}
{{- tpl (toYaml .Values.networkpolicy) . | nindent 2 }}
{{- end -}}
39 changes: 39 additions & 0 deletions charts/catalog-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,45 @@ 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we blocking these private/local IPs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The policies will be enabled by default. If you want to disable them you can change the networkpolicy value in production.yaml to {}.
The IPs are being blocked to prevent access to other pods and services in local network.

Copy link
Member

@mpgxvii mpgxvii Nov 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also accept incoming requests from management portal here? Since management portal needs the catalog server for source types?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Good catch! Thank you!

- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP
- to:
- 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

# -- number of Kafka brokers to look for
kafka_num_brokers: 3
# -- URI of Kafka brokers
Expand Down
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "0.60.1"
description: A Helm chart for Prometheus operator stack. This chart is an overlay for original kube-prometheus-stack chart. It defines some the default values for namespaces to monitor, alert templates, Nginx configuration and authentication and a few extra charts for Grafana. For more details on how to customize those values refer to original chart.
name: kube-prometheus-stack
version: 0.4.1
version: 0.4.2
sources: ["https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack"]
deprecated: false
type: application
Expand Down
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# kube-prometheus-stack
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/kube-prometheus-stack)](https://artifacthub.io/packages/helm/radar-base/kube-prometheus-stack)

![Version: 0.4.1](https://img.shields.io/badge/Version-0.4.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.60.1](https://img.shields.io/badge/AppVersion-0.60.1-informational?style=flat-square)
![Version: 0.4.2](https://img.shields.io/badge/Version-0.4.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.60.1](https://img.shields.io/badge/AppVersion-0.60.1-informational?style=flat-square)

A Helm chart for Prometheus operator stack. This chart is an overlay for original kube-prometheus-stack chart. It defines some the default values for namespaces to monitor, alert templates, Nginx configuration and authentication and a few extra charts for Grafana. For more details on how to customize those values refer to original chart.

Expand Down
5 changes: 5 additions & 0 deletions charts/kube-prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ kube-prometheus-stack:
patch:
enabled: false

networkPolicy:
## Enable creation of NetworkPolicy resources.
##
enabled: false

## Deploy a Prometheus instance
##
prometheus:
Expand Down
2 changes: 1 addition & 1 deletion charts/management-portal/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "2.0.0"
description: A Helm chart for RADAR-Base Management Portal to manage projects and participants throughout RADAR-base.
name: management-portal
version: 1.0.4
version: 1.1.0
icon: "http://radar-base.org/wp-content/uploads/2022/09/Logo_RADAR-Base-RGB.png"
sources:
- https://github.com/RADAR-base/radar-helm-charts/tree/main/charts/management-portal
Expand Down
5 changes: 3 additions & 2 deletions charts/management-portal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# management-portal
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/management-portal)](https://artifacthub.io/packages/helm/radar-base/management-portal)

![Version: 1.0.4](https://img.shields.io/badge/Version-1.0.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.0.0](https://img.shields.io/badge/AppVersion-2.0.0-informational?style=flat-square)
![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.0.0](https://img.shields.io/badge/AppVersion-2.0.0-informational?style=flat-square)

A Helm chart for RADAR-Base Management Portal to manage projects and participants throughout RADAR-base.

Expand Down Expand Up @@ -76,6 +76,7 @@ A Helm chart for RADAR-Base Management Portal to manage projects and participant
| 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 |
| keystore | string | `""` | base 64 encoded binary p12 keystore containing a ECDSA certificate with alias `radarbase-managementportal-ec` and a RSA certificate with alias `selfsigned`. |
| postgres.host | string | `"postgresql"` | host name of the postgres db |
| postgres.port | int | `5432` | post of the postgres db |
Expand All @@ -101,7 +102,7 @@ A Helm chart for RADAR-Base Management Portal to manage projects and participant
| smtp.from | string | `"[email protected]"` | Email address which should be used to send activation emails |
| smtp.starttls | bool | `false` | set to true,if ttls should be enabled |
| smtp.auth | bool | `true` | set to true, if the account should be authenticated before sending emails |
| oauth_clients | object | check values.yaml | OAuth2 Client configuration |
| oauth_clients | object | check `values.yaml` | OAuth2 Client configuration |

## OAuth Client Configuration
List of OAuth client configurations supported by RADAR-base. Each client should be enabled separately, if relevant and used in the installation.
Expand Down
5 changes: 1 addition & 4 deletions charts/management-portal/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ kind: ConfigMap
metadata:
name: {{ template "management-portal.fullname" . }}
labels:
app: {{ template "management-portal.name" . }}
chart: {{ template "management-portal.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{ include "management-portal.labels" . | indent 4 }}
data:
healthcheck.sh: |
#!/bin/sh
Expand Down
5 changes: 1 addition & 4 deletions charts/management-portal/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ kind: Deployment
metadata:
name: {{ include "management-portal.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "management-portal.name" . }}
helm.sh/chart: {{ include "management-portal.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{ include "management-portal.labels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
Expand Down
12 changes: 12 additions & 0 deletions charts/management-portal/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 "management-portal.fullname" . }}
labels:
{{ include "management-portal.labels" . | indent 4 }}
spec:
podSelector:
{{ include "management-portal.labels" . | indent 4 }}
{{- tpl (toYaml .Values.networkpolicy) . | nindent 2 }}
{{- end -}}
5 changes: 1 addition & 4 deletions charts/management-portal/templates/secrets-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ kind: Secret
metadata:
name: {{ template "management-portal.fullname" . }}-config
labels:
app: {{ template "management-portal.name" . }}
chart: {{ template "management-portal.chart" . }}
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{ include "management-portal.labels" . | indent 4 }}
data:
oauth_client_details.csv: {{ include "oauth-clients-details.csv" . | b64enc | quote }}
5 changes: 1 addition & 4 deletions charts/management-portal/templates/secrets-keystore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ kind: Secret
metadata:
name: {{ template "management-portal.fullname" . }}-keystore
labels:
app: {{ template "management-portal.name" . }}
chart: {{ template "management-portal.chart" . }}
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{ include "management-portal.labels" . | indent 4 }}
type: Opaque
data:
keystore.p12: {{ .Values.keystore }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ kind: Secret
metadata:
name: {{ template "management-portal.fullname" . }}-root-cert
labels:
app: {{ template "management-portal.name" . }}
chart: {{ template "management-portal.chart" . }}
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{ include "management-portal.labels" . | indent 4 }}
type: Opaque
data:
root.crt: {{ .Values.postgres.ssl.keystore }}
Expand Down
5 changes: 1 addition & 4 deletions charts/management-portal/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ kind: Secret
metadata:
name: {{ template "management-portal.fullname" . }}
labels:
app: {{ template "management-portal.name" . }}
chart: {{ template "management-portal.chart" . }}
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{ include "management-portal.labels" . | indent 4 }}
type: Opaque
data:
postgresql_password: {{ .Values.postgres.password | b64enc | quote }}
Expand Down
Loading