How openshift/hypershift works
Major Components
• API Layer and CRDs:
– The “api” directory shows that HyperShift defines several custom resource types (for certificates, hostedclusters, hypershift configurations, scheduling, etc.). These CRDs are the backbone of the system’s declarative management.
• Operators and Controllers:
– There are multiple operator components (such as “control-plane-operator”, “hypershift-operator”, “control-plane-pki-operator”, “karpenter-operator”, “ignition-server”, etc.). Each operator encapsulates a set of controllers dedicated to reconciling a portion of the cluster’s state (for example, hosted control plane setup, nodepool management, cloud provider integration, healthchecks, and k8s proxy configurations).
• CLI/Client Interfaces:
– Directories such as “product-cli”, “client”, and “cmd” indicate that users interact with HyperShift using a CLI to create, manage, or upgrade clusters.
• Supporting Infrastructure & Tools:
– Additional folders for “etcd-backup”, “dnsresolver”, “support”, “hack”, “docs”, and “test” showcase a comprehensive tooling layer for testing, documentation, and maintenance.
• Cloud Provider Integrations:
– Within operator directories (for example in the “control-plane-operator/controllers/hostedcontrolplane/cloud” folder) you see separate integrations for AWS, Azure, OpenStack, IBMCloud, Powervs, and Kubevirt. These integrations are essential for provisioning and managing the underlying resources.
Relationships and Data Flow
• User or CLI (Product CLI) interacting with the Kubernetes API server of the management cluster by submitting CRD-based requests.
• CRDs represent the desired state (for hosted clusters, certificates, node pools, etc.).
• Operators and controllers that “watch” these CRDs:
– For example, the Control Plane Operator reconciles hosted control plane resources.
– The Hypershift Operator might coordinate tasks such as deploying the ignition server and ensuring proper network routing.
– A dedicated PKI operator manages certificate lifecycles.
– Other operators (like karpenter for autoscaling, nodepool controllers, etc.) ensure that infrastructure is adjusted according to the state defined in the CRDs.
• Optionally, add secondary paths for telemetry, logging, or backup processes (represented by directories like “etcd-backup” and “support”).
Architectural Patterns and Design Principles
• The system is designed on a controller–reconciler pattern intrinsic to Kubernetes operators.
• Clear separation between the control plane and workload clusters is maintained through the CRD definitions and the management of hosted control planes.
• Each operator encapsulates its own concerns and leverages common libraries (as seen in “pkg”, “support”, and “hack”) to reduce duplication and ensure consistency.
– From the CLI to the Management API server.
– From the API server (CRDs) to the respective Operators.
– From Operators to external cloud/provider services.