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

feat(helm): add networkPolicy #336

Merged
merged 10 commits into from
Jun 7, 2023
45 changes: 45 additions & 0 deletions charts/tractusx-connector/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# Copyright (c) 2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

{{- if eq (.Values.networkPolicy.enabled | toString) "true" }}
{{- range tuple "controlplane" "dataplane" }}
{{- $name := . }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "txdc.fullname" $ }}-{{ $name }}
labels:
{{- include (printf "txdc.%s.labels" $name) $ | nindent 4 }}
spec:
podSelector:
matchLabels:
{{- include (printf "txdc.%s.selectorLabels" $name) $ | nindent 6 }}
ingress:
- from:
{{- toYaml (index $.Values.networkPolicy $name "from") | nindent 6 }}
ports:
{{- range $key,$value := (index $.Values $name "endpoints") }}
- port: {{ $value.port }}
protocol: TCP
{{- end }}
policyTypes:
- Ingress
---
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/tractusx-connector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,21 @@ daps:
certificate: "" # must be set externally!
backendService:
httpProxyTokenReceiverUrl: ""

networkPolicy:
# -- If `true` network policy will be created to restrict access to control- and dataplane
enabled: false
# -- Configuration of the controlplane component
controlplane:
# -- Specify from rule network policy for cp (defaults to all namespaces)
from:
- namespaceSelector: {}
# -- Configuration of the dataplane component
dataplane:
# -- Specify from rule network policy for dp (defaults to all namespaces)
from:
- namespaceSelector: {}

serviceAccount:
# Specifies whether a service account should be created
create: true
Expand Down