kubernetes-client
kubernetes-client copied to clipboard
How Can I Create ConfigMap From File
Hi, I want to create a configmap from file, is there any api implements the action kubectl create configmap [name] --from-flie=
I think this could be a good addition. We do have same functionality in Eclipse JKube ConfigMapEnricher .
We should port this functionality to a static utility method (preferably KubernetesResourceUtil) in KubernetesClient.
Expected Behavior:
Method's expected behavior should be same as defined in Kubernetes Docs.
Creating From File
Given File game.properteis
enemies=aliens
lives=3
enemies.cheat=true
enemies.cheat.level=noGoodRotten
secret.code.passphrase=UUDDLRLRBABAS
secret.code.allowed=true
secret.code.lives=30
When upon running this command:
kubectl create configmap game-config --from-file=game.properties
then this ConfigMap is created:
apiVersion: v1
data:
game.properties: |-
enemies=aliens
lives=3
enemies.cheat=true
enemies.cheat.level=noGoodRotten
secret.code.passphrase=UUDDLRLRBABAS
secret.code.allowed=true
secret.code.lives=30
kind: ConfigMap
metadata:
name: game-config
ConfigMap from directory
Given directory with files:
$ ls configure-pod-container/configmap/
game.properties ui.properties
When this command gets invoked:
$ kubectl create configmap game-config --from-file=configure-pod-container/configmap
Then this ConfigMap gets created:
apiVersion: v1
data:
game.properties: |-
enemies=aliens
lives=3
enemies.cheat=true
enemies.cheat.level=noGoodRotten
secret.code.passphrase=UUDDLRLRBABAS
secret.code.allowed=true
secret.code.lives=30
ui.properties: |
color.good=purple
color.bad=yellow
allow.textmode=true
how.nice.to.look=fairlyNice
kind: ConfigMap
metadata:
name: game-config
namespace: default
We should port this functionality to a static utility method (preferably KubernetesResourceUtil) in KubernetesClient.
Maybe also include it as part of the DSL for ConfigMaps
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!