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

Consider exposing petset index via downward api #30427

Closed
bprashanth opened this issue Aug 11, 2016 · 50 comments
Closed

Consider exposing petset index via downward api #30427

bprashanth opened this issue Aug 11, 2016 · 50 comments
Assignees
Labels
area/downward-api area/kubectl area/stateful-apps sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.

Comments

@bprashanth
Copy link
Contributor

bprashanth commented Aug 11, 2016

While it's easy enough to get through something like:
IFS='-' read -ra LIST <<< "$POD_NAME"; INDEX=${LIST[1]}
It requires a custom entrypoint. If the ordinal index is a common part of 12 fa apps we should just expose it more naturally through the downward api.

ref #30256
@tobegit3hub

@nhlfr
Copy link

nhlfr commented Aug 17, 2016

I'm going to work on this.

@bprashanth
Copy link
Contributor Author

@kubernetes/api-review-team @pmorie who to tag for downward api requests?
@smarterclayton out of petset interest

@smarterclayton
Copy link
Contributor

I agree that this is useful, although we need to be careful about how to
expose it.

On Wed, Aug 17, 2016 at 4:11 PM, Prashanth B notifications@github.com
wrote:

@kubernetes/api-review-team
https://github.com/orgs/kubernetes/teams/api-review-team @pmorie
https://github.com/pmorie who to tag for downward api requests?
@smarterclayton https://github.com/smarterclayton out of petset interest


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#30427 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABG_p9eA899Ppwfik9_u1R2vCJGusr29ks5qg2sIgaJpZM4JhzXh
.

@nhlfr
Copy link

nhlfr commented Aug 18, 2016

I'd suggest to keep a petset index in pod annotation (i.e. pod.beta.kubernetes.io/petset) and then pass it through downward API.

@smarterclayton
Copy link
Contributor

smarterclayton commented Aug 18, 2016 via email

@nhlfr
Copy link

nhlfr commented Aug 18, 2016

Of course. What I'm proposing is:

  • applying pod.beta.kubernetes.io/petset-index annotation with pet set index to any pods created during pets creation
  • adding dependencies.petSetIndex label which may be used for environment downward API
  • using the info from pod.beta.kubernetes.io/petset-index annotation to fill up the env with dependencies.petSetIndex field reference

@nhlfr
Copy link

nhlfr commented Aug 23, 2016

Due to discussion in PR, I decided to make an another issue about exposing annotations via downward API - #31218

In my PR, which is referring to this issue, I will only put an annotation with petset index on dependent pods. Then the general downward API for all annotations will make this petset index accessible.

I decided to use annotations, because I (and probably @smarterclayton ) think that we shoud'nt add any fields to Pod in case of alpha/beta features like petsets.

nhlfr pushed a commit to nhlfr/kubernetes that referenced this issue Sep 19, 2016
@alexouzounis
Copy link

is there a workaround for this currently ? If we don't want to change the entry point that is.

@smarterclayton
Copy link
Contributor

You can expose pod name via the downward API.

On Mon, Oct 31, 2016 at 1:08 PM, Alex Ouzounis notifications@github.com
wrote:

is there a workaround for this currently ? If we don't want to change the
entry point that is.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#30427 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABG_pxPnQufQk_29a18fSKcaKgcgMBiaks5q5iCQgaJpZM4JhzXh
.

@bprashanth
Copy link
Contributor Author

#30427 (comment), you can even replace POD_NAME with $(hostname) if you're using statefulset (aka petset)

@alexouzounis
Copy link

alexouzounis commented Oct 31, 2016

yeah - we are using PetSet and what we want is just the ordinal exposed in an environment variable i.e. 0, 1 etc. The pod name will be something like web-0 and i can't find a way to expose that in an env var.

@nhlfr
Copy link

nhlfr commented Nov 2, 2016

Sorry for leaving this issue without any action. PTAL on the issue #31218. It will surely not be touched in 1.5 release, but I've submitted a proposal to be considered for a future release.

@jberkus
Copy link

jberkus commented Nov 15, 2016

+1 on this feature, regardless of how it's implemented. Currently I'm parsing the pod name, which is awkward and fragile.

@alexouzounis
Copy link

Indeed - we ended doing the same as a postStart lifecycle hook to avoid modifying the docker image

@smarterclayton
Copy link
Contributor

@pmorie as we discussed we need to fully specify the downward API for
complex fields (annotations and labels) and get that over the review hump
in 1.6 so people can use an annotation in an env var. @liggitt too maybe.

On Tue, Nov 15, 2016 at 12:58 PM, Alex Ouzounis notifications@github.com
wrote:

Indeed - we ended doing the same as a postStart lifecycle hook to avoid
modifying the docker image


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#30427 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABG_p9oxBplas5h6lnuQsiFNU2U3YSUYks5q-h0SgaJpZM4JhzXh
.

@Aisuko
Copy link

Aisuko commented Jun 4, 2019

I tried the way name Pod hook, but they did not work for me. I want to get pods id of statefulsetl and add it to containers ENV. So, there is my solution below. It works for me.

env:
- name: POD_ID_OF_STATEFULSET 
   valueFrom:
     fieldRef:
       fieldPath: metadata.name
  POD_ID_OF_STATEFULSET:      phoenix-package-0 (v1:metadata.name)

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 3, 2019
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 3, 2019
@jberkus
Copy link

jberkus commented Oct 3, 2019

This issue has an active PR.

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Oct 3, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 1, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 1, 2020
@jlegrone
Copy link
Contributor

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Feb 29, 2020
@jberkus
Copy link

jberkus commented Mar 3, 2020

/remove-lifecycle rotten

This issue has an active PR

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 1, 2020
@bohdantverdyi
Copy link

bohdantverdyi commented Jun 15, 2020

/remove-lifecycle rotten

This issue has an active PR

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jul 15, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@bohdantverdyi
Copy link

/remove-lifecycle rotten

This issue has an active PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/downward-api area/kubectl area/stateful-apps sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
None yet