|
33 | 33 | # Create a route and specify a hostname
|
34 | 34 | %[1]s expose service nginx --hostname=www.example.com
|
35 | 35 |
|
| 36 | + # Create a route with wildcard |
| 37 | + %[1]s expose service nginx --hostname=x.example.com --wildcard=Subdomain |
| 38 | + This would be equivalent to *.example.com. NOTE: only hosts are matched by the wildcard, subdomains would not be included. |
| 39 | +
|
36 | 40 | # Expose a deployment configuration as a service and use the specified port
|
37 | 41 | %[1]s expose dc ruby-hello-world --port=8080
|
38 | 42 |
|
@@ -65,6 +69,7 @@ func NewCmdExpose(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.C
|
65 | 69 | }
|
66 | 70 | cmd.Flags().String("hostname", "", "Set a hostname for the new route")
|
67 | 71 | cmd.Flags().String("path", "", "Set a path for the new route")
|
| 72 | + cmd.Flags().String("wildcardpolicy", "", "Sets the WildcardPolicy for the hostname, the default is \"None\". Valid values are \"None\" and \"Subdomain\"") |
68 | 73 | return cmd
|
69 | 74 | }
|
70 | 75 |
|
@@ -93,6 +98,12 @@ func validate(cmd *cobra.Command, f *clientcmd.Factory, args []string) error {
|
93 | 98 | if err != nil {
|
94 | 99 | return kcmdutil.UsageError(cmd, err.Error())
|
95 | 100 | }
|
| 101 | + |
| 102 | + wildcardpolicy := kcmdutil.GetFlagString(cmd, "wildcardpolicy") |
| 103 | + if len(wildcardpolicy) > 0 && (wildcardpolicy != "Subdomain" && wildcardpolicy != "None") { |
| 104 | + return fmt.Errorf("only \"Subdomain\" or \"None\" are supported for wildcardpolicy") |
| 105 | + } |
| 106 | + |
96 | 107 | if len(infos) > 1 {
|
97 | 108 | return fmt.Errorf("multiple resources provided: %v", args)
|
98 | 109 | }
|
|
0 commit comments