istio - 安装期间的 Istio-ingressgateway 自定义
问题描述
在 Istio 安装期间,我需要将 Istio ingressgateway(网关对象)的“主机”从默认值“*”更改为“whatever”。我们正在使用 IstioOperator 对我们的安装进行自定义。我认为应该用k8s覆盖来完成
...
k8s:
overlays:
- kind: Gateway
name: istio-ingressgateway
patches:
- path: spec.servers.??????
value: whatever
...
path 属性的表达式应该是什么?
我在https://github.com/istio/istio/blob/master/operator/pkg/patch/patch.go上找到了一些信息,但情况并不完全相同。
因此,命名空间 istio-system 中的 istio-gateway Gateway 对象应该从
spec:
servers:
- hosts:
- '*'
port:
name: http
number: 80
protocol: HTTP
到
spec:
servers:
- hosts:
- whatever
port:
name: http
number: 80
protocol: HTTP
我们正在使用 Istio 1.5.6
谢谢 !
更新一个工作示例
感谢@Jakub为我指明了正确的方向。
overlays:
- kind: Gateway
name: istio-ingressgateway
patches:
- path: spec.servers[0]
value:
hosts:
- whatever.dummy
port:
name: http
number: 80
protocol: HTTP
解决方案
我将此作为社区 wiki 答案发布,以提高知名度。
@Jens Wurm 提供的答案和代码示例对此有类似的问题。
这是覆盖的一部分,它将添加另一个带有一些示例规范的服务器条目。只需将其调整为您想要的方式即可。您还可以使用 spec.servers[0] 的路径覆盖您的第一个服务器条目,然后将值设置为您想要的任何值。
ingressGateways:
- enabled: true
k8s:
overlays:
- apiVersion: networking.istio.io/v1alpha3
kind: Gateway
name: ingressgateway
patches:
- path: spec.servers[1]
value:
hosts:
- '*.example.com'
port:
name: https
number: 443
protocol: HTTPS
tls:
credentialName: example-cert
mode: SIMPLE
privateKey: sds
serverCertificate: sds
@Peter Claes 提供了一个工作示例
overlays:
- kind: Gateway
name: istio-ingressgateway
patches:
- path: spec.servers[0]
value:
hosts:
- whatever.dummy
port:
name: http
number: 80
protocol: HTTP
推荐阅读
- flutter - 如果用户注销并重新登录,WillPopScope 将不起作用
- azure-virtual-machine - 如何使用 Azure VPN 作为代理网关
- linux - 无法使用正确的密码连接到 ssh
- ios - 加载太多图像时,Ionic 5 iOS 应用程序重新启动
- java - @Transactional 注释仅在类中声明时有效
- python - 如何在python中显示更好的输出解释
- c# - UWP SQLite 错误:“尝试写入只读数据库”
- c# - Azure 不显示托管 .net 核心 API 的自定义错误消息
- java - 需要 Spring kafka 自定义日志记录
- javascript - 条件问题和输入的两个更改事件