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

WIP: KO-360: Fix dual-stack network issue #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Aerospike Kubernetes Operator Init Container.
#
# Build the akoinit binary
FROM --platform=$BUILDPLATFORM golang:1.22 as builder
FROM --platform=$BUILDPLATFORM golang:1.22 AS builder

# OS and Arch args
ARG TARGETOS
Expand Down Expand Up @@ -65,7 +65,7 @@ RUN microdnf update -y \
&& microdnf clean all

# Add /workdir/bin to PATH
ENV PATH "/workdir/bin:$PATH"
ENV PATH="/workdir/bin:$PATH"

# For RedHat Openshift, set this to non-root user ID 1001 using
# --build-arg USER=1001 as docker build argument.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/aerospike/aerospike-kubernetes-init
go 1.22

require (
github.com/aerospike/aerospike-kubernetes-operator v0.0.0-20241016165325-74a853c18a98
github.com/aerospike/aerospike-kubernetes-operator v0.0.0-20241220091418-a80c61e4e90c
github.com/go-logr/logr v1.4.2
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0
github.com/mitchellh/go-ps v1.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/aerospike/aerospike-client-go/v7 v7.6.1 h1:VZK6S9YKq2w6ptTk3kXXjTxG2U9M9Y7Oi3YQ+3T7wQQ=
github.com/aerospike/aerospike-client-go/v7 v7.6.1/go.mod h1:uCbSYMpjlRcH/9f26VSF/luzDDXrcDaV8c6/WIcKtT4=
github.com/aerospike/aerospike-kubernetes-operator v0.0.0-20241016165325-74a853c18a98 h1:bhg99pbh1Z0EALqANZs4EEIjyiYT9IuRuFrq8cmgfwI=
github.com/aerospike/aerospike-kubernetes-operator v0.0.0-20241016165325-74a853c18a98/go.mod h1:51gVMITScFL9O2gFQ263/JaO4GACcVbvyj5aXcHYxL8=
github.com/aerospike/aerospike-kubernetes-operator v0.0.0-20241220091418-a80c61e4e90c h1:2MkWyMOjewr0R3ut/LC4QsTi4oyNsQewJPd9HI/lEQc=
github.com/aerospike/aerospike-kubernetes-operator v0.0.0-20241220091418-a80c61e4e90c/go.mod h1:51gVMITScFL9O2gFQ263/JaO4GACcVbvyj5aXcHYxL8=
github.com/aerospike/aerospike-management-lib v1.5.0 h1:uAEaBU+PkzbtwsSrPVokLIUeJaDrFSMtwqeCKba3xIs=
github.com/aerospike/aerospike-management-lib v1.5.0/go.mod h1:hsEptY/AmTmHoJnItJNmfJ4yCMG8LIB8YPnIpIyvGXI=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
Expand Down
15 changes: 8 additions & 7 deletions pkg/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"net"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -321,9 +322,9 @@ func getHostIPS(ctx context.Context, k8sClient client.Client, hostIP string) (
matchFound = true
}

if add.Type == corev1.NodeInternalIP {
if add.Type == corev1.NodeInternalIP && net.ParseIP(add.Address).To4() != nil {
nodeInternalIP = add.Address
} else if add.Type == corev1.NodeExternalIP {
} else if add.Type == corev1.NodeExternalIP && net.ParseIP(add.Address).To4() != nil {
nodeExternalIP = add.Address
}
}
Expand Down Expand Up @@ -377,14 +378,14 @@ func parseCustomNetworkIP(networkType asdbv1.AerospikeNetworkType,
networkSet := sets.NewString(networks...)

for idx := range netStatuses {
net := &netStatuses[idx]
if networkSet.Has(net.Name) {
if len(net.IPs) == 0 {
network := &netStatuses[idx]
if networkSet.Has(network.Name) {
if len(network.IPs) == 0 {
return networkIPs, fmt.Errorf("ips list empty for network %s in pod annotations key %s",
net.Name, networkStatusAnnotation)
network.Name, networkStatusAnnotation)
}

networkIPs = append(networkIPs, net.IPs...)
networkIPs = append(networkIPs, network.IPs...)
}
}

Expand Down
Loading