Skip to content

Commit ded168d

Browse files
committed
Add --enable-forward-support flag
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
1 parent c90d6c0 commit ded168d

4 files changed

Lines changed: 10 additions & 3 deletions

File tree

cmd/stackset-controller/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ var (
4747
ConfigMapSupportEnabled bool
4848
SecretSupportEnabled bool
4949
PCSSupportEnabled bool
50+
ForwardSupportEnabled bool
5051
}
5152
)
5253

@@ -70,6 +71,7 @@ func main() {
7071
kingpin.Flag("enable-configmap-support", "Enable support for ConfigMaps on StackSets.").Default("false").BoolVar(&config.ConfigMapSupportEnabled)
7172
kingpin.Flag("enable-secret-support", "Enable support for Secrets on StackSets.").Default("false").BoolVar(&config.SecretSupportEnabled)
7273
kingpin.Flag("enable-pcs-support", "Enable support for PlatformCredentialsSet on StackSets.").Default("false").BoolVar(&config.PCSSupportEnabled)
74+
kingpin.Flag("enable-forward-support", "Enable support for skipper traffic forwarding.").Default("false").BoolVar(&config.ForwardSupportEnabled)
7375
kingpin.Parse()
7476

7577
if config.Debug {
@@ -91,6 +93,7 @@ func main() {
9193
ConfigMapSupportEnabled: config.ConfigMapSupportEnabled,
9294
SecretSupportEnabled: config.SecretSupportEnabled,
9395
PcsSupportEnabled: config.PCSSupportEnabled,
96+
ForwardSupportEnabled: config.ForwardSupportEnabled,
9497
}
9598

9699
ctx, cancel := context.WithCancel(context.Background())

controller/stackset.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ type StackSetConfig struct {
7777
ConfigMapSupportEnabled bool
7878
SecretSupportEnabled bool
7979
PcsSupportEnabled bool
80+
ForwardSupportEnabled bool
8081
}
8182

8283
type stacksetEvent struct {
@@ -758,7 +759,7 @@ func (c *StackSetController) ReconcileTrafficSegments(
758759

759760
// CreateCurrentStack creates a new Stack object for the current stack, if needed
760761
func (c *StackSetController) CreateCurrentStack(ctx context.Context, ssc *core.StackSetContainer) error {
761-
newStack, newStackVersion := ssc.NewStack()
762+
newStack, newStackVersion := ssc.NewStack(c.config.ForwardSupportEnabled)
762763
if newStack == nil {
763764
return nil
764765
}

pkg/core/stackset.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ func sanitizeServicePorts(service *zv1.StackServiceSpec) *zv1.StackServiceSpec {
5353
}
5454

5555
// NewStack returns an (optional) stack that should be created
56-
func (ssc *StackSetContainer) NewStack() (*StackContainer, string) {
56+
func (ssc *StackSetContainer) NewStack(forwardSupportEnabled bool) (*StackContainer, string) {
5757
_, forwardMigration := ssc.StackSet.ObjectMeta.Annotations[forwardBackendAnnotation]
58+
if !forwardSupportEnabled {
59+
forwardMigration = false
60+
}
5861
observedStackVersion := ssc.StackSet.Status.ObservedStackVersion
5962
stackVersion := currentStackVersion(ssc.StackSet)
6063
stackName := generateStackName(ssc.StackSet, stackVersion)

pkg/core/stackset_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ func TestStackSetNewStack(t *testing.T) {
371371
StackContainers: tc.stacks,
372372
backendWeightsAnnotationKey: traffic.DefaultBackendWeightsAnnotationKey,
373373
}
374-
newStack, newStackName := stackset.NewStack()
374+
newStack, newStackName := stackset.NewStack(false)
375375
require.EqualValues(t, tc.expectedStack, newStack)
376376
require.EqualValues(t, tc.expectedStackName, newStackName)
377377
})

0 commit comments

Comments
 (0)