Skip to content

Commit

Permalink
Fix #312: add a none context to avoid creating any if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro authored and lburgazzoli committed Jan 13, 2019
1 parent a69f5fd commit ac31685
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkg/controller/integrationplatform/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions pkg/platform/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down

0 comments on commit ac31685

Please sign in to comment.