Skip to content

Commit f62a936

Browse files
committed
Update based on PR feedback.
1 parent 3dc3a25 commit f62a936

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

controllers/cluster_controller.go

+14-13
Original file line numberDiff line numberDiff line change
@@ -885,32 +885,33 @@ func (instance FdbInstance) GetPublicIPs() []string {
885885

886886
source := instance.Metadata.Annotations[fdbtypes.PublicIPSourceAnnotation]
887887
if source == "" || source == string(fdbtypes.PublicIPSourcePod) {
888-
return getPublicIpsForPod(instance.Pod)
888+
return getPublicIPsForPod(instance.Pod)
889889
}
890890

891891
return []string{instance.Pod.ObjectMeta.Annotations[fdbtypes.PublicIPAnnotation]}
892892
}
893893

894-
func getPublicIpsForPod(pod *corev1.Pod) []string {
894+
func getPublicIPsForPod(pod *corev1.Pod) []string {
895895
var podIPFamily *int
896896

897897
if pod == nil {
898898
return []string{}
899899
}
900900

901901
for _, container := range pod.Spec.Containers {
902-
if container.Name == "foundationdb-kubernetes-sidecar" {
903-
for indexOfArgument, argument := range container.Args {
904-
if argument == "--public-ip-family" && indexOfArgument < len(container.Args)-1 {
905-
familyString := container.Args[indexOfArgument+1]
906-
family, err := strconv.Atoi(familyString)
907-
if err != nil {
908-
log.Error(err, "Error parsing public IP family", "family", familyString)
909-
return nil
910-
}
911-
podIPFamily = &family
912-
break
902+
if container.Name != "foundationdb-kubernetes-sidecar" {
903+
continue
904+
}
905+
for indexOfArgument, argument := range container.Args {
906+
if argument == "--public-ip-family" && indexOfArgument < len(container.Args)-1 {
907+
familyString := container.Args[indexOfArgument+1]
908+
family, err := strconv.Atoi(familyString)
909+
if err != nil {
910+
log.Error(err, "Error parsing public IP family", "family", familyString)
911+
return nil
913912
}
913+
podIPFamily = &family
914+
break
914915
}
915916
}
916917
}

foundationdb-kubernetes-sidecar/sidecar.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def extract_desired_ip(cls, version, string):
338338
raise Exception(f"Failed to find IPv{version} entry in {ips}")
339339
ip = matching_ips[0]
340340
if version == 6:
341-
ip = "[%s]" % ip
341+
ip = f"[{ip}]"
342342
return ip
343343

344344

0 commit comments

Comments
 (0)