From ff2a185f922ac7a6ad8497a7e24e22a56c33e732 Mon Sep 17 00:00:00 2001 From: nferraro Date: Thu, 10 Jan 2019 16:16:20 +0100 Subject: [PATCH] Fix #312: add a none context to avoid creating any if needed --- pkg/controller/integrationplatform/create.go | 15 +++++++++++---- pkg/platform/resources.go | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pkg/controller/integrationplatform/create.go b/pkg/controller/integrationplatform/create.go index fa203c2b75..fd2ddec38f 100644 --- a/pkg/controller/integrationplatform/create.go +++ b/pkg/controller/integrationplatform/create.go @@ -51,6 +51,11 @@ func (action *createAction) Handle(ctx context.Context, platform *v1alpha1.Integ res := make([]string, 0, l) for _, c := range platform.Spec.Resources.Contexts { + if c == p.NoContext { + // Signals nothing to install + continue + } + // // Assuming that if the resource ends with a yaml extension, the full // resource name is provided @@ -62,10 +67,12 @@ func (action *createAction) Handle(ctx context.Context, platform *v1alpha1.Integ res = append(res, c) } - logrus.Info("Installing custom platform resources") - err := install.Resources(ctx, action.client, platform.Namespace, res...) - if err != nil { - return err + if len(res) > 0 { + logrus.Info("Installing custom platform resources") + err := install.Resources(ctx, action.client, platform.Namespace, res...) + if err != nil { + return err + } } } else { logrus.Info("Installing default platform resources") diff --git a/pkg/platform/resources.go b/pkg/platform/resources.go index 292776fbf7..a0b208bf48 100644 --- a/pkg/platform/resources.go +++ b/pkg/platform/resources.go @@ -32,6 +32,9 @@ var KnativeContexts = []string{ "platform-integration-context-knative.yaml", } +// NoContext is a placeholder for a not-present context +const NoContext = "none" + // GetContexts -- func GetContexts() []string { return append(DefaultContexts, KnativeContexts...)