全部產品
Search
文件中心

Alibaba Cloud Service Mesh:ASM網關CRD說明

更新時間:Jun 30, 2024

ASM提供了一個kindIstioGatewayapiVersionistio.alibabacloud.com/v1beta1的自訂資源定義CRD(Custom Resource Definition),並提供了相應的Controller。通過監聽該CRD資源變化事件,對應的Controller可以在Kubernetes叢集中同步對應的Service、Deployment以及相關聯的ServiceAccount等。本文介紹ASM網關CRD的配置樣本和欄位說明。

配置樣本

前提條件

添加叢集到ASM執行個體

重要

新增ASM網關必須建立在命名空間istio-system中,以便擷取相關的配置資訊。在Istio1.6及以上的版本中,部署到其他命名空間,會因為不能擷取相關配置而導致ASM網關無法正常啟動。

樣本一:使用KubeAPI管理入口網關

  1. 登入ASM控制台,在左側導覽列,選擇服務網格 > 網格管理

  2. 網格管理頁面,單擊目標執行個體名稱,然後在左側導覽列,選擇ASM網關 > 入口網關

  3. 入口網關頁面,單擊使用YAML建立

  4. 建立頁面,輸入網關的名稱,選擇命名空間為istio-system,配置如下YAML,然後單擊建立

    關於欄位的說明,請參見CRD欄位說明

    展開查看YAML檔案

    apiVersion: istio.alibabacloud.com/v1beta1
    kind: IstioGateway
    metadata:   
      name: "myexample-customingressgateway"  
      namespace: "istio-system"
    spec:  
      clusterIds:
        - "${實際的叢集ID}"
        - "${實際的叢集ID}"   # ASM網關支援部署在多個叢集中。
      cpu: 
        targetAverageUtilization: 80
      env:
        - name: "envname1"
          value: "envvalue1"
      externalTrafficPolicy: Local
      gatewayType: ingress
      podLabels:
        key1: value1
      ports:  
      - name: status-port    
        port: 15020    
        targetPort: 15020  
      - name: http2    
        port: 80    
        targetPort: 80  
      - name: https    
        port: 443    
        targetPort: 0  
      - name: tls    
        port: 15443    
        targetPort: 15443  
      replicaCount: 1  
      resources:
        limits:
          cpu: '2'
          memory: 2G
        requests:
          cpu: 200m
          memory: 256Mi
    # - name: config-volume-lua
    #  configMapName: lua-libs
    #  mountPath: /var/lib/lua
    # secretVolumes:
    # - name: myexample-customingressgateway-certs
    #   secretName: istio-myexample-customingressgateway-certs
    #   mountPath: /etc/istio/myexample-customingressgateway-certs
      serviceType: LoadBalancer  
      serviceAnnotations:    
        service.beta.kubernetes.io/alicloud-loadbalancer-address-type: internet  
      serviceLabels:
        serviceLabelKey1: "serviceLabelValue1"
      podAnnotations:
        podAnnotationsKey1: "podAnnotationsValue1"
      rollingMaxSurge: "100%"
      rollingMaxUnavailable: "25%"
      overrides:
        cluster1Id:
          replicaCount: 1 
          resources:
            limits:
              cpu: '2'
              memory: 2G
            requests:
              cpu: 200m
              memory: 256Mi
          serviceAnnotations:    
            service.beta.kubernetes.io/alicloud-loadbalancer-address-type: internet
            service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: "slb.s1.small"
        cluster2Id:
          replicaCount: 2
          resources:
            limits:
              cpu: '4'
              memory: 4G
            requests:
              cpu: 400m
              memory: 512Mi
          serviceAnnotations:    
            service.beta.kubernetes.io/alicloud-loadbalancer-address-type: internet
            service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: "slb.s2.small"

    說明

    若您需要使用Kubernetes Client操作入口網關,請參見網關Go Struct實現

  5. 查看入口網關的服務資訊。

    1. 登入Container Service管理主控台,在左側導覽列選擇叢集

    2. 叢集列表頁面,單擊目的地組群名稱,然後在左側導覽列,選擇網路 > 服務

    3. 服務頁面上方,從命名空間下拉式清單中,選擇istio-system

    4. 在服務列表中,單擊目標服務名稱,查看入口網關的服務資訊。

  6. 查看入口網關的Pod資訊。

    1. 登入Container Service管理主控台,在左側導覽列選擇叢集

    2. 叢集列表頁面,單擊目的地組群名稱,然後在左側導覽列,選擇工作負載 > 容器組

    3. 容器組頁面上方,從命名空間下拉式清單中,選擇istio-system

    4. 在Pod列表中,單擊目標Pod名稱,查看入口網關的Pod資訊。

樣本二:使用KubeAPI管理出口網關

ASM提供出口網關服務,為網格內應用提供統一的流量出口。

  1. 登入ASM控制台,在左側導覽列,選擇服務網格 > 網格管理

  2. 網格管理頁面,單擊目標執行個體名稱,然後在左側導覽列,選擇ASM網關 > 出口網關

  3. 出口網關頁面,單擊使用YAML建立

  4. 建立頁面,輸入出口網關的名稱,選擇命名空間為istio-system,配置如下YAML,然後單擊建立

    關於欄位的說明,請參見CRD欄位說明

    展開查看YAML檔案

    apiVersion: istio.alibabacloud.com/v1beta1
    kind: IstioGateway
    metadata:
      name: egressgateway
      namespace: istio-system
    spec:
      autoCreateGatewayYaml: false
      clusterIds:
        - ${實際的叢集ID}
      disableContainerPortExposed: true
      dnsPolicy: ClusterFirst
      gatewayType: egress
      hostNetwork: false
      podLabels:
        security.istio.io/tlsMode: istio
      ports:
        - name: http-0
          port: 80
          protocol: HTTP
          targetPort: 80
        - name: https-1
          port: 443
          protocol: HTTPS
          targetPort: 443
      readinessProbe: {}
      replicaCount: 1
      resources:
        limits:
          cpu: '2'
          memory: 4G
        requests:
          cpu: 200m
          memory: 256Mi
      rollingMaxSurge: 25%
      rollingMaxUnavailable: 25%
      runAsRoot: true
      serviceType: ClusterIP
  5. 查看出口網關的服務資訊。

    1. 登入Container Service管理主控台,在左側導覽列選擇叢集

    2. 叢集列表頁面,單擊目的地組群名稱,然後在左側導覽列,選擇網路 > 服務

    3. 服務頁面,從命名空間下拉式清單中選擇istio-system

    4. 在服務列表中,單擊目標服務名稱,查看出口網關的服務資訊。

  6. 查看出口網關的Pod資訊。

    1. 登入Container Service管理主控台,在左側導覽列選擇叢集

    2. 叢集列表頁面,單擊目的地組群名稱,然後在左側導覽列,選擇工作負載 > 容器組

    3. 容器組頁面,從命名空間下拉式清單中選擇istio-system

    4. 在Pod列表中,單擊目標Pod名稱,查看出口網關的Pod資訊。

CRD欄位說明

欄位

說明

預設值

metadata.name

名稱。產生的Kubernetes Service和Deployment名稱為istio-{該值}。

metadata.namespace

命名空間,產生的Kubernetes Service和Deployment所在的命名空間。

重要

為相容Istio 1.6及以後的版本,該命名空間必須為istio-system。

istio-system

clusterIds

數群組類型。將部署網關的叢集ID,這些叢集隸屬於當前網格執行個體所管理。

env

數群組類型。網關Pod的環境變數。

externalTrafficPolicy

表示此服務是否希望將外部流量路由到節點本地或叢集範圍的端點,取值為ClusterLocal

說明

該欄位僅適用於入口網關。

Cluster

ports

數群組類型。網關Pod定義的連接埠和協議列表。例如:

  • name: http2 port: 80 targetPort: 80 protocol: HTTP2

  • name: https port: 443 targetPort: 443 protocol: HTTPS

說明

1.9.7.107之前的版本,protocol屬性欄位未做具體化聲明,您需要統一聲明配置為TCP。

gatewayType

網關類型,可以指定為ingressegress

  • ingress:入口網關,為網格內應用提供統一的流量入口。

  • egress:出口網關,為網格內應用提供統一的流量出口。

ingress

replicaCount

副本數。

1

configVolumes

網關Pod所使用的ConfigMap掛載卷,例如:

- name: config-volume-lua
  configMapName: lua-libs
  mountPath: /var/lib/lua

resources

網關Pod的資源配置。

  • limits:

    • cpu: '2'

    • memory: 2G

  • requests:

    • cpu: 200m

    • memory: 256Mi

secretVolumes

網關Pod所使用到的Secret掛載卷,例如:

- name: myexample-customingressgateway-certs
  secretName: istio-myexample-customingressgateway-certs
  mountPath: /etc/istio/myexample-customingressgateway-certs

serviceType

網關的服務類型,取值為LoadBalancerNodePort或者ClusterIP。出口網關通常設定為ClusterIP。

重要

如果您選擇的資料面叢集是註冊叢集且該欄位為LoadBalancer時,請確保叢集支援LoadBalancer類型的Service,避免ASM網關建立失敗。

LoadBalancer

loadBalancerClass

為網關服務指定loadBalancerClass,僅當serviceType為LoadBalancer類型時有效。該欄位從ASM 1.18版本開始支援。更多資訊,請參見在ASM入口網關中使用網路型負載平衡NLB

serviceAnnotations

網關服務的Annotation定義,例如service.beta.kubernetes.io/alibaba-cloud-loadbalancer-connection-drain: 'on' service.beta.kubernetes.io/alibaba-cloud-loadbalancer-connection-drain-timeout: '20'。關於Annotation的常用註解,請參見通過Annotation配置負載平衡

說明

僅適用於serviceType為LoadBalancer類型的網關,出口網關通常不配置。

serviceLabels

網關服務的Label定義。

podLabels

網關Pod的Label定義。

podAnnotations

網關Pod的Annotation定義。

rollingMaxSurge

變換過程中運行操作期望副本數的最大Pod數。取值可以為絕對數值或百分數。

"100%"

rollingMaxUnavailable

變換過程中停用最大Pod數。取值為絕對數值或百分數。

"25%"

overrides

clusterIds指定了2個及以上的叢集時,可以針對特定的叢集指定不同於上述參數定義的配置值,配置值為Map類型。

說明
  • key:本次定義的clusterIds中某一個叢集ID。

  • overrides支援的欄位如下:

    • serviceAnnotations

    • podAnnotations

    • resources

    • replicaCount

    • HPA相關配置(從ASM 1.16版本開始支援)

    • serviceType(從ASM 1.16版本開始支援)

kernel.enabled

是否啟用自訂核心參數。

false

kernel.parameters

核心參數設定,當前支援設定以下核心參數:

  • net.core.somaxconn

  • net.core.netdev_max_backlog

  • net.ipv4.tcp_rmem

  • net.ipv4.tcp_wmem

  • net.ipv4.ip_local_port_range

  • net.ipv4.tcp_fin_timeout

  • net.ipv4.tcp_tw_timeout

  • net.ipv4.tcp_tw_reuse

  • net.ipv4.tcp_tw_recycle

  • net.ipv4.tcp_timestamps

  • net.ipv4.tcp_retries2

  • net.ipv4.tcp_slow_start_after_idle

  • net.ipv4.tcp_max_orphans

  • net.ipv4.tcp_max_syn_backlog

  • net.ipv4.tcp_no_metrics_save

  • net.ipv4.tcp_autocorking

  • kernel.printk

  • vm.swappiness

說明

ASM支援的核心參數修改項可能因宿主機核心版本不同,而出現部分參數不支援的情況。如果出現這種情況,網格Pod可能會報錯。

您可以通過kubectl describe pod命令查看網關報錯情況。刪除不支援的參數後,容器即可正常啟動。

所有的核心參數值為字串格式,因YAML文法會將純數字解析為數實值型別,您需要使用半形雙引號("")包裹您的值,例如net.core.somaxconn: "65535"。

compression.enabled

是否啟用入口網關壓縮能力。

說明

compression相關欄位僅適用於入口網關。

false

compression.content_type

需要被壓縮的ContentType列表,例如:

  • text/html

  • application/json

compression.disable_on_etag_header

  • 設定為true:當Response中存在etag_header時,禁用壓縮。

  • 設定為false:當Response中存在etag_header時,進行壓縮。

false

compression.min_content_length

當ContentLength大於或等於設定的值時,觸發壓縮。

30

compression.remove_accept_encoding_header

  • 設定為true:入口網關在將用戶端請求轉寄至上遊之前,移除請求內的Accept-Encoding Header。

  • 設定為false:入口網關在將用戶端請求轉寄至上遊之前,保留請求內的Accept-Encoding Header。

false

compression.gzip

當前僅支援gzip壓縮格式。若要啟用壓縮,必須填寫該欄位。若所有參數保持預設,也需要填寫空結構,例如gzip: {}

compression.gzip.memory_level

zlib內部的記憶體使用量層級。合法值為1~9。取值越大佔用記憶體越多,同時也會帶來更快的壓縮速度和更好的壓縮品質。

5

compression.gzip.compression_level

zlib的壓縮層級,合法值如下:

  • COMPRESSION_LEVEL_1

  • COMPRESSION_LEVEL_2

  • COMPRESSION_LEVEL_3

  • COMPRESSION_LEVEL_4

  • COMPRESSION_LEVEL_5

  • COMPRESSION_LEVEL_6

  • COMPRESSION_LEVEL_7

  • COMPRESSION_LEVEL_8

  • COMPRESSION_LEVEL_9

  • DEFAULT_COMPRESSION

  • BEST_COMPRESSION

  • BEST_SPEED

說明

BEST_COMPRESSION是最高壓縮品質;BEST_SPEED是最快壓縮速度。其中:

  • COMPRESSION_LEVEL_1壓縮層級等價於BEST_SPEED。最快壓縮,壓縮率較低。

  • COMPRESSION_LEVEL_9壓縮層級等價於BEST_COMPRESSION。7-9壓縮層級對應最大壓縮率,壓縮速度較慢。

  • COMPRESSION_LEVEL_6壓縮層級等價於DEFAULT_COMPRESSION。2-6壓縮層級對應中等壓縮,壓縮率和速度值之間權衡。

DEFAULT_COMPRESSION

compression.gzip.compression_strategy

zlib的壓縮策略,合法值如下:

  • DEFAULT_STRATEGY

  • FILTERED

  • FIXED

  • HUFFMAN_ONLY

  • RLE

說明

DEFAULT_STRATEGY 

預設的壓縮策略,使用底層預設的行為,在多數情況下都能產生滿意的壓縮結果。

FILTERED 

針對大部分存在重複資料的情境,優先使用過濾層壓縮演算法。對於一些文本資料和人工產生的資料壓縮率較高。

HUFFMAN_ONLY 

只使用哈夫曼編碼進行壓縮,不使用其他壓縮演算法。一般用於產生待用資料,產生的壓縮資料可以更快地解壓縮。

RLE 

使用連續相同資料壓縮演算法,對於壓縮連續相同的資料非常高效。比如位元影像資料等。

FIXED 

使用預定義的編碼樹進行哈夫曼編碼,不根據具體資料動態產生編碼樹。這樣的好處是高速壓縮和解壓縮,但壓縮率一般會比較低。

DEFAULT_STRATEGY

compression.gzip.window_bits

zlib視窗大小。合法值為9~15。

12

compression.gzip.chunk_size

zlib輸出緩衝區大小。

4096

hostNetwork

主機網路。

  • 設定為true:網關Pod將使用宿主機的網路。

  • 設定為false:網關Pod將使用自身的網路。

false

dnsPolicy

DNS策略。關於dnsPolicy的詳細介紹,請參見DNS for Services and Pods

ClusterFirst

cpu.targetAverageUtilization

開啟HPA時的CPU目標使用率。取值為1~100。如果超過該值,會增加副本;如果低於該值,會減少副本。

memory.targetAverageUtilization

開啟HPA時的記憶體目標使用率。取值為1~100。如果超過該值,會增加副本;如果低於該值,會減少副本。

maxReplicas

HPA調節的最大副本數。取值為正整數。

minReplicas

HPA調節的最小副本數。取值為正整數,最小值為1。

nodeSelector

指定網關Pod所在的節點。在該欄位下,您可以自訂Key和Value的值,樣本如下:

nodeSelector:
  key1: value1

affinity

通過配置節點親和性來指定網關Pod所在的節點。更多資訊,請參見親和性與反親和性

tolerations

和節點Taint配合使用。更多資訊,請參見汙點和容忍度

導致網關滾動重啟的欄位

以下欄位變更會導致網關滾動重啟,請謹慎操作。

  • env

  • ports(ASM執行個體版本為1.16以下會導致網關重啟,1.16及以上不會重啟)

  • configVolumes

  • resources

  • secretVolumes

  • podLabels

  • podAnnotations

  • kernel.enabled

  • kernel.parameters

  • hostNetwork

  • dnsPolicy

  • nodeSelector(視調度情況而定)

  • affinity(視調度情況而定)

  • tolerations(視調度情況而定)

網關Go Struct實現

展開查看檔案樣本

package v1beta1

