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

Resolve env vars in kubelet; add downward API env for pod name #6000

Closed
wants to merge 1 commit into from

Conversation

pmorie
Copy link
Member

@pmorie pmorie commented Mar 26, 2015

As discussed in #2316; also relevant to #386

@googlebot
Copy link

Thanks for your pull request.

It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/.

If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits.

Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name.

@pmorie
Copy link
Member Author

pmorie commented Mar 26, 2015

@smarterclayton @thockin @bgrant0607 PTAL; it needs a lot more doc.

@@ -55,6 +56,7 @@ import (
func init() {
api.ForTesting_ReferencesAllowBlankSelfLinks = true
util.ReallyCrash = true
flag.Set("v", "5")
Copy link
Member Author

Choose a reason for hiding this comment

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

I'll remove this once we're ready to put this in

&api.Pod{ObjectMeta: api.ObjectMeta{Namespace: "unknown", Name: "test-pod"}},
&api.Container{
Env: []api.EnvVar{
{Name: "BAR", Value: "bar"},
Copy link
Member

Choose a reason for hiding this comment

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

What will Docker's transitive expansion do for us? I looked at the code, but have forgotten already. I'd rather define a simpler mechanism to populate environment variables with Kubernetes data, and then rely upon Docker and/or the shell for more general expansion/substitution.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could introduce a separate field on EnvVar that is the source of the data, and disallow value via validation. That would clearly delineate the two.

----- Original Message -----

  •           },
    
  •       },
    
  •       "kubernetes",
    
  •       true,
    
  •       util.NewStringSet(
    
  •           "BAR=bar",
    
  •           "FOO=bar",
    
  •       ),
    
  •       2,
    
  •   },
    
  •   {
    
  •       "slightly more complex substitution",
    
  •       &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: "unknown", Name:
    
    "test-pod"}},
  •       &api.Container{
    
  •           Env: []api.EnvVar{
    
  •               {Name: "BAR", Value: "bar"},
    

What will Docker's transitive expansion do for us? I looked at the code, but
have forgotten already. I'd rather define a simpler mechanism to populate
environment variables with Kubernetes data, and then rely upon Docker and/or
the shell for more general expansion/substitution.


Reply to this email directly or view it on GitHub:
https://github.com/GoogleCloudPlatform/kubernetes/pull/6000/files#r27256435

Copy link
Member Author

Choose a reason for hiding this comment

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

@bgrant0607 @smarterclayton I cannot find an info regarding expansion of vars that is not scoped to the docker builder. If you can point me to anything, I'd appreciate it.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

So, yes, that's scoped to the builder.

Copy link
Member Author

Choose a reason for hiding this comment

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

@smarterclayton On second reading, I don't get the bools for fields thing.

Copy link
Contributor

Choose a reason for hiding this comment

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

It was for specific fields that are not cleanly represented by an API resource. I think ObjectReference makes sense for many cases, but not all data we expose necessarily has an API object (although maybe you could argue that they should).

----- Original Message -----

  •           },
    
  •       },
    
  •       "kubernetes",
    
  •       true,
    
  •       util.NewStringSet(
    
  •           "BAR=bar",
    
  •           "FOO=bar",
    
  •       ),
    
  •       2,
    
  •   },
    
  •   {
    
  •       "slightly more complex substitution",
    
  •       &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: "unknown", Name:
    
    "test-pod"}},
  •       &api.Container{
    
  •           Env: []api.EnvVar{
    
  •               {Name: "BAR", Value: "bar"},
    

@smarterclayton On second reading, I don't get the bools for fields thing.


Reply to this email directly or view it on GitHub:
https://github.com/GoogleCloudPlatform/kubernetes/pull/6000/files#r27497979

Copy link
Member

Choose a reason for hiding this comment

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

Yes, maybe they should.

What I think is great about all of the approaches discussed here is that the substitution is performed by the control plane, which preserves separation of dev/ops concerns.

By contrast, a downward API that would be directly read/polled/watched by applications would bake that API into many more thousands of applications than those otherwise targeting the management API. Consequently, such an API would need to be narrower and more slowly changing than the management API, since it would be much harder to change.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bgrant0607 what do you consider the control plane in this case?

Copy link
Member Author

Choose a reason for hiding this comment

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

@bgrant0607 Disregard, I see what you mean. That is a good point re: consuming the API within the image, and another facet of how hard it would be make a sensible API to consume that way.

@pmorie
Copy link
Member Author

pmorie commented Mar 28, 2015

This is parked until we figure out how we really want to do substitution.

@pmorie
Copy link
Member Author

pmorie commented Apr 11, 2015

@bgrant0607 @smarterclayton closing this one; will make another PR with the env var sources we discussed here.

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

Successfully merging this pull request may close these issues.

4 participants