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

podman kube play should be able to read the bash variables #21057

Closed
antverpp opened this issue Dec 19, 2023 · 8 comments
Closed

podman kube play should be able to read the bash variables #21057

antverpp opened this issue Dec 19, 2023 · 8 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. kube locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. stale-issue

Comments

@antverpp
Copy link

Feature request description

For example, I have a number of manifests, where I want to refer some values by an environment variable:
spec:
containers:

  • name:
    image: ${REGISTRY}/:${TAG}

where REGISTRY and TAG are defined as env variables, for example in the .env file.

Suggest potential solution

A clear and concise description of what you want to happen.

Have you considered any alternatives?

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

@antverpp antverpp added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 19, 2023
@antverpp
Copy link
Author

A clear and concise description of what you want to happen:
So, I define variables in .env file.
And I refer them in the manifest, as described above.
Like, REGISTRY=myregistry.com, TAG=0.0.1

And as a result, the podman play kube should render the manifest and pull the image myregistry.com/myname:0.0.1,
being defined in the yaml manifest as "image: ${REGISTRY}/myname:${TAG}"

@rhatdan
Copy link
Member

rhatdan commented Dec 19, 2023

Interested in opening a PR to make this happen?

@rhatdan rhatdan added the kube label Dec 19, 2023
@giuseppe
Copy link
Member

Does Kubernetes support it?

@roman-kiselenko
Copy link

Kubernetes YAML doesn't support this kind of variable interpolation.
You can achieve the same thing with envsubst

# my_pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: foobar
spec:
  containers:
  - name: container-1
    image: ${REGISTRY}/${REPO}:${TAG}
REGISTRY=myregistry.com REPO=project TAG=0.0.1 envsubst < my_pod.yaml > pod.yaml
# pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: foobar
spec:
  containers:
  - name: container-1
    image: myregistry.com/project:0.0.1

@antverpp
Copy link
Author

Does Kubernetes support it?

Well, at least the well-known RedHat product can do it pretty well: oc process --param-file=test.env -f test.yaml | oc create -f -

@rgprajeen
Copy link

So, can't this be achieved by using sed? Like using a format like __VARNAME__ in the yaml file and later generating a new yaml using sed -i "s|__VARNAME__|${VARNAME}|g"

Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jan 21, 2024

Since we have not heard back, closing. Reopen if you have more feedback.

@rhatdan rhatdan closed this as completed Jan 21, 2024
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Apr 21, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Categorizes issue or PR as related to a new feature. kube locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. stale-issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants