8000 🌐 Adding Azure Workload Identity webhook and OIDC setup by clee231 · Pull Request #234 · acm-uic/IaC · GitHub
[go: up one dir, main page]

Skip to content

🌐 Adding Azure Workload Identity webhook and OIDC setup - #234

Merged
clee231 merged 6 commits into
mainfrom
feature/workload-identity
Dec 1, 2026
Merged

clee231 merged 6 commits into
mainfrom
feature/workload-identity

Conversation

@clee231
@clee231 clee231 commented Nov 25, 2026 •
Copy link
Copy Markdown
Contributor

This pull request introduces Kubernetes manifests to support Azure Workload Identity and OIDC discovery within the Umapyoi infrastructure. The changes add ArgoCD applications for managing these components and define all necessary resources for securely serving OIDC discovery documents in the cluster.

Azure Workload Identity Integration:

  • Adds a new ArgoCD Application (azure-workload-identity-webhook) to deploy the Azure Workload Identity webhook via Helm, including resource constraints and automated sync policies.
  • Creates the required Namespace (azure-workload-identity-system) for the webhook deployment.

OIDC Discovery Service:

  • Adds a new ArgoCD Application (workload-identity-oidc) to deploy OIDC discovery resources from the repository, with automated sync and server-side apply enabled.
  • Defines all Kubernetes resources needed to serve OIDC discovery documents:
    • Namespace, ServiceAccount, RBAC (ClusterRole/Binding) for publishing discovery docs.
    • NGINX Deployment (with initContainer to fetch discovery docs), Service, ConfigMap for NGINX config.
    • Shared Cilium Ingress behind the Umapyoi public tunnel for HTTPS at k8s-oidc.umapyoi.acmuic.org, using a cert-manager TLS secret.

Umapyoi public DNS

Terraform creates umapyoi.acmuic.org, delegates it from acmuic.org, and publishes A and AAAA aliases for tunnel.umapyoi.acmuic.org against the existing Azure gateway public IP resources. It points the k8s-oidc CNAME at that hostname so Entra can reach discovery before ExternalDNS starts. The ACM app cluster's ExternalDNS configuration excludes this delegated zone.

When federation is enabled, the dedicated managed identity trusts system:serviceaccount:external-dns:externaldns from this issuer. It has Reader on acm-general for zone discovery and DNS Zone Contributor on the child zone. Apply this PR and configure the API server issuer, public JWKS URI, before deploying #230.

The FRP client cutover is tracked in #239. Apply the DNS additions here before switching the client.

The initial rollout stages the overlapping FRP trust roots and uses a namespaced ACME Issuer for discovery HTTPS. Azure token exchange is disabled pending the cluster signing-key maintenance.

@clee231
clee231 added this pull request to stack #236 November 25, 2026 21:09
@clee231
clee231 force-pushed the feature/workload-identity branch from ae15934 to 8e82c57 Compare November 25, 2026 21:09
@clee231 clee231 linked an issue Nov 25, 2026 that may be closed by this pull request
@lamtnguyen989
Copy link
Copy Markdown
Member

Change for the failed kube-lint test

kube-linter's no-anti-affinity check was failing on the oidc-discovery Deployment: it runs 2 replicas, but nothing stopped both pods from landing on the same node, which would defeat the redundancy. Added a preferred pod anti-affinity on kubernetes.io/hostname, so the scheduler spreads them across nodes when it can but still runs both if only one node is available. kube-linter lint ./kubernetes passes locally.

@clee231 clee231 mentioned this pull request Nov 30, 2026
@github-actions
github-actions Bot commented Nov 30, 2026 •
Copy link
Copy Markdown

Terraform plan in azure/terraform/stacks/acm-general in the prod workspace
With var files: azure/terraform/stacks/acm-general/configuration/prod.tfvars

Plan: 8 to add, 0 to change, 0 to destroy. Changes to Outputs.
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+   create

Terraform will perform the following actions:

  # azurerm_dns_a_record.umapyoi_tunnel will be created
+   resource "azurerm_dns_a_record" "umapyoi_tunnel" {
+       fqdn                = (known after apply)
+       id                  = (known after apply)
+       name                = "tunnel"
+       resource_group_name = "acm-general"
+       tags                = {
+           "SIG" = "SIGSysAdmin"
        }
+       target_resource_id  = "************************************************************************************************************************************************"
+       ttl                 = 300
+       zone_name           = "umapyoi.acmuic.org"
    }

  # azurerm_dns_aaaa_record.umapyoi_tunnel will be created
+   resource "azurerm_dns_aaaa_record" "umapyoi_tunnel" {
+       fqdn                = (known after apply)
+       id                  = (known after apply)
+       name                = "tunnel"
+       resource_group_name = "acm-general"
+       tags                = {
+           "SIG" = "SIGSysAdmin"
        }
+       target_resource_id  = "************************************************************************************************************************************************"
+       ttl                 = 300
+       zone_name           = "umapyoi.acmuic.org"
    }

  # azurerm_dns_cname_record.umapyoi_oidc will be created
+   resource "azurerm_dns_cname_record" "umapyoi_oidc" {
+       fqdn                = (known after apply)
+       id                  = (known after apply)
+       name                = "k8s-oidc"
+       record              = "tunnel.umapyoi.acmuic.org"
+       resource_group_name = "acm-general"
+       tags                = {
+           "SIG" = "SIGSysAdmin"
        }
+       ttl                 = 300
+       zone_name           = "umapyoi.acmuic.org"
    }

  # azurerm_dns_ns_record.umapyoi will be created
+   resource "azurerm_dns_ns_record" "umapyoi" {
+       fqdn                = (known after apply)
+       id                  = (known after apply)
+       name                = "umapyoi"
+       records             = (known after apply)
+       resource_group_name = "acm-general"
+       tags                = {
+           "SIG" = "SIGSysAdmin"
        }
+       ttl                 = 300
+       zone_name           = "acmuic.org"
    }

  # azurerm_dns_zone.umapyoi will be created
+   resource "azurerm_dns_zone" "umapyoi" {
+       id                        = (known after apply)
+       max_number_of_record_sets = (known after apply)
+       name                      = "umapyoi.acmuic.org"
+       name_servers              = (known after apply)
+       number_of_record_sets     = (known after apply)
+       resource_group_name       = "acm-general"
+       tags                      = {
+           "SIG" = "SIGSysAdmin"
        }

+       soa_record (known after apply)
    }

  # azurerm_role_assignment.umapyoi_externaldns_contributor will be created
+   resource "azurerm_role_assignment" "umapyoi_externaldns_contributor" {
+       id                               = (known after apply)
+       name                             = (known after apply)
+       principal_id                     = (known after apply)
+       principal_type                   = "ServicePrincipal"
+       role_definition_id               = (known after apply)
+       role_definition_name             = "DNS Zone Contributor"
+       scope                            = (known after apply)
+       skip_service_principal_aad_check = (known after apply)
    }

  # azurerm_role_assignment.umapyoi_externaldns_reader will be created
+   resource "azurerm_role_assignment" "umapyoi_externaldns_reader" {
+       id                               = (known after apply)
+       name                             = (known after apply)
+       principal_id                     = (known after apply)
+       principal_type                   = "ServicePrincipal"
+       role_definition_id               = (known after apply)
+       role_definition_name             = "Reader"
+       scope                            = "/subscriptions/2f98793b-7e2f-4f03-ac5b-7b2ec934dcd7/resourceGroups/acm-general"
+       skip_service_principal_aad_check = (known after apply)
    }

  # azurerm_user_assigned_identity.umapyoi_externaldns will be created
+   resource "azurerm_user_assigned_identity" "umapyoi_externaldns" {
+       client_id           = (known after apply)
+       id                  = (known after apply)
+       location            = "northcentralus"
+       name                = "umapyoi-externaldns"
+       principal_id        = (known after apply)
+       resource_group_name = "acm-general"
+       tags                = {
+           "SIG" = "SIGSysAdmin"
        }
+       tenant_id           = (known after apply)
    }

Plan: 8 to add, 0 to change, 0 to destroy.

Changes to Outputs:
!~  azurerm_dns_zone_acm_uic           = {
        id                        = "/subscriptions/2f98793b-7e2f-4f03-ac5b-7b2ec934dcd7/resourceGroups/acm-general/providers/Microsoft.Network/dnsZones/acmuic.org"
        name                      = "acmuic.org"
!~      number_of_record_sets     = 83 -> 85
        tags                      = {}
#        (4 unchanged attributes hidden)
    }
+   umapyoi_externaldns_client_id      = (known after apply)

❌ Error applying plan in Terraform Apply on Azure #68

@github-actions
github-actions Bot commented Nov 30, 2026 •
Copy link
Copy Markdown

Terraform plan in azure/terraform/stacks/sysadmin-demo in the prod workspace
With var files: azure/terraform/stacks/sysadmin-demo/configuration/prod.tfvars

No changes. Your infrastructure matches the configuration.
No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration
and found no differences, so no changes are needed.

✅ Plan applied in Terraform Apply on Azure #68

@clee231
clee231 merged commit 7a08bc4 into main Dec 1, 2026
5 checks passed
@clee231
clee231 deleted the feature/workload-identity branch December 1, 2026 06:52
clee231 added a commit that referenced this pull request Dec 1, 2026
Scaffold the deployment of `external-dns`

The Umapyoi controller creates and updates records in
`umapyoi.acmuic.org` with a cluster-specific TXT owner ID. Terraform
owns the OIDC issuer record and the A/AAAA records for
`tunnel.umapyoi.acmuic.org`. Both names are excluded from
reconciliation. The Azure ConfigMap is in the controller's
`external-dns` namespace.

Merge and apply [#234](#234) first.
Before the first Argo CD sync, verify the public issuer and bind the
`externaldns` service account to the new managed identity's
Azure-assigned client ID. The [rollout
instructions](https://github.com/acm-uic/IaC/blob/umapyoi-eDNS/kubernetes/argocd/umapyoi/external-dns/README.md)
include the commands.


The initial rollout uses zero controller replicas pending the cluster
signing-key maintenance and activation of the Azure federated
credential.

---------

Co-authored-by: Chase 李 <chase@acm.cs.uic.edu>
clee231 added a commit that referenced this pull request Dec 1, 2026
Move the Umapyoi FRP client to `tunnel.umapyoi.acmuic.org`. The client
uses this name for both its control connection and the TLS server name.
The gateway VM and public addresses stay in service throughout the
rename.

## Before merging

- Apply #234 and confirm the new A and AAAA records resolve to the
gateway's existing addresses. #230 reserves this name in ExternalDNS and
updates the application CNAME example.
- The live TCP 7000 listener now presents the rotated certificate for
both hostnames. The existing client token was preserved and both FRP
proxies reconnected using the overlapping trust bundle.

Merging triggers the Argo CD client rollout with the final CA bundle.
The Cilium chart explicitly configures ADS for the agent and Envoy, and
the OIDC Ingress allows HTTP-01 challenges to reach cert-manager. Keep
the old DNS records until both FRP proxies reconnect, public application
traffic passes, and other consumers have migrated. The [cutover and
rollback
instructions](https://github.com/acm-uic/IaC/blob/codex/umapyoi-tunnel-hostname/azure/terraform/stacks/frp-gateway/OPERATIONS.md#move-the-tunnel-hostname)
include the final parent-zone cleanup.

## Verification

Kustomize and KubeLinter passed for the client. The isolated FRP 0.72.0
smoke test passed with the new tunnel hostname for IPv4 and IPv6
HTTP/HTTPS and after client and server restarts. OpenTofu formatting and
validation passed for the gateway stack.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Umapyoi checklist

2 participants

0