自动将外部IP附着在服务资源上的突变Webhook

62 阅读1分钟

负载平衡器IP-突变器

突变webhook,将loadBalancerIP参数附加到服务资源。

动机

有些服务控制器不会自动将loadBalancerIP 参数附加到带有type: LoadBalancer 参数的服务资源上。例如,VMware 上的 Anthos 与 Seesaw 负载均衡器集成。这个突变的webhook允许从选项指定的IP地址池中自动附加它。

使用方法

This application is MutationWebhook to attach loadBalancerIP to Service resource from a IP pool if not presented

Usage:
  loadbalancerip-mutator [flags]

Flags:
  -h, --help                   help for loadbalancerip-mutator
  -v, --level string           [OPTIONAL] Log level. Valid value is debug, info, warn and error (default "info")
  -p, --pool string            [REQUIRED] specify ip pool that will be attached through this MutationWebhook. Valid value is comma separated CIDR list e.g. "10.10.100.10/32,10.10.10.128/25,10.10.100.0/24"
  -c, --tls-cert-file string   [REQUIRED] path of TLS cert file
  -k, --tls-key-file string    [REQUIRED] path of TLS key file

开始使用

突变webhook需要附加TLS证书。我建议使用cert-manager来管理它。一旦你准备好TLS证书,你就可以通过Helm部署loadbalancerip-mutator。下面是一个Helmfile的例子:

repositories:
  - name: loadbalancerip-mutator
    url: https://sshota0809.github.io/loadbalancerip-mutator

releases:
  - name: loadbalancerip-mutator
    namespace: loadbalancerip-mutator
    chart: loadbalancerip-mutator/loadbalancerip-mutator
    version: 0.1.0