generating policies first version.

Still includes linkerd ports.
This commit is contained in:
2025-01-25 12:01:51 +01:00
parent 496e58347c
commit 108f21ea58
10 changed files with 209 additions and 85 deletions
@@ -0,0 +1,22 @@
---
apiVersion: policy.linkerd.io/v1alpha1
kind: AuthorizationPolicy
metadata:
name: {{ .app.Name }}-p{{ .port }}
namespace: {{ .app.Namespace.Name}}
spec:
targetRef:
group: policy.linkerd.io
kind: Server
name: {{ .app.Name }}-p{{ .port }}
requiredAuthenticationRefs:
- name: {{ .app.Name }}-p{{ .port }}
namespace: {{ .app.Namespace.Name }}
kind: MeshTLSAuthentication
group: policy.linkerd.io
{{- range $net := .clientNetworks }}
- name: {{ $net.Network.Name }}
namespace: default
kind: NetworkAuthentication
group: policy.linkerd.io
{{- end }}
@@ -2,16 +2,12 @@
apiVersion: policy.linkerd.io/v1alpha1
kind: MeshTLSAuthentication
metadata:
name: {{ .Name }}
namespace: {{ .Namespace.Name }}
name: {{ .app.Name }}-{{.port}}
namespace: {{ .app.Namespace.Name }}
spec:
{{- if .ServiceAccounts }}
identityRefs:
{{- range $sa := .ServiceAccounts }}
{{- range $sa := .serviceAccounts }}
- kind: ServiceAccount
name: {{ $sa }}
{{- end }}
{{- else }}
fail (printf "no service accounts defined for app %s" .Name )
{{- end}}