Skip to content

Commit 3aab23d

Browse files
authored
Merge pull request #10 from teamhephy/issue/fix-objecstorage-keyfile-in-namespaces
Fix for refreshing of objectstorage-keyfile
2 parents f5363a9 + 02f8892 commit 3aab23d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

rootfs/api/models/app.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,25 @@ def set_application_config(self, release):
11531153
def create_object_store_secret(self):
11541154
try:
11551155
self._scheduler.secret.get(self.id, 'objectstorage-keyfile')
1156+
if self._scheduler.secret.get(self.id, 'objectstorage-keyfile'):
1157+
'''
1158+
Rotating Secret Access Keys Bug:
1159+
Issue #9: https://github.com/teamhephy/controller/issues/9
1160+
1161+
We need to set a new objectstorage-keyfile if it has changed
1162+
in workflow's namespace
1163+
'''
1164+
workflow_objectstorage_keyfile = self._scheduler.secret.get(
1165+
settings.WORKFLOW_NAMESPACE, 'objectstorage-keyfile').json()
1166+
app_objectstorage_keyfile = self._scheduler.secret.get(
1167+
self.id, 'objectstorage-keyfile').json()
1168+
if workflow_objectstorage_keyfile['data'] != app_objectstorage_keyfile['data']:
1169+
self.log('Refreshing the objectstorage-keyfile for {} namespace'
1170+
.format(self.id), level=logging.INFO)
1171+
self._scheduler.secret.delete(self.id, 'objectstorage-keyfile')
1172+
secret = self._scheduler.secret.get(
1173+
settings.WORKFLOW_NAMESPACE, 'objectstorage-keyfile').json()
1174+
self._scheduler.secret.create(self.id, 'objectstorage-keyfile', secret['data'])
11561175
except KubeException:
11571176
secret = self._scheduler.secret.get(
11581177
settings.WORKFLOW_NAMESPACE, 'objectstorage-keyfile').json()

0 commit comments

Comments
 (0)