adde generation of Server resources.
This commit is contained in:
parent
f27f3610ab
commit
496e58347c
@ -49,6 +49,18 @@ func (g LinkerdPolicyGenerator) GenerateCommunicationRule(
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// and the server resources
|
||||||
|
fmt.Fprintf(os.Stderr, "Server %s/%s\n",
|
||||||
|
app.Namespace.Name, app.Name)
|
||||||
|
template = g.policyTemplates.PredefineApplicationPolicyTemplate("linkerd", "server")
|
||||||
|
if template == nil {
|
||||||
|
return fmt.Errorf("Could not find meshtlsauthentication template")
|
||||||
|
}
|
||||||
|
err = template.Execute(writer, app)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if len(ingress.Applications)+
|
if len(ingress.Applications)+
|
||||||
len(ingress.Networks)+
|
len(ingress.Networks)+
|
||||||
len(egress.Applications)+
|
len(egress.Applications)+
|
||||||
|
16
cmd/policygen/templates/linkerd/application/server.yaml
Normal file
16
cmd/policygen/templates/linkerd/application/server.yaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{{- range $port := .Ports }}
|
||||||
|
{{- if or (eq $port.Protocol "TCP") (not $port.Protocol) }}
|
||||||
|
---
|
||||||
|
apiVersion: policy.linkerd.io/v1beta1
|
||||||
|
kind: Server
|
||||||
|
metadata:
|
||||||
|
name: {{ $.Name }}-p{{ $port.Port }}
|
||||||
|
namespace: {{ $.Namespace.Name }}
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels: {{ $.MatchLabels | toJson }}
|
||||||
|
matchExpressions: {{ $.MatchExpressions | toJson }}
|
||||||
|
port: {{ $port.Port }}
|
||||||
|
#proxyProtocol: "HTTP/2"
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
@ -22,6 +22,7 @@ namespaces:
|
|||||||
- name: openapp
|
- name: openapp
|
||||||
ports:
|
ports:
|
||||||
- port: 100
|
- port: 100
|
||||||
|
protocol: TCP
|
||||||
serviceAccounts:
|
serviceAccounts:
|
||||||
- xyz
|
- xyz
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user