Closed cedar715 closed 4 years ago
@cedar715 : Could you please share code from which you're trying to create route? And what does your current route look like? Looks like a case of mis-matching apiVersions.
final RouteList routes = openShiftClient.routes().inNamespace(namespace).list()
final List<Route> routeList = routes.getItems()
final Route existingRoute = routeList.find {
it.metadata?.name == routeName
}
final Route enrichedRoute = enrichTLSConfig(routeFolderPath, route)
ScalableResource<Route, DoneableRoute> routeOpr = openShiftClient.routes().inNamespace(namespace).withName(routeName) as ScalableResource
if (existingRoute) {
final Boolean isDeleted = routeOpr.delete()
log.info("Deleted route $routeName? :: $isDeleted")
if (!isDeleted) {
log.error("Route exists with the name $routeName and could NOT be deleted, terminating!")
throw new KubeClientException("Route exists with the name $routeName and could NOT be deleted!");
}
}
Route result = routeOpr.createOrReplace(enrichedRoute) as Route
log.info("Created route: $route")
We don't specify apiVersion in the manifests; its delegated to Fabric8 to determine the apt version based on the cluster version.
final VersionInfo versionInfo = namespaceOcpClient.version
final String apiVersionToUse = openshiftVersion?.startsWith('3.7') ? 'v1' : 'route.openshift.io/v1'
Got resolved when we explicitly set the version.
We upgraded Fabric8 from 4.1.1 to 4.7.0. All the manifests are getting applied correctly except for the Route: