renoki-co/php-k8s

Support for envFrom for containers

madalinignisca opened this issue · 5 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.

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
});

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

stale commented

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

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

stale commented

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