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

Update proposal for ConfigMap volume #19923

Merged
merged 1 commit into from
Jan 26, 2016

Conversation

pmorie
Copy link
Member

@pmorie pmorie commented Jan 21, 2016

Updates the ConfigMap volume design to reflect the outcome of #18586; proposes a new API that will be backward compatible when applied to secrets.

@thockin @bgrant0607 @erictune @smarterclayton
cc @kubernetes/rh-cluster-infra

@k8s-github-robot
Copy link

Labelling this PR as size/S

@k8s-github-robot k8s-github-robot added kind/design Categorizes issue or PR as related to design. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 21, 2016
@k8s-bot
Copy link

k8s-bot commented Jan 21, 2016

GCE e2e test build/test passed for commit aa1a216fe0fb561a23fc4126a4908bef8eac49d9.

key: redis.conf
- name: config-map-volume
configMap:
configMapName: redis-volume-config
Copy link
Member

Choose a reason for hiding this comment

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

For env we chose a LocalObjectRef, and for volumes we chose a Name. That smells a bit. LocalObjectRef allows for extension into cross-namespace references, whcih seems plausible for large, complex applications. A simple name would NOT allow that. I spoke to Brian this morning and I'm coming around to cross-namespace stuff being viable.

Should we be converting to LocalObjectRef here?

Copy link
Member

Choose a reason for hiding this comment

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

...and if we do, Secret should change, too. We can always change later, I guess, by marking this field as optional (which Secret does with SecretName) and later changing to one-of SecretName or [Namespace]+Name

Copy link
Member Author

Choose a reason for hiding this comment

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

@thockin Yeah, we want to move to using LocalObjectReference eventually.

Copy link
Member Author

Choose a reason for hiding this comment

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

@thockin For LocalObjectReference we would need to default the value of the old field for old clients. I can do that for both this and secrets in a follow-up if we want to do that now.

cc @smarterclayton @deads2k

Copy link
Member

Choose a reason for hiding this comment

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

SecretVolumeSource.SecretName is omitempty already, so you don't NEED to default it, strictly. I still would.

If we're going to move this way, why add ConfigMapName at all, if we just intend to deprecate it? We could just start with LocalObjectRef for this one and move Secret to be consistent, with a deprecated-but-working SecretName

Copy link
Member Author

Choose a reason for hiding this comment

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

@thockin ugh, you're right, but that's a bug. SecretName should not be omitempty, since it is required.

Anyway, I'm fine with using LocalObjectReference now, but I thought we wanted to make this like existing volumes. For example, we used Items for the list of projections into files because that's what downward API volume uses. If we use LocalObjectReference, we should use files instead of items, too. What do you say?

Copy link
Member Author

Choose a reason for hiding this comment

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

@thockin

type ConfigMapVolumeSource struct {
  LocalObjectReference `json:",inline"`

  Files []KeyToPath `json:"files,omitempty"`
}

Copy link
Member Author

Choose a reason for hiding this comment

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

@thockin

apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  containers:
    - name: test-container
      image: my-image
      volumeMounts:
          # name must match the volume name below
          - name: config-volume
            mountPath: /etc/config-volume
  volumes:
    - name: config-volume
      configMap:
        name: my-config-map
        files:
        - key: my-config-key
          path: path/to/config.properties
        - key: another-config-key
          path: path/to/logging.properties
  restartPolicy: Never

@bgrant0607 bgrant0607 assigned thockin and unassigned smarterclayton Jan 21, 2016
@bgrant0607
Copy link
Member

Please move this doc out of proposals to design.

@pmorie pmorie force-pushed the config-volume-proposal branch 2 times, most recently from f1d0b12 to b75f1f2 Compare January 21, 2016 21:14
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed kind/design Categorizes issue or PR as related to design. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 21, 2016
@k8s-github-robot
Copy link

Labelling this PR as size/M

@pmorie
Copy link
Member Author

pmorie commented Jan 21, 2016

@thockin Should be consistent internally now. Let me know if you desire more detail.

@k8s-bot
Copy link

k8s-bot commented Jan 21, 2016

GCE e2e test build/test passed for commit f1d0b120b57356026147e84f88b15a89fcd45168.

@pmorie
Copy link
Member Author

pmorie commented Jan 21, 2016

@k8s-bot unit test this

@k8s-bot
Copy link

k8s-bot commented Jan 21, 2016

GCE e2e test build/test passed for commit b75f1f2f2662c91bec998251bed1e0e1f6dcc359.

@thockin
Copy link
Member

thockin commented Jan 22, 2016

just the one point

@thockin
Copy link
Member

thockin commented Jan 22, 2016

GitHub lost all the comments. Yay GitHub.

@thockin ugh, you're right, but that's a bug. SecretName should not be omitempty, since it is required.

Nooooo! It's a feature, since you want it that way, now. :)

Anyway, I'm fine with using LocalObjectReference now, but I thought we wanted to make this like existing volumes. For example, we used Items for
the list of projections into files because that's what downward API volume uses. If we use LocalObjectReference, we should use files instead of items,
too. What do you say?

I do want consistency. Both can consistently use LocalObjectRef :) Deprecate Secret.SecretName. Internal has only Name. Conversion takes SecretName if it exists, else Name on the way in, and produces both on the way out.

Downward API still uses items, so these should use items, too. Deprecating a list is more trouble than it is worth here.

@bgrant0607
Copy link
Member

Please don't duplicate/alias fields in the same API versions. It's a royal PITA for updates.

// is the key and content is the value.
// If specified, the listed keys will be project into the specified paths, and
// unlisted keys will not be present.
Items []KeyToPath `json:"items,optional"`
Copy link
Member

Choose a reason for hiding this comment

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

s/optional/omitempty/

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed locally.

@pmorie
Copy link
Member Author

pmorie commented Jan 25, 2016

@bgrant0607

Please don't duplicate/alias fields in the same API versions. It's a royal PITA for updates.

So, keep secret as-is for now? Should we still use LocalObjectReference for config map volume?

@bgrant0607
Copy link
Member

Yes, keep Secret as is. We'll have to fix it in a future API version, if ever.

An inline LocalObjectReference for ConfigMap is fine. The redundant "configMap" string in the name field is unnecessary. The inconsistency is annoying, but exists in other objects also, and the fix for Secret is more complicated than it's worth.

@pmorie
Copy link
Member Author

pmorie commented Jan 25, 2016

@bgrant0607 Ack

@pmorie pmorie force-pushed the config-volume-proposal branch from b75f1f2 to 918a694 Compare January 25, 2016 18:48
@pmorie
Copy link
Member Author

pmorie commented Jan 25, 2016

@bgrant0607 @thockin feedback addressed

@k8s-bot
Copy link

k8s-bot commented Jan 25, 2016

GCE e2e test build/test passed for commit 918a694.

@bgrant0607
Copy link
Member

LGTM, thanks

@bgrant0607 bgrant0607 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 26, 2016
@k8s-github-robot
Copy link

Automatic merge from submit-queue

k8s-github-robot pushed a commit that referenced this pull request Jan 26, 2016
@k8s-github-robot k8s-github-robot merged commit 6f1ec1b into kubernetes:master Jan 26, 2016
xingzhou pushed a commit to xingzhou/kubernetes that referenced this pull request Dec 15, 2016
xingzhou pushed a commit to xingzhou/kubernetes that referenced this pull request Dec 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants