mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Merge pull request #38183 from tianshapjq/remove-create-external-load-balancer
Automatic merge from submit-queue (batch tested with PRs 40345, 38183, 40236, 40861, 40900) remove the create-external-load-balancer flag in cmd/expose.go **What this PR does / why we need it**: In cmd/expose.go there is a todo "remove create-external-load-balancer in code on or after Aug 25, 2016.", and now it's been a long time past. So I remove this flag and modify the test cases. Please check for this, thanks! **Release note**: ``` remove the deprecated flag "create-external-load-balancer" and use --type="LoadBalancer" instead. ```
This commit is contained in:
commit
d404e07a72
@ -59,7 +59,7 @@ curl http://localhost:4444
|
|||||||
If you are using Google Container Engine, you can expose your hub via the internet. This is a bad idea for many reasons, but you can do it as follows:
|
If you are using Google Container Engine, you can expose your hub via the internet. This is a bad idea for many reasons, but you can do it as follows:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kubectl expose rc selenium-hub --name=selenium-hub-external --labels="app=selenium-hub,external=true" --create-external-load-balancer=true
|
kubectl expose rc selenium-hub --name=selenium-hub-external --labels="app=selenium-hub,external=true" --type=LoadBalancer
|
||||||
```
|
```
|
||||||
|
|
||||||
Then wait a few minutes, eventually your new `selenium-hub-external` service will be assigned a load balanced IP from gcloud. Once `kubectl get svc selenium-hub-external` shows two IPs, run this snippet.
|
Then wait a few minutes, eventually your new `selenium-hub-external` service will be assigned a load balanced IP from gcloud. Once `kubectl get svc selenium-hub-external` shows two IPs, run this snippet.
|
||||||
|
@ -120,7 +120,6 @@ controller-start-interval
|
|||||||
cors-allowed-origins
|
cors-allowed-origins
|
||||||
cpu-cfs-quota
|
cpu-cfs-quota
|
||||||
cpu-percent
|
cpu-percent
|
||||||
create-external-load-balancer
|
|
||||||
current-release-pr
|
current-release-pr
|
||||||
current-replicas
|
current-replicas
|
||||||
daemonset-lookup-cache-size
|
daemonset-lookup-cache-size
|
||||||
|
@ -100,9 +100,6 @@ func NewCmdExposeService(f cmdutil.Factory, out io.Writer) *cobra.Command {
|
|||||||
cmd.Flags().String("protocol", "", "The network protocol for the service to be created. Default is 'TCP'.")
|
cmd.Flags().String("protocol", "", "The network protocol for the service to be created. Default is 'TCP'.")
|
||||||
cmd.Flags().String("port", "", "The port that the service should serve on. Copied from the resource being exposed, if unspecified")
|
cmd.Flags().String("port", "", "The port that the service should serve on. Copied from the resource being exposed, if unspecified")
|
||||||
cmd.Flags().String("type", "", "Type for this service: ClusterIP, NodePort, or LoadBalancer. Default is 'ClusterIP'.")
|
cmd.Flags().String("type", "", "Type for this service: ClusterIP, NodePort, or LoadBalancer. Default is 'ClusterIP'.")
|
||||||
// TODO: remove create-external-load-balancer in code on or after Aug 25, 2016.
|
|
||||||
cmd.Flags().Bool("create-external-load-balancer", false, "If true, create an external load balancer for this service (trumped by --type). Implementation is cloud provider dependent. Default is 'false'.")
|
|
||||||
cmd.Flags().MarkDeprecated("create-external-load-balancer", "use --type=\"LoadBalancer\" instead")
|
|
||||||
cmd.Flags().String("load-balancer-ip", "", "IP to assign to the Load Balancer. If empty, an ephemeral IP will be created and used (cloud-provider specific).")
|
cmd.Flags().String("load-balancer-ip", "", "IP to assign to the Load Balancer. If empty, an ephemeral IP will be created and used (cloud-provider specific).")
|
||||||
cmd.Flags().String("selector", "", "A label selector to use for this service. Only equality-based selector requirements are supported. If empty (the default) infer the selector from the replication controller or replica set.")
|
cmd.Flags().String("selector", "", "A label selector to use for this service. Only equality-based selector requirements are supported. If empty (the default) infer the selector from the replication controller or replica set.")
|
||||||
cmd.Flags().StringP("labels", "l", "", "Labels to apply to the service created by this call.")
|
cmd.Flags().StringP("labels", "l", "", "Labels to apply to the service created by this call.")
|
||||||
|
@ -62,7 +62,6 @@ func paramNames() []GeneratorParam {
|
|||||||
{"ports", false},
|
{"ports", false},
|
||||||
{"labels", false},
|
{"labels", false},
|
||||||
{"external-ip", false},
|
{"external-ip", false},
|
||||||
{"create-external-load-balancer", false},
|
|
||||||
{"load-balancer-ip", false},
|
{"load-balancer-ip", false},
|
||||||
{"type", false},
|
{"type", false},
|
||||||
{"protocol", false},
|
{"protocol", false},
|
||||||
@ -210,9 +209,6 @@ func generate(genericParams map[string]interface{}) (runtime.Object, error) {
|
|||||||
service.Spec.Ports[i].TargetPort = intstr.FromInt(int(port))
|
service.Spec.Ports[i].TargetPort = intstr.FromInt(int(port))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if params["create-external-load-balancer"] == "true" {
|
|
||||||
service.Spec.Type = api.ServiceTypeLoadBalancer
|
|
||||||
}
|
|
||||||
if len(params["external-ip"]) > 0 {
|
if len(params["external-ip"]) > 0 {
|
||||||
service.Spec.ExternalIPs = []string{params["external-ip"]}
|
service.Spec.ExternalIPs = []string{params["external-ip"]}
|
||||||
}
|
}
|
||||||
|
@ -154,13 +154,13 @@ func TestGenerateService(t *testing.T) {
|
|||||||
{
|
{
|
||||||
generator: ServiceGeneratorV2{},
|
generator: ServiceGeneratorV2{},
|
||||||
params: map[string]interface{}{
|
params: map[string]interface{}{
|
||||||
"selector": "foo=bar,baz=blah",
|
"selector": "foo=bar,baz=blah",
|
||||||
"name": "test",
|
"name": "test",
|
||||||
"port": "80",
|
"port": "80",
|
||||||
"protocol": "UDP",
|
"protocol": "UDP",
|
||||||
"container-port": "foobar",
|
"container-port": "foobar",
|
||||||
"external-ip": "1.2.3.4",
|
"external-ip": "1.2.3.4",
|
||||||
"create-external-load-balancer": "true",
|
"type": "LoadBalancer",
|
||||||
},
|
},
|
||||||
expected: api.Service{
|
expected: api.Service{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Loading…
Reference in New Issue
Block a user