nodepool

package
v0.1.87 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 108 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	EC2VolumeDefaultSize int64  = 16
	EC2VolumeDefaultType string = "gp3"
)
View Source
const (
	StreamRHEL9  = releaseinfo.StreamRHEL9
	StreamRHEL10 = releaseinfo.StreamRHEL10
)
View Source
const (
	TokenSecretTokenGenerationTime       = "hypershift.openshift.io/last-token-generation-time"
	TokenSecretReleaseKey                = "release"
	TokenSecretReleaseVersionKey         = "release-version"
	TokenSecretTokenKey                  = "token"
	TokenSecretPullSecretHashKey         = "pull-secret-hash"
	TokenSecretHCConfigurationHashKey    = "hc-configuration-hash"
	TokenSecretAdditionalTrustBundleKey  = "additional-trust-bundle-hash"
	TokenSecretCloudConfigHashKey        = "cloud-config-hash"
	TokenSecretConfigKey                 = "config"
	TokenSecretAnnotation                = "hypershift.openshift.io/ignition-config"
	TokenSecretIgnitionReachedAnnotation = "hypershift.openshift.io/ignition-reached"
	TokenSecretNodePoolUpgradeType       = "hypershift.openshift.io/node-pool-upgrade-type"
	TokenSecretOSStreamKey               = "os-stream"
)
View Source
const (

	// AnnotationEnableSpot enables spot instance creation for this NodePool.
	// When set, the NodePool will create spot instances instead of on-demand instances.
	AnnotationEnableSpot = "hypershift.openshift.io/enable-spot"
)
View Source
const (
	ContainerRuntimeConfigConfigMapLabel = "hypershift.openshift.io/containerruntimeconfig-config"
)
View Source
const TokenSecretPrefix = "token"
View Source
const UserDataSecrePrefix = "user-data"

Variables

This section is empty.

Functions

func FindStatusCondition

func FindStatusCondition(conditions []hyperv1.NodePoolCondition, conditionType string) *hyperv1.NodePoolCondition

FindStatusCondition finds the conditionType in conditions.

func GetHostedClusterByName

func GetHostedClusterByName(ctx context.Context, c client.Client, namespace, name string) (*hyperv1.HostedCluster, error)

GetHostedClusterByName finds and return a HostedCluster object using the specified params.

func GetRHELStream added in v0.1.77

func GetRHELStream(explicitStream string, releaseVersion semver.Version, usesRunc bool) (string, error)

GetRHELStream resolves which RHEL CoreOS stream a NodePool should use. Returns the resolved stream name, or an error for invalid combinations. For OCP < 5.0 with no explicit stream it returns StreamRHEL9 (the only stream available on those releases). Exported for use by integration tests and future Phase 2 consumers (token secret plumbing, validMachineConfigCondition).

func GetRHELStreamForBootImage added in v0.1.81

func GetRHELStreamForBootImage(ctx context.Context, c client.Client, nodePool *hyperv1.NodePool, releaseImage *releaseinfo.ReleaseImage, osStreamsEnabled bool) (string, error)

GetRHELStreamForBootImage returns the RHEL stream name to pass to StreamForName when resolving platform-specific boot images (AMIs, VHDs, GCE images, etc.).

Resolution order:

  1. spec.osImageStream.Name — explicit user choice, always honored
  2. When the OSStreams feature gate is disabled: always rhel-9 (backwards-compatible with upstream behavior)
  3. When the OSStreams feature gate is enabled: version-derived default via GetRHELStream (rhel-9 for <5.0, rhel-10 for >=5.0)

func IBMPowerVSImage

func IBMPowerVSImage(namespace, name string) *capipowervs.IBMPowerVSImage

func MachineDeploymentComplete

func MachineDeploymentComplete(deployment *capiv1.MachineDeployment, machineSets []capiv1.MachineSet) bool

MachineDeploymentComplete considers a MachineDeployment to be complete once all of its desired replicas are available, the MachineSet holding the current template is fully rolled out, and no old machines are running.

Rollout completion is derived from the MachineSets owned by the MachineDeployment, which guards against a race in CAPI where ObservedGeneration and status counters are set before downstream controllers (Machine, MachineSet) have reconciled the template change, causing the counters to be stale. See https://github.com/kubernetes-sigs/cluster-api/issues/13738.

MachineDeployment.status.upToDateReplicas (and the Machine UpToDate condition behind it) is deliberately not consulted. Since upstream CAPI v1.14.0 (https://github.com/kubernetes-sigs/cluster-api/pull/13876) that condition compares Node.status.nodeInfo.kubeletVersion (e.g. "v1.33.5+<hash>") as a raw string against Machine.spec.version, which HyperShift sets to the OCP release version (e.g. "4.20.3"). It can therefore never become true for Replace-strategy NodePools, which would leave upToDateReplicas at 0 forever and stall every NodePool version and config rollout. See https://github.com/kubernetes-sigs/cluster-api/issues/14086.

func PerformanceProfileConfigMap added in v0.1.20

func PerformanceProfileConfigMap(namespace, name, nodePoolName string) *corev1.ConfigMap

func SetStatusCondition

func SetStatusCondition(conditions *[]hyperv1.NodePoolCondition, newCondition hyperv1.NodePoolCondition)

SetStatusCondition sets the corresponding condition in conditions to newCondition. conditions must be non-nil.

  1. if the condition of the specified type already exists (all fields of the existing condition are updated to newCondition, LastTransitionTime is set to now if the new status differs from the old status)
  2. if a condition of the specified type does not exist (LastTransitionTime is set to now() if unset, and newCondition is appended)

func TokenSecret

func TokenSecret(namespace, name, payloadInputHash string) *corev1.Secret

func TunedConfigMap added in v0.1.20

func TunedConfigMap(namespace, name string) *corev1.ConfigMap

Types

type CAPI added in v0.1.48

type CAPI struct {
	*Token

	upsert.ApplyProvider
	// contains filtered or unexported fields
}

CAPI Knows how to reconcile all the CAPI resources for a unique token. TODO(alberto): consider stronger decoupling from Token by making it an interface and let nodepool, hostedcluster, and client be fields of CAPI / interface methods.

func (*CAPI) Pause added in v0.1.48

func (c *CAPI) Pause(ctx context.Context) error

func (*CAPI) Reconcile added in v0.1.48

func (c *CAPI) Reconcile(ctx context.Context) error

type CPOCapabilities

type CPOCapabilities struct {
	DecompressAndDecodeConfig     bool
	CreateDefaultAWSSecurityGroup bool
}

type ConfigGenerator added in v0.1.48

type ConfigGenerator struct {
	client.Client
	// contains filtered or unexported fields
}

ConfigGenerator knows how to: - Generate a unique hash id for any NodePool API input that requires a NodePool rollout. - Generate a compressed and encoded artifact of the mco RawConfig that can be stored in a Secret and consumed by mco/local-ignition-provider to generate the final ignition config served to Nodes.

func NewConfigGenerator added in v0.1.48

func NewConfigGenerator(ctx context.Context, client client.Client, hostedCluster *hyperv1.HostedCluster, nodePool *hyperv1.NodePool, releaseImage *releaseinfo.ReleaseImage, haproxyRawConfig string, controlPlaneNamespace string, resolvedRHELStream string) (*ConfigGenerator, error)

NewConfigGenerator is the contract to create a new ConfigGenerator.

func (*ConfigGenerator) Compressed added in v0.1.48

func (cg *ConfigGenerator) Compressed() (*bytes.Buffer, error)

Compressed returns a gzipped artifact of the rawconfig. Prefer CompressedAndEncoded unless the CPO/your decompressor doesn't know how to handle base64 encoded data.

func (*ConfigGenerator) CompressedAndEncoded added in v0.1.48

func (cg *ConfigGenerator) CompressedAndEncoded() (*bytes.Buffer, error)

CompressedAndEncoded returns a gzipped and base-64 encodesd artifact of the raw config.

func (*ConfigGenerator) GetCloudConfigHash added in v0.1.80

func (cg *ConfigGenerator) GetCloudConfigHash(ctx context.Context) (string, error)

GetCloudConfigHash returns a hash of the platform-specific cloud config ConfigMap content. For platforms without a cloud config ConfigMap (e.g. AWS), it returns an empty string.

func (*ConfigGenerator) Hash added in v0.1.48

func (cg *ConfigGenerator) Hash() string

Hash returns a unique hash id for any NodePool API input that requires a NodePool rollout, i.e. the rolloutConfig struct. TODO(alberto): hash the struct directly instead of the string representation field by field. This is kept like this for now to contain the scope of the refactor and avoid backward compatibility issues.

func (*ConfigGenerator) HashWithoutVersion added in v0.1.48

func (cg *ConfigGenerator) HashWithoutVersion() string

HashWithOutVersion is like Hash but doesn't compute the release version. This is only used to signal if a rollout is driven by a new release or by something else. TODO(alberto): This was left inconsistent in https://github.com/openshift/hypershift/pull/3795/files. It should also contain cg.globalConfig. This is kept like this for now to contain the scope of the refactor and avoid backward compatibility issues.

func (*ConfigGenerator) RolloutHash added in v0.1.87

func (cg *ConfigGenerator) RolloutHash() string

RolloutHash returns a hash derived only from spec-driven inputs that require node replacement. Management-side changes (e.g. HAProxy image digest bumps, platform-computed proxy defaults) are excluded, so they do not trigger Replace or InPlace rollouts. Endpoint-affecting connectivity changes (Public/Private, API server address/port) are included.

func (*ConfigGenerator) RolloutHashWithoutVersion added in v0.1.87

func (cg *ConfigGenerator) RolloutHashWithoutVersion() string

RolloutHashWithoutVersion is like RolloutHash but excludes the release version. Used to detect config-only changes for the UpdatingConfig condition, separate from version changes which have their own condition.

func (*ConfigGenerator) Version added in v0.1.48

func (cg *ConfigGenerator) Version() string

type GCPBootDiskConfig added in v0.1.74

type GCPBootDiskConfig struct {
	Size          int64
	Type          *capigcp.DiskType
	EncryptionKey *capigcp.CustomerEncryptionKey
}

GCPBootDiskConfig holds boot disk configuration values

type MirrorConfig added in v0.1.40

type MirrorConfig struct {
	*corev1.ConfigMap
	Labels map[string]string
}

MirrorConfig holds the information needed to mirror a config object to HCP namespace

func BuildMirrorConfigs added in v0.1.48

func BuildMirrorConfigs(ctx context.Context, cg *ConfigGenerator) ([]*MirrorConfig, error)

BuildMirrorConfigs returns a slice of MirrorConfigs for user configs that are supposed to be mirrored to the HCP namespace.

type MissingCoreConfigError added in v0.1.48

type MissingCoreConfigError struct {
	Expected int
	Got      int
}

func (*MissingCoreConfigError) Error added in v0.1.48

func (e *MissingCoreConfigError) Error() string

type NodePoolReconciler

type NodePoolReconciler struct {
	client.Client

	ReleaseProvider releaseinfo.Provider
	upsert.CreateOrUpdateProvider
	HypershiftOperatorImage string
	ImageMetadataProvider   imageregistry.ImageMetadataProvider
	KubevirtInfraClients    kvinfra.KubevirtInfraClientMap
	EC2Client               awsapi.EC2API
	InstanceTypeProvider    instancetype.Provider
	ScaleFromZeroPlatform   hyperv1.PlatformType
	// contains filtered or unexported fields
}

func (*NodePoolReconciler) Reconcile

func (r *NodePoolReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error)

func (*NodePoolReconciler) SetPerformanceProfileConditions added in v0.1.43

func (r *NodePoolReconciler) SetPerformanceProfileConditions(ctx context.Context, logger logr.Logger, nodePool *hyperv1.NodePool, controlPlaneNamespace string, toDelete bool) error

SetPerformanceProfileConditions checks for performance profile status updates, and reflects them in the nodepool status conditions

func (*NodePoolReconciler) SetupWithManager

func (r *NodePoolReconciler) SetupWithManager(mgr ctrl.Manager) error

type NotReadyError

type NotReadyError struct {
	// contains filtered or unexported fields
}

type Token added in v0.1.48

type Token struct {
	upsert.CreateOrUpdateProvider

	*ConfigGenerator
	// contains filtered or unexported fields
}

Token knows how to create an UUUID token for a unique configGenerator Hash. It also knows how to manage the lifecycle of a corresponding token secret that it is used by the tokenSecret controller to generate the final ignition payload and a user data secret that points to the ignition server URL using the UUUID as an authenticator header to get that payload.

func NewToken added in v0.1.48

func NewToken(ctx context.Context, configGenerator *ConfigGenerator, cpoCapabilities *CPOCapabilities) (*Token, error)

NewToken is the contract to create a new Token struct.

func (*Token) EffectiveHash added in v0.1.87

func (t *Token) EffectiveHash() string

EffectiveHash returns the full hash that this reconcile cycle maintained secrets for. Determined by resolveEffectiveHash() during Reconcile(). Only valid after Reconcile() has been called.

func (*Token) Reconcile added in v0.1.48

func (t *Token) Reconcile(ctx context.Context) error

func (*Token) SetDeployedBootstrapHash added in v0.1.87

func (t *Token) SetDeployedBootstrapHash(hash string)

SetDeployedBootstrapHash records the full hash extracted from the CAPI workload's current bootstrap secret reference (e.g. MachineDeployment or MachineSet). Must be called before Reconcile() so effectiveSecrets() can maintain the in-progress rollout target during management-side drift.

func (*Token) TokenSecret added in v0.1.48

func (t *Token) TokenSecret() *corev1.Secret

func (*Token) UserDataSecret added in v0.1.48

func (t *Token) UserDataSecret() *corev1.Secret

Directories

Path Synopsis
aws

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL