Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support exposing clusterIP services via minikube service #17877

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cmd/minikube/cmd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ You may select another namespace by using 'minikube service {{.service}} -n <nam
}

var data [][]string
var noNodePortServices service.URLs

for _, svc := range services {
openUrls, err := service.WaitForService(co.API, co.Config.Name, namespace, svc.Name, serviceURLTemplate, serviceURLMode, https, wait, interval)

Expand All @@ -133,6 +135,7 @@ You may select another namespace by using 'minikube service {{.service}} -n <nam

if len(openUrls) == 0 {
data = append(data, []string{svc.Namespace, svc.Name, "No node port"})
noNodePortServices = append(noNodePortServices, svc)
} else {
servicePortNames := strings.Join(svc.PortNames, "\n")
serviceURLs := strings.Join(openUrls, "\n")
Expand All @@ -154,10 +157,22 @@ You may select another namespace by using 'minikube service {{.service}} -n <nam
}
}

noNodePortSvcNames := []string{}
for _, svc := range noNodePortServices {
noNodePortSvcNames = append(noNodePortSvcNames, fmt.Sprintf("%s/%s", svc.Namespace, svc.Name))
}
if len(noNodePortServices) != 0 {
out.WarningT("Services {{.svc_names}} have type \"ClusterIP\" not meant to be exposed, however for local developement minikube allows you to access this !", out.V{"svc_names": noNodePortSvcNames})
}

if driver.NeedsPortForward(co.Config.Driver) && services != nil {
startKicServiceTunnel(services, cname, co.Config.Driver)
} else if !serviceURLMode {
openURLs(data)
if len(noNodePortServices) != 0 {
startKicServiceTunnel(noNodePortServices, cname, co.Config.Driver)
}

}
},
}
Expand Down
1 change: 1 addition & 0 deletions translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@
"Select a valid value for --dnsdomain": "Wähle einen gültigen Wert für --dnsdomain",
"Send trace events. Options include: [gcp]": "Schicke Trace Events. Mögliche Optionen sind [gcp]",
"Service '{{.service}}' was not found in '{{.namespace}}' namespace.\nYou may select another namespace by using 'minikube service {{.service}} -n \u003cnamespace\u003e'. Or list out all the services using 'minikube service list'": "Service '{{.service}}' konnte nicht im Namespace '{{.namespace}} gefunden werden.\nEs ist möglich einen anderen Namespace mit 'minikube service {{.service}} -n \u003cnamespace\u003e' auszuwählen. Oder die Liste aller Services anzuzeigen mit 'minikube service list'",
"Services {{.svc_names}} have type \"ClusterIP\" not meant to be exposed, however for local developement minikube allows you to access this !": "",
"Set a static IP for the minikube cluster, the IP must be: private, IPv4, and the last octet must be between 2 and 254, for example 192.168.200.200 (Docker and Podman drivers only)": "Setzte eine statische IP für den Minikube Cluster, die IP muss folgendes erfüllen: eine private Addresse, IPv4, das letzte Oktet muss zwischen 2 und 254 liegen, z.B. 192.168.200.200 (Nur Docker und Podman Treiber)",
"Set failed": "Setzen fehlgeschlagen",
"Set flag to delete all profiles": "Setze Flag um alle Profile zu löschen",
Expand Down
1 change: 1 addition & 0 deletions translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@
"Select a valid value for --dnsdomain": "",
"Send trace events. Options include: [gcp]": "",
"Service '{{.service}}' was not found in '{{.namespace}}' namespace.\nYou may select another namespace by using 'minikube service {{.service}} -n \u003cnamespace\u003e'. Or list out all the services using 'minikube service list'": "",
"Services {{.svc_names}} have type \"ClusterIP\" not meant to be exposed, however for local developement minikube allows you to access this !": "",
"Set a static IP for the minikube cluster, the IP must be: private, IPv4, and the last octet must be between 2 and 254, for example 192.168.200.200 (Docker and Podman drivers only)": "",
"Set failed": "",
"Set flag to delete all profiles": "",
Expand Down
1 change: 1 addition & 0 deletions translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@
"Select a valid value for --dnsdomain": "Sélectionnez une valeur valide pour --dnsdomain",
"Send trace events. Options include: [gcp]": "Envoyer des événements de trace. Les options incluent : [gcp]",
"Service '{{.service}}' was not found in '{{.namespace}}' namespace.\nYou may select another namespace by using 'minikube service {{.service}} -n \u003cnamespace\u003e'. Or list out all the services using 'minikube service list'": "Le service '{{.service}}' n'a pas été trouvé dans l'espace de noms '{{.namespace}}'.\nVous pouvez sélectionner un autre espace de noms en utilisant 'minikube service {{.service}} -n \u003cnamespace\u003e'. Ou répertoriez tous les services à l'aide de 'minikube service list'",
"Services {{.svc_names}} have type \"ClusterIP\" not meant to be exposed, however for local developement minikube allows you to access this !": "",
"Set a static IP for the minikube cluster, the IP must be: private, IPv4, and the last octet must be between 2 and 254, for example 192.168.200.200 (Docker and Podman drivers only)": "Définissez une adresse IP statique pour le cluster minikube, l'adresse IP doit être : privée, IPv4, et le dernier octet doit être compris entre 2 et 254, par exemple 192.168.200.200 (pilotes Docker et Podman uniquement)",
"Set failed": "Échec de la définition",
"Set flag to delete all profiles": "Définir un indicateur pour supprimer tous les profils",
Expand Down
1 change: 1 addition & 0 deletions translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@
"Select a valid value for --dnsdomain": "--dnsdomain に有効な値を選択してください",
"Send trace events. Options include: [gcp]": "トレースイベントを送信します。含まれるオプション: [gcp]",
"Service '{{.service}}' was not found in '{{.namespace}}' namespace.\nYou may select another namespace by using 'minikube service {{.service}} -n \u003cnamespace\u003e'. Or list out all the services using 'minikube service list'": "'{{.namespace}}' ネームスペース中に '{{.service}}' サービスが見つかりませんでした。\n'minikube service {{.service}} -n \u003cnamespace\u003e' を使って別のネームスペースを選択できます。または、'minikube service list' を使って全サービスを一覧表示してください",
"Services {{.svc_names}} have type \"ClusterIP\" not meant to be exposed, however for local developement minikube allows you to access this !": "",
"Set a static IP for the minikube cluster, the IP must be: private, IPv4, and the last octet must be between 2 and 254, for example 192.168.200.200 (Docker and Podman drivers only)": "minikube クラスターの静的 IP を設定します。IP はプライベート、IPv4 である必要があり、最後のオクテットは 2 から 254 の間である必要があります (例: 192.168.200.200) (Docker および Podman ドライバーのみ)",
"Set failed": "設定に失敗しました",
"Set flag to delete all profiles": "全プロファイルを削除します",
Expand Down
1 change: 1 addition & 0 deletions translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@
"Select a valid value for --dnsdomain": "",
"Send trace events. Options include: [gcp]": "",
"Service '{{.service}}' was not found in '{{.namespace}}' namespace.\nYou may select another namespace by using 'minikube service {{.service}} -n \u003cnamespace\u003e'. Or list out all the services using 'minikube service list'": "",
"Services {{.svc_names}} have type \"ClusterIP\" not meant to be exposed, however for local developement minikube allows you to access this !": "",
"Set a static IP for the minikube cluster, the IP must be: private, IPv4, and the last octet must be between 2 and 254, for example 192.168.200.200 (Docker and Podman drivers only)": "",
"Set failed": "설정이 실패하였습니다",
"Set flag to delete all profiles": "",
Expand Down
1 change: 1 addition & 0 deletions translations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@
"Select a valid value for --dnsdomain": "",
"Send trace events. Options include: [gcp]": "",
"Service '{{.service}}' was not found in '{{.namespace}}' namespace.\nYou may select another namespace by using 'minikube service {{.service}} -n \u003cnamespace\u003e'. Or list out all the services using 'minikube service list'": "",
"Services {{.svc_names}} have type \"ClusterIP\" not meant to be exposed, however for local developement minikube allows you to access this !": "",
"Set a static IP for the minikube cluster, the IP must be: private, IPv4, and the last octet must be between 2 and 254, for example 192.168.200.200 (Docker and Podman drivers only)": "",
"Set failed": "",
"Set flag to delete all profiles": "",
Expand Down
1 change: 1 addition & 0 deletions translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@
"Select a valid value for --dnsdomain": "",
"Send trace events. Options include: [gcp]": "",
"Service '{{.service}}' was not found in '{{.namespace}}' namespace.\nYou may select another namespace by using 'minikube service {{.service}} -n \u003cnamespace\u003e'. Or list out all the services using 'minikube service list'": "",
"Services {{.svc_names}} have type \"ClusterIP\" not meant to be exposed, however for local developement minikube allows you to access this !": "",
"Set a static IP for the minikube cluster, the IP must be: private, IPv4, and the last octet must be between 2 and 254, for example 192.168.200.200 (Docker and Podman drivers only)": "",
"Set failed": "",
"Set flag to delete all profiles": "",
Expand Down
1 change: 1 addition & 0 deletions translations/strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@
"Select a valid value for --dnsdomain": "",
"Send trace events. Options include: [gcp]": "",
"Service '{{.service}}' was not found in '{{.namespace}}' namespace.\nYou may select another namespace by using 'minikube service {{.service}} -n \u003cnamespace\u003e'. Or list out all the services using 'minikube service list'": "",
"Services {{.svc_names}} have type \"ClusterIP\" not meant to be exposed, however for local developement minikube allows you to access this !": "",
"Set a static IP for the minikube cluster, the IP must be: private, IPv4, and the last octet must be between 2 and 254, for example 192.168.200.200 (Docker and Podman drivers only)": "",
"Set failed": "",
"Set flag to delete all profiles": "",
Expand Down
3 changes: 3 additions & 0 deletions translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,8 @@
"Selecting '{{.driver}}' driver from user configuration (alternates: {{.alternates}})": "从用户配置中选择 {{.driver}}' 驱动程序(可选:{{.alternates}})",
"Send trace events. Options include: [gcp]": "发送跟踪事件。包含的选项:[gcp]",
"Service '{{.service}}' was not found in '{{.namespace}}' namespace.\nYou may select another namespace by using 'minikube service {{.service}} -n \u003cnamespace\u003e'. Or list out all the services using 'minikube service list'": "在 '{{.namespace}}' 命名空间中未找到服务 '{{.service}}'。\n您可以通过使用 'minikube service {{.service}} -n \u003cnamespace\u003e' 选择另一个命名空间。或使用 'minikube service list' 列出所有服务",
"Services {{.svc_names}} have type \"ClusterIP\" . Minikube allows you to access them only for testing": "{{.svc_names}} 均为ClusterIP类型,正常情况仅供集群内访问。Minikube提供的外部访问手段仅可供测试使用",
"Services {{.svc_names}} have type \"ClusterIP\" not meant to be exposed, however for local developement minikube allows you to access this !": "",
"Set a static IP for the minikube cluster, the IP must be: private, IPv4, and the last octet must be between 2 and 254, for example 192.168.200.200 (Docker and Podman drivers only)": "为 minikube 集群设置静态IP,该IP必须是私有IPv4地址,最后一位必须介于2和254之间,例如:192.168.200.200(仅适用于 Docker 和 Podman 驱动程序)",
"Set failed": "设置失败",
"Set flag to delete all profiles": "设置标志以删除所有配置文件",
Expand Down Expand Up @@ -833,6 +835,7 @@
"The driver '{{.driver}}' is not supported on {{.os}}/{{.arch}}": "{{.os}} 不支持驱动程序“{{.driver}}/{{.arch}}”",
"The existing \"{{.name}}\" cluster was created using the \"{{.old}}\" driver, which is incompatible with requested \"{{.new}}\" driver.": "",
"The existing node configuration appears to be corrupt. Run 'minikube delete'": "",
"The following services are clusterIP services: {{.svc_names}}, which are supposed to be accessable inside the cluster only. Minikube allows you to access them by opening an SSH tunnel, which is only for test purpose and must not be used in production environment": "以下服务为ClusterIP类型:{{.svc_names}}. 这些服务正常情况下只能从集群内部访问。Minikube通过ssh隧道的方式使你可以从本机访问这些服务,但此功能仅供测试用途严禁生产环境中使用",
"The heapster addon is depreciated. please try to disable metrics-server instead": "",
"The hyperv virtual switch name. Defaults to first found. (hyperv driver only)": "hyperv 虚拟交换机名称。默认为找到的第一个 hyperv 虚拟交换机。(仅限 hyperv 驱动程序)",
"The hypervisor does not appear to be configured properly. Run 'minikube start --alsologtostderr -v=1' and inspect the error code": "管理程序似乎配置的不正确。执行 'minikube start --alsologtostderr -v=1' 并且检查错误代码",
Expand Down
Loading