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

ExtraVolumes and ExtraVolumeMounts for Configmap not working with singleuser #3579

Open
duc-dn opened this issue Nov 20, 2024 · 3 comments
Open

Comments

@duc-dn
Copy link

duc-dn commented Nov 20, 2024

Hi,
I want to mount a configmap sparkmagic config to singleuser pod but it doesn't work for me.
I created a configmap file, tried to mount it into a hub pod, and found the config file of spark magic.
However, in singleuser pod, I realized that it doesn't be mounted
singleuser in values.yaml:

singleuser:
  storage:
    extraVolumes:
      - name: spark-magic-config
        configMap:
          name: spark-magic-config
    extraVolumeMounts:
      - name: spark-magic-config
        mountPath: /home/config.json
        subPath: config.json

hub in values.yaml:

hub:
  extraVolumes:
    - name: spark-magic-config
      configMap:
        name: spark-magic-config
  extraVolumeMounts:
    - name: spark-magic-config
      mountPath: /home/config.json
      subPath: config.json

image
And I described notebook pod, it's none
image

Can you share with me some recommendations for this problem?

@duc-dn duc-dn changed the title ExtraVolume and ExtraVolume for Configmap not working with singleuser ExtraVolumes and ExtraVolumeMounts for Configmap not working with singleuser Nov 20, 2024
@consideRatio
Copy link
Member

consideRatio commented Nov 20, 2024

Didnt you get a schema validation error from this? Are you using a packaged chart (recommended) or one from this git repository directly (not with a schema without manual action).

It seems singleuser.extraVolumes wasn't defined as i though, but you can do hub.config.KubeSpawner.extra_volumes and .extra_volume_mounts i think. This is a kubespawner config, and singleuser. typically is just configuring kubespawner as well as you can do directly via hub.config.KubeSpawner.

@duc-dn
Copy link
Author

duc-dn commented Nov 21, 2024

Thanks @consideRatio

Didnt you get a schema validation error from this? Are you using a packaged chart (recommended) or one from this git repository directly (not with a schema without manual action).
I used chart in this repo, and added sparkmagicConfig in singleuser in values.yaml. After I added define for this config in values.schema.json

"sparkmagicConfig": {
    "type": "object",
    "description": "Configuration for Sparkmagic integration",
    "additionalProperties": true
}

Moreover, I also added configmap.yaml in singleuser folder

apiVersion: v1
kind: ConfigMap
metadata:
  name: spark-magic-config
data:
  config.json: |
    {{ .Values.singleuser.sparkmagicConfig | toJson | nindent 4 }}

When installing chart, configmap was created and mounted to hub pod. But with singleuser pod, it wasn't be mounted


It seems singleuser.extraVolumes wasn't defined as i though, but you can do hub.config.KubeSpawner.extra_volumes and .extra_volume_mounts i think. This is a kubespawner config, and singleuser. typically is just configuring kubespawner as well as you can do directly via hub.config.KubeSpawner.

I tried this way. However, when single pod started, spark-magic-config in configmap wasn't be mounted

hub: 
  revisionHistoryLimit:
  config:
    KubeSpawner:
      extraVolumes:
        - name: spark-magic-config
          configMap:
            name: spark-magic-config
      extraVolumeMounts:
        - name: spark-magic-config
          mountPath: /home/config.json
          subPath: config.json

@consideRatio
Copy link
Member

It ahould be extra_volumes when you put something under hub.config.KubeSpawner, and you can use KubeSpanwer documentation of what you configure etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants