Skip to content

Commit

Permalink
Remove datastreams iam sa key (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvgorbunov authored Aug 22, 2024
1 parent e600025 commit e0387f4
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 38 deletions.
3 changes: 0 additions & 3 deletions api/v1alpha1/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ const (
DatabaseEncryptionKeySecretFile = "key.pem"
DatabaseEncryptionKeyConfigFile = "key.txt"

DatastreamsIAMServiceAccountKeyDir = "datastreams"
DatastreamsIAMServiceAccountKeyFile = "sa_key.json"

BinariesDir = "/opt/ydb/bin"
DaemonBinaryName = "ydbd"

Expand Down
3 changes: 0 additions & 3 deletions api/v1alpha1/database_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,6 @@ type EncryptionConfig struct {
type DatastreamsConfig struct {
// +required
Enabled bool `json:"enabled"`

// +required
IAMServiceAccountKey *corev1.SecretKeySelector `json:"iam_service_account_key,omitempty"`
}

type DatabaseServices struct {
Expand Down
7 changes: 1 addition & 6 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 0 additions & 23 deletions internal/resources/database_statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ func (b *DatabaseStatefulSetBuilder) buildVolumes() []corev1.Volume {
}

if b.Spec.Datastreams != nil && b.Spec.Datastreams.Enabled {
volumes = append(volumes, b.buildDatastreamsIAMServiceAccountKeyVolume())
if b.Spec.Service.Datastreams.TLSConfiguration.Enabled {
volumes = append(volumes, buildTLSVolume(datastreamsTLSVolumeName, b.Spec.Service.Datastreams.TLSConfiguration))
}
Expand Down Expand Up @@ -385,23 +384,6 @@ func (b *DatabaseStatefulSetBuilder) buildEncryptionVolumes() []corev1.Volume {
return []corev1.Volume{encryptionKeySecret, encryptionKeyConfig}
}

func (b *DatabaseStatefulSetBuilder) buildDatastreamsIAMServiceAccountKeyVolume() corev1.Volume {
return corev1.Volume{
Name: datastreamsIAMServiceAccountKeyVolumeName,
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
SecretName: b.Spec.Datastreams.IAMServiceAccountKey.Name,
Items: []corev1.KeyToPath{
{
Key: b.Spec.Datastreams.IAMServiceAccountKey.Key,
Path: api.DatastreamsIAMServiceAccountKeyFile,
},
},
},
},
}
}

func (b *DatabaseStatefulSetBuilder) buildContainer() corev1.Container {
command, args := b.buildContainerArgs()
imagePullPolicy := corev1.PullIfNotPresent
Expand Down Expand Up @@ -509,11 +491,6 @@ func (b *DatabaseStatefulSetBuilder) buildVolumeMounts() []corev1.VolumeMount {
}

if b.Spec.Datastreams != nil && b.Spec.Datastreams.Enabled {
volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: datastreamsIAMServiceAccountKeyVolumeName,
ReadOnly: true,
MountPath: api.DatastreamsIAMServiceAccountKeyDir,
})
if b.Spec.Service.Datastreams.TLSConfiguration.Enabled {
volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: datastreamsTLSVolumeName,
Expand Down
5 changes: 2 additions & 3 deletions internal/resources/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ const (
localCertsDir = "/usr/local/share/ca-certificates"
systemCertsDir = "/etc/ssl/certs"

encryptionKeyConfigVolumeName = "encryption-config"
encryptionKeySecretVolumeName = "encryption-key"
datastreamsIAMServiceAccountKeyVolumeName = "datastreams-iam-sa-key"
encryptionKeyConfigVolumeName = "encryption-config"
encryptionKeySecretVolumeName = "encryption-key"
)

type ResourceBuilder interface {
Expand Down

0 comments on commit e0387f4

Please sign in to comment.