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

YDBOPS-9691 fix GRPC TLS certificates in dynnodes #207

Merged
merged 6 commits into from
May 14, 2024
Merged
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 deploy/ydb-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.5.10
version: 0.5.11

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.5.10"
appVersion: "0.5.11"
24 changes: 18 additions & 6 deletions internal/resources/database_statefulset.go
Original file line number Diff line number Diff line change
@@ -304,15 +304,15 @@ func buildTLSVolume(name string, configuration *api.TLSConfiguration) corev1.Vol
Items: []corev1.KeyToPath{
{
Key: configuration.CertificateAuthority.Key,
Path: "ca.crt",
Path: wellKnownNameForTLSCertificateAuthority,
},
{
Key: configuration.Certificate.Key,
Path: "tls.crt",
Path: wellKnownNameForTLSCertificate,
},
{
Key: configuration.Key.Key,
Path: "tls.key",
Path: wellKnownNameForTLSPrivateKey,
},
},
},
@@ -436,15 +436,15 @@ func (b *DatabaseStatefulSetBuilder) buildVolumeMounts() []corev1.VolumeMount {
volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: grpcTLSVolumeName,
ReadOnly: true,
MountPath: "/tls/grpc", // fixme const
MountPath: grpcTLSVolumeMountPath,
})
}

if b.Spec.Service.Interconnect.TLSConfiguration.Enabled {
volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: interconnectTLSVolumeName,
ReadOnly: true,
MountPath: "/tls/interconnect", // fixme const
MountPath: interconnectTLSVolumeMountPath,
})
}

@@ -466,7 +466,7 @@ func (b *DatabaseStatefulSetBuilder) buildVolumeMounts() []corev1.VolumeMount {
volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: datastreamsTLSVolumeName,
ReadOnly: true,
MountPath: "/tls/datastreams", // fixme const
MountPath: datastreamsTLSVolumeMountPath,
})
}
}
@@ -537,6 +537,18 @@ func (b *DatabaseStatefulSetBuilder) buildContainerArgs() ([]string, []string) {
)
}

// hotfix KIKIMR-16728
if b.Spec.Service.GRPC.TLSConfiguration.Enabled {
args = append(args,
"--grpc-cert",
fmt.Sprintf("%s/%s", grpcTLSVolumeMountPath, wellKnownNameForTLSCertificate),
"--grpc-key",
fmt.Sprintf("%s/%s", grpcTLSVolumeMountPath, wellKnownNameForTLSPrivateKey),
"--grpc-ca",
fmt.Sprintf("%s/%s", grpcTLSVolumeMountPath, wellKnownNameForTLSCertificateAuthority),
)
}

for _, secret := range b.Spec.Secrets {
exist, err := CheckSecretKey(
context.Background(),
13 changes: 8 additions & 5 deletions internal/resources/resource.go
Original file line number Diff line number Diff line change
@@ -52,9 +52,12 @@ const (
localCertsVolumeName = "init-main-shared-source-dir-volume"
operatorTokenVolumeName = "operator-token-volume"

wellKnownDirForAdditionalSecrets = "/opt/ydb/secrets"
wellKnownDirForAdditionalVolumes = "/opt/ydb/volumes"
wellKnownNameForOperatorToken = "token-file"
wellKnownDirForAdditionalSecrets = "/opt/ydb/secrets"
wellKnownDirForAdditionalVolumes = "/opt/ydb/volumes"
wellKnownNameForOperatorToken = "token-file"
wellKnownNameForTLSCertificateAuthority = "ca.crt"
wellKnownNameForTLSCertificate = "tls.crt"
wellKnownNameForTLSPrivateKey = "tls.key"

caBundleEnvName = "CA_BUNDLE"
caBundleFileName = "userCABundle.crt"
@@ -509,11 +512,11 @@ func buildCAStorePatchingCommandArgs(
}

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

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

if arg != "" {
4 changes: 2 additions & 2 deletions internal/resources/storage_statefulset.go
Original file line number Diff line number Diff line change
@@ -407,15 +407,15 @@ func (b *StorageStatefulSetBuilder) buildVolumeMounts() []corev1.VolumeMount {
volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: grpcTLSVolumeName,
ReadOnly: true,
MountPath: "/tls/grpc", // fixme const
MountPath: grpcTLSVolumeMountPath,
})
}

if b.Spec.Service.Interconnect.TLSConfiguration.Enabled {
volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: interconnectTLSVolumeName,
ReadOnly: true,
MountPath: "/tls/interconnect", // fixme const
MountPath: interconnectTLSVolumeMountPath,
})
}

Loading