import (
    corev1 "k8s.io/api/core/v1"
    metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type GatewayType string
type ConfigState string

const (
    GatewayTypeIngress GatewayType = "ingress"
    GatewayTypeEgress  GatewayType = "egress"
)

// IstioGatewaySpec defines the desired state of Istio
// +k8s:openapi-gen=true
type IstioGatewaySpec struct {
    // +kubebuilder:validation:Enum=ingress;egress
    GatewayType                    GatewayType `json:"gatewayType,omitempty"`
    IstioGatewayBasicConfiguration `json:",inline"`
    ClusterIds                     []string                                  `json:"clusterIds,omitempty"`
    clusterId                      string                                    `json:"clusterId,omitempty"`
    Overrides                      map[string]IstioGatewayBasicConfiguration `json:"overrides,omitempty"`
}

type KernelParameters struct {
    NetCoreSoMaxConn             *string `json:"net.core.somaxconn,omitempty"`
    NetCoreNetdevMaxBacklog      *string `json:"net.core.netdev_max_backlog,omitempty"`
    NetIpv4TcpRMem               *string `json:"net.ipv4.tcp_rmem,omitempty"`
    NetIpv4TcpWMem               *string `json:"net.ipv4.tcp_wmem,omitempty"`
    NetIpv4IpLocalPortRange      *string `json:"net.ipv4.ip_local_port_range,omitempty"`
    NetIpv4TcpFinTimeout         *string `json:"net.ipv4.tcp_fin_timeout,omitempty"`
    NetIpv4TcpTwTimeout          *string `json:"net.ipv4.tcp_tw_timeout,omitempty"`
    NetIpv4TcpTwReuse            *string `json:"net.ipv4.tcp_tw_reuse,omitempty"`
    NetIpv4TcpTwRecycle          *string `json:"net.ipv4.tcp_tw_recycle,omitempty"`
    NetIpv4TcpTimestamps         *string `json:"net.ipv4.tcp_timestamps,omitempty"`
    NetIpv4TcpRetries2           *string `json:"net.ipv4.tcp_retries2,omitempty"`
    NetIpv4TcpSlowStartAfterIdle *string `json:"net.ipv4.tcp_slow_start_after_idle,omitempty"`
    NetIpv4TcpMaxOrphans         *string `json:"net.ipv4.tcp_max_orphans,omitempty"`
    NetIpv4TcpMaxSynBacklog      *string `json:"net.ipv4.tcp_max_syn_backlog,omitempty"`
    NetIpv4TcpNoMetricsSave      *string `json:"net.ipv4.tcp_no_metrics_save,omitempty"`
    NetIpv4TcpAutocorking        *string `json:"net.ipv4.tcp_autocorking,omitempty"`
    KernelPrintk                 *string `json:"kernel.printk,omitempty"`
    VmSwappiness                 *string `json:"vm.swappiness,omitempty"`
}

type KernelConfiguration struct {
    Enabled    *bool            `json:"enabled,omitempty"`
    Parameters KernelParameters `json:"parameters,omitempty"`
}

type GzipCompressorConfiguration struct {
    MemoryLevel         *uint32 `json:"memory_level,omitempty"`
    CompressionLevel    *string `json:"compression_level,omitempty"`
    CompressionStrategy *string `json:"compression_strategy,omitempty"`
    WindowBits          *uint32 `json:"window_bits,omitempty"`
    ChunkSize           *uint32 `json:"chunk_size,omitempty"`
}

type CompressorConfiguration struct {
    Enabled                    *bool                        `json:"enabled,omitempty"`
    MinContentLength           *uint32                      `json:"min_content_length,omitempty"`
    ContentType                *[]string                    `json:"content_type,omitempty"`
    DisableOnETagHeader        *bool                        `json:"disable_on_etag_header,omitempty"`
    RemoveAcceptEncodingHeader *bool                        `json:"remove_accept_encoding_header,omitempty"`
    Gzip                       *GzipCompressorConfiguration `json:"gzip,omitempty"`
}

type ReadinessProbeConfiguration struct {
    FailureThreshold int32 `json:"failureThreshold,omitempty"`
    PeriodSeconds    int32 `json:"periodSeconds,omitempty"`
    SuccessThreshold int32 `json:"successThreshold,omitempty"`
}

// +k8s:openapi-gen=true
type IstioGatewayBasicConfiguration struct {
    ReplicaCount     int32 `json:"replicaCount,omitempty"`
    AutoscaleEnabled bool  `json:"autoscaleEnabled,omitempty"`
    MinReplicas      int32 `json:"minReplicas,omitempty"`
    MaxReplicas      int32 `json:"maxReplicas,omitempty"`
    // +kubebuilder:validation:Enum=ClusterIP;NodePort;LoadBalancer
    ServiceType           corev1.ServiceType           `json:"serviceType,omitempty"`
    LoadBalancerIP        string                       `json:"loadBalancerIP,omitempty"`
    ExternalTrafficPolicy string                       `json:"externalTrafficPolicy,omitempty"`
    ServiceAnnotations    map[string]string            `json:"serviceAnnotations,omitempty"`
    PodAnnotations        map[string]string            `json:"podAnnotations,omitempty"`
    ServiceLabels         map[string]string            `json:"serviceLabels,omitempty"`
    PodLabels             map[string]string            `json:"podLabels,omitempty"`
    Resources             *corev1.ResourceRequirements `json:"resources,omitempty"`
    EnvVars               []corev1.EnvVar              `json:"env,omitempty"`
    Ports                 []corev1.ServicePort         `json:"ports,omitempty"`
    MeshExpansionPorts    []corev1.ServicePort         `json:"meshExpansionPorts,omitempty"`
    NodeSelector          map[string]string            `json:"nodeSelector,omitempty"`
    ApplicationPorts      string                       `json:"applicationPorts,omitempty"`
    RequestedNetworkView  string                       `json:"requestedNetworkView,omitempty"`
    Affinity              *corev1.Affinity             `json:"affinity,omitempty"`
    Tolerations           []corev1.Toleration          `json:"tolerations,omitempty"`
    SecretVolumes         []SecretVolume               `json:"secretVolumes,omitempty"`
    ConfigVolumes         []ConfigVolume               `json:"configVolumes,omitempty"`
    RollingMaxSurge       *string                      `json:"rollingMaxSurge,omitempty"`
    RollingMaxUnavailable *string                      `json:"rollingMaxUnavailable,omitempty"`
    CPU                   HpaCPU                       `json:"cpu,omitempty"`
    Memory                HpaMemory                    `json:"memory,omitempty"`
    Kernel                KernelConfiguration          `json:"kernel,omitempty"`
    Compressor            CompressorConfiguration      `json:"compression,omitempty"`
    RunAsRoot             *bool                        `json:"runAsRoot,omitempty"`
    Lifecycle             *corev1.Lifecycle            `json:"lifecycle,omitempty"`
    ReadinessProbe        ReadinessProbeConfiguration  `json:"readinessProbe,omitempty"`
    HostNetwork           *bool                        `json:"hostNetwork,omitempty"`
    DnsPolicy             corev1.DNSPolicy             `json:"dnsPolicy,omitempty"`
    AutoCreateGatewayYaml *bool                        `json:"autoCreateGatewayYaml,omitempty"`
}

type SecretVolume struct {
    Name       string `json:"name,omitempty"`
    SecretName string `json:"secretName,omitempty"`
    MountPath  string `json:"mountPath,omitempty"`
}

type ConfigVolume struct {
    Name          string `json:"name,omitempty"`
    ConfigMapName string `json:"configMapName,omitempty"`
    MountPath     string `json:"mountPath,omitempty"`
}

// +k8s:openapi-gen=true
type HpaCPU struct {
    TargetAverageUtilization *int32 `json:"targetAverageUtilization,omitempty"`
}

// +k8s:openapi-gen=true
type HpaMemory struct {
    TargetAverageUtilization *int32 `json:"targetAverageUtilization,omitempty"`
}

// +k8s:openapi-gen=true
type IstioGatewayStatus struct {
    // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
    // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
    // Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html
    Status                     ConfigState      `json:"Status,omitempty"`
    GatewayAddress             []string         `json:"GatewayAddress,omitempty"`
    ClusterIdGatewayAddressMap []GatewayAddress `json:"ClusterIdGatewayAddressMap,omitempty"`

    ErrorMessage string `json:"ErrorMessage,omitempty"`
}

// +k8s:openapi-gen=true
type GatewayAddress struct {
    IPAddress string `json:"ipAddress,omitempty"`
    ClusterId string `json:"clusterId,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// IstioGateway is the Schema for the istiogateways API
// +k8s:openapi-gen=true
// +kubebuilder:subresource:status
type IstioGateway struct {
    metav1.TypeMeta   `json:",inline"`
    metav1.ObjectMeta `json:"metadata,omitempty"`

    Spec   IstioGatewaySpec   `json:"spec,omitempty"`
    Status IstioGatewayStatus `json:"status,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// IstioGatewayList contains a list of IstioGateway
type IstioGatewayList struct {
    metav1.TypeMeta `json:",inline"`
    metav1.ListMeta `json:"metadata,omitempty"`
    Items           []IstioGateway `json:"items"`
}