Overview

Ingress class mapping in Kubernetes helps direct traffic efficiently by associating ingress resources with specific ingress controllers. This is especially useful in clusters running multiple ingress controllers, such as NGINX, Traefik, or HAProxy.


Starting from Kubernetes v1.18, IngressClass was introduced as a way to formally associate ingress resources with controllers. Before this, ingress controllers relied on annotations like:


annotations:
  kubernetes.io/ingress.class: "nginx"



You can deploy the ingress controller. 


k apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/oracle/deploy.yaml 



Ingress Annotation Mapping:


Annotations in Kubernetes ingress resources allow fine-grained control over the behavior of the NGINX Ingress Controller. These annotations enable custom configurations such as path rewrites, rate limiting, authentication, and SSL settings.



SWIFT Allow these mapping, you to map ingress class for ingress replication You can map ingress class directly for each selected ingress from the replicated namespace to specify a new class. Optionally, you can also specify new annotations for each selected ingress from the replicated namespace 



1. If you want to Ingress class mapping and and annotation mapping in SWIFT, then you have to go to "All Replication" under "Sync Administration"  and click on "New" and choose the "Application Replication" and select "Passthrough Sync"


2. When you open the Passthrough window , you have to provide the source cluster information and target cluster information along with namespace that you want to replicate .






In the above we have selected the local-k8s cluster at source and target and selected the different namespace here. Also fill up the all required details  as per your environment in the "General Options"  



3. In the "Advanced Option" there is one option that is "Kubernetes Ingress Config" ,  there you need to select the Ingress name in the "Ingress Class Mapping" section and select the "dst_ingress_class". 

4. And then select the "Ingress Name" and Provide the "Annotation key and value". Please see below snippet for your reference.





5. Once you click on "Add" button, then it will map the ingressclass at target once finish the sync. and you can check at target cluster if that mapping done or not?


Run the following command to list the available IngressClass resources in the cluster: 

kubectl get ingressclass


Check if your Ingress objects are mapped to the expected IngressClass

kubectl get ingress -A -o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name,INGRESS_CLASS:.spec.ingressClassName