Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
davi17g committed Jan 14, 2025
1 parent 383b49e commit 0fc1407
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion avs-init-container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ COPY . .

RUN <<-EOF
xx-go --wrap
cd /app/avs-init-container/cmd && OS=${TARGETOS} ARCH=${TARGETARCH} go build -o /app/avs-init-container/target/avs-init-container_${TARGETOS}_${TARGETARCH}
cd /app/avs-init-container/cmd && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /app/avs-init-container/target/avs-init-container_${TARGETOS}_${TARGETARCH}
xx-verify /app/avs-init-container/target/avs-init-container_${TARGETOS}_${TARGETARCH}
EOF

Expand Down
11 changes: 9 additions & 2 deletions avs-init-container/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

const (
AVS_NODE_LABEL_KEY = "avs-node-label"
AVS_NODE_LABEL_KEY = "aerospike.io/role-label"
NODE_ROLES_KEY = "node-roles"
AVS_CONFIG_FILE_PATH = "/etc/aerospike-vector-search/aerospike-vector-search.yml"
)
Expand Down Expand Up @@ -50,6 +50,10 @@ func getAerospikeVectorSearchRoles() (map[string]interface{}, error) {
return nil, err
}

if label == "" {
return nil, nil
}

aerospikeVectorSearchRolesEnvVariable := os.Getenv("AEROSPIKE_VECTOR_SEARCH_NODE_ROLES")
if aerospikeVectorSearchRolesEnvVariable == "" {
return nil, nil
Expand Down Expand Up @@ -77,6 +81,10 @@ func setRoles(aerospikeVectorSearchConfig map[string]interface{}) error {
return err
}

if roles == nil {
return nil
}

if cluster, ok := aerospikeVectorSearchConfig["cluster"].(map[string]interface{}); ok {
cluster[NODE_ROLES_KEY] = roles[NODE_ROLES_KEY]
aerospikeVectorSearchConfig["cluster"] = cluster
Expand Down Expand Up @@ -143,6 +151,5 @@ func run() int {
}

func main() {
fmt.Println("Starting")
os.Exit(run())
}
11 changes: 1 addition & 10 deletions charts/aerospike-vector-search/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: config-injector
image: davi17g/avs-init-container:2.0.0
image: davi17g/avs-init-container:3.0.0
imagePullPolicy: Always
volumeMounts:
- name: aerospike-vector-search
Expand Down Expand Up @@ -89,9 +89,6 @@ spec:
{{- $svcPortCounter = add $svcPortCounter 1 }}
containerPort: {{ $port }}
protocol: {{ default "TCP" $config.protocol }}
{{- if $config.addresses }}
addresses: {{ $config.addresses }}
{{- end }}
{{- end }}
{{- end }}
{{- if and .Values.aerospikeVectorSearchConfig.manage (not (empty .Values.aerospikeVectorSearchConfig.manage.ports)) }}
Expand All @@ -102,9 +99,6 @@ spec:
{{- $managePortCounter = add $managePortCounter 1 }}
containerPort: {{ $port }}
protocol: {{ default "TCP" $config.protocol }}
{{- if $config.addresses }}
addresses: {{ $config.addresses }}
{{- end }}
{{- end }}
{{- end }}
{{- if and .Values.aerospikeVectorSearchConfig.interconnect (not (empty .Values.aerospikeVectorSearchConfig.interconnect.ports)) }}
Expand All @@ -115,9 +109,6 @@ spec:
{{- $interconnectPortCounter = add $interconnectPortCounter 1 }}
containerPort: {{ $port }}
protocol: {{ default "TCP" $config.protocol }}
{{- if $config.addresses }}
addresses: {{ $config.addresses }}
{{- end }}
{{- end }}
{{- end }}
volumeMounts:
Expand Down

0 comments on commit 0fc1407

Please sign in to comment.