Skip to content

Commit fafe14e

Browse files
committed
feat: Added the optional appProtocol field to Canary.Service
Signed-off-by: Phil Nichol <[email protected]>
1 parent a1e519b commit fafe14e

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

artifacts/flagger/crd.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ spec:
158158
portName:
159159
description: Container port name
160160
type: string
161+
appProtocol:
162+
description: Application protocol of the port
163+
type: string
161164
targetPort:
162165
description: Container target port name
163166
x-kubernetes-int-or-string: true

pkg/apis/flagger/v1beta1/canary.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ type CanaryService struct {
128128
// +optional
129129
TargetPort intstr.IntOrString `json:"targetPort,omitempty"`
130130

131+
// AppProtocol of the service
132+
// https://kubernetes.io/docs/concepts/services-networking/service/#application-protocol
133+
// +optional
134+
AppProtocol string `json:"appProtocol,omitempty"`
135+
131136
// PortDiscovery adds all container ports to the generated Kubernetes service
132137
PortDiscovery bool `json:"portDiscovery"`
133138

pkg/router/kubernetes_default.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ func (c *KubernetesDefaultRouter) reconcileService(canary *flaggerv1.Canary, nam
114114
},
115115
}
116116

117+
if v := canary.Spec.Service.AppProtocol; v != "" {
118+
svcSpec.Ports[0].AppProtocol = &v
119+
}
120+
117121
// set additional ports
118122
for n, p := range c.ports {
119123
cp := corev1.ServicePort{

0 commit comments

Comments
 (0)