Skip to content

Commit

Permalink
make token var name more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
strangiato committed May 14, 2024
1 parent 6a6c5ce commit 407c866
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions pipelines/01_test_connection_via_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
load_dotenv(override=True)

kubeflow_endpoint = "https://ds-pipeline-dspa:8443"
bearer_token = os.environ["BEARER_TOKEN"]

if __name__ == "__main__":
# Check if the script is running in a k8s pod
Expand All @@ -17,9 +16,9 @@
sa_token_path = "/run/secrets/kubernetes.io/serviceaccount/token" # noqa: S105
if os.path.isfile(sa_token_path):
with open(sa_token_path) as f:
token = f.read().rstrip()
bearer_token = f.read().rstrip()
else:
token = os.environ["BEARER_TOKEN"]
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
Expand Down
6 changes: 3 additions & 3 deletions pipelines/02_submitted_pipeline_via_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def add_pipeline(a: float = 1.0, b: float = 7.0):
sa_token_path = "/run/secrets/kubernetes.io/serviceaccount/token" # noqa: S105
if os.path.isfile(sa_token_path):
with open(sa_token_path) as f:
token = f.read().rstrip()
bearer_token = f.read().rstrip()
else:
token = os.environ["BEARER_TOKEN"]
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
Expand All @@ -51,7 +51,7 @@ def add_pipeline(a: float = 1.0, b: float = 7.0):

client = kfp.Client(
host=kubeflow_endpoint,
existing_token=token,
existing_token=bearer_token,
ssl_ca_cert=ssl_ca_cert,
)

Expand Down
4 changes: 2 additions & 2 deletions pipelines/11_iris_training_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ def iris_pipeline(model_obc: str = "iris-model"):
sa_token_path = "/run/secrets/kubernetes.io/serviceaccount/token" # noqa: S105
if os.path.isfile(sa_token_path):
with open(sa_token_path) as f:
token = f.read().rstrip()
bearer_token = f.read().rstrip()
else:
token = os.environ["BEARER_TOKEN"]
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
Expand Down

0 comments on commit 407c866

Please sign in to comment.