turbot/openshift
steampipe plugin install openshift

Table: openshift_deployment_config - Query OpenShift Deployment Configs using SQL

OpenShift Deployment Configs are a feature of OpenShift, a Kubernetes distribution from Red Hat. Deployment Configs define the template for a pod and manage the deployment of new pod versions when the template changes. They provide detailed control over the lifecycle of deployments, including strategies for rolling updates, manual intervention, and rollback.

Table Usage Guide

The openshift_deployment_config table provides insights into Deployment Configs within OpenShift. As a DevOps engineer or system administrator, explore deployment-specific details through this table, including triggers, strategies, and information about the latest deployments. Utilize it to manage and monitor the deployment of new pod versions in an OpenShift cluster.

Examples

Basic info

Explore the status and details of different deployment configurations within an OpenShift environment. This allows for efficient monitoring and management of resources, ensuring optimal application performance and availability.

select
uid,
name,
namespace,
spec_replicas ready_replicas,
updated_replicas,
available_replicas,
unavailable_replicas,
creation_timestamp
from
openshift_deployment_config;
select
uid,
name,
namespace,
spec_replicas,
ready_replicas,
updated_replicas,
available_replicas,
unavailable_replicas,
creation_timestamp
from
openshift_deployment_config;

List deployment configs present in the default namespace

Explore the deployment configurations within the default namespace to understand the status and availability of replicas. This can be useful for managing resources and identifying potential issues in your OpenShift environment.

select
uid,
name,
namespace,
spec_replicas ready_replicas,
updated_replicas,
available_replicas,
unavailable_replicas,
creation_timestamp
from
openshift_deployment_config
where
namespace = 'default';
select
uid,
name,
namespace,
spec_replicas,
ready_replicas,
updated_replicas,
available_replicas,
unavailable_replicas,
creation_timestamp
from
openshift_deployment_config
where
namespace = 'default';

List paused deployment configs

Discover the segments that have paused deployment configurations. This can help in identifying instances where updates or changes have been halted, allowing for quick resolution of issues that may be causing the pause.

select
uid,
name,
namespace,
spec_replicas ready_replicas,
updated_replicas,
available_replicas,
unavailable_replicas,
creation_timestamp
from
openshift_deployment_config
where
paused;
select
uid,
name,
namespace,
spec_replicas,
ready_replicas,
updated_replicas,
available_replicas,
unavailable_replicas,
creation_timestamp
from
openshift_deployment_config
where
paused = 1;

List deployment configs created in the last 30 days

Identify recent deployment configurations within the past month to understand their status and performance. This can be beneficial in monitoring system health and identifying potential issues early.

select
uid,
name,
namespace,
spec_replicas ready_replicas,
updated_replicas,
available_replicas,
unavailable_replicas,
creation_timestamp
from
openshift_deployment_config
where
creation_timestamp >= now() - interval '30' day;
select
uid,
name,
namespace,
spec_replicas,
ready_replicas,
updated_replicas,
available_replicas,
unavailable_replicas,
creation_timestamp
from
openshift_deployment_config
where
creation_timestamp >= datetime('now', '-30 day');

Get container images used in deployment configs

Discover the specific container images used in your deployment configurations. This allows you to assess and manage your resource usage and maintain an inventory of your deployed images.

select
name,
namespace,
c ->> 'name' as container_name,
c ->> 'image' as image
from
openshift_deployment_config,
jsonb_array_elements(template -> 'Spec' -> 'Containers') as c
order by
namespace,
name;
select
name,
namespace,
json_extract(c.value, '$.name') as container_name,
json_extract(c.value, '$.image') as image
from
openshift_deployment_config,
json_each(json_extract(template, '$.Spec.Containers')) as c
order by
namespace,
name;

List pods for a particular deployment config

This query helps you to monitor and manage your Kubernetes deployment by listing all the pods associated with a specific deployment configuration. It's particularly useful when you need to track the status and location of pods within a particular deployment, such as troubleshooting issues or optimizing resource allocation.

