databases/gke-stateful-mysql/kubernetes/c1-router.yaml [15:102]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: mysql-router-config
data:
  db-url: mysql-router
---
apiVersion: v1
kind: Service
metadata:
  name: mysql-router
  labels:
    app: mysql-router
  annotations:
    networking.gke.io/load-balancer-type: "Internal"
spec:
  type: LoadBalancer
  selector:
    app: mysql-router
  ports:
  - name: mysql-rw
    port: 6446
  - name: mysql-ro
    port: 6447
  - name: mysqlx-rw
    port: 64460
  - name: mysqlx-ro
    port: 64470

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql-router
  labels:
    app: mysql-router
spec:
  replicas: 3
  selector:
    matchLabels:
      app: mysql-router
  template:
    metadata:
      labels:
        app: mysql-router
    spec:
      affinity:
        podAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - mysql
            topologyKey: topology.kubernetes.io/zone
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - mysql-router
              topologyKey: "topology.kubernetes.io/zone"
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - mysql
            topologyKey: "kubernetes.io/hostname"
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - mysql-router
            topologyKey: "kubernetes.io/hostname"
      containers:
      - name: mysql-router
        image: mysql/mysql-router:8.0.27
        env:
        - name: MYSQL_HOST
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



databases/gke-stateful-mysql/kubernetes/c2-router.yaml [15:102]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: mysql-router-config
data:
  db-url: mysql-router
---
apiVersion: v1
kind: Service
metadata:
  name: mysql-router
  labels:
    app: mysql-router
  annotations:
    networking.gke.io/load-balancer-type: "Internal"
spec:
  type: LoadBalancer
  selector:
    app: mysql-router
  ports:
  - name: mysql-rw
    port: 6446
  - name: mysql-ro
    port: 6447
  - name: mysqlx-rw
    port: 64460
  - name: mysqlx-ro
    port: 64470

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql-router
  labels:
    app: mysql-router
spec:
  replicas: 3
  selector:
    matchLabels:
      app: mysql-router
  template:
    metadata:
      labels:
        app: mysql-router
    spec:
      affinity:
        podAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - mysql
            topologyKey: topology.kubernetes.io/zone
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - mysql-router
              topologyKey: "topology.kubernetes.io/zone"
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - mysql
            topologyKey: "kubernetes.io/hostname"
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - mysql-router
            topologyKey: "kubernetes.io/hostname"
      containers:
      - name: mysql-router
        image: mysql/mysql-router:8.0.27
        env:
        - name: MYSQL_HOST
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



