Skip to content

Commit 120007e

Browse files
authored
working with caBundle as env variable oneline base64 string (#164)
* working with caBundle as base64 oneline string * fix lint * trigger GitHub actions * bump chart version
1 parent f375df3 commit 120007e

File tree

6 files changed

+8
-18
lines changed

6 files changed

+8
-18
lines changed

api/v1alpha1/database_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ type DatabaseSpec struct {
103103
// User-defined root certificate authority that is added to system trust
104104
// store of Storage pods on startup.
105105
// +optional
106-
CABundle []byte `json:"caBundle,omitempty"`
106+
CABundle string `json:"caBundle,omitempty"`
107107

108108
// Secret names that will be mounted into the well-known directory of
109109
// every storage pod. Directory: `/opt/ydb/secrets/<secret_name>/<secret_key>`

api/v1alpha1/storage_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ type StorageSpec struct {
8484
// User-defined root certificate authority that is added to system trust
8585
// store of Storage pods on startup.
8686
// +optional
87-
CABundle []byte `json:"caBundle,omitempty"`
87+
CABundle string `json:"caBundle,omitempty"`
8888

8989
// Secret names that will be mounted into the well-known directory of
9090
// every storage pod. Directory: `/opt/ydb/secrets/<secret_name>/<secret_key>`

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/ydb-operator/Chart.yaml

Lines changed: 2 additions & 2 deletions
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.4.35
18+
version: 0.4.36
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.4.35"
24+
appVersion: "0.4.36"

internal/resources/database_statefulset.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ func (b *DatabaseStatefulSetBuilder) buildCaStorePatchingInitContainer() corev1.
229229
container.Env = []corev1.EnvVar{
230230
{
231231
Name: caBundleEnvName,
232-
Value: string(b.Spec.CABundle),
232+
Value: b.Spec.CABundle,
233233
},
234234
}
235235
}
@@ -490,7 +490,7 @@ func (b *DatabaseStatefulSetBuilder) buildCaStorePatchingInitContainerArgs() ([]
490490
arg := ""
491491

492492
if len(b.Spec.CABundle) > 0 {
493-
arg += fmt.Sprintf("echo $%s > %s/%s && ", caBundleEnvName, localCertsDir, caBundleFileName)
493+
arg += fmt.Sprintf("printf $%s | base64 --decode > %s/%s && ", caBundleEnvName, localCertsDir, caBundleFileName)
494494
}
495495

496496
if b.Spec.Service.GRPC.TLSConfiguration.Enabled {

internal/resources/storage_statefulset.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ func (b *StorageStatefulSetBuilder) buildCaStorePatchingInitContainer() corev1.C
254254
container.Env = []corev1.EnvVar{
255255
{
256256
Name: caBundleEnvName,
257-
Value: string(b.Spec.CABundle),
257+
Value: b.Spec.CABundle,
258258
},
259259
}
260260
}
@@ -427,7 +427,7 @@ func (b *StorageStatefulSetBuilder) buildCaStorePatchingInitContainerArgs() ([]s
427427
arg := ""
428428

429429
if len(b.Spec.CABundle) > 0 {
430-
arg += fmt.Sprintf("echo $%s > %s/%s && ", caBundleEnvName, localCertsDir, caBundleFileName)
430+
arg += fmt.Sprintf("printf $%s | base64 --decode > %s/%s && ", caBundleEnvName, localCertsDir, caBundleFileName)
431431
}
432432

433433
if IsGrpcSecure(b.Storage) {

0 commit comments

Comments
 (0)