php-k8s icon indicating copy to clipboard operation
php-k8s copied to clipboard

Support for envFrom for containers

Open madalinignisca opened this issue 3 years ago • 2 comments

https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/pod-single-configmap-env-variable.yaml

Hi there. If I create a configMap, I can load the env from it, without being explicit on keys.

This makes life very easy for an isolated application with multiple services to load all environments from one single configmap.

Intention is to have a generic "Container" builder to which I tell it's configmap for env.

You already support creation of configmaps, so probably this would be only an addition to support env from configmaps.

PS: Multe salutari.

madalinignisca avatar Jul 28 '22 15:07 madalinignisca

I think macros should be added on the instance classes for custom methods. Would this be good?

Container::macro('getEnvFrom', function () {
    return $this->getAttribute('env'); // or something
});

rennokki avatar Aug 04 '22 13:08 rennokki

I think macros should be added on the instance classes for custom methods. Would this be good?

Container::macro('getEnvFrom', function () {
    return $this->getAttribute('env'); // or something
});

This is not a macro.

Look at the kubernetes docs. Same like you set env, you can reference a configmap or a secret to load the env.

https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/pod-configmap-envFrom.yaml

https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/inject/pod-secret-envFrom.yaml

madalinignisca avatar Aug 04 '22 20:08 madalinignisca

This issue has been automatically closed because it has not had any recent activity. 😨

stale[bot] avatar Sep 28 '22 02:09 stale[bot]

I've had an envFrom idea before, but got over it as it was easily to be set using macros like $container->setEnvFrom([['secretRef' => ...]]).

If anyone got a PR, I'll happily review it. :D

rennokki avatar Oct 22 '22 23:10 rennokki

This issue has been automatically closed because it has not had any recent activity. 😨

stale[bot] avatar Dec 23 '22 20:12 stale[bot]