in gke-deploy/cmd/apply/apply.go [75:101]
func apply(_ *cobra.Command, options *options) error {
ctx := context.Background()
if options.filename == "" {
return fmt.Errorf("required -f|--filename flag is not set")
}
if options.clusterName != "" && options.clusterLocation == "" {
return fmt.Errorf("you must set -c|--cluster flag because -l|--location flag is set")
}
if options.clusterLocation != "" && options.clusterName == "" {
return fmt.Errorf("you must set -l|--location flag because -c|--cluster flag is set")
}
useGcloud := common.GcloudInPath()
useGsutil := common.UseGsutil(options.filename, "")
d, err := common.CreateDeployer(ctx, useGsutil, useGcloud, options.verbose, options.serverDryRun)
if err != nil {
return err
}
if err := d.Apply(ctx, options.clusterName, options.clusterLocation, options.clusterProject, options.filename, options.namespace, options.waitTimeout, options.recursive); err != nil {
return fmt.Errorf("failed to apply deployment: %v", err)
}
return nil
}