Skip to content

Commit d90e12e

Browse files
committed
YDBOPS-9691 fix GRPC TLS certificates in dynnodes (ydb-platform#207)
1 parent f34083f commit d90e12e

File tree

4 files changed

+30
-15
lines changed

4 files changed

+30
-15
lines changed

deploy/ydb-operator/Chart.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.5.10
18+
version: 0.5.11
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to
2222
# follow Semantic Versioning. They should reflect the version the application is using.
2323
# It is recommended to use it with quotes.
24-
appVersion: "0.5.10"
24+
appVersion: "0.5.11"

internal/resources/database_statefulset.go

+18-6
Original file line numberDiff line numberDiff line change
@@ -302,15 +302,15 @@ func buildTLSVolume(name string, configuration *api.TLSConfiguration) corev1.Vol
302302
Items: []corev1.KeyToPath{
303303
{
304304
Key: configuration.CertificateAuthority.Key,
305-
Path: "ca.crt",
305+
Path: wellKnownNameForTLSCertificateAuthority,
306306
},
307307
{
308308
Key: configuration.Certificate.Key,
309-
Path: "tls.crt",
309+
Path: wellKnownNameForTLSCertificate,
310310
},
311311
{
312312
Key: configuration.Key.Key,
313-
Path: "tls.key",
313+
Path: wellKnownNameForTLSPrivateKey,
314314
},
315315
},
316316
},
@@ -434,15 +434,15 @@ func (b *DatabaseStatefulSetBuilder) buildVolumeMounts() []corev1.VolumeMount {
434434
volumeMounts = append(volumeMounts, corev1.VolumeMount{
435435
Name: grpcTLSVolumeName,
436436
ReadOnly: true,
437-
MountPath: "/tls/grpc", // fixme const
437+
MountPath: grpcTLSVolumeMountPath,
438438
})
439439
}
440440

441441
if b.Spec.Service.Interconnect.TLSConfiguration.Enabled {
442442
volumeMounts = append(volumeMounts, corev1.VolumeMount{
443443
Name: interconnectTLSVolumeName,
444444
ReadOnly: true,
445-
MountPath: "/tls/interconnect", // fixme const
445+
MountPath: interconnectTLSVolumeMountPath,
446446
})
447447
}
448448

@@ -464,7 +464,7 @@ func (b *DatabaseStatefulSetBuilder) buildVolumeMounts() []corev1.VolumeMount {
464464
volumeMounts = append(volumeMounts, corev1.VolumeMount{
465465
Name: datastreamsTLSVolumeName,
466466
ReadOnly: true,
467-
MountPath: "/tls/datastreams", // fixme const
467+
MountPath: datastreamsTLSVolumeMountPath,
468468
})
469469
}
470470
}
@@ -535,6 +535,18 @@ func (b *DatabaseStatefulSetBuilder) buildContainerArgs() ([]string, []string) {
535535
)
536536
}
537537

538+
// hotfix KIKIMR-16728
539+
if b.Spec.Service.GRPC.TLSConfiguration.Enabled {
540+
args = append(args,
541+
"--grpc-cert",
542+
fmt.Sprintf("%s/%s", grpcTLSVolumeMountPath, wellKnownNameForTLSCertificate),
543+
"--grpc-key",
544+
fmt.Sprintf("%s/%s", grpcTLSVolumeMountPath, wellKnownNameForTLSPrivateKey),
545+
"--grpc-ca",
546+
fmt.Sprintf("%s/%s", grpcTLSVolumeMountPath, wellKnownNameForTLSCertificateAuthority),
547+
)
548+
}
549+
538550
for _, secret := range b.Spec.Secrets {
539551
exist, err := CheckSecretKey(
540552
context.Background(),

internal/resources/resource.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ const (
5353
localCertsVolumeName = "init-main-shared-source-dir-volume"
5454
operatorTokenVolumeName = "operator-token-volume"
5555

56-
wellKnownDirForAdditionalSecrets = "/opt/ydb/secrets"
57-
wellKnownDirForAdditionalVolumes = "/opt/ydb/volumes"
58-
wellKnownNameForOperatorToken = "token-file"
56+
wellKnownDirForAdditionalSecrets = "/opt/ydb/secrets"
57+
wellKnownDirForAdditionalVolumes = "/opt/ydb/volumes"
58+
wellKnownNameForOperatorToken = "token-file"
59+
wellKnownNameForTLSCertificateAuthority = "ca.crt"
60+
wellKnownNameForTLSCertificate = "tls.crt"
61+
wellKnownNameForTLSPrivateKey = "tls.key"
5962

6063
caBundleEnvName = "CA_BUNDLE"
6164
caBundleFileName = "userCABundle.crt"
@@ -519,11 +522,11 @@ func buildCAStorePatchingCommandArgs(
519522
}
520523

521524
if grpcService.TLSConfiguration.Enabled {
522-
arg += fmt.Sprintf("cp %s/ca.crt %s/grpcRoot.crt && ", grpcTLSVolumeMountPath, localCertsDir)
525+
arg += fmt.Sprintf("cp %s/%s %s/grpcRoot.crt && ", grpcTLSVolumeMountPath, wellKnownNameForTLSCertificateAuthority, localCertsDir)
523526
}
524527

525528
if interconnectService.TLSConfiguration.Enabled {
526-
arg += fmt.Sprintf("cp %s/ca.crt %s/interconnectRoot.crt && ", interconnectTLSVolumeMountPath, localCertsDir)
529+
arg += fmt.Sprintf("cp %s/%s %s/interconnectRoot.crt && ", interconnectTLSVolumeMountPath, wellKnownNameForTLSCertificateAuthority, localCertsDir)
527530
}
528531

529532
if arg != "" {

internal/resources/storage_statefulset.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -402,15 +402,15 @@ func (b *StorageStatefulSetBuilder) buildVolumeMounts() []corev1.VolumeMount {
402402
volumeMounts = append(volumeMounts, corev1.VolumeMount{
403403
Name: grpcTLSVolumeName,
404404
ReadOnly: true,
405-
MountPath: "/tls/grpc", // fixme const
405+
MountPath: grpcTLSVolumeMountPath,
406406
})
407407
}
408408

409409
if b.Spec.Service.Interconnect.TLSConfiguration.Enabled {
410410
volumeMounts = append(volumeMounts, corev1.VolumeMount{
411411
Name: interconnectTLSVolumeName,
412412
ReadOnly: true,
413-
MountPath: "/tls/interconnect", // fixme const
413+
MountPath: interconnectTLSVolumeMountPath,
414414
})
415415
}
416416

0 commit comments

Comments
 (0)