Re: [kubernetes/kubernetes] kubectl patch should accept stdin for -p (#17028)

3 views
Skip to first unread message

Michail Kargakis

unread,
Jun 10, 2017, 12:13:17 PM6/10/17
to kubernetes/kubernetes, k8s-mirror-cli-feature-requests, Team mention

@kubernetes/sig-cli-feature-requests


You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

fejta-bot

unread,
Dec 26, 2017, 11:30:32 PM12/26/17
to kubernetes/kubernetes, k8s-mirror-cli-feature-requests, Team mention

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale

Kai Groner

unread,
Jan 17, 2018, 11:57:06 AM1/17/18
to kubernetes/kubernetes, k8s-mirror-cli-feature-requests, Team mention

Using -p "$(cat)" works to load the secret from stdin.

:; jq '{stringData: .AccessKey}' create-access-key-response.json |
    kubectl patch secret whatever-aws-apikey -p "$(cat)"
secret "whatever-aws-apikey" patched

fejta-bot

unread,
Feb 16, 2018, 12:04:41 PM2/16/18
to kubernetes/kubernetes, k8s-mirror-cli-feature-requests, Team mention

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale

k8s-ci-robot

unread,
Apr 14, 2018, 8:03:22 PM4/14/18
to kubernetes/kubernetes, k8s-mirror-cli-feature-requests, Team mention

Closed #17028.

fejta-bot

unread,
Apr 14, 2018, 8:03:41 PM4/14/18
to kubernetes/kubernetes, k8s-mirror-cli-feature-requests, Team mention

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.


Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Aaron Curtis

unread,
May 19, 2020, 10:06:34 PM5/19/20
to kubernetes/kubernetes, k8s-mirror-cli-feature-requests, Team mention

/remove-lifecycle rotten
Got here because I was trying to figure out how to load a patch from a file... seems like the -p "(cat mypatch.yaml)" method is the best so far. I really think patch and apply should behave identically, though, with regards to supplying the json or yaml from a file or stdin.


You are receiving this because you are on a team that was mentioned.

Reply to this email directly, view it on GitHub, or unsubscribe.

Aaron Curtis

unread,
May 19, 2020, 10:07:10 PM5/19/20
to kubernetes/kubernetes, k8s-mirror-cli-feature-requests, Team mention

/reopen

Kubernetes Prow Robot

unread,
May 19, 2020, 10:07:26 PM5/19/20
to kubernetes/kubernetes, k8s-mirror-cli-feature-requests, Team mention

@foobarbecue: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen

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.

Julius Michaelis

unread,
Feb 17, 2021, 7:50:45 PM2/17/21
to kubernetes/kubernetes, k8s-mirror-cli-feature-requests, Team mention

(Obvious warning that kubectl patch secret foo -p "$(cat)" is not giving the security benefits that "read secrets from stdin" has.)
My reason for wanting this: what if your patch is bigger than getconf ARG_MAX?

Nguyễn Đức Chiến

unread,
Dec 12, 2021, 6:12:33 PM12/12/21
to kubernetes/kubernetes, k8s-mirror-cli-feature-requests, Team mention

For anyone who is having trouble with this. You can try

kubectl patch secret foo --type=json --patch-file=/dev/stdin <<-EOF
  [
    {
      "op": "replace",
      "path": "/data/metadata/name",
      "value": "bar"
    }
  ]
EOF


You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.

David Shen

unread,
Aug 28, 2023, 2:06:49 AM8/28/23
to kubernetes/kubernetes, k8s-mirror-cli-feature-requests, Team mention

/reopen
/remove-lifecycle rotten

I still experience this issue with kubectl v1.27.4.

clientVersion:
  buildDate: "2023-07-28T09:46:04Z"
  compiler: gc
  gitCommit: 36645e7311e9bdbbf2adb79ecd8bd68556bc86f6
  gitTreeState: clean
  gitVersion: v1.27.4+k3s1
  goVersion: go1.20.6
  major: "1"
  minor: "27"
  platform: linux/amd64
kustomizeVersion: v5.0.1
serverVersion:
  buildDate: "2023-07-28T09:46:04Z"
  compiler: gc
  gitCommit: 36645e7311e9bdbbf2adb79ecd8bd68556bc86f6
  gitTreeState: clean
  gitVersion: v1.27.4+k3s1
  goVersion: go1.20.6
  major: "1"
  minor: "27"
  platform: linux/amd64

I just tried @nobiit 's suggestion and it works. How come it can read from /dev/stdin, but ignore -? Using - as the standard input is the Linux standard.

kubectl apply -f - works just as expected.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are on a team that was mentioned.Message ID: <kubernetes/kubernetes/issues/17028/1695071333@github.com>

Kubernetes Prow Robot

unread,
Aug 28, 2023, 2:06:53 AM8/28/23
to kubernetes/kubernetes, k8s-mirror-cli-feature-requests, Team mention

@davidshen84: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen
/remove-lifecycle rotten

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.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are on a team that was mentioned.Message ID: <kubernetes/kubernetes/issues/17028/1695071492@github.com>

Simon Oakes

unread,
Jun 11, 2024, 7:10:04 AM6/11/24
to kubernetes/kubernetes, k8s-mirror-cli-feature-requests, Team mention

For anyone who is having trouble with this. You can try

kubectl patch secret foo --type=json --patch-file=/dev/stdin <<-EOF
  [
    {
      "op": "replace",
      "path": "/data/metadata/name",
      "value": "bar"
    }
  ]
EOF

Many thanks for the workaround @nobiit , this works a treat. I must admit I didnt think about trying this. Kudos to you sir.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are on a team that was mentioned.Message ID: <kubernetes/kubernetes/issues/17028/2160474957@github.com>

Reply all
Reply to author
Forward
0 new messages