Skip to content

Commit f69c93c

Browse files
committed
support certSecret option in annotation
Signed-off-by: roc <[email protected]>
1 parent e024371 commit f69c93c

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

internal/controller/clbbinding.go

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -671,15 +671,34 @@ func generatePortsFromAnnotation(anno string) (ports []networkingv1alpha1.PortEn
671671
protocol := fields[1]
672672
pools := strings.Split(fields[2], ",")
673673
var useSamePortAcrossPools *bool
674-
if len(fields) >= 4 && fields[3] == "useSamePortAcrossPools" {
675-
b := true
676-
useSamePortAcrossPools = &b
674+
var certSecretName *string
675+
if len(fields) >= 4 {
676+
options := fields[3]
677+
optionList := strings.Split(options, ",")
678+
for _, option := range optionList {
679+
kv := strings.Split(option, "=")
680+
if len(kv) == 1 {
681+
switch kv[0] {
682+
case "useSamePortAcrossPools":
683+
b := true
684+
useSamePortAcrossPools = &b
685+
}
686+
} else if len(kv) == 2 {
687+
key := kv[0]
688+
value := kv[1]
689+
switch key {
690+
case "certSecret":
691+
certSecretName = &value
692+
}
693+
}
694+
}
677695
}
678696
ports = append(ports, networkingv1alpha1.PortEntry{
679697
Port: port,
680698
Protocol: protocol,
681699
Pools: pools,
682700
UseSamePortAcrossPools: useSamePortAcrossPools,
701+
CertSecretName: certSecretName,
683702
})
684703
}
685704
return

0 commit comments

Comments
 (0)