Documentation ¶
Index ¶
- Constants
- Variables
- func AddAdditionalKubeconfigCAs(data []byte) ([]byte, error)
- func AddControllerMetricsTransportWrapper(cfg *rest.Config, controllerName hivev1.ControllerName, remote bool)
- func AddFinalizer(object metav1.Object, finalizer string)
- func AddTypeMeta(objects []runtime.RawExtension, scheme *runtime.Scheme) ([]runtime.RawExtension, error)
- func BuildControllerLogger(controller hivev1.ControllerName, resource string, nsName types.NamespacedName) *log.Entry
- func CalculateJobSpecHash(job *batchv1.Job) (string, error)
- func CalculateStatefulSetSpecHash(statefulset *appsv1.StatefulSet) (string, error)
- func ClearRelocateAnnotation(obj metav1.Object) (changed bool)
- func CopySecret(c client.Client, src, dest types.NamespacedName, owner metav1.Object, ...) error
- func CredentialsSecretName(cd *hivev1.ClusterDeployment) string
- func DNSZoneName(cdName string) string
- func DeleteFinalizer(object metav1.Object, finalizer string)
- func Dotted(domain string) string
- func EnqueueDNSZonesOwnedByClusterDeployment(c client.Client, logger log.FieldLogger) handler.EventHandler
- func EnsureRequeueAtLeastWithin(duration time.Duration, result reconcile.Result, err error) (reconcile.Result, error)
- func ErrorScrub(err error) string
- func FindClusterClaimCondition(conditions []hivev1.ClusterClaimCondition, ...) *hivev1.ClusterClaimCondition
- func FindClusterDeploymentCondition(conditions []hivev1.ClusterDeploymentCondition, ...) *hivev1.ClusterDeploymentCondition
- func FindClusterDeprovisionCondition(conditions []hivev1.ClusterDeprovisionCondition, ...) *hivev1.ClusterDeprovisionCondition
- func FindClusterInstallCondition(conditions []hivev1.ClusterInstallCondition, conditionType string) *hivev1.ClusterInstallCondition
- func FindClusterPoolCondition(conditions []hivev1.ClusterPoolCondition, ...) *hivev1.ClusterPoolCondition
- func FindClusterProvisionCondition(conditions []hivev1.ClusterProvisionCondition, ...) *hivev1.ClusterProvisionCondition
- func FindDNSZoneCondition(conditions []hivev1.DNSZoneCondition, ...) *hivev1.DNSZoneCondition
- func FindMachinePoolCondition(conditions []hivev1.MachinePoolCondition, ...) *hivev1.MachinePoolCondition
- func FindSyncCondition(conditions []hivev1.SyncCondition, conditionType hivev1.SyncConditionType) *hivev1.SyncCondition
- func GetChecksumOfObject(object interface{}) (string, error)
- func GetChecksumOfObjects(objects ...interface{}) (string, error)
- func GetControllerConfig(client client.Client, controllerName hivev1.ControllerName) (int, flowcontrol.RateLimiter, workqueue.RateLimiter, error)
- func GetDuckType(ctx context.Context, client client.Client, gvk schema.GroupVersionKind, ...) error
- func GetHiveNamespace() string
- func HasFinalizer(object metav1.Object, finalizer string) bool
- func InitializeClusterClaimConditions(existingConditions []hivev1.ClusterClaimCondition, ...) []hivev1.ClusterClaimCondition
- func InitializeClusterDeploymentConditions(existingConditions []hivev1.ClusterDeploymentCondition, ...) []hivev1.ClusterDeploymentCondition
- func InitializeClusterPoolConditions(existingConditions []hivev1.ClusterPoolCondition, ...) []hivev1.ClusterPoolCondition
- func InitializeMachinePoolConditions(existingConditions []hivev1.MachinePoolCondition, ...) []hivev1.MachinePoolCondition
- func InjectWatcher(r reconcile.Reconciler, c controller.Controller)
- func IsClaimedClusterMarkedForRemoval(cd *hivev1.ClusterDeployment) bool
- func IsClusterDeploymentErrorUpdateEvent(evt event.UpdateEvent) bool
- func IsClusterPausedOrRelocating(cd *hivev1.ClusterDeployment, logger log.FieldLogger) bool
- func IsConditionInDesiredState(condition hivev1.ClusterDeploymentCondition) bool
- func IsConditionWithPositivePolarity(conditionType hivev1.ClusterDeploymentConditionType) bool
- func IsDeadlineExceeded(job *batchv1.Job) bool
- func IsDeleteProtected(cd *hivev1.ClusterDeployment) bool
- func IsFailed(job *batchv1.Job) bool
- func IsFakeCluster(cd *hivev1.ClusterDeployment) bool
- func IsFinished(job *batchv1.Job) bool
- func IsRelocating(obj metav1.Object) (relocateName string, status hivev1.RelocateStatus, err error)
- func IsSuccessful(job *batchv1.Job) bool
- func ListRuntimeObjects(c client.Client, typesToList []client.ObjectList, opts ...client.ListOption) ([]runtime.Object, error)
- func LoadSecretData(c client.Client, secretName, namespace, dataKey string) (string, error)
- func LogLevel(err error) log.Level
- func MergeJsons(globalPullSecret string, localPullSecret string, cdLog log.FieldLogger) (string, error)
- func NewClientWithMetricsOrDie(mgr manager.Manager, ctrlrName hivev1.ControllerName, ...) client.Client
- func NewRateLimitedUpdateEventHandler(eventHandler handler.EventHandler, ...) handler.EventHandler
- func ReadStatefulsetOrDie(objBytes []byte) *appsv1.StatefulSet
- func ReconcileDNSZoneForRelocation(c client.Client, logger log.FieldLogger, dnsZone *hivev1.DNSZone, ...) (*reconcile.Result, error)
- func ReconcileOwnerReferences(owner hivev1.MetaRuntimeObject, ownershipKeys []*OwnershipUniqueKey, ...) error
- func SafeDelete(cl client.Client, ctx context.Context, obj client.Object) error
- func SetClusterClaimCondition(conditions []hivev1.ClusterClaimCondition, ...) []hivev1.ClusterClaimCondition
- func SetClusterClaimConditionWithChangeCheck(conditions []hivev1.ClusterClaimCondition, ...) ([]hivev1.ClusterClaimCondition, bool)
- func SetClusterDeploymentCondition(conditions []hivev1.ClusterDeploymentCondition, ...) []hivev1.ClusterDeploymentCondition
- func SetClusterDeploymentConditionWithChangeCheck(conditions []hivev1.ClusterDeploymentCondition, ...) ([]hivev1.ClusterDeploymentCondition, bool)
- func SetClusterDeprovisionCondition(conditions []hivev1.ClusterDeprovisionCondition, ...) []hivev1.ClusterDeprovisionCondition
- func SetClusterDeprovisionConditionWithChangeCheck(conditions []hivev1.ClusterDeprovisionCondition, ...) ([]hivev1.ClusterDeprovisionCondition, bool)
- func SetClusterInstallConditionWithChangeCheck(conditions []hivev1.ClusterInstallCondition, conditionType string, ...) ([]hivev1.ClusterInstallCondition, bool)
- func SetClusterPoolCondition(conditions []hivev1.ClusterPoolCondition, ...) []hivev1.ClusterPoolCondition
- func SetClusterPoolConditionWithChangeCheck(conditions []hivev1.ClusterPoolCondition, ...) ([]hivev1.ClusterPoolCondition, bool)
- func SetClusterProvisionCondition(conditions []hivev1.ClusterProvisionCondition, ...) []hivev1.ClusterProvisionCondition
- func SetDNSZoneCondition(conditions []hivev1.DNSZoneCondition, ...) []hivev1.DNSZoneCondition
- func SetDNSZoneConditionWithChangeCheck(conditions []hivev1.DNSZoneCondition, ...) ([]hivev1.DNSZoneCondition, bool)
- func SetMachinePoolCondition(conditions []hivev1.MachinePoolCondition, ...) []hivev1.MachinePoolCondition
- func SetMachinePoolConditionWithChangeCheck(conditions []hivev1.MachinePoolCondition, ...) ([]hivev1.MachinePoolCondition, bool)
- func SetProxyEnvVars(podSpec *corev1.PodSpec, httpProxy, httpsProxy, noProxy string)
- func SetRelocateAnnotation(obj metav1.Object, relocateName string, relocateStatus hivev1.RelocateStatus) (changed bool)
- func SetSyncCondition(conditions []hivev1.SyncCondition, conditionType hivev1.SyncConditionType, ...) []hivev1.SyncCondition
- func SetupAdditionalCA() error
- func SetupClusterInstallServiceAccount(c client.Client, namespace string, logger log.FieldLogger) error
- func SetupClusterUninstallServiceAccount(c client.Client, namespace string, logger log.FieldLogger) error
- func SyncOwnerReference(owner hivev1.MetaRuntimeObject, object hivev1.MetaRuntimeObject, ...) error
- func TrustBundleFromSecretToWriter(c client.Client, secretNamespace, secretName string, w io.Writer) error
- func Undotted(domain string) string
- func UpdateConditionAlways(_, _, _, _ string) bool
- func UpdateConditionIfReasonOrMessageChange(oldReason, oldMessage, newReason, newMessage string) bool
- func UpdateConditionNever(_, _, _, _ string) bool
- func ValidateCredentialsForClusterDeployment(kubeClient client.Client, cd *hivev1.ClusterDeployment, logger log.FieldLogger) (bool, error)
- func WrapEventHandlerWithLogging(eventHandler handler.EventHandler, logger log.FieldLogger) handler.EventHandler
- type ControlleeExpectations
- type ControllerMetricsTripper
- type Expectations
- func (r *Expectations) CreationObserved(controllerKey string)
- func (r *Expectations) DeleteExpectations(controllerKey string)
- func (r *Expectations) DeletionObserved(controllerKey string)
- func (r *Expectations) ExpectCreations(controllerKey string, adds int) error
- func (r *Expectations) ExpectDeletions(controllerKey string, dels int) error
- func (r *Expectations) GetExpectations(controllerKey string) (*ControlleeExpectations, bool, error)
- func (r *Expectations) LowerExpectations(controllerKey string, add, del int)
- func (r *Expectations) RaiseExpectations(controllerKey string, add, del int)
- func (r *Expectations) SatisfiedExpectations(controllerKey string) bool
- func (r *Expectations) SetExpectations(controllerKey string, add, del int) error
- type ExpectationsInterface
- type OwnershipUniqueKey
- type UpdateConditionCheck
- type Watcher
Constants ¶
const ( // InstallServiceAccountName will be a service account that can run the installer and then // upload artifacts to the cluster's namespace. InstallServiceAccountName = "cluster-installer" // UninstallServiceAccountName will be a service account that can run the installer deprovision and then // upload artifacts to the cluster's namespace. UninstallServiceAccountName = "cluster-uninstaller" )
const ( // ConcurrentReconcilesEnvVariableFormat is the format of the environment variable // that stores concurrent reconciles for a controller ConcurrentReconcilesEnvVariableFormat = "%s-concurrent-reconciles" // ClientQPSEnvVariableFormat is the format of the environment variable that stores // client QPS for a controller ClientQPSEnvVariableFormat = "%s-client-qps" // ClientBurstEnvVariableFormat is the format of the environment variable that stores // client burst for a controller ClientBurstEnvVariableFormat = "%s-client-burst" // QueueQPSEnvVariableFormat is the format of the environment variable that stores // workqueue QPS for a controller QueueQPSEnvVariableFormat = "%s-queue-qps" // QueueBurstEnvVariableFormat is the format of the environment variable that stores // workqueue burst for a controller QueueBurstEnvVariableFormat = "%s-queue-burst" )
const ( // ExpectationsTimeout defines the length of time that a dormant // controller will wait for an expectation to be satisfied. It is // specifically targeted at the case where some problem prevents an update // of expectations, without it the controller could stay asleep forever. This should // be set based on the expected latency of watch events. ExpectationsTimeout = 5 * time.Minute )
Variables ¶
var ExpKeyFunc = func(obj interface{}) (string, error) { if e, ok := obj.(*ControlleeExpectations); ok { return e.key, nil } return "", fmt.Errorf("Could not find key for obj %#v", obj) }
ExpKeyFunc to parse out the key from a ControlleeExpectation
Functions ¶
func AddAdditionalKubeconfigCAs ¶
AddAdditionalKubeconfigCAs adds additional certificate authorities to a given kubeconfig
func AddControllerMetricsTransportWrapper ¶
func AddControllerMetricsTransportWrapper(cfg *rest.Config, controllerName hivev1.ControllerName, remote bool)
AddControllerMetricsTransportWrapper adds a transport wrapper to the given rest config which exposes metrics based on the requests being made.
func AddFinalizer ¶
AddFinalizer adds a finalizer to the given object
func AddTypeMeta ¶
func AddTypeMeta(objects []runtime.RawExtension, scheme *runtime.Scheme) ([]runtime.RawExtension, error)
AddTypeMeta adds type metadata to objects in a list of RawExtension TypeMeta is needed for proper serialization/deserialization
func BuildControllerLogger ¶ added in v1.0.12
func BuildControllerLogger(controller hivev1.ControllerName, resource string, nsName types.NamespacedName) *log.Entry
BuildControllerLogger returns a logger for controllers with consistent fields.
func CalculateJobSpecHash ¶
CalculateJobSpecHash returns a hash of the job.Spec.
func CalculateStatefulSetSpecHash ¶ added in v1.0.19
func CalculateStatefulSetSpecHash(statefulset *appsv1.StatefulSet) (string, error)
CalculateStatefulSetSpecHash returns a hash of the statefulset.Spec.
func ClearRelocateAnnotation ¶ added in v1.0.6
func CopySecret ¶ added in v1.0.12
func CopySecret(c client.Client, src, dest types.NamespacedName, owner metav1.Object, scheme *runtime.Scheme) error
CopySecret copies the secret defined by src to dest.
func CredentialsSecretName ¶ added in v1.1.0
func CredentialsSecretName(cd *hivev1.ClusterDeployment) string
CredentialsSecretName returns the name of the credentials secret for platforms that have a CredentialsSecretRef. An empty string is returned if platform has none.
func DNSZoneName ¶
DNSZoneName returns the predictable name for a DNSZone for the given ClusterDeployment.
func DeleteFinalizer ¶
DeleteFinalizer removes a finalizer from the given object
func EnqueueDNSZonesOwnedByClusterDeployment ¶ added in v1.0.6
func EnqueueDNSZonesOwnedByClusterDeployment(c client.Client, logger log.FieldLogger) handler.EventHandler
func EnsureRequeueAtLeastWithin ¶ added in v1.0.11
func EnsureRequeueAtLeastWithin(duration time.Duration, result reconcile.Result, err error) (reconcile.Result, error)
EnsureRequeueAtLeastWithin ensures that the requeue of the object will occur within the given duration. If the reconcile result and error will already result in a requeue soon enough, then the supplied reconcile result and error will be returned as is.
func ErrorScrub ¶ added in v1.1.6
ErrorScrub scrubs cloud error messages destined for CRD status to remove things that change every attempt, such as request IDs, which subsequently cause an infinite update/reconcile loop.
func FindClusterClaimCondition ¶ added in v1.0.7
func FindClusterClaimCondition(conditions []hivev1.ClusterClaimCondition, conditionType hivev1.ClusterClaimConditionType) *hivev1.ClusterClaimCondition
FindClusterClaimCondition finds in the condition that has the specified condition type in the given list. If none exists, then returns nil.
func FindClusterDeploymentCondition ¶
func FindClusterDeploymentCondition(conditions []hivev1.ClusterDeploymentCondition, conditionType hivev1.ClusterDeploymentConditionType) *hivev1.ClusterDeploymentCondition
FindClusterDeploymentCondition finds in the condition that has the specified condition type in the given list. If none exists, then returns nil.
func FindClusterDeprovisionCondition ¶ added in v1.0.11
func FindClusterDeprovisionCondition(conditions []hivev1.ClusterDeprovisionCondition, conditionType hivev1.ClusterDeprovisionConditionType) *hivev1.ClusterDeprovisionCondition
FindClusterDeprovisionCondition finds in the condition that has the specified condition type in the given list. If none exists, then returns nil.
func FindClusterInstallCondition ¶ added in v1.1.3
func FindClusterInstallCondition(conditions []hivev1.ClusterInstallCondition, conditionType string) *hivev1.ClusterInstallCondition
FindClusterInstallCondition finds in the condition that has the specified condition type in the given list. If none exists, then returns nil.
func FindClusterPoolCondition ¶ added in v1.0.6
func FindClusterPoolCondition(conditions []hivev1.ClusterPoolCondition, conditionType hivev1.ClusterPoolConditionType) *hivev1.ClusterPoolCondition
FindClusterPoolCondition finds in the condition that has the specified condition type in the given list. If none exists, then returns nil.
func FindClusterProvisionCondition ¶
func FindClusterProvisionCondition(conditions []hivev1.ClusterProvisionCondition, conditionType hivev1.ClusterProvisionConditionType) *hivev1.ClusterProvisionCondition
FindClusterProvisionCondition finds in the condition that has the specified condition type in the given list. If none exists, then returns nil.
func FindDNSZoneCondition ¶
func FindDNSZoneCondition(conditions []hivev1.DNSZoneCondition, conditionType hivev1.DNSZoneConditionType) *hivev1.DNSZoneCondition
FindDNSZoneCondition finds in the condition that has the specified condition type in the given list. If none exists, then returns nil.
func FindMachinePoolCondition ¶
func FindMachinePoolCondition(conditions []hivev1.MachinePoolCondition, conditionType hivev1.MachinePoolConditionType) *hivev1.MachinePoolCondition
FindMachinePoolCondition finds in the condition that has the specified condition type in the given list. If none exists, then returns nil.
func FindSyncCondition ¶
func FindSyncCondition(conditions []hivev1.SyncCondition, conditionType hivev1.SyncConditionType) *hivev1.SyncCondition
FindSyncCondition finds in the condition that has the specified condition type in the given list. If none exists, then returns nil.
func GetChecksumOfObject ¶
GetChecksumOfObject returns the md5sum hash of the object passed in.
func GetChecksumOfObjects ¶
GetChecksumOfObjects returns the md5sum hash of the objects passed in.
func GetControllerConfig ¶ added in v1.0.11
func GetControllerConfig(client client.Client, controllerName hivev1.ControllerName) (int, flowcontrol.RateLimiter, workqueue.RateLimiter, error)
func GetDuckType ¶ added in v1.1.3
func GetDuckType(ctx context.Context, client client.Client, gvk schema.GroupVersionKind, key types.NamespacedName, obj client.Object) error
GetDuckType uses the client to fetch a type defined by gck and key, and marshals it into the duck type defined in obj.
func GetHiveNamespace ¶ added in v1.0.1
func GetHiveNamespace() string
GetHiveNamespace determines the namespace where core hive components run (hive-controllers, hiveadmission), by checking for the required environment variable.
func HasFinalizer ¶
HasFinalizer returns true if the given object has the given finalizer
func InitializeClusterClaimConditions ¶ added in v1.1.6
func InitializeClusterClaimConditions(existingConditions []hivev1.ClusterClaimCondition, conditionsToBeAdded []hivev1.ClusterClaimConditionType) []hivev1.ClusterClaimCondition
InitializeClusterClaimConditions initializes the given set of conditions for the first time, set with Status Unknown
func InitializeClusterDeploymentConditions ¶ added in v1.1.2
func InitializeClusterDeploymentConditions(existingConditions []hivev1.ClusterDeploymentCondition, conditionsToBeAdded []hivev1.ClusterDeploymentConditionType) []hivev1.ClusterDeploymentCondition
InitializeClusterDeploymentConditions initializes the given set of conditions for the first time, set with Status Unknown
func InitializeClusterPoolConditions ¶ added in v1.1.6
func InitializeClusterPoolConditions(existingConditions []hivev1.ClusterPoolCondition, conditionsToBeAdded []hivev1.ClusterPoolConditionType) []hivev1.ClusterPoolCondition
InitializeClusterPoolConditions initializes the given set of conditions for the first time, set with Status Unknown
func InitializeMachinePoolConditions ¶ added in v1.1.6
func InitializeMachinePoolConditions(existingConditions []hivev1.MachinePoolCondition, conditionsToBeAdded []hivev1.MachinePoolConditionType) []hivev1.MachinePoolCondition
InitializeMachinePoolConditions initializes the given set of conditions for the first time, set with Status Unknown
func InjectWatcher ¶ added in v1.1.3
func InjectWatcher(r reconcile.Reconciler, c controller.Controller)
InjectWatcher injects the reconciler that implements the watcherInjectable interface with the provided controller. If the reconciler passed does not implement the interface, it returns nil
func IsClaimedClusterMarkedForRemoval ¶ added in v1.0.17
func IsClaimedClusterMarkedForRemoval(cd *hivev1.ClusterDeployment) bool
IsClaimedClusterMarkedForRemoval returns true when hive.openshift.io/remove-claimed-cluster-from-pool annotation is set to true value in the clusterdeployment
func IsClusterDeploymentErrorUpdateEvent ¶ added in v1.1.16
func IsClusterDeploymentErrorUpdateEvent(evt event.UpdateEvent) bool
IsClusterDeploymentErrorUpdateEvent returns true when the update event is from error state in clusterdeployment.
func IsClusterPausedOrRelocating ¶ added in v1.0.16
func IsClusterPausedOrRelocating(cd *hivev1.ClusterDeployment, logger log.FieldLogger) bool
IsClusterPausedOrRelocating checks if the syncing to the cluster is paused or if the cluster is relocating
func IsConditionInDesiredState ¶ added in v1.1.6
func IsConditionInDesiredState(condition hivev1.ClusterDeploymentCondition) bool
IsConditionInDesiredState checks if the condition status is in its desired/expected state
func IsConditionWithPositivePolarity ¶ added in v1.1.6
func IsConditionWithPositivePolarity(conditionType hivev1.ClusterDeploymentConditionType) bool
IsConditionWithPositivePolarity checks if cluster deployment condition has positive polarity
func IsDeadlineExceeded ¶ added in v1.1.1
IsDeadlineExceeded returns true if the job failed due to deadline being exceeded
func IsDeleteProtected ¶ added in v1.0.5
func IsDeleteProtected(cd *hivev1.ClusterDeployment) bool
func IsFakeCluster ¶ added in v1.0.17
func IsFakeCluster(cd *hivev1.ClusterDeployment) bool
func IsFinished ¶
IsFinished returns true if the job completed (succeeded or failed)
func IsRelocating ¶ added in v1.0.6
func IsSuccessful ¶
IsSuccessful returns true if the job was successful
func ListRuntimeObjects ¶ added in v1.0.2
func ListRuntimeObjects(c client.Client, typesToList []client.ObjectList, opts ...client.ListOption) ([]runtime.Object, error)
ListRuntimeObjects returns a slice of runtime objects returned from the kubernetes client based on the passed in list of types to return and list options.
func LoadSecretData ¶
LoadSecretData loads a given secret key and returns it's data as a string.
func MergeJsons ¶
func MergeJsons(globalPullSecret string, localPullSecret string, cdLog log.FieldLogger) (string, error)
MergeJsons will merge the global and local pull secret and return it
func NewClientWithMetricsOrDie ¶
func NewClientWithMetricsOrDie(mgr manager.Manager, ctrlrName hivev1.ControllerName, rateLimiter *flowcontrol.RateLimiter) client.Client
NewClientWithMetricsOrDie creates a new controller-runtime client with a wrapper which increments metrics for requests by controller name, HTTP method, URL path, and whether or not the request was to a remote cluster.. The client will re-use the managers cache. This should be used in all Hive controllers.
func NewRateLimitedUpdateEventHandler ¶ added in v1.1.6
func NewRateLimitedUpdateEventHandler(eventHandler handler.EventHandler, shouldRateLimitFunc func(event.UpdateEvent) bool) handler.EventHandler
NewRateLimitedUpdateEventHandler wraps the specified event handler inside a new event handler that will rate limit the incoming UPDATE events when the provided shouldRateLimit function returns true.
func ReadStatefulsetOrDie ¶ added in v1.0.16
func ReadStatefulsetOrDie(objBytes []byte) *appsv1.StatefulSet
ReadStatefulsetOrDie converts a statefulset asset into an actual instance of a statefulset.
func ReconcileDNSZoneForRelocation ¶ added in v1.0.6
func ReconcileDNSZoneForRelocation(c client.Client, logger log.FieldLogger, dnsZone *hivev1.DNSZone, finalizer string) (*reconcile.Result, error)
ReconcileDNSZoneForRelocation performs reconciliation on a DNSZone that is in the midst of a relocation to a new Hive instance. If the DNSZone is undergoing relocation, then the source Hive instance should not act on the DNSZone. If the DNSZone is undergoing relocation, then the destination Hive instance should not act on the DNSZone except to allow for a delete. If the DSNZone has completed relocation, then the source Hive instance should not act on the DNSZone except to remove the finalizer.
func ReconcileOwnerReferences ¶ added in v1.0.2
func ReconcileOwnerReferences(owner hivev1.MetaRuntimeObject, ownershipKeys []*OwnershipUniqueKey, kubeclient client.Client, scheme *runtime.Scheme, logger log.FieldLogger) error
ReconcileOwnerReferences ensures that given owner is in fact the actual owner for all types in typesToList given a specific labelSelector
func SafeDelete ¶ added in v1.1.14
func SetClusterClaimCondition ¶ added in v1.0.7
func SetClusterClaimCondition( conditions []hivev1.ClusterClaimCondition, conditionType hivev1.ClusterClaimConditionType, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) []hivev1.ClusterClaimCondition
SetClusterClaimCondition sets a condition on a ClusterClaim resource's status
func SetClusterClaimConditionWithChangeCheck ¶ added in v1.0.7
func SetClusterClaimConditionWithChangeCheck( conditions []hivev1.ClusterClaimCondition, conditionType hivev1.ClusterClaimConditionType, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) ([]hivev1.ClusterClaimCondition, bool)
SetClusterClaimConditionWithChangeCheck sets a condition on a ClusterClaim resource's status. It returns the conditions as well a boolean indicating whether there was a change made to the conditions.
func SetClusterDeploymentCondition ¶
func SetClusterDeploymentCondition( conditions []hivev1.ClusterDeploymentCondition, conditionType hivev1.ClusterDeploymentConditionType, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) []hivev1.ClusterDeploymentCondition
SetClusterDeploymentCondition sets a condition on a ClusterDeployment resource's status
func SetClusterDeploymentConditionWithChangeCheck ¶
func SetClusterDeploymentConditionWithChangeCheck( conditions []hivev1.ClusterDeploymentCondition, conditionType hivev1.ClusterDeploymentConditionType, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) ([]hivev1.ClusterDeploymentCondition, bool)
SetClusterDeploymentConditionWithChangeCheck sets a condition on a ClusterDeployment resource's status. It returns the conditions as well a boolean indicating whether there was a change made to the conditions.
func SetClusterDeprovisionCondition ¶ added in v1.0.11
func SetClusterDeprovisionCondition( conditions []hivev1.ClusterDeprovisionCondition, conditionType hivev1.ClusterDeprovisionConditionType, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) []hivev1.ClusterDeprovisionCondition
SetClusterDeprovisionCondition sets a condition on a ClusterDeprovision resource's status
func SetClusterDeprovisionConditionWithChangeCheck ¶ added in v1.0.11
func SetClusterDeprovisionConditionWithChangeCheck( conditions []hivev1.ClusterDeprovisionCondition, conditionType hivev1.ClusterDeprovisionConditionType, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) ([]hivev1.ClusterDeprovisionCondition, bool)
SetClusterDeprovisionConditionWithChangeCheck sets a condition on a ClusterDeprovision resource's status It returns the conditions as well a boolean indicating whether there was a change made to the conditions.
func SetClusterInstallConditionWithChangeCheck ¶ added in v1.1.3
func SetClusterInstallConditionWithChangeCheck( conditions []hivev1.ClusterInstallCondition, conditionType string, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) ([]hivev1.ClusterInstallCondition, bool)
SetClusterInstallConditionWithChangeCheck sets a condition in the list of status conditions for a ClusterInstall implementation. It returns the resulting conditions as well a boolean indicating whether there was a change made to the conditions.
func SetClusterPoolCondition ¶ added in v1.0.6
func SetClusterPoolCondition( conditions []hivev1.ClusterPoolCondition, conditionType hivev1.ClusterPoolConditionType, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) []hivev1.ClusterPoolCondition
SetClusterPoolCondition sets a condition on a ClusterPool resource's status
func SetClusterPoolConditionWithChangeCheck ¶ added in v1.0.6
func SetClusterPoolConditionWithChangeCheck( conditions []hivev1.ClusterPoolCondition, conditionType hivev1.ClusterPoolConditionType, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) ([]hivev1.ClusterPoolCondition, bool)
SetClusterPoolConditionWithChangeCheck sets a condition on a ClusterPool resource's status. It returns the conditions as well a boolean indicating whether there was a change made to the conditions.
func SetClusterProvisionCondition ¶
func SetClusterProvisionCondition( conditions []hivev1.ClusterProvisionCondition, conditionType hivev1.ClusterProvisionConditionType, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) []hivev1.ClusterProvisionCondition
SetClusterProvisionCondition sets a condition on a ClusterProvision resource's status
func SetDNSZoneCondition ¶
func SetDNSZoneCondition( conditions []hivev1.DNSZoneCondition, conditionType hivev1.DNSZoneConditionType, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) []hivev1.DNSZoneCondition
SetDNSZoneCondition sets a condition on a DNSZone resource's status
func SetDNSZoneConditionWithChangeCheck ¶
func SetDNSZoneConditionWithChangeCheck( conditions []hivev1.DNSZoneCondition, conditionType hivev1.DNSZoneConditionType, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) ([]hivev1.DNSZoneCondition, bool)
SetDNSZoneConditionWithChangeCheck sets a condition on a DNSZone resource's status It returns the conditions as well a boolean indicating whether there was a change made to the conditions.
func SetMachinePoolCondition ¶
func SetMachinePoolCondition( conditions []hivev1.MachinePoolCondition, conditionType hivev1.MachinePoolConditionType, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) []hivev1.MachinePoolCondition
SetMachinePoolCondition sets a condition on a MachinePool resource's status
func SetMachinePoolConditionWithChangeCheck ¶
func SetMachinePoolConditionWithChangeCheck( conditions []hivev1.MachinePoolCondition, conditionType hivev1.MachinePoolConditionType, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) ([]hivev1.MachinePoolCondition, bool)
SetMachinePoolConditionWithChangeCheck sets a condition on a MachinePool resource's status. It returns the conditions as well a boolean indicating whether there was a change made to the conditions.
func SetProxyEnvVars ¶ added in v1.1.1
SetProxyEnvVars will add the standard proxy environment variables to all containers in the given pod spec. If any of the provided values are empty, the environment variable will not be set.
func SetRelocateAnnotation ¶ added in v1.0.6
func SetRelocateAnnotation(obj metav1.Object, relocateName string, relocateStatus hivev1.RelocateStatus) (changed bool)
SetRelocateAnnotation sets the relocate annotation on the specified object.
func SetSyncCondition ¶
func SetSyncCondition( conditions []hivev1.SyncCondition, conditionType hivev1.SyncConditionType, status corev1.ConditionStatus, reason string, message string, updateConditionCheck UpdateConditionCheck, ) []hivev1.SyncCondition
SetSyncCondition sets a condition on a SyncSet or resource's status
func SetupAdditionalCA ¶
func SetupAdditionalCA() error
SetupAdditionalCA reads a file referenced by the ADDITIONAL_CA environment variable that contains an additional CA. This should only be called once on initialization
func SetupClusterInstallServiceAccount ¶
func SetupClusterInstallServiceAccount(c client.Client, namespace string, logger log.FieldLogger) error
SetupClusterInstallServiceAccount ensures a service account exists which can upload the required artifacts after running the installer in a pod. (metadata, admin kubeconfig)
func SetupClusterUninstallServiceAccount ¶ added in v1.1.1
func SetupClusterUninstallServiceAccount(c client.Client, namespace string, logger log.FieldLogger) error
SetupClusterUninstallServiceAccount ensures a service account exists which can read the required secrets, upload the required artifacts after running the installer deprovision in a pod.
func SyncOwnerReference ¶ added in v1.0.6
func SyncOwnerReference(owner hivev1.MetaRuntimeObject, object hivev1.MetaRuntimeObject, kubeclient client.Client, scheme *runtime.Scheme, controlled bool, logger log.FieldLogger) error
SyncOwnerReference ensures that the object passed in has an owner reference of the owner passed in. It then updates the object in Kube. If 'controlled' is set to true, the owner is set as the controller of the object. BlockOwnerDeletion is set to true for all owner references
func TrustBundleFromSecretToWriter ¶ added in v1.0.18
func TrustBundleFromSecretToWriter(c client.Client, secretNamespace, secretName string, w io.Writer) error
TrustBundleFromSecretToWriter creates a trust bundle from keys in the secret writing it to a writer. It assumes all the keys have trust bundles in PEM format and writes each one to writer with a newline between each key contents.
func UpdateConditionAlways ¶
UpdateConditionAlways returns true. The condition will always be updated.
func UpdateConditionIfReasonOrMessageChange ¶
func UpdateConditionIfReasonOrMessageChange(oldReason, oldMessage, newReason, newMessage string) bool
UpdateConditionIfReasonOrMessageChange returns true if there is a change in the reason or the message of the condition.
func UpdateConditionNever ¶
UpdateConditionNever return false. The condition will never be updated, unless there is a change in the status of the condition.
func ValidateCredentialsForClusterDeployment ¶ added in v1.0.16
func ValidateCredentialsForClusterDeployment(kubeClient client.Client, cd *hivev1.ClusterDeployment, logger log.FieldLogger) (bool, error)
ValidateCredentialsForClusterDeployment will attempt to verify that the platform/cloud credentials for the given ClusterDeployment are valid. Note: It simply checks that the username/password (or equivalent) can authenticate, not that the credentials have any specific permissions.
func WrapEventHandlerWithLogging ¶
func WrapEventHandlerWithLogging(eventHandler handler.EventHandler, logger log.FieldLogger) handler.EventHandler
WrapEventHandlerWithLogging wraps the specified event handler inside a new event handler that will log when events are handled and items are added to the queue.
Types ¶
type ControlleeExpectations ¶
type ControlleeExpectations struct {
// contains filtered or unexported fields
}
ControlleeExpectations track controllee creates/deletes.
func (*ControlleeExpectations) Add ¶
func (e *ControlleeExpectations) Add(add, del int64)
Add increments the add and del counters.
func (*ControlleeExpectations) Fulfilled ¶
func (e *ControlleeExpectations) Fulfilled() bool
Fulfilled returns true if this expectation has been fulfilled.
func (*ControlleeExpectations) GetExpectations ¶
func (e *ControlleeExpectations) GetExpectations() (int64, int64)
GetExpectations returns the add and del expectations of the controllee.
type ControllerMetricsTripper ¶
type ControllerMetricsTripper struct { http.RoundTripper Controller hivev1.ControllerName Remote bool }
ControllerMetricsTripper is a RoundTripper implementation which tracks our metrics for client requests.
func (*ControllerMetricsTripper) CancelRequest ¶ added in v1.0.13
func (cmt *ControllerMetricsTripper) CancelRequest(req *http.Request)
type Expectations ¶
Expectations is a cache mapping controllers to what they expect to see before being woken up for a sync.
func NewExpectations ¶
func NewExpectations(logger log.FieldLogger) *Expectations
NewExpectations returns a store for Expectations.
func (*Expectations) CreationObserved ¶
func (r *Expectations) CreationObserved(controllerKey string)
CreationObserved atomically decrements the `add` expectation count of the given controller.
func (*Expectations) DeleteExpectations ¶
func (r *Expectations) DeleteExpectations(controllerKey string)
DeleteExpectations deletes the expectations of the given controller from the TTLStore.
func (*Expectations) DeletionObserved ¶
func (r *Expectations) DeletionObserved(controllerKey string)
DeletionObserved atomically decrements the `del` expectation count of the given controller.
func (*Expectations) ExpectCreations ¶
func (r *Expectations) ExpectCreations(controllerKey string, adds int) error
ExpectCreations sets the expectations to expect the specified number of additions for the controller with the specified key.
func (*Expectations) ExpectDeletions ¶
func (r *Expectations) ExpectDeletions(controllerKey string, dels int) error
ExpectDeletions sets the expectations to expect the specified number of deletions for the controller with the specified key.
func (*Expectations) GetExpectations ¶
func (r *Expectations) GetExpectations(controllerKey string) (*ControlleeExpectations, bool, error)
GetExpectations returns the ControlleeExpectations of the given controller.
func (*Expectations) LowerExpectations ¶
func (r *Expectations) LowerExpectations(controllerKey string, add, del int)
LowerExpectations decrements the expectation counts of the given controller.
func (*Expectations) RaiseExpectations ¶
func (r *Expectations) RaiseExpectations(controllerKey string, add, del int)
RaiseExpectations increments the expectation counts of the given controller.
func (*Expectations) SatisfiedExpectations ¶
func (r *Expectations) SatisfiedExpectations(controllerKey string) bool
SatisfiedExpectations returns true if the required adds/dels for the given controller have been observed. Add/del counts are established by the controller at sync time, and updated as controllees are observed by the controller manager.
func (*Expectations) SetExpectations ¶
func (r *Expectations) SetExpectations(controllerKey string, add, del int) error
SetExpectations registers new expectations for the given controller. Forgets existing expectations.
type ExpectationsInterface ¶
type ExpectationsInterface interface { GetExpectations(controllerKey string) (*ControlleeExpectations, bool, error) SatisfiedExpectations(controllerKey string) bool DeleteExpectations(controllerKey string) SetExpectations(controllerKey string, add, del int) error ExpectCreations(controllerKey string, adds int) error ExpectDeletions(controllerKey string, dels int) error CreationObserved(controllerKey string) DeletionObserved(controllerKey string) RaiseExpectations(controllerKey string, add, del int) LowerExpectations(controllerKey string, add, del int) }
ExpectationsInterface is an interface that allows users to set and wait on expectations. Only abstracted out for testing. Warning: if using KeyFunc it is not safe to use a single ExpectationsInterface with different types of controllers, because the keys might conflict across types.
type OwnershipUniqueKey ¶ added in v1.0.2
type OwnershipUniqueKey struct { LabelSelector map[string]string TypeToList client.ObjectList Controlled bool }
OwnershipUniqueKey contains the uniquly identifiable pattern for ensuring ownership labels are correct applied for a type.
type UpdateConditionCheck ¶
UpdateConditionCheck tests whether a condition should be updated from the old condition to the new condition. Returns true if the condition should be updated.
type Watcher ¶ added in v1.1.3
type Watcher interface {
Watch(src source.Source, eventhandler handler.EventHandler, predicates ...predicate.Predicate) error
}
Watcher is a smaller interface of controller.Controller that only provides function to add watches. This allows reconcilers to start new watches when required.