Skip to content

[FEAT] reconcile Domains and ClusterDomains #188

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

Merged
merged 6 commits into from
May 22, 2025
Merged

[FEAT] reconcile Domains and ClusterDomains #188

merged 6 commits into from
May 22, 2025

Conversation

skrishnan-sap
Copy link
Contributor

@skrishnan-sap skrishnan-sap commented Apr 11, 2025

Task List

Overall Status: Domain & ClusterDomain reconciliation implemented and working. Refactoring, unit tests in progress.

Status Task
Enhance controller by creating queues, informer change handlers etc. for Domain & ClusterDomain.
Create & Update Gardener Certificate with the domain resource linked as owner via. owner identifier hash label.
Implement support for changes in ingressSelector.
Create & Update Gateway with domain resource in owner reference.
Observe and update available subdomains from Tenants and Versions (service exposures) in CAPApplication status for use by domain resources. Requeue referenced domain resources in case of changes.
Requeue referenced domain resources (added and removed) when there are changes to spec.domainRefs in the CAPApplication.
Create / Update / Delete DNS Entries based on changes in DNS mode, domain host and changes queued from referencing applications.
Recognize changes in domain host in domain resources to requeue referencing CAPApplications.
Reque tenants and versions (with service exposure) when there is (a) a change in CAPApplication.spec.domainRefs and (b) when a domain host change ina referenced domain resource is recognized from CAPApplication. This is required to keep the VirtualServices up-to-date with the correct set of gateways and hosts.
Handle deletion of domain resources including deletion of linked Certificates
Refactor certificate handling to reuse common code and add support for cert-manager certificates.
Rework network policies generated for ingress
Update unit tests. (>80% coverage)
Implement migration routine (controller start-up)

Notes

Regarding Note
DomainandClusterDomain` These resources have independent reconciliation queues, but are reconciled with common functions (internal/controller/reconcile-domain.go). To create reuseable functions an abstration interface v1alpha1.DomainEntity with common getter and setter methods has been created.
Certificates Even though it is very tempting to use the SAP Gardener provided annotations for creating certificates (TLS), it becomes harder to track the readiness of the resulting certificate for determining application readiness. Another point to note is that even though the Gardener certificates can be created by specifying an alternate namespace for the generated credentials secret (required for Istio), the certificates created with cert-manager does not support this. With these constraints the following strategy is used (a) both gardener and cert-manager certificates are created directly by the operator (b) in the namespace of the ingress controller (c) and the ready status is tracked.
Gateways Gateways are created in the same namespace for Domains and in the cap-operator namespace for ClusterDomains. This eliminates the need to identify ingress controller namespaces during VirtualService reconciliations.
Ingress selector labels In a cluster where multiple ingress controllers are deployed, it should be possible to switch the controller used for a domain host by changing the ingress label selector on the domain resource. This can result in a movement (delete and create) of the related certificate resource to another namespace (corresponding to new selector).
DNS Entries DNS entries can change because of changes in (a) DNS mode (b) domain host (c) domain references in application
Network Policies Network policies for ingress (into the cluster) are created from the domain resource. One network policy is created per namespace where the domain resource is used by an application.

Future:

  • Refactor VirtualService reconciliation to reuse code for tenants and versions
  • Handle updates to domain spec and updation of existing VirtualService

skrishnan-sap and others added 3 commits May 19, 2025 14:25
Reworked networking aspects of CAP Operator, which is now primarily
taken care of by the `Domains` and `ClusterDomains` resources.

---------

Co-authored-by: anirudhprasad-sap <[email protected]>
Co-authored-by: Pavan <[email protected]>
@Pavan-SAP Pavan-SAP marked this pull request as ready for review May 22, 2025 08:58
Copy link
Member

@Pavan-SAP Pavan-SAP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Copy link
Contributor

@anirudhprasad-sap anirudhprasad-sap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Pavan-SAP Pavan-SAP merged commit 62ccb9b into main May 22, 2025
9 checks passed
@Pavan-SAP Pavan-SAP deleted the domains branch May 22, 2025 14:32
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.

3 participants