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

docs: make kubectl patch commands use yaml instead of json payloads, for legibility #3180

Closed
eitansuez opened this issue Apr 11, 2024 · 4 comments · Fixed by #3184
Closed
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed

Comments

@eitansuez
Copy link
Contributor

Description:

i wonder whether the kubectl patch commands used in different guides can be recast using yaml instead of json, to eliminate some of that noise.

example:

https://gateway.envoyproxy.io/v1.0.1/tasks/security/basic-auth/#enable-https

kubectl patch gateway eg --type=json --patch '[{
   "op": "add",
   "path": "/spec/listeners/-",
   "value": {
      "name": "https",
      "protocol": "HTTPS",
      "port": 443,
      "tls": {
        "mode": "Terminate",
        "certificateRefs": [{
          "kind": "Secret",
          "group": "",
          "name": "example-cert",
        }],
      },
    },
}]'

becomes..

cat <<EOF | kubectl patch gateway eg --type=json --patch-file=/dev/stdin
- op: add
  path: "/spec/listeners/-"
  value:
    name: https
    protocol: HTTPS
    port: 443
    tls:
      mode: Terminate
      certificateRefs:
      - group: ""
        kind: Secret
        name: example-cert
EOF

i'm not sure the yaml example above is the canonical way of using kubectl patch with yaml. i'll look more closely at that if this issue is accepted post-triage.

@arkodg
Copy link
Contributor

arkodg commented Apr 12, 2024

big +1

@arkodg arkodg added documentation Improvements or additions to documentation help wanted Extra attention is needed and removed triage labels Apr 12, 2024
@eitansuez
Copy link
Contributor Author

i looks like the above example can be simplified slightly to:

kubectl patch gateway eg --type=json --patch '
  - op: add
    path: "/spec/listeners/-"
    value:
      name: https
      protocol: HTTPS
      port: 443
      tls:
        mode: Terminate
        certificateRefs:
        - group: ""
          kind: Secret
          name: example-cert
  '

i'll use that format as the recipe to edit each instance.

@ShyunnY
Copy link
Contributor

ShyunnY commented Apr 12, 2024

i looks like the above example can be simplified slightly to:

kubectl patch gateway eg --type=json --patch '
  - op: add
    path: "/spec/listeners/-"
    value:
      name: https
      protocol: HTTPS
      port: 443
      tls:
        mode: Terminate
        certificateRefs:
        - group: ""
          kind: Secret
          name: example-cert
  '

i'll use that format as the recipe to edit each instance.

Maybe it would be better to execute after we redirect the results to a file, like the solution you started with: cat <<EOF ... EOF

@eitansuez
Copy link
Contributor Author

so for this issue the plan is to just translate the json to yaml. in a separate issue the idea is to provide two tabs, where one will just display the resource (or patch file) to apply, decoupled from the command that actually applies it.

eitansuez pushed a commit to eitansuez/gateway that referenced this issue Apr 12, 2024
Signed-off-by: Eitan Suez <eitan@tetrate.io>
eitansuez pushed a commit to eitansuez/gateway that referenced this issue Apr 12, 2024
eitansuez pushed a commit to eitansuez/gateway that referenced this issue Apr 15, 2024
Signed-off-by: Eitan Suez <eitan@tetrate.io>
eitansuez pushed a commit to eitansuez/gateway that referenced this issue Apr 15, 2024
eitansuez pushed a commit to eitansuez/gateway that referenced this issue Apr 16, 2024
Signed-off-by: Eitan Suez <eitan@tetrate.io>
eitansuez pushed a commit to eitansuez/gateway that referenced this issue Apr 16, 2024
eitansuez pushed a commit to eitansuez/gateway that referenced this issue Apr 17, 2024
Signed-off-by: Eitan Suez <eitan@tetrate.io>
eitansuez pushed a commit to eitansuez/gateway that referenced this issue Apr 17, 2024
arkodg pushed a commit that referenced this issue Apr 19, 2024
* docs: replaces json patch bodies with yaml format (#3180)

Signed-off-by: Eitan Suez <eitan@tetrate.io>

* docs: replaces json patch bodies with yaml format, in 'latest' version (#3180)

Signed-off-by: Eitan Suez <eitan@tetrate.io>

* docs - gateway address - removes auto-inserted prereqs anchor link

Signed-off-by: Eitan Suez <eitan@tetrate.io>

* docs - mutual tls - reverting edit of link to quickstart

Signed-off-by: Eitan Suez <eitan@tetrate.io>

---------

Signed-off-by: Eitan Suez <eitan@tetrate.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants