Skip to content

The controller of the configMap of the pod's volume without the Name field parameter reports an error #2491

Closed Answered by camilamacedo86
zerunhu asked this question in Support
Discussion options

You must be logged in to vote

Hello,

It seems like you're correctly trying to associate a ConfigMap to a Volume in a Pod specification. The Name field you're referring to indeed does not directly exist under the ConfigMapVolumeSource object. Instead, it is present under the LocalObjectReference object, as you've shown in your code.

To fix you would need to probably:

ConfigMap: &corev1.ConfigMapVolumeSource{
    LocalObjectReference: corev1.LocalObjectReference{
        Name: zapi.Spec.ConfigMap,
    },
    DefaultMode: &configMapMode,
}

Here, the Name field inside LocalObjectReference is what maps to the name of the ConfigMap you want to mount.

I hope that answered your question.
I am closing this one since it was ope…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by camilamacedo86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
2 participants