update to ip
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m46s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m46s
This commit is contained in:
@@ -58,7 +58,7 @@ spec:
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
- name: NODE_NAME
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
|
||||
2
main.go
2
main.go
@@ -122,7 +122,7 @@ func (s *PoolServer) Serve() *http.ServeMux {
|
||||
return mux
|
||||
}
|
||||
|
||||
var clientName = os.Getenv("NODE_NAME")
|
||||
var clientName = os.Getenv("POD_IP")
|
||||
|
||||
func main() {
|
||||
// Create a new instance of the server
|
||||
|
||||
@@ -35,7 +35,7 @@ func (k *K8sDiscovery) DiscoverInNamespace(namespace string) ([]string, error) {
|
||||
}
|
||||
hosts := make([]string, 0, len(pods.Items))
|
||||
for _, pod := range pods.Items {
|
||||
hosts = append(hosts, pod.Name)
|
||||
hosts = append(hosts, pod.Status.PodIP)
|
||||
}
|
||||
return hosts, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user