github.com/jaylevin/jenkins-library@v1.230.4/cmd/kubernetesDeploy_generated.go (about)

     1  // Code generated by piper's step-generator. DO NOT EDIT.
     2  
     3  package cmd
     4  
     5  import (
     6  	"fmt"
     7  	"os"
     8  	"time"
     9  
    10  	"github.com/SAP/jenkins-library/pkg/config"
    11  	"github.com/SAP/jenkins-library/pkg/log"
    12  	"github.com/SAP/jenkins-library/pkg/splunk"
    13  	"github.com/SAP/jenkins-library/pkg/telemetry"
    14  	"github.com/SAP/jenkins-library/pkg/validation"
    15  	"github.com/spf13/cobra"
    16  )
    17  
    18  type kubernetesDeployOptions struct {
    19  	AdditionalParameters       []string               `json:"additionalParameters,omitempty"`
    20  	APIServer                  string                 `json:"apiServer,omitempty"`
    21  	AppTemplate                string                 `json:"appTemplate,omitempty"`
    22  	ChartPath                  string                 `json:"chartPath,omitempty"`
    23  	ContainerRegistryPassword  string                 `json:"containerRegistryPassword,omitempty"`
    24  	ContainerImageName         string                 `json:"containerImageName,omitempty"`
    25  	ContainerImageTag          string                 `json:"containerImageTag,omitempty"`
    26  	ContainerRegistryURL       string                 `json:"containerRegistryUrl,omitempty"`
    27  	ContainerRegistryUser      string                 `json:"containerRegistryUser,omitempty"`
    28  	ContainerRegistrySecret    string                 `json:"containerRegistrySecret,omitempty"`
    29  	CreateDockerRegistrySecret bool                   `json:"createDockerRegistrySecret,omitempty"`
    30  	DeploymentName             string                 `json:"deploymentName,omitempty"`
    31  	DeployTool                 string                 `json:"deployTool,omitempty" validate:"possible-values=kubectl helm helm3"`
    32  	ForceUpdates               bool                   `json:"forceUpdates,omitempty"`
    33  	HelmDeployWaitSeconds      int                    `json:"helmDeployWaitSeconds,omitempty"`
    34  	HelmValues                 []string               `json:"helmValues,omitempty"`
    35  	ValuesMapping              map[string]interface{} `json:"valuesMapping,omitempty"`
    36  	Image                      string                 `json:"image,omitempty"`
    37  	ImageNames                 []string               `json:"imageNames,omitempty"`
    38  	ImageNameTags              []string               `json:"imageNameTags,omitempty"`
    39  	ImageDigests               []string               `json:"imageDigests,omitempty"`
    40  	IngressHosts               []string               `json:"ingressHosts,omitempty"`
    41  	KeepFailedDeployments      bool                   `json:"keepFailedDeployments,omitempty"`
    42  	RunHelmTests               bool                   `json:"runHelmTests,omitempty"`
    43  	ShowTestLogs               bool                   `json:"showTestLogs,omitempty"`
    44  	KubeConfig                 string                 `json:"kubeConfig,omitempty"`
    45  	KubeContext                string                 `json:"kubeContext,omitempty"`
    46  	KubeToken                  string                 `json:"kubeToken,omitempty"`
    47  	Namespace                  string                 `json:"namespace,omitempty"`
    48  	TillerNamespace            string                 `json:"tillerNamespace,omitempty"`
    49  	DockerConfigJSON           string                 `json:"dockerConfigJSON,omitempty"`
    50  	DeployCommand              string                 `json:"deployCommand,omitempty" validate:"possible-values=apply replace"`
    51  }
    52  
    53  // KubernetesDeployCommand Deployment to Kubernetes test or production namespace within the specified Kubernetes cluster.
    54  func KubernetesDeployCommand() *cobra.Command {
    55  	const STEP_NAME = "kubernetesDeploy"
    56  
    57  	metadata := kubernetesDeployMetadata()
    58  	var stepConfig kubernetesDeployOptions
    59  	var startTime time.Time
    60  	var logCollector *log.CollectorHook
    61  	var splunkClient *splunk.Splunk
    62  	telemetryClient := &telemetry.Telemetry{}
    63  
    64  	var createKubernetesDeployCmd = &cobra.Command{
    65  		Use:   STEP_NAME,
    66  		Short: "Deployment to Kubernetes test or production namespace within the specified Kubernetes cluster.",
    67  		Long: `Deployment to Kubernetes test or production namespace within the specified Kubernetes cluster.
    68  
    69  !!! note "Deployment supports multiple deployment tools"
    70      Currently the following are supported:
    71  
    72      * [Helm](https://helm.sh/) command line tool and [Helm Charts](https://docs.helm.sh/developing_charts/#charts).
    73      * [kubectl](https://kubernetes.io/docs/reference/kubectl/overview/) and ` + "`" + `kubectl apply` + "`" + ` command.
    74  
    75  ## Helm
    76  Following helm command will be executed by default:
    77  
    78  ` + "`" + `` + "`" + `` + "`" + `
    79  helm upgrade <deploymentName> <chartPath> --install --force --namespace <namespace> --wait --timeout <helmDeployWaitSeconds> --set "image.repository=<yourRegistry>/<yourImageName>,image.tag=<yourImageTag>,secret.dockerconfigjson=<dockerSecret>,ingress.hosts[0]=<ingressHosts[0]>,,ingress.hosts[1]=<ingressHosts[1]>,...
    80  ` + "`" + `` + "`" + `` + "`" + `
    81  
    82  * ` + "`" + `yourRegistry` + "`" + ` will be retrieved from ` + "`" + `containerRegistryUrl` + "`" + `
    83  * ` + "`" + `yourImageName` + "`" + `, ` + "`" + `yourImageTag` + "`" + ` will be retrieved from ` + "`" + `image` + "`" + `
    84  * ` + "`" + `dockerSecret` + "`" + ` will be calculated with a call to ` + "`" + `kubectl create secret generic <containerRegistrySecret> --from-file=.dockerconfigjson=<dockerConfigJson> --type=kubernetes.io/dockerconfigjson --insecure-skip-tls-verify=true --dry-run=client --output=json` + "`" + ``,
    85  		PreRunE: func(cmd *cobra.Command, _ []string) error {
    86  			startTime = time.Now()
    87  			log.SetStepName(STEP_NAME)
    88  			log.SetVerbose(GeneralConfig.Verbose)
    89  
    90  			GeneralConfig.GitHubAccessTokens = ResolveAccessTokens(GeneralConfig.GitHubTokens)
    91  
    92  			path, _ := os.Getwd()
    93  			fatalHook := &log.FatalHook{CorrelationID: GeneralConfig.CorrelationID, Path: path}
    94  			log.RegisterHook(fatalHook)
    95  
    96  			err := PrepareConfig(cmd, &metadata, STEP_NAME, &stepConfig, config.OpenPiperFile)
    97  			if err != nil {
    98  				log.SetErrorCategory(log.ErrorConfiguration)
    99  				return err
   100  			}
   101  			log.RegisterSecret(stepConfig.ContainerRegistryPassword)
   102  			log.RegisterSecret(stepConfig.ContainerRegistryUser)
   103  			log.RegisterSecret(stepConfig.KubeConfig)
   104  			log.RegisterSecret(stepConfig.KubeToken)
   105  			log.RegisterSecret(stepConfig.DockerConfigJSON)
   106  
   107  			if len(GeneralConfig.HookConfig.SentryConfig.Dsn) > 0 {
   108  				sentryHook := log.NewSentryHook(GeneralConfig.HookConfig.SentryConfig.Dsn, GeneralConfig.CorrelationID)
   109  				log.RegisterHook(&sentryHook)
   110  			}
   111  
   112  			if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
   113  				splunkClient = &splunk.Splunk{}
   114  				logCollector = &log.CollectorHook{CorrelationID: GeneralConfig.CorrelationID}
   115  				log.RegisterHook(logCollector)
   116  			}
   117  
   118  			validation, err := validation.New(validation.WithJSONNamesForStructFields(), validation.WithPredefinedErrorMessages())
   119  			if err != nil {
   120  				return err
   121  			}
   122  			if err = validation.ValidateStruct(stepConfig); err != nil {
   123  				log.SetErrorCategory(log.ErrorConfiguration)
   124  				return err
   125  			}
   126  
   127  			return nil
   128  		},
   129  		Run: func(_ *cobra.Command, _ []string) {
   130  			stepTelemetryData := telemetry.CustomData{}
   131  			stepTelemetryData.ErrorCode = "1"
   132  			handler := func() {
   133  				config.RemoveVaultSecretFiles()
   134  				stepTelemetryData.Duration = fmt.Sprintf("%v", time.Since(startTime).Milliseconds())
   135  				stepTelemetryData.ErrorCategory = log.GetErrorCategory().String()
   136  				stepTelemetryData.PiperCommitHash = GitCommit
   137  				telemetryClient.SetData(&stepTelemetryData)
   138  				telemetryClient.Send()
   139  				if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
   140  					splunkClient.Send(telemetryClient.GetData(), logCollector)
   141  				}
   142  			}
   143  			log.DeferExitHandler(handler)
   144  			defer handler()
   145  			telemetryClient.Initialize(GeneralConfig.NoTelemetry, STEP_NAME)
   146  			if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
   147  				splunkClient.Initialize(GeneralConfig.CorrelationID,
   148  					GeneralConfig.HookConfig.SplunkConfig.Dsn,
   149  					GeneralConfig.HookConfig.SplunkConfig.Token,
   150  					GeneralConfig.HookConfig.SplunkConfig.Index,
   151  					GeneralConfig.HookConfig.SplunkConfig.SendLogs)
   152  			}
   153  			kubernetesDeploy(stepConfig, &stepTelemetryData)
   154  			stepTelemetryData.ErrorCode = "0"
   155  			log.Entry().Info("SUCCESS")
   156  		},
   157  	}
   158  
   159  	addKubernetesDeployFlags(createKubernetesDeployCmd, &stepConfig)
   160  	return createKubernetesDeployCmd
   161  }
   162  
   163  func addKubernetesDeployFlags(cmd *cobra.Command, stepConfig *kubernetesDeployOptions) {
   164  	cmd.Flags().StringSliceVar(&stepConfig.AdditionalParameters, "additionalParameters", []string{}, "Defines additional parameters for \"helm install\" or \"kubectl apply\" command.")
   165  	cmd.Flags().StringVar(&stepConfig.APIServer, "apiServer", os.Getenv("PIPER_apiServer"), "Defines the Url of the API Server of the Kubernetes cluster.")
   166  	cmd.Flags().StringVar(&stepConfig.AppTemplate, "appTemplate", os.Getenv("PIPER_appTemplate"), "Defines the filename for the kubernetes app template (e.g. k8s_apptemplate.yaml).")
   167  	cmd.Flags().StringVar(&stepConfig.ChartPath, "chartPath", os.Getenv("PIPER_chartPath"), "Defines the chart path for deployments using helm. It is a mandatory parameter when `deployTool:helm` or `deployTool:helm3`.")
   168  	cmd.Flags().StringVar(&stepConfig.ContainerRegistryPassword, "containerRegistryPassword", os.Getenv("PIPER_containerRegistryPassword"), "Password for container registry access - typically provided by the CI/CD environment.")
   169  	cmd.Flags().StringVar(&stepConfig.ContainerImageName, "containerImageName", os.Getenv("PIPER_containerImageName"), "Name of the container which will be built - will be used together with `containerImageTag` instead of parameter `containerImage`")
   170  	cmd.Flags().StringVar(&stepConfig.ContainerImageTag, "containerImageTag", os.Getenv("PIPER_containerImageTag"), "Tag of the container which will be built - will be used together with `containerImageName` instead of parameter `containerImage`")
   171  	cmd.Flags().StringVar(&stepConfig.ContainerRegistryURL, "containerRegistryUrl", os.Getenv("PIPER_containerRegistryUrl"), "http(s) url of the Container registry where the image to deploy is located.")
   172  	cmd.Flags().StringVar(&stepConfig.ContainerRegistryUser, "containerRegistryUser", os.Getenv("PIPER_containerRegistryUser"), "Username for container registry access - typically provided by the CI/CD environment.")
   173  	cmd.Flags().StringVar(&stepConfig.ContainerRegistrySecret, "containerRegistrySecret", `regsecret`, "Name of the container registry secret used for pulling containers from the registry.")
   174  	cmd.Flags().BoolVar(&stepConfig.CreateDockerRegistrySecret, "createDockerRegistrySecret", false, "Only for `deployTool:kubectl`: Toggle to turn on `containerRegistrySecret` creation.")
   175  	cmd.Flags().StringVar(&stepConfig.DeploymentName, "deploymentName", os.Getenv("PIPER_deploymentName"), "Defines the name of the deployment. It is a mandatory parameter when `deployTool:helm` or `deployTool:helm3`.")
   176  	cmd.Flags().StringVar(&stepConfig.DeployTool, "deployTool", `kubectl`, "Defines the tool which should be used for deployment.")
   177  	cmd.Flags().BoolVar(&stepConfig.ForceUpdates, "forceUpdates", true, "Adds `--force` flag to a helm resource update command or to a kubectl replace command")
   178  	cmd.Flags().IntVar(&stepConfig.HelmDeployWaitSeconds, "helmDeployWaitSeconds", 300, "Number of seconds before helm deploy returns.")
   179  	cmd.Flags().StringSliceVar(&stepConfig.HelmValues, "helmValues", []string{}, "List of helm values as YAML file reference or URL (as per helm parameter description for `-f` / `--values`)")
   180  
   181  	cmd.Flags().StringVar(&stepConfig.Image, "image", os.Getenv("PIPER_image"), "Full name of the image to be deployed.")
   182  	cmd.Flags().StringSliceVar(&stepConfig.ImageNames, "imageNames", []string{}, "List of names of the images to be deployed.")
   183  	cmd.Flags().StringSliceVar(&stepConfig.ImageNameTags, "imageNameTags", []string{}, "List of full names (registry and tag) of the images to be deployed.")
   184  	cmd.Flags().StringSliceVar(&stepConfig.ImageDigests, "imageDigests", []string{}, "List of image digests of the images to be deployed, in the format `sha256:<hash>`. If provided, image digests will be appended to the image tag, e.g. `<repository>/<name>:<tag>@<digest>`")
   185  	cmd.Flags().StringSliceVar(&stepConfig.IngressHosts, "ingressHosts", []string{}, "(Deprecated) List of ingress hosts to be exposed via helm deployment.")
   186  	cmd.Flags().BoolVar(&stepConfig.KeepFailedDeployments, "keepFailedDeployments", false, "Defines whether a failed deployment will be purged")
   187  	cmd.Flags().BoolVar(&stepConfig.RunHelmTests, "runHelmTests", false, "Defines whether or not to run helm tests against the recently deployed release")
   188  	cmd.Flags().BoolVar(&stepConfig.ShowTestLogs, "showTestLogs", false, "Defines whether to print the pod logs after running helm tests")
   189  	cmd.Flags().StringVar(&stepConfig.KubeConfig, "kubeConfig", os.Getenv("PIPER_kubeConfig"), "Defines the path to the \"kubeconfig\" file.")
   190  	cmd.Flags().StringVar(&stepConfig.KubeContext, "kubeContext", os.Getenv("PIPER_kubeContext"), "Defines the context to use from the \"kubeconfig\" file.")
   191  	cmd.Flags().StringVar(&stepConfig.KubeToken, "kubeToken", os.Getenv("PIPER_kubeToken"), "Contains the id_token used by kubectl for authentication. Consider using kubeConfig parameter instead.")
   192  	cmd.Flags().StringVar(&stepConfig.Namespace, "namespace", `default`, "Defines the target Kubernetes namespace for the deployment.")
   193  	cmd.Flags().StringVar(&stepConfig.TillerNamespace, "tillerNamespace", os.Getenv("PIPER_tillerNamespace"), "Defines optional tiller namespace for deployments using helm.")
   194  	cmd.Flags().StringVar(&stepConfig.DockerConfigJSON, "dockerConfigJSON", `.pipeline/docker/config.json`, "Path to the file `.docker/config.json` - this is typically provided by your CI/CD system. You can find more details about the Docker credentials in the [Docker documentation](https://docs.docker.com/engine/reference/commandline/login/).")
   195  	cmd.Flags().StringVar(&stepConfig.DeployCommand, "deployCommand", `apply`, "Only for `deployTool: kubectl`: defines the command `apply` or `replace`. The default is `apply`.")
   196  
   197  	cmd.MarkFlagRequired("containerRegistryUrl")
   198  	cmd.MarkFlagRequired("deployTool")
   199  	cmd.MarkFlagRequired("image")
   200  }
   201  
   202  // retrieve step metadata
   203  func kubernetesDeployMetadata() config.StepData {
   204  	var theMetaData = config.StepData{
   205  		Metadata: config.StepMetadata{
   206  			Name:        "kubernetesDeploy",
   207  			Aliases:     []config.Alias{{Name: "deployToKubernetes", Deprecated: true}},
   208  			Description: "Deployment to Kubernetes test or production namespace within the specified Kubernetes cluster.",
   209  		},
   210  		Spec: config.StepSpec{
   211  			Inputs: config.StepInputs{
   212  				Secrets: []config.StepSecrets{
   213  					{Name: "kubeConfigFileCredentialsId", Description: "Jenkins 'Secret file' credentials ID containing kubeconfig file. Details can be found in the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/).", Type: "jenkins", Aliases: []config.Alias{{Name: "kubeCredentialsId", Deprecated: true}}},
   214  					{Name: "kubeTokenCredentialsId", Description: "Jenkins 'Secret text' credentials ID containing token to authenticate to Kubernetes. This is an alternative way to using a kubeconfig file. Details can be found in the [Kubernetes documentation](https://kubernetes.io/docs/reference/access-authn-authz/authentication/).", Type: "jenkins", Aliases: []config.Alias{{Name: "k8sTokenCredentialsId", Deprecated: true}}},
   215  					{Name: "dockerCredentialsId", Type: "jenkins"},
   216  					{Name: "dockerConfigJsonCredentialsId", Description: "Jenkins 'Secret file' credentials ID containing Docker config.json (with registry credential(s)).", Type: "jenkins"},
   217  				},
   218  				Resources: []config.StepResources{
   219  					{Name: "deployDescriptor", Type: "stash"},
   220  				},
   221  				Parameters: []config.StepParameters{
   222  					{
   223  						Name:        "additionalParameters",
   224  						ResourceRef: []config.ResourceReference{},
   225  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   226  						Type:        "[]string",
   227  						Mandatory:   false,
   228  						Aliases:     []config.Alias{{Name: "helmDeploymentParameters"}},
   229  						Default:     []string{},
   230  					},
   231  					{
   232  						Name:        "apiServer",
   233  						ResourceRef: []config.ResourceReference{},
   234  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   235  						Type:        "string",
   236  						Mandatory:   false,
   237  						Aliases:     []config.Alias{{Name: "k8sAPIServer"}},
   238  						Default:     os.Getenv("PIPER_apiServer"),
   239  					},
   240  					{
   241  						Name:        "appTemplate",
   242  						ResourceRef: []config.ResourceReference{},
   243  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   244  						Type:        "string",
   245  						Mandatory:   false,
   246  						Aliases:     []config.Alias{{Name: "k8sAppTemplate"}},
   247  						Default:     os.Getenv("PIPER_appTemplate"),
   248  					},
   249  					{
   250  						Name:        "chartPath",
   251  						ResourceRef: []config.ResourceReference{},
   252  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   253  						Type:        "string",
   254  						Mandatory:   false,
   255  						Aliases:     []config.Alias{{Name: "helmChartPath"}},
   256  						Default:     os.Getenv("PIPER_chartPath"),
   257  					},
   258  					{
   259  						Name: "containerRegistryPassword",
   260  						ResourceRef: []config.ResourceReference{
   261  							{
   262  								Name:  "dockerCredentialsId",
   263  								Param: "password",
   264  								Type:  "secret",
   265  							},
   266  
   267  							{
   268  								Name:  "commonPipelineEnvironment",
   269  								Param: "container/repositoryPassword",
   270  							},
   271  
   272  							{
   273  								Name:  "commonPipelineEnvironment",
   274  								Param: "custom/repositoryPassword",
   275  							},
   276  						},
   277  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   278  						Type:      "string",
   279  						Mandatory: false,
   280  						Aliases:   []config.Alias{},
   281  						Default:   os.Getenv("PIPER_containerRegistryPassword"),
   282  					},
   283  					{
   284  						Name:        "containerImageName",
   285  						ResourceRef: []config.ResourceReference{},
   286  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   287  						Type:        "string",
   288  						Mandatory:   false,
   289  						Aliases:     []config.Alias{{Name: "dockerImageName"}},
   290  						Default:     os.Getenv("PIPER_containerImageName"),
   291  					},
   292  					{
   293  						Name: "containerImageTag",
   294  						ResourceRef: []config.ResourceReference{
   295  							{
   296  								Name:  "commonPipelineEnvironment",
   297  								Param: "artifactVersion",
   298  							},
   299  						},
   300  						Scope:     []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   301  						Type:      "string",
   302  						Mandatory: false,
   303  						Aliases:   []config.Alias{{Name: "artifactVersion"}},
   304  						Default:   os.Getenv("PIPER_containerImageTag"),
   305  					},
   306  					{
   307  						Name: "containerRegistryUrl",
   308  						ResourceRef: []config.ResourceReference{
   309  							{
   310  								Name:  "commonPipelineEnvironment",
   311  								Param: "container/registryUrl",
   312  							},
   313  						},
   314  						Scope:     []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   315  						Type:      "string",
   316  						Mandatory: true,
   317  						Aliases:   []config.Alias{{Name: "dockerRegistryUrl"}},
   318  						Default:   os.Getenv("PIPER_containerRegistryUrl"),
   319  					},
   320  					{
   321  						Name: "containerRegistryUser",
   322  						ResourceRef: []config.ResourceReference{
   323  							{
   324  								Name:  "dockerCredentialsId",
   325  								Param: "username",
   326  								Type:  "secret",
   327  							},
   328  
   329  							{
   330  								Name:  "commonPipelineEnvironment",
   331  								Param: "container/repositoryUsername",
   332  							},
   333  
   334  							{
   335  								Name:  "commonPipelineEnvironment",
   336  								Param: "custom/repositoryUsername",
   337  							},
   338  						},
   339  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   340  						Type:      "string",
   341  						Mandatory: false,
   342  						Aliases:   []config.Alias{},
   343  						Default:   os.Getenv("PIPER_containerRegistryUser"),
   344  					},
   345  					{
   346  						Name:        "containerRegistrySecret",
   347  						ResourceRef: []config.ResourceReference{},
   348  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   349  						Type:        "string",
   350  						Mandatory:   false,
   351  						Aliases:     []config.Alias{},
   352  						Default:     `regsecret`,
   353  					},
   354  					{
   355  						Name:        "createDockerRegistrySecret",
   356  						ResourceRef: []config.ResourceReference{},
   357  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   358  						Type:        "bool",
   359  						Mandatory:   false,
   360  						Aliases:     []config.Alias{},
   361  						Default:     false,
   362  					},
   363  					{
   364  						Name:        "deploymentName",
   365  						ResourceRef: []config.ResourceReference{},
   366  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   367  						Type:        "string",
   368  						Mandatory:   false,
   369  						Aliases:     []config.Alias{{Name: "helmDeploymentName"}},
   370  						Default:     os.Getenv("PIPER_deploymentName"),
   371  					},
   372  					{
   373  						Name:        "deployTool",
   374  						ResourceRef: []config.ResourceReference{},
   375  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   376  						Type:        "string",
   377  						Mandatory:   true,
   378  						Aliases:     []config.Alias{},
   379  						Default:     `kubectl`,
   380  					},
   381  					{
   382  						Name:        "forceUpdates",
   383  						ResourceRef: []config.ResourceReference{},
   384  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   385  						Type:        "bool",
   386  						Mandatory:   false,
   387  						Aliases:     []config.Alias{{Name: "force"}},
   388  						Default:     true,
   389  					},
   390  					{
   391  						Name:        "helmDeployWaitSeconds",
   392  						ResourceRef: []config.ResourceReference{},
   393  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   394  						Type:        "int",
   395  						Mandatory:   false,
   396  						Aliases:     []config.Alias{},
   397  						Default:     300,
   398  					},
   399  					{
   400  						Name:        "helmValues",
   401  						ResourceRef: []config.ResourceReference{},
   402  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   403  						Type:        "[]string",
   404  						Mandatory:   false,
   405  						Aliases:     []config.Alias{},
   406  						Default:     []string{},
   407  					},
   408  					{
   409  						Name:        "valuesMapping",
   410  						ResourceRef: []config.ResourceReference{},
   411  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   412  						Type:        "map[string]interface{}",
   413  						Mandatory:   false,
   414  						Aliases:     []config.Alias{},
   415  					},
   416  					{
   417  						Name: "image",
   418  						ResourceRef: []config.ResourceReference{
   419  							{
   420  								Name:  "commonPipelineEnvironment",
   421  								Param: "container/imageNameTag",
   422  							},
   423  						},
   424  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   425  						Type:      "string",
   426  						Mandatory: true,
   427  						Aliases:   []config.Alias{{Name: "deployImage"}},
   428  						Default:   os.Getenv("PIPER_image"),
   429  					},
   430  					{
   431  						Name: "imageNames",
   432  						ResourceRef: []config.ResourceReference{
   433  							{
   434  								Name:  "commonPipelineEnvironment",
   435  								Param: "container/imageNames",
   436  							},
   437  						},
   438  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   439  						Type:      "[]string",
   440  						Mandatory: false,
   441  						Aliases:   []config.Alias{},
   442  						Default:   []string{},
   443  					},
   444  					{
   445  						Name: "imageNameTags",
   446  						ResourceRef: []config.ResourceReference{
   447  							{
   448  								Name:  "commonPipelineEnvironment",
   449  								Param: "container/imageNameTags",
   450  							},
   451  						},
   452  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   453  						Type:      "[]string",
   454  						Mandatory: false,
   455  						Aliases:   []config.Alias{},
   456  						Default:   []string{},
   457  					},
   458  					{
   459  						Name: "imageDigests",
   460  						ResourceRef: []config.ResourceReference{
   461  							{
   462  								Name:  "commonPipelineEnvironment",
   463  								Param: "container/imageDigests",
   464  							},
   465  						},
   466  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   467  						Type:      "[]string",
   468  						Mandatory: false,
   469  						Aliases:   []config.Alias{},
   470  						Default:   []string{},
   471  					},
   472  					{
   473  						Name:        "ingressHosts",
   474  						ResourceRef: []config.ResourceReference{},
   475  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   476  						Type:        "[]string",
   477  						Mandatory:   false,
   478  						Aliases:     []config.Alias{},
   479  						Default:     []string{},
   480  					},
   481  					{
   482  						Name:        "keepFailedDeployments",
   483  						ResourceRef: []config.ResourceReference{},
   484  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   485  						Type:        "bool",
   486  						Mandatory:   false,
   487  						Aliases:     []config.Alias{},
   488  						Default:     false,
   489  					},
   490  					{
   491  						Name:        "runHelmTests",
   492  						ResourceRef: []config.ResourceReference{},
   493  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   494  						Type:        "bool",
   495  						Mandatory:   false,
   496  						Aliases:     []config.Alias{},
   497  						Default:     false,
   498  					},
   499  					{
   500  						Name:        "showTestLogs",
   501  						ResourceRef: []config.ResourceReference{},
   502  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   503  						Type:        "bool",
   504  						Mandatory:   false,
   505  						Aliases:     []config.Alias{},
   506  						Default:     false,
   507  					},
   508  					{
   509  						Name: "kubeConfig",
   510  						ResourceRef: []config.ResourceReference{
   511  							{
   512  								Name: "kubeConfigFileCredentialsId",
   513  								Type: "secret",
   514  							},
   515  
   516  							{
   517  								Name:    "kubeConfigFileVaultSecretName",
   518  								Type:    "vaultSecretFile",
   519  								Default: "kube-config",
   520  							},
   521  						},
   522  						Scope:     []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   523  						Type:      "string",
   524  						Mandatory: false,
   525  						Aliases:   []config.Alias{},
   526  						Default:   os.Getenv("PIPER_kubeConfig"),
   527  					},
   528  					{
   529  						Name:        "kubeContext",
   530  						ResourceRef: []config.ResourceReference{},
   531  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   532  						Type:        "string",
   533  						Mandatory:   false,
   534  						Aliases:     []config.Alias{},
   535  						Default:     os.Getenv("PIPER_kubeContext"),
   536  					},
   537  					{
   538  						Name: "kubeToken",
   539  						ResourceRef: []config.ResourceReference{
   540  							{
   541  								Name: "kubeTokenCredentialsId",
   542  								Type: "secret",
   543  							},
   544  						},
   545  						Scope:     []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   546  						Type:      "string",
   547  						Mandatory: false,
   548  						Aliases:   []config.Alias{},
   549  						Default:   os.Getenv("PIPER_kubeToken"),
   550  					},
   551  					{
   552  						Name:        "namespace",
   553  						ResourceRef: []config.ResourceReference{},
   554  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   555  						Type:        "string",
   556  						Mandatory:   false,
   557  						Aliases:     []config.Alias{{Name: "helmDeploymentNamespace"}, {Name: "k8sDeploymentNamespace"}},
   558  						Default:     `default`,
   559  					},
   560  					{
   561  						Name:        "tillerNamespace",
   562  						ResourceRef: []config.ResourceReference{},
   563  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   564  						Type:        "string",
   565  						Mandatory:   false,
   566  						Aliases:     []config.Alias{{Name: "helmTillerNamespace"}},
   567  						Default:     os.Getenv("PIPER_tillerNamespace"),
   568  					},
   569  					{
   570  						Name: "dockerConfigJSON",
   571  						ResourceRef: []config.ResourceReference{
   572  							{
   573  								Name: "dockerConfigJsonCredentialsId",
   574  								Type: "secret",
   575  							},
   576  
   577  							{
   578  								Name:    "dockerConfigFileVaultSecretName",
   579  								Type:    "vaultSecretFile",
   580  								Default: "docker-config",
   581  							},
   582  						},
   583  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   584  						Type:      "string",
   585  						Mandatory: false,
   586  						Aliases:   []config.Alias{},
   587  						Default:   `.pipeline/docker/config.json`,
   588  					},
   589  					{
   590  						Name:        "deployCommand",
   591  						ResourceRef: []config.ResourceReference{},
   592  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   593  						Type:        "string",
   594  						Mandatory:   false,
   595  						Aliases:     []config.Alias{},
   596  						Default:     `apply`,
   597  					},
   598  				},
   599  			},
   600  			Containers: []config.Container{
   601  				{Image: "dtzar/helm-kubectl:3.8.1", WorkingDir: "/config", Options: []config.Option{{Name: "-u", Value: "0"}}, Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "deployTool", Value: "helm3"}}}}},
   602  				{Image: "dtzar/helm-kubectl:2.17.0", WorkingDir: "/config", Options: []config.Option{{Name: "-u", Value: "0"}}, Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "deployTool", Value: "helm"}}}}},
   603  				{Image: "dtzar/helm-kubectl:2.17.0", WorkingDir: "/config", Options: []config.Option{{Name: "-u", Value: "0"}}, Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "deployTool", Value: "kubectl"}}}}},
   604  			},
   605  		},
   606  	}
   607  	return theMetaData
   608  }