Skip to content

Commit

Permalink
make route detection more dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
strangiato committed Jun 7, 2024
1 parent 7a49184 commit d24ee22
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pipelines/11_iris_training_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,17 @@ def iris_pipeline(model_obc: str = "iris-model"):
print(f"Connecting to kfp: {kubeflow_endpoint}")

sa_token_path = "/run/secrets/kubernetes.io/serviceaccount/token" # noqa: S105
if os.path.isfile(sa_token_path):
if os.environ["BEARER_TOKEN"]:
bearer_token = os.environ["BEARER_TOKEN"]
elif os.path.isfile(sa_token_path):
with open(sa_token_path) as f:
bearer_token = f.read().rstrip()
else:
bearer_token = os.environ["BEARER_TOKEN"]

# Check if the script is running in a k8s pod
# Get the CA from the service account if it is
# Skip the CA if it is not
sa_ca_cert = "/run/secrets/kubernetes.io/serviceaccount/service-ca.crt"
if os.path.isfile(sa_ca_cert):
if os.path.isfile(sa_ca_cert) and "svc" in kubeflow_endpoint:
ssl_ca_cert = sa_ca_cert
else:
ssl_ca_cert = None
Expand Down

0 comments on commit d24ee22

Please sign in to comment.