select
pod.namespace,
d.name as deployment_config_name,
rc.name as replication_controller_name,
pod.name as pod_name,
pod.phase,
age(current_timestamp, pod.creation_timestamp),
pod.pod_ip,
pod.node_name
from
kubernetes_pod as pod,
jsonb_array_elements(pod.owner_references) as pod_owner,
kubernetes_replication_controller as rc,
jsonb_array_elements(rc.owner_references) as rc_owner,
openshift_deployment_config as d
where
pod_owner ->> 'kind' = 'ReplicationController'
and rc.uid = pod_owner ->> 'uid'
and rc_owner ->> 'uid' = d.uid
and d.name = 'sample-deployment'
order by
pod.namespace,
d.name,
rc.name,
pod.name;
select
pod.namespace,
d.name as deployment_config_name,
rc.name as replication_controller_name,
pod.name as pod_name,
pod.phase,
(
strftime('%s', 'now') - strftime('%s', pod.creation_timestamp)
) as age,
pod.pod_ip,
pod.node_name
from
kubernetes_pod as pod,
json_each(pod.owner_references) as pod_owner,
kubernetes_replication_controller as rc,
json_each(rc.owner_references) as rc_owner,
openshift_deployment_config as d
where
json_extract(pod_owner.value, '$.kind') = 'ReplicationController'
and rc.uid = json_extract(pod_owner.value, '$.uid')
and json_extract(rc_owner.value, '$.uid') = d.uid
and d.name = 'sample-deployment'
order by
pod.namespace,
d.name,
rc.name,
pod.name;

List deployment config with access to the host process ID, IPC, or network

Discover the deployment configurations that have access to the host process ID, IPC, or network. This is useful for identifying potential security risks in your Openshift environment.

select
namespace,
name,
template -> 'spec' ->> 'hostPID' as hostPID,
template -> 'spec' ->> 'hostIPC' as hostIPC,
template -> 'spec' ->> 'hostNetwork' as hostNetwork
from
openshift_deployment_config
where
template -> 'spec' ->> 'hostPID' = 'true'
or template -> 'spec' ->> 'hostIPC' = 'true'
or template -> 'spec' ->> 'hostNetwork' = 'true';
select
namespace,
name,
json_extract(template, '$.spec.hostPID') as hostPID,
json_extract(template, '$.spec.hostIPC') as hostIPC,
json_extract(template, '$.spec.hostNetwork') as hostNetwork
from
openshift_deployment_config
where
json_extract(template, '$.spec.hostPID') = 'true'
or json_extract(template, '$.spec.hostIPC') = 'true'
or json_extract(template, '$.spec.hostNetwork') = 'true';

Schema for openshift_deployment_config

NameTypeOperatorsDescription
DetailsjsonbDetails are the reasons for the update to this deployment config.
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
annotationsjsonbAnnotations is an unstructured key-value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
available_replicasbigintThe total number of available pods targeted by this deployment config.
conditionsjsonbConditions represent the latest available observations of a deployment config's current state.
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.
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.
latest_versionbigintLatestVersion is used to determine whether the current deployment associated with a deployment config is out of sync.
min_ready_secondsbigintMinReadySeconds is the minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available.
nametext=Name of the object. Name must be unique within a namespace.
namespacetext=Namespace defines the space within which each name must be unique.
observed_generationbigintObservedGeneration is the most recent generation observed by the deployment config controller.
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.
pausedbooleanPaused indicates that the deployment config is paused resulting in no new deployments on template changes or changes in the template caused by other triggers.
ready_replicasbigintTotal number of ready pods targeted by this deployment.
resource_versiontextAn opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed.
revision_history_limitbigintRevisionHistoryLimit is the number of old ReplicationControllers to retain to allow for rollbacks. This field is a pointer to allow for differentiation between an explicit zero and not specified. Defaults to 10.
selectorjsonbSelector is a label query over pods that should match the Replicas count.
spec_replicasbigintReplicas is the number of desired replicas.
status_replicasbigintReplicas is the total number of pods targeted by this deployment config.
strategyjsonbStrategy describes how a deployment is executed.
templatejsonbTemplate is the object that describes the pod that will be created if insufficient replicas are detected.
testbooleanTest ensures that this deployment config will have zero replicas except while a deployment is running.
titletextTitle of the resource.
triggersjsonbTriggers determine how updates to a DeploymentConfig result in new deployments. If no triggers are defined, a new deployment can only occur as a result of an explicit client update to the DeploymentConfig with a new LatestVersion. If null, defaults to having a config change trigger.
uidtextUID is the unique in time and space value for this object.
unavailable_replicasbigintThe total number of unavailable pods targeted by this deployment config.
updated_replicasbigintThe total number of non-terminated pods targeted by this deployment config that has the desired template spec.

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_deployment_config