Resource class is the foundation of the OpenShift Python Wrapper. It provides common functionality for all Kubernetes and OpenShift resources, including CRUD operations, resource management, and schema validation.
Class Hierarchy
All resource classes in the wrapper follow a clear inheritance hierarchy:Key Attributes
Every resource class has these important class-level attributes:Creating Resources
Resources can be created in multiple ways:From Python Objects
From YAML Files
From Dictionaries
Resource Lifecycle
Deploy Method
Thedeploy() method creates the resource on the cluster:
Check Existence
Update Resources
Delete Resources
Querying Resources
Get Single Resource
Get Multiple Resources
Get All Cluster Resources
Status and Conditions
Wait for Status
Wait for Conditions
Get Condition Messages
Resource Events
Watching Resources
Schema Validation
Schema validation ensures your resource definitions match the Kubernetes API schema before sending them to the cluster.
Enable Validation
Manual Validation
Validate Dictionaries
API Groups and Versions
Resources are organized by API groups:Resource.ApiGroup:
Resource Constants
TheResource class inherits from ResourceConstants, providing common constants:
Best Practices
Do: Use Client Instance
Don’t: Use Deprecated Parameters
Error Handling
Next Steps
Namespaced Resources
Learn about resources that exist within a namespace
Context Managers
Automatic resource lifecycle management
Client Configuration
Configure your Kubernetes client connection
API Reference
Complete Resource class API documentation