Skip to content

Commit b3b81af

Browse files
committed
fix: when useIamRole is true operator may fail due to secret not found
1 parent a8567cd commit b3b81af

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

stackgres-k8s/e2e/utils/operator

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ get_operator_images_pre_1_18_0_alpha1() {
10021002
echo "${CLUSTER_CONTROLLER_IMAGE_NAME%:*}:$VERSION"
10031003
echo "${STREAM_IMAGE_NAME%:*}:$VERSION-jvm"
10041004
echo "${ADMINUI_IMAGE_NAME%:*}:$VERSION"
1005-
echo "${PGLAMBDA_JAVASCRIPT_IMAGE_NAME%:*}:${NATIVE_TAG}-javascript"
1005+
echo "${PGLAMBDA_JAVASCRIPT_IMAGE_NAME%:*}:${VERSION}-javascript"
10061006
}
10071007
10081008
get_operator_images_pre_1_14_0_alpha1() {

stackgres-k8s/src/operator/src/main/java/io/stackgres/operator/conciliation/factory/cluster/backup/BackupEnvVarFactory.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,18 @@ private ImmutableMap<String, String> getBackupSecrets(
152152
return Seq.of(
153153
Optional.of(storage)
154154
.map(BackupStorage::getS3)
155-
.map(awsConf -> Seq.of(
156-
getSecretEntry("AWS_ACCESS_KEY_ID",
157-
awsConf.getAwsCredentials().getSecretKeySelectors().getAccessKeyId(),
158-
secrets),
159-
getSecretEntry("AWS_SECRET_ACCESS_KEY",
160-
awsConf.getAwsCredentials()
161-
.getSecretKeySelectors().getSecretAccessKey(), secrets))
162-
.filter(Predicate.not(entry -> Optional.of(awsConf.getAwsCredentials())
155+
.map(awsConf -> Optional.of(true)
156+
.filter(Predicate.not(ignored -> Optional.of(awsConf.getAwsCredentials())
163157
.map(AwsCredentials::getUseIamRole)
164-
.orElse(false)))),
158+
.orElse(false)))
159+
.stream()
160+
.flatMap(ignored -> Seq.of(
161+
getSecretEntry("AWS_ACCESS_KEY_ID",
162+
awsConf.getAwsCredentials().getSecretKeySelectors().getAccessKeyId(),
163+
secrets),
164+
getSecretEntry("AWS_SECRET_ACCESS_KEY",
165+
awsConf.getAwsCredentials()
166+
.getSecretKeySelectors().getSecretAccessKey(), secrets)))),
165167
Optional.of(storage)
166168
.map(BackupStorage::getS3Compatible)
167169
.map(awsConf -> Seq.of(

0 commit comments

Comments
 (0)