turbot/openshift
steampipe plugin install openshift

Table: openshift_route - Query OpenShift Routes using SQL

OpenShift Routes is a resource within Red Hat OpenShift that helps expose a service at a host name, like www.example.com, so that external clients can reach it by name. It provides a way to aggregate multiple services under the same IP address and differentiate them with the host name. OpenShift Routes makes it easy to expose services to the internet and manage traffic to your applications.

Table Usage Guide

The openshift_route table provides insights into the route objects within Red Hat OpenShift. As a DevOps engineer, you can explore route-specific details through this table, including the host, path, and the associated services. Utilize it to manage and monitor the accessibility of your applications, ensuring they are reachable and functioning as expected.

Examples

Basic info

select
uid,
name,
path,
host,
creation_timestamp,
resource_version,
namespace
from
openshift_route;
select
uid,
name,
path,
host,
creation_timestamp,
resource_version,
namespace
from
openshift_route;

List routes that are present in the default namespace

select
uid,
name,
path,
host,
creation_timestamp,
resource_version,
namespace
from
openshift_route
where
namespace = 'default';
select
uid,
name,
path,
host,
creation_timestamp,
resource_version,
namespace
from
openshift_route
where
namespace = 'default';

List deleted routes

select
uid,
name,
path,
host,
creation_timestamp,
resource_version,
namespace
from
openshift_route
where
deletion_timestamp is not null;
select
uid,
name,
path,
host,
creation_timestamp,
resource_version,
namespace
from
openshift_route
where
deletion_timestamp is not null;

List routes ingresses

select
uid,
name,
namespace,
jsonb_pretty(ingress) as ingress
from
openshift_route;
select
uid,
name,
namespace,
ingress
from
openshift_route;

List routes associated with a particular service

select
uid,
name,
path,
host,
creation_timestamp,
resource_version,
namespace
from
openshift_route
where
spec_to ->> 'kind' = 'Service'
and spec_to ->> 'name' = 'console';
select
uid,
name,
path,
host,
creation_timestamp,
resource_version,
namespace
from
openshift_route
where
json_extract(spec_to, '$.kind') = 'Service'
and json_extract(spec_to, '$.name') = 'console';

List routes associated with a particular daemonset

select
uid,
name,
or.path,
host,
creation_timestamp,
resource_version,
namespace
from
openshift_route as
or,
jsonb_array_elements(owner_references) owner
where
owner ->> 'kind' = 'daemonset'
and owner ->> 'name' = 'ingress-canary';
select
uid,
name,
osr.path,
host,
creation_timestamp,
resource_version,
namespace
from
openshift_route as osr,
json_each(owner_references) as owner
where
json_extract(owner.value, '$.kind') = 'daemonset'
and json_extract(owner.value, '$.name') = 'ingress-canary';

Schema for openshift_route

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
alternate_backendsjsonbAlternate backends allow up to 3 additional backends to be assigned to the route. Only the Service kind is allowed, and it will be defaulted to Service. Use the weight field in RouteTargetReference object to specify relative preference.
annotationsjsonbAnnotations is an unstructured key-value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
creation_timestamptimestamp with time zoneCreationTimestamp is a timestamp representing the server time when this object was created.
deletion_grace_period_secondsbigintNumber of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set.
deletion_timestamptimestamp with time zoneDeletionTimestamp is RFC 3339 date and time at which this resource will be deleted.
finalizersjsonbMust be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.
generate_nametextGenerateName is an optional prefix, used by the server, to generate a unique name only if the Name field has not been provided.
generationbigintA sequence number representing a specific generation of the desired state.
hosttextHost is an alias/DNS that points to the service. Optional. If not specified a route name will typically be automatically chosen. Must follow DNS952 subdomain conventions.
ingressjsonbIngress describes the places where the route may be exposed. The list of ingress points may contain duplicate Host or RouterName values. Routes are considered live once they are `Ready`.
labelsjsonbMap of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services.
nametext=Name of the object. Name must be unique within a namespace.
namespacetext=Namespace defines the space within which each name must be unique.
owner_referencesjsonbList of objects depended by this object. If all objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.
pathtextPath that the router watches for, to route traffic to the service.
portjsonbIf specified, the port to be used by the router. Most routers will use all endpoints exposed by the service by default - set this value to instruct routers which port to use.
resource_versiontextAn opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed.
spec_tojsonbTo is an object the route should use as the primary backend. Only the Service kind is allowed, and it will be defaulted to Service. If the weight field (0-256 default 1) is set to zero, no traffic will be sent to this backend.
subdomaintextSubdomain is a DNS subdomain that is requested within the ingress controller's domain (as a subdomain). If the host is set this field is ignored. An ingress controller may choose to ignore this suggested name, in which case the controller will report the assigned name in the status.
titletextTitle of the resource.
tlsjsonbThe tls field provides the ability to configure certificates and termination for the route.
uidtextUID is the unique in time and space value for this object.
wildcard_policytextWildcard policy if any for the route. Currently only 'Subdomain' or 'None' is allowed.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- openshift

You can pass the configuration to the command with the --config argument:

steampipe_export_openshift --config '<your_config>' openshift_route