Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Added basic script to make api-token for culler #97

Merged
merged 3 commits into from
Jul 27, 2021

Conversation

maroroman
Copy link

Related Issues and Dependencies

This introduces a breaking change

  • Yes
  • No

This Pull Request implements

Adds the JupyterHub Idle Culler as an external service

Description

This PR adds the idle culler as an external service and also exposes its api-token into a secret the the idle culler can read from.

@maroroman maroroman self-assigned this Jul 12, 2021
@maroroman maroroman changed the title [WIP] Added basic script to make api-token for culler Added basic script to make api-token for culler Jul 12, 2021
@maroroman maroroman requested a review from vpavlin July 12, 2021 11:46
@@ -25,6 +25,9 @@
'KUBERNETES_SERVICE_PORT': os.environ['KUBERNETES_SERVICE_PORT'],
'JUPYTERHUB_LOGIN_URL': None
}

idle_culler_api_token = str(uuid.uuid4())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cannot be re-generated on every restart of the JH as the culler container would not get the new value and API calls woulds start failing after restart.

Ideally implement 2 functions:

  • get_culler_secret
  • set_culler_secret

Call the get_culler_secret here and only if the secret does not exist, call set_culler_secret

And use the loaded or created secret in the services dict

Also, the name of the secret should be something like jupyterhub-idle-culler and the key in it should be api_token

@maroroman maroroman force-pushed the feature/idle-culler branch 2 times, most recently from d96de4d to f4d53ec Compare July 19, 2021 12:59
Copy link

@4n4nd 4n4nd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

def set_culler_secret():

secret_data = str(uuid.uuid4())
openshift.write_secret('jupyterhub-api-token', {'token': secret_data})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chanfe the name to something related to idle-culler - e.g. jupyterhub-idle-culler

@vpavlin
Copy link

vpavlin commented Jul 27, 2021

/deploy

@vpavlin vpavlin merged commit 110b04e into opendatahub-io-contrib:master Jul 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants