Invalid Ingress Class when Provisioning a Controller with CasC and OpenShift

2 minute readKnowledge base

Issue

When defining Managed controller provisioning values using CasC after version 2.440.1.3, specifically when defining an ingress in an OpenShift environment, you are seeing an error similar to the following (truncated for privacy) when attempting to provision a Managed controller:

ERROR: Failed to provision controller:... null:Failure executing: POST at: ... Message: ... denied the request: invalid ingress class: IngressClass.networking.k8s.io "nginx" not found. Received status: Status(apiVersion=v1, code=403, details=null, kind=Status, message... invalid ingress class: IngressClass.networking.k8s.io "nginx" not found, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=invalid ingress class: IngressClass.networking.k8s.io "nginx" not found, status=Failure, additionalProperties={}).

This issue is occurring while the ingress class (nginx in this case) is defined in the Helm values:

OperationsCenter: Ingress: Class: nginx

As well as the jenkins.yaml:

masterprovisioning: kubernetes: clusterEndpoints: - id: "myEndpoint" name: "kubernetes" serviceExposure: ingress: ingressAnnotations: |- key1: value1 key2: value2 ingressClass: “nginx"

Resolution

Prior to the introduction of a concrete type for controller exposure, the operations center would dynamically change the behavior of exposing a controller based on a runtime lookup to detect if the underlying Kubernetes infrastructure was OpenShift. However, this dynamic check could lead to the creation of an Ingress object for a controller instead of Route.

If your kubernetes infrastructure is OpenShift, this error could mean that you should be providing a Route instead of an Ingress. This would be defined under the concrete type exposure as:

masterprovisioning: kubernetes: clusterEndpoints: - id: "myEndpoint" name: "openshift" serviceExposure: "openShiftRoute"

For more information on this change, please see Operations Center Parent 3.0.74 as well as the upgrade notes for CloudBees CI on modern cloud platforms 2.440.1.3