kubectl patch configmap dec --namespace=namespace1 --patch {"data": {"config": {"staticPasswords": {"email": "
[email protected]
","hash": "1234"}}}}
zsh: parse error near `}'
kubectl patch --type=json configmap dec --namespace=namespace1 --patch '{"data": {"config": {"staticPasswords": {"email": "
[email protected]
","hash": "1234"}}}}'
Error from server (BadRequest): json: cannot unmarshal object into Go value of type jsonpatch.Patch
kubectl patch configmap dec --namespace=namespace1 --patch 'data:\n config:\n staticPasswords:\n - email:
[email protected]
\n hash: 1234'
error: unable to parse "data:\n configl:\n staticPasswords:\n - email:
[email protected]
\n hash: 1234": yaml: mapping values are not allowed in this context
kubectl patch --type=json configmap dec --namespace=namespace1 --patch '{"data": {"config": {"staticPasswords": {"email": "
[email protected]
","hash": "1234"}}}}'
kubectl patch configmap dec --namespace=namespace1 --patch 'data:\n config:\n staticPasswords:\n - email:
[email protected]
\n hash: 1234'
kubectl version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.16", GitCommit:"60e5135f758b6e43d0523b3277e8d34b4ab3801f", GitTreeState:"clean", BuildDate:"2023-01-18T16:01:10Z", GoVersion:"go1.19.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"23+", GitVersion:"v1.23.17-eks-0a21954", GitCommit:"cd5c12c51b0899612375453f7a7c2e7b6563f5e9", GitTreeState:"clean", BuildDate:"2023-04-15T00:32:27Z", GoVersion:"go1.19.6", Compiler:"gc", Platform:"linux/amd64"}
$ uname -a
noorins@noorinsBMD6R symphony % uname -a
Darwin noorinsBMD6R.vmware.com 21.6.0 Darwin Kernel Version 21.6.0: Thu Mar 9 20:08:59 PST 2023; root:xnu-8020.240.18.700.8~1/RELEASE_X86_64 x86_64
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, ...) and versions (if applicable)
This issue is currently awaiting triage.
If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted
label and provide further guidance.
The triage/accepted
label can be added by org members by writing /triage accepted
in a comment.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
Hi @noorinshaikh,
See Blog post https://kubernetes.io/blog/2021/05/14/using-finalizers-to-control-deletion/#understanding-finalizers which is having example of patch configmap and check where you are doing wrong.
I hope that will be helpful to you.
ConfigMap data is a key-value struct, so you can't patch a nested JSON data. Also you should escape quotes in JSON value.
$ k patch cm dec --patch '{"data": {"config": "{\"staticPasswords\": {\"email\": \"[email protected]\",\"hash\": \"1234\"}}"}}'
configmap/dec patched
$ k get cm dec -o yaml
apiVersion: v1
data:
config: '{"staticPasswords": {"email": "[email protected]","hash": "1234"}}'
kind: ConfigMap
metadata:
creationTimestamp: "2023-05-25T05:59:36Z"
name: dec
namespace: default
resourceVersion: "1424"
uid: 474eb9c7-f52b-4e59-a4b5-59dbafe8343a
/remove-kind bug
/kind support
@iyear Thanks for the response,
However I need it to append something like this:
Before patch:
apiVersion: v1
data:
config: |
issuer: xxxxx
storage:
type: kubernetes
config:
inCluster: true
http: 0.0.0.0:4444
logger:
level: "debug"
format: text
oauth2:
skipApprovalScreen: true
enablePasswordDB: true
staticPasswords:
- email: [email protected]
hash: 1234
username: user1
userID: "1"
staticClients:
# https://github.com/dexidp/dex/pull/1664
- idEnv: IIIIIID
redirectURIs: ["/login/xyz"]
name: 'Dec Login App'
secretEnv: CLIENT_SECRET
kind: ConfigMap
metadata:
annotations:
meta.helm.sh/release-name: dec
meta.helm.sh/release-namespace: default
creationTimestamp: "2022-11-29T03:11"
labels:
app.kubernetes.io/managed-by: Helm
name: dec
namespace: auth
resourceVersion: "98765"
uid: a9665139-35a5-4567-91bg-1db9eb431def
Patch data:
data:
config: |
staticPasswords:
- email: [email protected]
hash: 12345
username: user2
After patch:
apiVersion: v1
data:
config: |
issuer: xxxxx
storage:
type: kubernetes
config:
inCluster: true
http: 0.0.0.0:4444
logger:
level: "debug"
format: text
oauth2:
skipApprovalScreen: true
enablePasswordDB: true
staticPasswords:
- email: [email protected]
hash: 1234
username: user1
userID: "1"
- email: [email protected]
hash: 12345
username: user2
staticClients:
# https://github.com/dexidp/dex/pull/1664
- idEnv: IIIIIID
redirectURIs: ["/login/xyz"]
name: 'Dec Login App'
secretEnv: CLIENT_SECRET
kind: ConfigMap
metadata:
annotations:
meta.helm.sh/release-name: dec
meta.helm.sh/release-namespace: default
creationTimestamp: "2022-11-29T03:11"
labels:
app.kubernetes.io/managed-by: Helm
name: dec
namespace: auth
resourceVersion: "98765"
uid: a9665139-35a5-4567-91bg-1db9eb431def
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
After 90d of inactivity, lifecycle/stale
is applied
After 30d of inactivity since lifecycle/stale
was applied, lifecycle/rotten
is applied
After 30d of inactivity since lifecycle/rotten
was applied, the issue is closed
You can:
Mark this issue as fresh with /remove-lifecycle stale
Close this issue with /close
Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
lifecycle/stale
Denotes an issue or PR has remained open with no activity and has become stale.
label
Jan 21, 2024
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
After 90d of inactivity, lifecycle/stale
is applied
After 30d of inactivity since lifecycle/stale
was applied, lifecycle/rotten
is applied
After 30d of inactivity since lifecycle/rotten
was applied, the issue is closed
You can:
Mark this issue as fresh with /remove-lifecycle rotten
Close this issue with /close
Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
lifecycle/rotten
Denotes an issue or PR that has aged beyond stale and will be auto-closed.
and removed
lifecycle/stale
Denotes an issue or PR has remained open with no activity and has become stale.
labels
Feb 20, 2024
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
After 90d of inactivity, lifecycle/stale
is applied
After 30d of inactivity since lifecycle/stale
was applied, lifecycle/rotten
is applied
After 30d of inactivity since lifecycle/rotten
was applied, the issue is closed
You can:
Reopen this issue with /reopen
Mark this issue as fresh with /remove-lifecycle rotten
Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
After 90d of inactivity, lifecycle/stale
is applied
After 30d of inactivity since lifecycle/stale
was applied, lifecycle/rotten
is applied
After 30d of inactivity since lifecycle/rotten
was applied, the issue is closed
You can:
Reopen this issue with /reopen
Mark this issue as fresh with /remove-lifecycle rotten
Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
lifecycle/rotten
Denotes an issue or PR that has aged beyond stale and will be auto-closed.
needs-triage
Indicates an issue or PR lacks a `triage/foo` label and requires one.
sig/cli
Categorizes an issue or PR as relevant to SIG CLI.