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

Add ciliumnetworkpolicies #558

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all 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: 2 additions & 0 deletions keda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ their default values.
| `http.timeout` | int | `3000` | The default HTTP timeout to use for all scalers that use raw HTTP clients (some scalers use SDKs to access target services. These have built-in HTTP clients, and the timeout does not necessarily apply to them) |
| `image.pullPolicy` | string | `"Always"` | Image pullPolicy for all KEDA components |
| `imagePullSecrets` | list | `[]` | Name of secret to use to pull images to use to pull Docker images |
| `networkPolicy.enabled` | bool | `false` | Enable network policies |
| `networkPolicy.flavor` | string | `"cilium"` | Flavor of the network policies (cilium) |
tomkerkhove marked this conversation as resolved.
Show resolved Hide resolved
| `nodeSelector` | object | `{}` | Node selector for pod scheduling ([docs](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/)) |
| `podIdentity.activeDirectory.identity` | string | `""` | Identity in Azure Active Directory to use for Azure pod identity |
| `podIdentity.aws.irsa.audience` | string | `"sts.amazonaws.com"` | Sets the token audience for IRSA. This will be set as an annotation on the KEDA service account. |
Expand Down
27 changes: 27 additions & 0 deletions keda/templates/manager/ciliumnetworkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if and .Values.networkPolicy.enabled (eq .Values.networkPolicy.flavor "cilium") }}
apiVersion: "cilium.io/v2"
kind: CiliumNetworkPolicy
metadata:
name: {{ .Values.operator.name }}
namespace: {{ .Release.Namespace }}
{{- with .Values.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app: {{ .Values.operator.name }}
name: {{ .Values.operator.name }}
app.kubernetes.io/name: {{ .Values.operator.name }}
{{- include "keda.labels" . | indent 4 }}
spec:
endpointSelector:
matchLabels:
app: {{ .Values.operator.name }}
egress:
- toEntities:
- kube-apiserver
- cluster
ingress:
- fromEntities:
- cluster
{{ end }}
26 changes: 26 additions & 0 deletions keda/templates/metrics-server/ciliumnetworkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- if and .Values.networkPolicy.enabled (eq .Values.networkPolicy.flavor "cilium") }}
apiVersion: "cilium.io/v2"
kind: CiliumNetworkPolicy
metadata:
name: {{ .Values.operator.name }}-metrics-apiserver
namespace: {{ .Release.Namespace }}
{{- with .Values.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app: {{ .Values.operator.name }}-metrics-apiserver
app.kubernetes.io/name: {{ .Values.operator.name }}-metrics-apiserver
{{- include "keda.labels" . | indent 4 }}
spec:
endpointSelector:
matchLabels:
app: {{ .Values.operator.name }}-metrics-apiserver
egress:
- toEntities:
- kube-apiserver
- cluster
ingress:
- fromEntities:
- cluster
{{ end }}
27 changes: 27 additions & 0 deletions keda/templates/webhooks/ciliumnetworkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if and .Values.webhooks.enabled .Values.networkPolicy.enabled (eq .Values.networkPolicy.flavor "cilium") }}
apiVersion: "cilium.io/v2"
kind: CiliumNetworkPolicy
metadata:
name: {{ .Values.webhooks.name }}
namespace: {{ .Release.Namespace }}
{{- with .Values.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app: {{ .Values.webhooks.name }}
name: {{ .Values.webhooks.name }}
app.kubernetes.io/name: {{ .Values.webhooks.name }}
{{- include "keda.labels" . | indent 4 }}
spec:
endpointSelector:
matchLabels:
app: {{ .Values.webhooks.name }}
egress:
- toEntities:
- kube-apiserver
- cluster
ingress:
- fromEntities:
- cluster
{{ end }}
6 changes: 6 additions & 0 deletions keda/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ watchNamespace: ""
# -- Name of secret to use to pull images to use to pull Docker images
imagePullSecrets: []

networkPolicy:
# -- Enable network policies
enabled: false
# -- Flavor of the network policies (cilium)
flavor: "cilium"

operator:
# -- Name of the KEDA operator
name: keda-operator
Expand Down
Loading