Skip to content

Agent Mesh

move to gateway

Antonio Ojea590e10632f95
diff --git a/.github/k8s/dex-deployment.yaml b/.github/k8s/dex-deployment.yaml
index 5b64f9ab..1fd1877e 100644
--- a/.github/k8s/dex-deployment.yaml
+++ b/.github/k8s/dex-deployment.yaml
@@ -1,3 +1,15 @@
+# Create the Google-managed certificate
+# gcloud certificate-manager certificates create dex-cert \
+# --domains="auth.sam-mesh.dev" --global
+
+# Create a Certificate Map
+# gcloud certificate-manager maps create dex-cert-map
+
+# Bind the certificate to the map for your domain
+# gcloud certificate-manager maps entries create dex-cert-map-entry \
+# --map="dex-cert-map" \
+# --hostname="auth.sam-mesh.dev" \
+# --certificates="dex-cert"
---
apiVersion: v1
kind: ServiceAccount
@@ -5,38 +17,6 @@ metadata:
name: dex
namespace: dex
---
-# Custom Health Check configuration for the Google Cloud Load Balancer
-apiVersion: cloud.google.com/v1
-kind: BackendConfig
-metadata:
- name: dex-backend-config
- namespace: dex
-spec:
- healthCheck:
- checkIntervalSec: 15
- port: 5556
- type: HTTP
- requestPath: /healthz
----
-apiVersion: v1
-kind: Service
-metadata:
- name: dex
- namespace: dex
- annotations:
- # Bind the backend config to the service so the L7 Load Balancer uses /healthz
- cloud.google.com/backend-config: '{"default": "dex-backend-config"}'
-spec:
- # Must be NodePort for GKE L7 Ingress to route to it
- type: NodePort
- ports:
- - name: dex
- port: 5556
- protocol: TCP
- targetPort: 5556
- selector:
- app: dex
----
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -114,36 +94,77 @@ spec:
- key: config.yaml
path: config.yaml
---
-# Request a free, auto-renewing SSL certificate from Google
+apiVersion: v1
+kind: Service
+metadata:
+ name: dex
+ namespace: dex
+spec:
+ ports:
+ - name: dex
+ port: 5556
+ protocol: TCP
+ targetPort: 5556
+ selector:
+ app: dex
+---
apiVersion: networking.gke.io/v1
-kind: ManagedCertificate
+kind: HealthCheckPolicy
metadata:
- name: dex-cert
+ name: dex-healthcheck
namespace: dex
spec:
- domains:
- - auth.sam-mesh.dev
+ default:
+ checkIntervalSec: 15
+ timeoutSec: 5
+ healthyThreshold: 1
+ unhealthyThreshold: 2
+ config:
+ type: HTTP
+ httpHealthCheck:
+ requestPath: /healthz
+ targetRef:
+ group: ""
+ kind: Service
+ name: dex
---
-# The L7 Load Balancer
-apiVersion: networking.k8s.io/v1
-kind: Ingress
+apiVersion: gateway.networking.k8s.io/v1
+kind: Gateway
metadata:
- name: dex-ingress
+ name: external-http-gateway
namespace: dex
annotations:
- networking.gke.io/managed-certificates: dex-cert
- # Tells GKE to attach the global static IP you reserved earlier
- kubernetes.io/ingress.global-static-ip-name: "auth-sam-mash"
+ # Attach the Certificate Map
+ networking.gke.io/certmap: dex-cert-map
+spec:
+ # This provisions a Global External Application Load Balancer
+ gatewayClassName: gke-l7-global-external-managed
+ addresses:
+ - type: NamedAddress
+ value: auth-sam-mash # reserved static IP name
+ listeners:
+ - name: https
+ protocol: HTTPS
+ port: 443
+ allowedRoutes:
+ namespaces:
+ from: Same
+---
+apiVersion: gateway.networking.k8s.io/v1
+kind: HTTPRoute
+metadata:
+ name: dex-route
+ namespace: dex
spec:
- ingressClassName: "gce"
+ parentRefs:
+ - name: external-http-gateway
+ hostnames:
+ - "auth.sam-mesh.dev"
rules:
- - host: auth.sam-mesh.dev
- http:
- paths:
- - path: /*
- pathType: ImplementationSpecific
- backend:
- service:
- name: dex
- port:
- number: 5556
+ - matches:
+ - path:
+ type: PathPrefix
+ value: /
+ backendRefs:
+ - name: dex
+ port: 5556