Skip to content

Commit cba6d2d

Browse files
author
Konstantin Bogdanov
committed
Set Databases GRPC public host explicitly
1 parent 9d74bbf commit cba6d2d

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

internal/resources/database_statefulset.go

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -233,20 +233,23 @@ func (b *DatabaseStatefulSetBuilder) buildContainerArgs() ([]string, []string) {
233233
db.GetStorageEndpointWithProto(),
234234
}
235235

236-
if b.Spec.Service.GRPC.ExternalHost != "" {
237-
publicHostOption := "--grpc-public-host"
238-
publicPortOption := "--grpc-public-port"
236+
if b.Spec.Service.GRPC.ExternalHost == "" {
237+
service := fmt.Sprintf(grpcServiceNameFormat, b.GetName())
238+
b.Spec.Service.GRPC.ExternalHost = fmt.Sprintf("%s.%s.svc.cluster.local", service, b.GetNamespace()) // FIXME .svc.cluster.local
239+
}
239240

240-
args = append(
241-
args,
241+
publicHostOption := "--grpc-public-host"
242+
publicPortOption := "--grpc-public-port"
242243

243-
publicHostOption,
244-
fmt.Sprintf("%s.%s", "$(NODE_NAME)", b.Spec.Service.GRPC.ExternalHost), // fixme $(NODE_NAME)
244+
args = append(
245+
args,
245246

246-
publicPortOption,
247-
strconv.Itoa(v1alpha1.GRPCPort),
248-
)
249-
}
247+
publicHostOption,
248+
fmt.Sprintf("%s.%s", "$(NODE_NAME)", b.Spec.Service.GRPC.ExternalHost), // fixme $(NODE_NAME)
249+
250+
publicPortOption,
251+
strconv.Itoa(v1alpha1.GRPCPort),
252+
)
250253

251254
return command, args
252255
}

0 commit comments

Comments
 (0)