envoyproxy / gateway

Manages Envoy Proxy as a Standalone or Kubernetes-based Application Gateway
https://gateway.envoyproxy.io
Apache License 2.0
1.53k stars 328 forks source link

docs: use kubectl patch with `--type=merge` in docs #4022

Open kranurag7 opened 1 month ago

kranurag7 commented 1 month ago

Description:

I was trying out the following docs here https://gateway.envoyproxy.io/docs/tasks/security/tls-cert-manager/#creating-a-tls-gateway-listener the docs as of now suggests the following command for patch using --patch-file flag. This is not working out for me somehow. (I'm using bash shell)

$ kubectl patch gateway eg --patch-file=- <<EOF
metadata:
  annotations:
    cert-manager.io/cluster-issuer: selfsigned
    cert-manager.io/common-name: "Hello World!"
spec:
  listeners:
  - name: https
    protocol: HTTPS
    hostname: www.example.com
    port: 443
    tls:
      mode: Terminate
      certificateRefs:
      - kind: Secret
        name: eg-https
EOF
error: unable to read patch file: open -: no such file or directory
$ kubectl version
Client Version: v1.30.1
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.2

I updated the command and used the following:

$ kubectl patch gateway eg --patch '
metadata:
  annotations:
    cert-manager.io/cluster-issuer: selfsigned
    cert-manager.io/common-name: "Hello World!"
spec:
  listeners:
  - name: https
    protocol: HTTPS
    hostname: www.example.com
    port: 443
    tls:
      mode: Terminate
      certificateRefs:
      - kind: Secret
        name: eg-https
' --type=merge
gateway.gateway.networking.k8s.io/eg patched

This worked good for me. Is there something I'm missing in the first case which is documented as of now.

[optional Relevant Links:]

slack discussion: https://envoyproxy.slack.com/archives/C03E6NHLESV/p1723037137777729

arkodg commented 1 month ago

he @kranurag7 thanks for surfacing this issue, would be great if you can fix it in the docs

github-actions[bot] commented 19 hours ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days.