[operator] Use headless service for head node (#7622)

This commit is contained in:
Edward Oakes
2020-03-19 10:31:56 -05:00
committed by GitHub
parent c78b52b5b2
commit 90b553ed05
4 changed files with 8 additions and 8 deletions
@@ -21,7 +21,7 @@ spec:
type: worker
# Command to start ray
command: ray start --block --node-ip-address=$MY_POD_IP --address=$RAYCLUSTER_SAMPLE_SERVICE_HOST:$RAYCLUSTER_SAMPLE_SERVICE_PORT_REDIS --object-manager-port=12345 --node-manager-port=12346 --object-store-memory=100000000 --num-cpus=1
command: ray start --block --node-ip-address=$MY_POD_IP --address=$CLUSTER_NAME-head:6379 --object-manager-port=12345 --node-manager-port=12346 --object-store-memory=100000000 --num-cpus=1
# custom labels. NOTE: do not define custom labels start with `raycluster.`, they may be used in controller.
# Refer to https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
@@ -112,7 +112,7 @@ spec:
key: value
# Command to start ray
command: ray start --block --node-ip-address=$MY_POD_IP --address=$RAYCLUSTER_SAMPLE_SERVICE_HOST:$RAYCLUSTER_SAMPLE_SERVICE_PORT_REDIS --object-manager-port=12345 --node-manager-port=12346 --object-store-memory=100000000 --num-cpus=1
command: ray start --block --node-ip-address=$MY_POD_IP --address=$CLUSTER_NAME-head:6379 --object-manager-port=12345 --node-manager-port=12346 --object-store-memory=100000000 --num-cpus=1
# use affinity to select nodes.Optional.
# Refer to https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
@@ -26,7 +26,7 @@ spec:
raycluster.group.name: small-group
# Command to start ray
command: ray start --block --node-ip-address=$MY_POD_IP --address=$RAYCLUSTER_SAMPLE_SERVICE_HOST:$RAYCLUSTER_SAMPLE_SERVICE_PORT_REDIS --object-manager-port=12345 --node-manager-port=12346 --object-store-memory=100000000 --num-cpus=1
command: ray start --block --node-ip-address=$MY_POD_IP --address=$CLUSTER_NAME-head:6379 --object-manager-port=12345 --node-manager-port=12346 --object-store-memory=100000000 --num-cpus=1
# resource requirements
# Refer to https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
@@ -70,7 +70,7 @@ spec:
raycluster.group.name: medium-group
# Command to start ray
command: ray start --block --node-ip-address=$MY_POD_IP --address=$RAYCLUSTER_SAMPLE_SERVICE_HOST:$RAYCLUSTER_SAMPLE_SERVICE_PORT_REDIS --object-manager-port=12345 --node-manager-port=12346 --object-store-memory=100000000 --num-cpus=1
command: ray start --block --node-ip-address=$MY_POD_IP --address=$CLUSTER_NAME-head:6379 --object-manager-port=12345 --node-manager-port=12346 --object-store-memory=100000000 --num-cpus=1
# resource requirements
# Refer to https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
@@ -26,7 +26,7 @@ spec:
raycluster.group.name: small-group
# Command to start ray
command: ray start --block --node-ip-address=$MY_POD_IP --address=$RAYCLUSTER_SAMPLE_SERVICE_HOST:$RAYCLUSTER_SAMPLE_SERVICE_PORT_REDIS --object-manager-port=12345 --node-manager-port=12346 --object-store-memory=100000000 --num-cpus=1
command: ray start --block --node-ip-address=$MY_POD_IP --address=$CLUSTER_NAME-head:6379 --object-manager-port=12345 --node-manager-port=12346 --object-store-memory=100000000 --num-cpus=1
# resource requirements
# Refer to https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
@@ -36,9 +36,9 @@ func ServiceForPod(conf *ServiceConfig) *corev1.Service {
},
Spec: corev1.ServiceSpec{
Ports: []corev1.ServicePort{{Name: "redis", Port: int32(defaultRedisPort)}},
// TODO(edoakes): ClusterIPNone (headless service) should work but I wasn't
// able to get the environment variables for service discovery to work.
// ClusterIP: corev1.ClusterIPNone,
// Use a headless service, meaning that the DNS record for the service will
// point directly to the head node pod's IP address.
ClusterIP: corev1.ClusterIPNone,
// This selector must match the label of the head node.
Selector: map[string]string{
rayclusterComponent: conf.PodName,