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

How Can I Create ConfigMap From File #4184

Closed
stupid-yu opened this issue Jun 2, 2022 · 4 comments · Fixed by #5173
Closed

How Can I Create ConfigMap From File #4184

stupid-yu opened this issue Jun 2, 2022 · 4 comments · Fixed by #5173

Comments

@stupid-yu
Copy link

Hi, I want to create a configmap from file, is there any api implements the action kubectl create configmap [name] --from-flie=

@manusa manusa added this to the 6.x milestone Jun 6, 2022
@rohanKanojia
Copy link
Member

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

@manusa
Copy link
Member

manusa commented Jun 7, 2022

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

@stale
Copy link

stale bot commented Sep 5, 2022

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!

@stale stale bot added the status/stale label Sep 5, 2022
@stale
Copy link

stale bot commented Dec 8, 2022

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!

@stale stale bot added the status/stale label Dec 8, 2022
@rohanKanojia rohanKanojia moved this to Planned in Eclipse JKube Dec 14, 2022
@stale stale bot closed this as completed Dec 15, 2022
Repository owner moved this from Planned to Done in Eclipse JKube Dec 15, 2022
@rohanKanojia rohanKanojia reopened this Dec 15, 2022
@stale stale bot removed the status/stale label Dec 15, 2022
@rohanKanojia rohanKanojia moved this from Done to Planned in Eclipse JKube Dec 15, 2022
@rohanKanojia rohanKanojia self-assigned this Dec 23, 2022
@rohanKanojia rohanKanojia moved this from Planned to In Progress in Eclipse JKube Dec 23, 2022
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Dec 23, 2022
…m file (fabric8io#4184)

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Dec 26, 2022
…netesResourceUtil

Related to fabric8io/kubernetes-client#4184

Move creation of ConfigMap from file related logic to
KubernetesResourceUtil. This would later be replaced by
KubernetesClient's KubernetesResourceUtil methods on next upgrade.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Dec 26, 2022
…netesResourceUtil

Related to fabric8io/kubernetes-client#4184

Move creation of ConfigMap from file related logic to
KubernetesResourceUtil. This would later be replaced by
KubernetesClient's KubernetesResourceUtil methods on next upgrade.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Dec 26, 2022
…m file (fabric8io#4184)

+ Added ConfigMapResource for modifying default ConfigMap operations
+ Added FromFileCreatable DSL method to provide file
+ Move KubernetesResourceUtilTest to
  `io.fabric8.kubernetes.client.utils`

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Dec 26, 2022
…m file (fabric8io#4184)

+ Added ConfigMapResource for modifying default ConfigMap operations
+ Added FromFileCreatable DSL method to provide file
+ Move KubernetesResourceUtilTest to
  `io.fabric8.kubernetes.client.utils`

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Dec 26, 2022
…m file (fabric8io#4184)

+ Added ConfigMapResource for modifying default ConfigMap operations
+ Added FromFileCreatable DSL method to provide file
+ Move KubernetesResourceUtilTest to
  `io.fabric8.kubernetes.client.utils`

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Dec 26, 2022
…m file (fabric8io#4184)

+ Added ConfigMapResource for modifying default ConfigMap operations
+ Added FromFileCreatable DSL method to provide file
+ Move KubernetesResourceUtilTest to
  `io.fabric8.kubernetes.client.utils`

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Dec 26, 2022
…m file (fabric8io#4184)

+ Added ConfigMapResource for modifying default ConfigMap operations
+ Added FromFileCreatable DSL method to provide file
+ Move KubernetesResourceUtilTest to
  `io.fabric8.kubernetes.client.utils`

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Dec 27, 2022
…m file (fabric8io#4184)

+ Added ConfigMapResource for modifying default ConfigMap operations
+ Added FromFileCreatable DSL method to provide file
+ Move KubernetesResourceUtilTest to
  `io.fabric8.kubernetes.client.utils`

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@manusa manusa modified the milestones: 6.x, 6.4.0 Jan 4, 2023
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Jan 9, 2023
…m file (fabric8io#4184)

+ Added ConfigMapResource for modifying default ConfigMap operations
+ Added FromFileCreatable DSL method to provide file
+ Move KubernetesResourceUtilTest to
  `io.fabric8.kubernetes.client.utils`

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Jan 12, 2023
…m file (fabric8io#4184)

+ Added ConfigMapResource for modifying default ConfigMap operations
+ Added FromFileCreatable DSL method to provide file
+ Move KubernetesResourceUtilTest to
  `io.fabric8.kubernetes.client.utils`

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@manusa manusa modified the milestones: 6.4.0, 6.x Jan 18, 2023
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Jan 18, 2023
…m file (fabric8io#4184)

+ Added ConfigMapResource for modifying default ConfigMap operations
+ Added FromFileCreatable DSL method to provide file
+ Move KubernetesResourceUtilTest to
  `io.fabric8.kubernetes.client.utils`

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@manusa manusa modified the milestones: 6.x, 6.4.0 Jan 19, 2023
@rohanKanojia rohanKanojia moved this from Review to In Progress in Eclipse JKube Jan 23, 2023
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Jan 24, 2023
…m file (fabric8io#4184)

+ Added ConfigMapResource for modifying default ConfigMap operations
+ Added FromFileCreatable DSL method to provide file
+ Move KubernetesResourceUtilTest to
  `io.fabric8.kubernetes.client.utils`

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@rohanKanojia rohanKanojia moved this from In Progress to Review in Eclipse JKube Jan 25, 2023
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Jan 26, 2023
now that we're considering allowing for the modification of the current
item, and not just create, this makes the api more consistent with the
rest of the dsl
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Jan 26, 2023
now that we're considering allowing for the modification of the current
item, and not just create, this makes the api more consistent with the
rest of the dsl
@manusa manusa moved this from Review to In Progress in Eclipse JKube Feb 15, 2023
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Feb 17, 2023
…m file (fabric8io#4184)

+ Added ConfigMapResource for modifying default ConfigMap operations
+ Added FromFileCreatable DSL method to provide file
+ Move KubernetesResourceUtilTest to
  `io.fabric8.kubernetes.client.utils`

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
shawkins added a commit to shawkins/kubernetes-client that referenced this issue May 24, 2023
shawkins added a commit to shawkins/kubernetes-client that referenced this issue May 24, 2023
shawkins added a commit to shawkins/kubernetes-client that referenced this issue May 24, 2023
shawkins added a commit to shawkins/kubernetes-client that referenced this issue May 24, 2023
@manusa manusa modified the milestones: 6.x, 6.7.0 May 30, 2023
manusa added a commit that referenced this issue May 30, 2023
feat (kubernetes-client) : Add utility methods to KubernetesResourceUtil for creating ConfigMap from file (#4184)
@github-project-automation github-project-automation bot moved this from In Progress to Done in Eclipse JKube May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment