Skip to content

Commit b1028dd

Browse files
author
william chu
committed
0.6.2: removing any reliance on exposing aws secrets
1 parent c6f3143 commit b1028dd

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

gitops/utils/kube.py

+2-25
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import humanize
1919
import yaml
2020
from colorama import Fore
21-
from invoke import run, task
21+
from invoke import run
2222
from invoke.exceptions import UnexpectedExit
2323

2424
from gitops.common.app import App
@@ -61,7 +61,7 @@ def list_backups(product, prefix):
6161

6262

6363
def download_backup(product, prefix, index, path=None, datestamp=False):
64-
s3 = get_client("s3")
64+
s3 = boto3.client("s3")
6565
key = get_backups(product, prefix)[int(index) - 1][3]
6666
url = s3.generate_presigned_url("get_object", Params={"Bucket": "uptick-backups", "Key": key})
6767
name = prefix
@@ -105,22 +105,6 @@ def copy_db(ctx, source, destination, context=""):
105105
)
106106

107107

108-
@task
109-
def create_backup_secrets(ctx, context="", namespace="workforce"):
110-
"""Create backup job secrets.
111-
112-
Before running backups certain secret keys need to be available to
113-
the job. This creates the secrets on the cluster.
114-
"""
115-
run(
116-
"kubectl create secret generic backups-secrets"
117-
f" --context {context}"
118-
f" -n {namespace}"
119-
" --from-literal=AWS_ACCESS_KEY_ID={get_secret('BACKUPS_AWS_ACCESS_KEY_ID')}"
120-
" --from-literal=AWS_SECRET_ACCESS_KEY={get_secret('BACKUPS_AWS_SECRET_ACCESS_KEY')}"
121-
)
122-
123-
124108
def get_backups(product, prefix):
125109
s3 = boto3.resource("s3")
126110
bucket = s3.Bucket("uptick-backups")
@@ -153,13 +137,6 @@ def get_secret(name, base64=False):
153137
return value
154138

155139

156-
def get_client(name):
157-
return boto3.Session(
158-
aws_access_key_id=os.environ["BACKUPS_AWS_ACCESS_KEY_ID"],
159-
aws_secret_access_key=os.environ["BACKUPS_AWS_SECRET_ACCESS_KEY"],
160-
).client(name)
161-
162-
163140
@contextmanager
164141
def run_wrapper(intro):
165142
print(intro, end="", flush=True)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "gitops"
3-
version = "0.6.1"
3+
version = "0.6.2"
44
description = "Manage multiple apps across one or more k8s clusters."
55
authors = ["Jarek Głowacki <[email protected]>"]
66
license = "BSD"

0 commit comments

Comments
 (0)