Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement graceful, modifiable UDS Core CoreDNS overrides #112

Merged
merged 17 commits into from
Oct 2, 2024

Conversation

justinthelaw
Copy link
Contributor

@justinthelaw justinthelaw commented Sep 24, 2024

Description

Implements an alternative CoreDNS override that relies on UDS Core's base service mesh, Istio. Uses the admin and tenant ingress gateways as the rewrite targets to gracefully handle ungraceful Docker restarts/stops, where host.k3d.internal fails. Also handles the case of integrating and routing to potential/future alternative service meshes via CoreDNS (e.g., kong). Another added benefit is the end-user's ability to add further rewrites based on additional or alternative gateways, domains, subdomains, services and/or virtual services.

Related Issue

Fixes #99

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist before merging

@justinthelaw justinthelaw added the enhancement New feature or request label Sep 24, 2024
@justinthelaw justinthelaw self-assigned this Sep 24, 2024
@justinthelaw
Copy link
Contributor Author

justinthelaw commented Sep 24, 2024

Local tests were performed to ensure the override works with UDS Core (slim-dev):

  1. Use uds zarf tools kubectl get configmap -n kube-system coredns-custom -o yaml >> coredns-overrides.yaml on the locally created uds-k3d cluster on this PR's branch
  2. Apply (w/o resourceVersion, uid, and creationTimestamp) the coredns-overrides.yaml to a fresh deployment of k3d-core-slim-dev from upstream UDS Core
  3. Re-cycle the CoreDNS deployment
  4. Visited the sso.uds.dev and keycloak.admin.uds.dev URLs in a browser

EDIT: let me know if this is something you want me to automate into a CI test.

@justinthelaw justinthelaw marked this pull request as ready for review September 24, 2024 21:52
@justinthelaw justinthelaw requested a review from a team as a code owner September 24, 2024 21:52
@justinthelaw justinthelaw changed the title feat: implement graceful UDS Core CoreDNS overrides feat: implement graceful, modifiable UDS Core CoreDNS overrides Sep 25, 2024
chart/values.yaml Outdated Show resolved Hide resolved
values/dev-stack-values.yaml Outdated Show resolved Hide resolved
Co-authored-by: Micah Nagel <micah.nagel@defenseunicorns.com>
tasks.yaml Outdated Show resolved Hide resolved
@justinthelaw
Copy link
Contributor Author

@rjferguson21 @mjnagel I sort of modified things based on a combination of your guys' comments. Please let me know if there's more you'd like me to change. Thank you!

@justinthelaw
Copy link
Contributor Author

@rjferguson21 @mjnagel turns out, the wrong indent type was used, thanks @rjferguson21 for pointing it out! Everything is in working order now. feel free to run things without and with an override to see how they work.

@justinthelaw
Copy link
Contributor Author

Final output without providing the override at deployment:

apiVersion: v1
data:
  uds.override: |
    rewrite stop {
      name regex (.*\.admin\.uds\.dev) admin-ingressgateway.istio-admin-gateway.svc.cluster.local answer auto
    }
    rewrite stop {
      name regex (.*\.uds\.dev) tenant-ingressgateway.istio-tenant-gateway.svc.cluster.local answer auto
    }
    rewrite stop {
      name regex (.*\.uds\.dev) host.k3d.internal answer auto
    }
kind: ConfigMap
metadata:
  annotations:
    meta.helm.sh/release-name: uds-dev-stack
    meta.helm.sh/release-namespace: uds-dev-stack
  labels:
    app.kubernetes.io/managed-by: Helm
  name: coredns-custom
  namespace: kube-system

Final output when supplying the override within docs/DNS.md:

apiVersion: v1
data:
  uds.override: |
    rewrite stop {
      name regex (.*\.uds\.dev) host.k3d.internal answer auto
    }
kind: ConfigMap
metadata:
  annotations:
    meta.helm.sh/release-name: uds-dev-stack
    meta.helm.sh/release-namespace: uds-dev-stack
  labels:
    app.kubernetes.io/managed-by: Helm
  name: coredns-custom
  namespace: kube-system

chart/values.yaml Outdated Show resolved Hide resolved
@justinthelaw justinthelaw requested review from mjnagel and a team September 27, 2024 18:16
@justinthelaw justinthelaw merged commit 7fe1876 into main Oct 2, 2024
3 checks passed
@justinthelaw justinthelaw deleted the graceful-k3d-coredns-corefile-rewrites branch October 2, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Persist DNS resolution across machine and Docker restarts
3 participants