From cc8fea57c05cdc601aaceed7d8dd35fd3d9df343 Mon Sep 17 00:00:00 2001 From: Jiaxin Shan Date: Sun, 15 Nov 2020 15:23:04 -0800 Subject: [PATCH] Automated cherry pick of #438: fail build on missing application name (#446) * fail build on missing application name * add application index on missing application error * update index syntax --- pkg/kfconfig/loaders/v1.go | 8 +++++++- pkg/kfconfig/types.go | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/kfconfig/loaders/v1.go b/pkg/kfconfig/loaders/v1.go index 8d162650..77ad05b2 100644 --- a/pkg/kfconfig/loaders/v1.go +++ b/pkg/kfconfig/loaders/v1.go @@ -45,7 +45,13 @@ func (v V1) LoadKfConfig(def interface{}) (*kfconfig.KfConfig, error) { config.Annotations = kfdef.Annotations config.ClusterName = kfdef.ClusterName config.Spec.Version = kfdef.Spec.Version - for _, app := range kfdef.Spec.Applications { + for i, app := range kfdef.Spec.Applications { + if app.Name == "" { + return nil, &kfapis.KfError{ + Code: int(kfapis.INVALID_ARGUMENT), + Message: fmt.Sprintf("must have name for application. missing application name on application[%d] in kfdef", i), + } + } application := kfconfig.Application{ Name: app.Name, } diff --git a/pkg/kfconfig/types.go b/pkg/kfconfig/types.go index ed7e2acf..17336353 100644 --- a/pkg/kfconfig/types.go +++ b/pkg/kfconfig/types.go @@ -845,7 +845,7 @@ func (c *KfConfig) SetApplicationParameter(appName string, paramName string, val "profiles": KfAppsStackName, "dex": "dex", // Spartakus is its own application because we want kfctl to be able to remove it. - "spartakus": "spartakus", + "spartakus": "spartakus", // AWS Specific "aws-alb-ingress-controller": KfAppsStackName, "istio-ingress": "istio-ingress",