Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions charts/istio-certs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Istio Certs Helm Chart

This chart configures DNS labels for Azure Kubernetes Service (AKS) LoadBalancer IPs, enabling automatic FQDN assignment for OSDU services.
This chart configures DNS labels for Azure Kubernetes Service (AKS) LoadBalancer IPs associated with Gateway API gateways, enabling automatic FQDN assignment for OSDU services with Let's Encrypt certificate provisioning.

--------------------------------------------------------------------------------

Expand All @@ -20,8 +20,8 @@ Modify the `values.yaml` for the chart or create a `custom_values.yaml` with the
azure:
region: <your_azure_region> # Azure region, e.g. eastus
dnsName: <your_dns_label> # Unique DNS label for the cluster
istioServiceName: istio-ingressgateway # Name of the Istio service
istioNamespace: istio-system # Namespace of the Istio service
gatewayServiceName: external-gateway-istio # Name of the Gateway API service (LoadBalancer)
gatewayNamespace: istio-system # Namespace of the Gateway API service
maxRetries: 30 # Max retries for waiting on LoadBalancer IP
retryInterval: 10 # Seconds between retries
```
Expand Down
4 changes: 4 additions & 0 deletions charts/istio-certs/templates/access_control.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ rules:
- apiGroups: ["cert-manager.io"]
resources: ["certificates"]
verbs: ["get", "create", "update", "patch", "apply"]
# Gateway API permissions for Gateway and HTTPRoute management
- apiGroups: ["gateway.networking.k8s.io"]
resources: ["gateways", "httproutes"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down
20 changes: 13 additions & 7 deletions charts/istio-certs/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ data:
configure-dns.sh: |
#!/usr/bin/env bash
set -euo pipefail

echo "================================================================="
echo " Starting DNS + Cert Configuration for AKS LoadBalancer"
echo "================================================================="
Expand All @@ -22,13 +21,13 @@ data:
}

wait_for_loadbalancer_ip() {
echo "Waiting for LoadBalancer IP on service istio-ingress-external in istio-system..."
echo "Waiting for LoadBalancer IP on service external-gateway-istio in istio-system..."
for ((i=0; i<60; i++)); do
EXTERNAL_IP=$(kubectl get svc istio-ingress-external -n istio-system -o jsonpath='{.status.loadBalancer.ingress[0].ip}' 2>/dev/null || :)
EXTERNAL_IP=$(kubectl get svc external-gateway-istio -n istio-system -o jsonpath='{.status.loadBalancer.ingress[0].ip}' 2>/dev/null || :)
if [[ -n "$EXTERNAL_IP" ]]; then
echo "Found IP: $EXTERNAL_IP"
return 0
fi
fi
echo "…retry $((i+1))/60"
sleep 5
done
Expand All @@ -38,7 +37,7 @@ data:

annotate_service_with_dns() {
echo "Annotating service with DNS label ${DNS_NAME}..."
kubectl annotate svc istio-ingress-external -n istio-system \
kubectl annotate svc external-gateway-istio -n istio-system \
service.beta.kubernetes.io/azure-dns-label-name="${DNS_NAME}" --overwrite
}

Expand All @@ -58,7 +57,6 @@ data:
}

main "$@"

istio-certificate.yaml: |
apiVersion: cert-manager.io/v1
kind: Certificate
Expand All @@ -71,10 +69,18 @@ data:
renewBefore: 360h # 15 days
subject:
organizations:
- Example Organization
- OSDU Developer
commonName: __FQDN__
dnsNames:
- __FQDN__
issuerRef:
name: letsencrypt-staging
kind: ClusterIssuer
# Use HTTP-01 challenge which will work with Gateway API HTTPRoute
# The ACME challenge solver will create temporary pods that need routing
privateKey:
algorithm: RSA
size: 2048
usages:
- digital signature
- key encipherment
10 changes: 5 additions & 5 deletions charts/istio-certs/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ azure:
dnsName: "" # DNS name to be used for the LoadBalancer IP

################################################################################
# Istio configuration values
# Gateway API configuration values
#
istioServiceName: "istio-ingressgateway" # Name of the Istio service
istioNamespace: "istio-system" # Namespace of the Istio service
maxRetries: 30 # Max retries for waiting on LoadBalancer IP
retryInterval: 10 # Seconds between retries
gatewayServiceName: "external-gateway-istio" # Name of the Gateway API service (LoadBalancer)
gatewayNamespace: "istio-system" # Namespace of the Gateway API service
maxRetries: 30 # Max retries for waiting on LoadBalancer IP
retryInterval: 10 # Seconds between retries
7 changes: 7 additions & 0 deletions charts/istio-ingress/templates/certificate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Certificate will be created by the istio-certs chart after DNS configuration
# This ensures proper FQDN is available for Let's Encrypt validation
# The istio-certs Job handles:
# 1. Waiting for LoadBalancer IP
# 2. Setting DNS label annotation
# 3. Creating Certificate with correct FQDN
# 4. HTTP-01 challenge routing via Gateway API
131 changes: 83 additions & 48 deletions charts/istio-ingress/templates/gateways.yaml
Original file line number Diff line number Diff line change
@@ -1,60 +1,95 @@
{{- define "gateway" -}}
apiVersion: networking.istio.io/v1alpha3
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: {{ .name | default (printf "%s-gateway" .gatewayType) }}
namespace: istio-system
spec:
selector:
{{- .selector | default (dict "istio" (printf "ingress-%s" .gatewayType)) | toYaml | nindent 4 }}
servers:
- port:
name: http2
number: 80
protocol: HTTP2
hosts:
{{- if .hosts }}
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
{{- else }}
- "*"
{{- end }}
- port:
name: https
number: 443
protocol: HTTPS
hosts:
{{- if .hosts }}
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
{{- else }}
- "*"
{{- end }}
gatewayClassName: istio
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: All
- name: https
protocol: HTTPS
port: 443
hostname: {{ printf "%s.%s.cloudapp.azure.com" .azure.dnsName .azure.region | quote }}
tls:
{{- if .requireSSL }}
httpsRedirect: true # sends 301 redirect for http requests
{{- end }}
{{- with .tls }}
{{- toYaml . | nindent 8 }}
{{- end }}
mode: Terminate
certificateRefs:
- kind: Secret
name: {{ .tls.credentialName | quote }}
namespace: istio-system
allowedRoutes:
namespaces:
from: All
{{- end }}

{{- if .Values.ingress }}
{{- if hasKey .Values.ingress "internalGateway" }}
{{- if .Values.ingress.internalGateway.enabled }}
{{- if .Values.ingress.externalGateway.enabled }}
---
{{- $internalGateway := merge (dict "gatewayType" "internal" "requireSSL" .Values.ingress.internalGateway.requireSSL) .Values.ingress.internalGateway -}}
{{ include "gateway" $internalGateway }}
{{- end }}
{{- end }}
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: external-gateway
namespace: istio-system
labels:
{{- include "istio-ingress.labels" . | nindent 4 }}
istio.io/gateway-name: external-gateway
spec:
gatewayClassName: istio
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: All
- name: https
protocol: HTTPS
port: 443
tls:
mode: Terminate
certificateRefs:
- kind: Secret
name: {{ .Values.ingress.externalGateway.tls.credentialName | quote }}
namespace: istio-system
allowedRoutes:
namespaces:
from: All
{{- end }}

{{- if hasKey .Values.ingress "externalGateway" }}
{{- if .Values.ingress.externalGateway.enabled }}
{{- if .Values.ingress.internalGateway.enabled }}
---
{{- $externalGateway := merge (dict "gatewayType" "external" "requireSSL" .Values.ingress.externalGateway.requireSSL) .Values.ingress.externalGateway -}}
{{ include "gateway" $externalGateway }}
{{- end }}
{{- end }}
{{- end }}
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: internal-gateway
namespace: istio-system
labels:
{{- include "istio-ingress.labels" . | nindent 4 }}
istio.io/gateway-name: internal-gateway
spec:
gatewayClassName: istio
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: All
- name: https
protocol: HTTPS
port: 443
tls:
mode: Terminate
certificateRefs:
- kind: Secret
name: {{ .Values.ingress.internalGateway.tls.credentialName | quote }}
namespace: istio-system
allowedRoutes:
namespaces:
from: All
{{- end }}
12 changes: 12 additions & 0 deletions charts/istio-ingress/templates/httproutes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# HTTPRoutes for ACME challenge handling with Gateway API
#
# Note: For Gateway API, cert-manager typically uses one of these approaches:
# 1. Creates temporary Ingress resources that get converted to HTTPRoutes
# 2. Uses Gateway API native challenge solvers (experimental)
# 3. Relies on application HTTPRoutes to handle challenge paths
#
# Since this is infrastructure-level routing, we'll let individual applications
# handle ACME challenge routing in their own HTTPRoutes, or cert-manager
# will create temporary resources as needed.
#
# This avoids namespace dependency issues during deployment.
9 changes: 9 additions & 0 deletions charts/istio-ingress/templates/referencegrants.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ReferenceGrants are now managed by individual application charts
# to avoid namespace dependency issues during deployment:
# - web-site ReferenceGrant is in software/applications/web-site/
# - cert-manager ReferenceGrant is managed by cert-manager operator
#
# This approach ensures that:
# 1. istio-ingress can deploy without waiting for application namespaces
# 2. Each application manages its own cross-namespace access permissions
# 3. No circular dependencies between infrastructure and applications
6 changes: 2 additions & 4 deletions charts/istio-ingress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ ingress:
- "*"
tls:
mode: SIMPLE
credentialName: wild-card-tls
credentialName: istio-ingressgateway-certs # Match the secret created by istio-certs chart
externalGateway:
enabled: true
hosts:
- "*"
tls:
mode: SIMPLE
credentialName: wild-card-tls
credentialName: istio-ingressgateway-certs # Match the secret created by istio-certs chart
43 changes: 43 additions & 0 deletions charts/osdu-developer-auth/templates/http-route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{- $namespace := .Release.Namespace }}
{{- if and .Values.hosts .Values.gateways }}
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: osdu-auth-route
namespace: {{ $namespace }}
spec: parentRefs:
{{- range .Values.gateways }}
{{- $parts := split "/" . }}
{{- if eq (len $parts) 2 }}
- name: {{ index $parts 1 }}
namespace: {{ index $parts 0 }}
group: gateway.networking.k8s.io
kind: Gateway
{{- else }}
- name: {{ . }}
namespace: istio-system
group: gateway.networking.k8s.io
kind: Gateway
{{- end }}
{{- end }}
rules:
# Auth SPA route
- matches:
- path:
type: PathPrefix
value: {{ .Values.path }}spa/
backendRefs:
- name: osdu-auth-spa
port: 80
weight: 100
# Main auth route
- matches:
- path:
type: PathPrefix
value: {{ .Values.path }}
backendRefs:
- name: osdu-auth
port: 80
weight: 100
{{- end }}
33 changes: 33 additions & 0 deletions charts/osdu-developer-auth/templates/reference-grant.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{- $namespace := .Release.Namespace }}
{{- if and .Values.hosts .Values.gateways }}
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: ReferenceGrant
metadata:
name: osdu-auth-reference-grant
namespace: {{ $namespace }}
spec:
from:
- group: gateway.networking.k8s.io
kind: HTTPRoute
namespace: istio-system
to:
- group: ""
kind: Service
name: osdu-auth
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: ReferenceGrant
metadata:
name: osdu-auth-spa-reference-grant
namespace: {{ $namespace }}
spec:
from:
- group: gateway.networking.k8s.io
kind: HTTPRoute
namespace: istio-system
to:
- group: ""
kind: Service
name: osdu-auth-spa
{{- end }}
Loading