Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: pipelines profile controller should get minio access keys from the secret #1372

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ spec:
envFrom:
- configMapRef:
name: profile-controller-env
env:
- name: MINIO_ACCESS_KEY
valueFrom:
secretKeyRef:
name: mlpipeline-minio-artifact
key: accesskey
- name: MINIO_SECRET_KEY
valueFrom:
secretKeyRef:
name: mlpipeline-minio-artifact
key: secretkey
volumeMounts:
- name: hooks
mountPath: /hooks
Expand Down
31 changes: 18 additions & 13 deletions pipeline/installs/multi-user/pipelines-profile-controller/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import os
import base64

kfp_version = os.environ["KFP_VERSION"]
disable_istio_sidecar = os.environ.get("DISABLE_ISTIO_SIDECAR") == "true"
mlpipeline_minio_access_key = os.environ.get("MINIO_ACCESS_KEY")
mlpipeline_minio_secret_key = os.environ.get("MINIO_SECRET_KEY")


class Controller(BaseHTTPRequestHandler):
Expand Down Expand Up @@ -49,18 +52,6 @@ def sync(self, parent, children):
# parent is a namespace
namespace = parent.get("metadata", {}).get("name")
desired_resources = [
{
"apiVersion": "v1",
"kind": "Secret",
"metadata": {
"name": "mlpipeline-minio-artifact",
"namespace": namespace,
},
"data": {
"accesskey": "bWluaW8=", # base64 for minio
"secretkey": "bWluaW8xMjM=", # base64 for minio123
},
},
{
"apiVersion": "v1",
"kind": "ConfigMap",
Expand Down Expand Up @@ -255,7 +246,21 @@ def sync(self, parent, children):
}
},
]
print('Received request', parent, desired_resources)
print('Received request:', parent)
print('Desired resources except secrets:', desired_resources)
# Moved after the print argument because this is sensitive data.
desired_resources.append({
"apiVersion": "v1",
"kind": "Secret",
"metadata": {
"name": "mlpipeline-minio-artifact",
"namespace": namespace,
},
"data": {
"accesskey": base64.b64encode(mlpipeline_minio_access_key),
"secretkey": base64.b64encode(mlpipeline_minio_secret_key),
},
})

return {"status": desired_status, "children": desired_resources}

Expand Down