From c407f5c1d9d478521e673cfea46c8036eca3ad28 Mon Sep 17 00:00:00 2001 From: Brandon Foley Date: Mon, 7 Oct 2024 16:01:46 -0400 Subject: [PATCH] error handler in create --- cmd/create.go | 4 ++++ cmd/info.go | 2 +- pkg/manifests/deployment.yaml | 24 ------------------------ pkg/manifests/service.yaml | 15 --------------- 4 files changed, 5 insertions(+), 40 deletions(-) delete mode 100644 pkg/manifests/deployment.yaml delete mode 100644 pkg/manifests/service.yaml diff --git a/cmd/create.go b/cmd/create.go index 4a6ee846..31dfbe5e 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -341,6 +341,10 @@ func (cc *createCmd) createDeployment() error { return err } + if deployTemplate == nil || deployTemplate.Config == nil { + return errors.New("invalid deployment type") + } + deployTemplate.Config.VariableMapToDraftConfig(flagVariablesMap) err = prompts.RunPromptsFromConfigWithSkips(deployTemplate.Config) diff --git a/cmd/info.go b/cmd/info.go index 29e45a20..ed114575 100644 --- a/cmd/info.go +++ b/cmd/info.go @@ -18,7 +18,7 @@ const ( ) var ( - supportedDeploymentTypes = []string{"helm", "kustomize", "manifest"} + supportedDeploymentTypes = []string{"helm", "kustomize", "manifests"} ) type infoCmd struct { diff --git a/pkg/manifests/deployment.yaml b/pkg/manifests/deployment.yaml deleted file mode 100644 index b3726a27..00000000 --- a/pkg/manifests/deployment.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: testapp - labels: - app: testapp - kubernetes.azure.com/generator: draft - namespace: default -spec: - replicas: 1 - selector: - matchLabels: - app: testapp - template: - metadata: - labels: - app: testapp - spec: - containers: - - name: testapp - image: testimage:latest - imagePullPolicy: Always - ports: - - containerPort: 80 \ No newline at end of file diff --git a/pkg/manifests/service.yaml b/pkg/manifests/service.yaml deleted file mode 100644 index 324d7ecb..00000000 --- a/pkg/manifests/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: testapp - namespace: default - labels: - kubernetes.azure.com/generator: draft -spec: - type: LoadBalancer - selector: - app: testapp - ports: - - protocol: TCP - port: 80 - targetPort: 80 \ No newline at end of file