Skip to content

Commit

Permalink
Don't prepend TrafficSegment on empty string. (#607)
Browse files Browse the repository at this point in the history
Signed-off-by: Rodrigo Reis <[email protected]>
  • Loading branch information
gargravarr authored Mar 4, 2024
1 parent bc0f9ec commit f58a57c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
28 changes: 14 additions & 14 deletions docs/stack_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7045,6 +7045,20 @@ spec:
description: key is the key to project.
type: string
mode:
description: 'mode is Optional:
mode bits used to set permissions
on this file. Must be an octal
value between 0000 and 0777 or
a decimal value between 0 and
511. YAML accepts both octal and
decimal values, JSON requires
decimal values for mode bits.
If not specified, the volume defaultMode
will be used. This might be in
conflict with other options that
affect the file mode, like fsGroup,
and the result can be other mode
bits set.'
format: int32
type: integer
path:
Expand Down Expand Up @@ -7177,20 +7191,6 @@ spec:
description: key is the key to project.
type: string
mode:
description: 'mode is Optional:
mode bits used to set permissions
on this file. Must be an octal
value between 0000 and 0777 or
a decimal value between 0 and
511. YAML accepts both octal and
decimal values, JSON requires
decimal values for mode bits.
If not specified, the volume defaultMode
will be used. This might be in
conflict with other options that
affect the file mode, like fsGroup,
and the result can be other mode
bits set.'
format: int32
type: integer
path:
Expand Down
2 changes: 1 addition & 1 deletion pkg/core/stack_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ func (sc *StackContainer) GenerateIngressSegment() (
sc.ingressAnnotationsToSync,
)

if predVal, ok := res.Annotations[IngressPredicateKey]; !ok {
if predVal, ok := res.Annotations[IngressPredicateKey]; !ok || predVal == "" {
res.Annotations = mergeLabels(
res.Annotations,
map[string]string{IngressPredicateKey: sc.trafficSegment()},
Expand Down
16 changes: 16 additions & 0 deletions pkg/core/stack_resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,22 @@ func TestStackGenerateIngressSegment(t *testing.T) {
expectedPredicate: "TrafficSegment(0.10, 0.30) && Method(\"GET\")",
expectedHosts: []string{"example.teapot.zalan.do"},
},
{
ingressSpec: &zv1.StackSetIngressSpec{
EmbeddedObjectMetaWithAnnotations: zv1.EmbeddedObjectMetaWithAnnotations{
Annotations: map[string]string{
IngressPredicateKey: "",
},
},
Hosts: []string{"example.teapot.zalan.do"},
},
lowerLimit: 0.1,
upperLimit: 0.3,
expectNil: false,
expectError: false,
expectedPredicate: "TrafficSegment(0.10, 0.30)",
expectedHosts: []string{"example.teapot.zalan.do"},
},
} {
backendPort := intstr.FromInt(int(80))
c := &StackContainer{
Expand Down

0 comments on commit f58a57c

Please sign in to comment.