Overview
TheImageStream class represents an OpenShift ImageStream object, which provides an abstraction for referencing container images. ImageStreams enable you to track and manage images from multiple registries, automatically trigger builds and deployments when images change, and provide a stable reference to images that may change over time.
Source: ocp_resources/image_stream.py:5
API Reference: OpenShift ImageStream API
Class Definition
Constructor
Parameters
str
default:"None"
Name of the ImageStream resource. If not provided, it must be specified in the YAML file.
str
default:"None"
Namespace where the ImageStream will be created. Required for namespaced resources.
DynamicClient
default:"None"
Kubernetes dynamic client for API communication. If not provided, the default client will be used.
bool
default:"False"
Controls whether image references can use the ImageStream name directly in pod specs. When set to True (local lookup enabled), pods can reference images using the ImageStream name instead of the full registry path.Example: With local lookup, you can use
my-app:latest instead of image-registry.openshift-image-registry.svc:5000/myproject/my-app:latestlist[dict[str, Any]]
default:"None"
List of image tags to track in this ImageStream. Each tag can reference images from external registries or from builds.Example:
bool
default:"True"
If True, the resource will be automatically deleted when used as a context manager.
str
default:"None"
Path to a YAML file containing the ImageStream definition. If provided, the ImageStream will be created from this file.
int
default:"TIMEOUT_4MINUTES"
Timeout in seconds for delete operations. Defaults to 4 minutes.
Any
Additional keyword arguments passed to the parent
NamespacedResource class. Common options include label and annotations.Usage Examples
Basic ImageStream
Create a simple ImageStream without tags:ImageStream with External Image
Create an ImageStream that tracks an external Docker image:Multiple Tags
Create an ImageStream with multiple version tags:ImageStream for Build Output
Create an ImageStream to store build outputs:Scheduled Image Import
Create an ImageStream that periodically checks for image updates:Creating from YAML
Create an ImageStream from a YAML file:Using Context Manager
Automatically clean up the ImageStream after use:Accessing ImageStream Tags
Query ImageStream tags and image information:Tag Configuration
Import Policy
Controls how images are imported:Reference Policy
Controls how image references are stored:- Local: Images are imported to the internal OpenShift registry
- Source: References point to the original external registry
Tag Annotations
Add metadata to tags:Image Reference Types
Docker Image
Reference an external container image:ImageStreamTag
Reference another tag within the same or different ImageStream:ImageStreamImage
Reference a specific image by digest:Common Use Cases
Build Output Storage
ImageStreams are commonly used as build output destinations:Deployment Triggers
ImageStreams trigger automatic deployments when images change:Image Mirroring
Mirror external images to the internal registry:OpenShift Internal Registry
ImageStreams automatically integrate with OpenShift’s internal registry: Registry URL Format:Lookup Policy
Whenlookup_policy is enabled:
Related Resources
- BuildConfig - Uses ImageStreams for output
- DeploymentConfig - Uses ImageStreams for triggers
- ImageStreamTag - Individual tag within an ImageStream
- OpenShift ImageStream Documentation