This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
overlay and readme changes custom CA and use env as verify in Elyra (#…
…669) * overlay and readme changes * jupyterhub singleuser configmap add env TRUSTED_CA_BUNDLE_PATH * added files in overlay * delete build directory from wrong subfolder * removed mess in folder structure * moved new env add from base singleuser configmap to overlay. added correct json merge section for jupyterhub singleuser and jupyterhub-cfg configmap * changed additonal env entry in jupyterhub-singleuser-profiles configmap to entirety due to inability to do JsonPatches6902 or strategic merge with scalar text value in configmap * typo in overlay kustomization.yaml * added jupyterhub singleuser profiles configmap via strategic merge * added patchesJson6902 for jupyterhub-configmap Co-authored-by: shalberd <sthoms@svens-mbp-1.home> Co-authored-by: shalberd <sthoms@Svens-MacBook-Pro-2.local> Co-authored-by: Sven Thoms <sven.thoms@inventx.ch>
- Loading branch information
1 parent
c645e88
commit 0edd65c
Showing
7 changed files
with
192 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
jupyterhub/jupyterhub/overlays/trusted-ca-bundle-path/jupyterhub-configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
- op: replace | ||
path: /data/jupyterhub_config.py | ||
value: |- | ||
if "TRUSTED_CA_BUNDLE_PATH" in os.environ: | ||
TRUSTED_CA_BUNDLE_PATH = os.environ.get("TRUSTED_CA_BUNDLE_PATH") | ||
basepath, filename = os.path.split({TRUSTED_CA_BUNDLE_PATH}) | ||
spawner = c.OpenShiftSpawner | ||
def custom_apply_pod_profile(spawner, pod): | ||
""" | ||
Example function for overriding JupyterHub server functionality to modify the user notebook Pod spec | ||
Should only be called via a function referenced by spawner.modify_pod_hook | ||
See https://jupyterhub-kubespawner.readthedocs.io/en/latest/spawner.html | ||
""" | ||
# Apply profile from singleuser-profiles. REQUIRED since we want to extend the current pod spec | ||
# configs supported by the JH server | ||
apply_pod_profile(spawner, pod) | ||
print("custom apply pod profile ...") | ||
# make pod volume definition from optional CA configmap trusted-cabundle. | ||
trustedCAVolume = client.V1Volume( | ||
name="trusted-cas-volume", | ||
config_map=client.V1ConfigMapVolumeSource( | ||
name="trusted-cabundle", | ||
optional=True, | ||
items=[client.V1KeyToPath(key="ca-bundle.crt", path="trustedcas.pem")], | ||
) | ||
) | ||
print("existing container volume mounts ") | ||
print (str(pod.spec.containers[0].volume_mounts)[1:-1]) | ||
newVolumesList = [trustedCAVolume] | ||
if pod.spec.volumes is None: | ||
print("pod def has no volumes yet") | ||
pod.spec.volumes = newVolumesList | ||
else: | ||
print("extending pod def volumes with configmap volume") | ||
pod.spec.volumes.extend(newVolumesList) | ||
print("extending container volume mounts for ca cert configmap") | ||
newVolumeMount = client.V1VolumeMount(mount_path=basepath, name="trusted-cas-volume", read_only=True) | ||
newVolumeMountList = [newVolumeMount] | ||
# Inject extraVolumeMount | ||
if pod.spec.containers[0].volume_mounts is None: | ||
print("notebook container def has no volumes mounted yet") | ||
pod.spec.containers[0].volume_mounts = newVolumeMountList | ||
else: | ||
print("extending existing container def volume mounts section with configmap volume mount reference") | ||
pod.spec.containers[0].volume_mounts.extend(newVolumeMountList) | ||
print("new container volume mounts ") | ||
print (str(pod.spec.containers[0].volume_mounts)[1:-1]) | ||
return pod | ||
spawner.modify_pod_hook = custom_apply_pod_profile |
71 changes: 71 additions & 0 deletions
71
.../jupyterhub/overlays/trusted-ca-bundle-path/jupyterhub-singleuser-profiles-configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: jupyter-singleuser-profiles | ||
data: | ||
jupyterhub-singleuser-profiles.yaml: | | ||
profiles: | ||
- name: globals | ||
env: | ||
- name: S3_ENDPOINT_URL | ||
value: $(s3_endpoint_url) | ||
- name: TRUSTED_CA_BUNDLE_PATH | ||
value: $(trusted_ca_bundle_path) | ||
resources: | ||
requests: | ||
memory: 1Gi | ||
cpu: 500m | ||
limits: | ||
memory: 2Gi | ||
cpu: 1 | ||
- name: Spark Notebook | ||
images: | ||
- 's2i-spark-minimal-notebook:3.6' | ||
- 's2i-spark-minimal-notebook:py36-spark2.4.5-hadoop2.7.3' | ||
env: | ||
- name: PYSPARK_SUBMIT_ARGS | ||
value: '--conf spark.cores.max=2 --conf spark.executor.instances=2 --conf spark.executor.memory=1G --conf spark.executor.cores=1 --conf spark.driver.memory=2G --packages com.amazonaws:aws-java-sdk:1.7.4 org.apache.hadoop:hadoop-aws:2.7.3 io.xskipper:xskipper-core_2.11:1.1.1 pyspark-shell' | ||
- name: PYSPARK_DRIVER_PYTHON | ||
value: 'jupyter' | ||
- name: PYSPARK_DRIVER_PYTHON_OPTS | ||
value: 'notebook' | ||
- name: SPARK_HOME | ||
value: '/opt/app-root/lib/python3.6/site-packages/pyspark/' | ||
- name: PYTHONPATH | ||
value: '$PYTHONPATH:/opt/app-root/lib/python3.6/site-packages/:/opt/app-root/lib/python3.6/site-packages/pyspark/python/:/opt/app-root/lib/python3.6/site-packages/pyspark/python/lib/py4j-0.8.2.1-src.zip' | ||
services: | ||
spark: | ||
resources: | ||
- name: spark-cluster-template | ||
path: notebookPodServiceTemplate | ||
- name: spark-cluster-template | ||
path: sparkClusterTemplate | ||
configuration: | ||
worker_nodes: '2' | ||
master_nodes: '1' | ||
master_memory_limit: '2Gi' | ||
master_cpu_limit: '1' | ||
master_memory_request: '2Gi' | ||
master_cpu_request: '1' | ||
worker_memory_limit: '2Gi' | ||
worker_cpu_limit: '1' | ||
worker_memory_request: '2Gi' | ||
worker_cpu_request: '1' | ||
spark_image: 'quay.io/radanalyticsio/openshift-spark-py36:2.4.5-2' | ||
return: | ||
SPARK_CLUSTER: 'metadata.name' | ||
gpuTypes: | ||
- type: gpu_one | ||
node_tolerations: | ||
- key: provider | ||
operator: Equal | ||
value: gpu-node | ||
effect: NoSchedule | ||
# This is the default NoSchedule toleration that is recognized by the NVIDIA gpu operator | ||
- type: nvidia_gpu | ||
node_tolerations: | ||
- key: "nvidia.com/gpu" | ||
operator: Exists | ||
effect: NoSchedule | ||
21 changes: 21 additions & 0 deletions
21
jupyterhub/jupyterhub/overlays/trusted-ca-bundle-path/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
commonLabels: | ||
app.kubernetes.io/part-of: jupyterhub | ||
|
||
bases: | ||
- ../../base | ||
|
||
resources: | ||
- trusted-cabundle-configmap.yaml | ||
|
||
patchesJson6902: | ||
- path: jupyterhub-configmap.yaml | ||
target: | ||
version: v1 | ||
kind: ConfigMap | ||
name: jupyterhub-cfg | ||
|
||
patchesStrategicMerge: | ||
- jupyterhub-singleuser-profiles-configmap.yaml |
6 changes: 6 additions & 0 deletions
6
jupyterhub/jupyterhub/overlays/trusted-ca-bundle-path/trusted-cabundle-configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: trusted-cabundle | ||
labels: | ||
config.openshift.io/inject-trusted-cabundle: 'true' |