github.com/jenkins-x/jx/v2@v2.1.155/pkg/cmd/upgrade/upgrade_ingress.go (about)

     1  package upgrade
     2  
     3  import (
     4  	"github.com/jenkins-x/jx/v2/pkg/cmd/helper"
     5  	"github.com/jenkins-x/jx/v2/pkg/cmd/opts"
     6  
     7  	opts_upgrade "github.com/jenkins-x/jx/v2/pkg/cmd/opts/upgrade"
     8  	"github.com/jenkins-x/jx/v2/pkg/cmd/templates"
     9  	"github.com/spf13/cobra"
    10  )
    11  
    12  var (
    13  	upgradeIngressLong = templates.LongDesc(`
    14  		Upgrades the Jenkins X Ingress rules
    15  `)
    16  
    17  	upgradeIngressExample = templates.Examples(`
    18  		# Upgrades the Jenkins X Ingress rules
    19  		jx upgrade ingress
    20  	`)
    21  )
    22  
    23  // NewCmdUpgradeIngress defines the command
    24  func NewCmdUpgradeIngress(commonOpts *opts.CommonOptions) *cobra.Command {
    25  	options := &opts_upgrade.UpgradeIngressOptions{
    26  		CommonOptions: commonOpts,
    27  	}
    28  
    29  	cmd := &cobra.Command{
    30  		Use:     "ingress",
    31  		Short:   "Upgrades Ingress rules",
    32  		Aliases: []string{"ing"},
    33  		Long:    upgradeIngressLong,
    34  		Example: upgradeIngressExample,
    35  		Run: func(cmd *cobra.Command, args []string) {
    36  			options.Cmd = cmd
    37  			options.Args = args
    38  			err := options.Run()
    39  			helper.CheckErr(err)
    40  		},
    41  	}
    42  	addFlags(options, cmd)
    43  
    44  	return cmd
    45  }
    46  
    47  func addFlags(o *opts_upgrade.UpgradeIngressOptions, cmd *cobra.Command) {
    48  	cmd.Flags().BoolVarP(&o.Cluster, "cluster", "", false, "Enable cluster wide Ingress upgrade")
    49  	cmd.Flags().StringArrayVarP(&o.Namespaces, "namespaces", "", []string{}, "Namespaces to upgrade")
    50  	cmd.Flags().BoolVarP(&o.SkipCertManager, "skip-certmanager", "", false, "Skips cert-manager installation")
    51  	cmd.Flags().StringArrayVarP(&o.Services, "services", "", []string{}, "Services to upgrade")
    52  	cmd.Flags().BoolVarP(&o.SkipResourcesUpdate, "skip-resources-update", "", false, "Skips the update of jx related resources such as webhook or Jenkins URL")
    53  	cmd.Flags().BoolVarP(&o.Force, "force", "", false, "Forces upgrades of all webooks even if ingress URL has not changed")
    54  	cmd.Flags().BoolVarP(&o.WaitForCerts, "wait-for-certs", "", true, "Waits for TLS certs to be issued by cert-manager")
    55  	cmd.Flags().StringVarP(&o.ConfigNamespace, "config-namespace", "", "", "Namespace where the ingress-config is stored (if empty, it will try to read it from Dev environment namespace)")
    56  	cmd.Flags().StringVarP(&o.IngressConfig.Domain, "domain", "", "", "Domain to expose ingress endpoints (e.g., jenkinsx.io). Leave empty to preserve the current value.")
    57  	cmd.Flags().StringVarP(&o.IngressConfig.UrlTemplate, "urltemplate", "", "", "For ingress; exposers can set the urltemplate to expose. The default value is \"{{.Service}}.{{.Namespace}}.{{.Domain}}\". Leave empty to preserve the current value.")
    58  }