Documentation
¶
Index ¶
- func ApplyPatchToSpec(hc *hcov1beta1.HyperConverged, annotationName string, obj runtime.Object) error
- func CheckComponentVersion(versionEnvName, actualVersion string) bool
- func GetLabels(hc *hcov1beta1.HyperConverged, component hcoutil.AppComponent) map[string]string
- func GetNamespace(defaultNamespace string, opts []string) string
- func GetPodAntiAffinity(componentLabel string, infrastructureHighlyAvailable bool) *corev1.Affinity
- func HasServiceRightFields(found *corev1.Service, required *corev1.Service) bool
- func OSConditionsToK8s(conditions []conditionsv1.Condition) []metav1.Condition
- type CRGetter
- type ConditionFunc
- type ConditionalHandler
- type EnsureResult
- func (r *EnsureResult) Error(err error) *EnsureResult
- func (r *EnsureResult) SetCreated() *EnsureResult
- func (r *EnsureResult) SetDeleted() *EnsureResult
- func (r *EnsureResult) SetName(name string) *EnsureResult
- func (r *EnsureResult) SetOverwritten(overwritten bool) *EnsureResult
- func (r *EnsureResult) SetUpdated() *EnsureResult
- func (r *EnsureResult) SetUpgradeDone(upgradeDone bool) *EnsureResult
- type GenericOperand
- func NewClusterRoleBindingHandler(Client client.Client, Scheme *runtime.Scheme, ...) *GenericOperand
- func NewClusterRoleHandler(Client client.Client, Scheme *runtime.Scheme, required *rbacv1.ClusterRole) *GenericOperand
- func NewCmHandler(Client client.Client, Scheme *runtime.Scheme, required *corev1.ConfigMap) *GenericOperand
- func NewDaemonSetHandler(Client client.Client, Scheme *runtime.Scheme, newCrFunc newDaemonSetFunc) *GenericOperand
- func NewDeploymentHandler(Client client.Client, Scheme *runtime.Scheme, ...) *GenericOperand
- func NewGenericOperand(client client.Client, scheme *runtime.Scheme, crType string, ...) *GenericOperand
- func NewNetworkAttachmentDefinitionHandler(Client client.Client, Scheme *runtime.Scheme, ...) *GenericOperand
- func NewNetworkPolicyHandler(Client client.Client, Scheme *runtime.Scheme, ...) *GenericOperand
- func NewRoleBindingHandler(Client client.Client, Scheme *runtime.Scheme, required *rbacv1.RoleBinding) *GenericOperand
- func NewRoleHandler(Client client.Client, Scheme *runtime.Scheme, required *rbacv1.Role) *GenericOperand
- func NewSecurityContextConstraintsHandler(Client client.Client, Scheme *runtime.Scheme, ...) *GenericOperand
- func NewServiceAccountHandler(Client client.Client, Scheme *runtime.Scheme, newCrFunc newSvcAccountFunc) *GenericOperand
- func NewServiceHandler(Client client.Client, Scheme *runtime.Scheme, newCrFunc newSvcFunc) *GenericOperand
- type GetCRWithNameFunc
- type GetHandler
- type GetHandlers
- type HCOOperandHooks
- type HCOResourceHooks
- type Operand
- type Reseter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyPatchToSpec ¶ added in v1.16.0
func ApplyPatchToSpec(hc *hcov1beta1.HyperConverged, annotationName string, obj runtime.Object) error
func CheckComponentVersion ¶ added in v1.16.0
func GetLabels ¶ added in v1.16.0
func GetLabels(hc *hcov1beta1.HyperConverged, component hcoutil.AppComponent) map[string]string
func GetNamespace ¶ added in v1.16.0
func GetPodAntiAffinity ¶ added in v1.16.0
func HasServiceRightFields ¶ added in v1.16.0
HasServiceRightFields checks if the found Service object has the right fields We need to check only certain fields of Service object. Since there are some fields in the Spec that are set by k8s like "clusterIP", "ipFamilyPolicy", etc. When we compare current spec with expected spec by using reflect.DeepEqual, it never returns true.
func OSConditionsToK8s ¶ added in v1.16.0
func OSConditionsToK8s(conditions []conditionsv1.Condition) []metav1.Condition
Types ¶
type CRGetter ¶ added in v1.16.0
type CRGetter interface {
// GetFullCr Generate the required resource, with all the required fields)
GetFullCr(*hcov1beta1.HyperConverged) (client.Object, error)
}
type ConditionFunc ¶ added in v1.16.0
type ConditionFunc func(hc *v1beta1.HyperConverged) bool
type ConditionalHandler ¶ added in v1.16.0
type ConditionalHandler struct {
// contains filtered or unexported fields
}
ConditionalHandler is an operand handler that only deploy the operand CR if a given shouldDeploy function returns true. If not, it makes sure the CR is deleted.
func NewConditionalHandler ¶ added in v1.16.0
func NewConditionalHandler(operand *GenericOperand, shouldDeploy ConditionFunc, getCRWithName GetCRWithNameFunc) *ConditionalHandler
func (*ConditionalHandler) Ensure ¶ added in v1.16.0
func (ch *ConditionalHandler) Ensure(req *common.HcoRequest) *EnsureResult
func (*ConditionalHandler) GetFullCr ¶ added in v1.16.0
func (ch *ConditionalHandler) GetFullCr(hc *v1beta1.HyperConverged) (client.Object, error)
func (*ConditionalHandler) Reset ¶ added in v1.16.0
func (ch *ConditionalHandler) Reset()
type EnsureResult ¶
type EnsureResult struct {
Updated bool
Overwritten bool
Created bool
UpgradeDone bool
Deleted bool
Err error
Type string
Name string
}
func NewEnsureResult ¶
func NewEnsureResult(resource runtime.Object) *EnsureResult
func (*EnsureResult) Error ¶
func (r *EnsureResult) Error(err error) *EnsureResult
func (*EnsureResult) SetCreated ¶
func (r *EnsureResult) SetCreated() *EnsureResult
func (*EnsureResult) SetDeleted ¶
func (r *EnsureResult) SetDeleted() *EnsureResult
func (*EnsureResult) SetName ¶
func (r *EnsureResult) SetName(name string) *EnsureResult
func (*EnsureResult) SetOverwritten ¶
func (r *EnsureResult) SetOverwritten(overwritten bool) *EnsureResult
func (*EnsureResult) SetUpdated ¶
func (r *EnsureResult) SetUpdated() *EnsureResult
func (*EnsureResult) SetUpgradeDone ¶
func (r *EnsureResult) SetUpgradeDone(upgradeDone bool) *EnsureResult
type GenericOperand ¶ added in v1.16.0
type GenericOperand struct {
// K8s client
client.Client
Scheme *runtime.Scheme
// contains filtered or unexported fields
}
GenericOperand Handles a specific resource (a CR, a configMap and so on), to be run during reconciliation
func NewClusterRoleBindingHandler ¶ added in v1.16.0
func NewClusterRoleBindingHandler(Client client.Client, Scheme *runtime.Scheme, required *rbacv1.ClusterRoleBinding) *GenericOperand
func NewClusterRoleHandler ¶ added in v1.16.0
func NewClusterRoleHandler(Client client.Client, Scheme *runtime.Scheme, required *rbacv1.ClusterRole) *GenericOperand
func NewCmHandler ¶ added in v1.16.0
func NewDaemonSetHandler ¶ added in v1.16.0
func NewDaemonSetHandler(Client client.Client, Scheme *runtime.Scheme, newCrFunc newDaemonSetFunc) *GenericOperand
func NewDeploymentHandler ¶ added in v1.16.0
func NewDeploymentHandler(Client client.Client, Scheme *runtime.Scheme, deploymentGenerator newDeploymentFunc, hc *hcov1beta1.HyperConverged) *GenericOperand
func NewGenericOperand ¶ added in v1.16.0
func NewGenericOperand(client client.Client, scheme *runtime.Scheme, crType string, hooks HCOResourceHooks, setControllerReference bool) *GenericOperand
func NewNetworkAttachmentDefinitionHandler ¶ added in v1.16.0
func NewNetworkAttachmentDefinitionHandler(Client client.Client, Scheme *runtime.Scheme, newCrFunc newNetworkAttachmentDefinitionFunc) *GenericOperand
func NewNetworkPolicyHandler ¶ added in v1.16.0
func NewNetworkPolicyHandler(Client client.Client, Scheme *runtime.Scheme, required *networkingv1.NetworkPolicy) *GenericOperand
func NewRoleBindingHandler ¶ added in v1.16.0
func NewRoleBindingHandler(Client client.Client, Scheme *runtime.Scheme, required *rbacv1.RoleBinding) *GenericOperand
func NewRoleHandler ¶ added in v1.16.0
func NewSecurityContextConstraintsHandler ¶ added in v1.16.0
func NewSecurityContextConstraintsHandler(Client client.Client, Scheme *runtime.Scheme, newCrFunc newSecurityContextConstraintsFunc) *GenericOperand
func NewServiceAccountHandler ¶ added in v1.16.0
func NewServiceAccountHandler(Client client.Client, Scheme *runtime.Scheme, newCrFunc newSvcAccountFunc) *GenericOperand
func NewServiceHandler ¶ added in v1.16.0
func NewServiceHandler(Client client.Client, Scheme *runtime.Scheme, newCrFunc newSvcFunc) *GenericOperand
func (*GenericOperand) Ensure ¶ added in v1.16.0
func (h *GenericOperand) Ensure(req *common.HcoRequest) *EnsureResult
func (*GenericOperand) GetFullCr ¶ added in v1.16.0
func (h *GenericOperand) GetFullCr(hc *hcov1beta1.HyperConverged) (client.Object, error)
func (*GenericOperand) Reset ¶ added in v1.16.0
func (h *GenericOperand) Reset()
type GetCRWithNameFunc ¶ added in v1.16.0
type GetCRWithNameFunc func(hc *v1beta1.HyperConverged) client.Object
type GetHandler ¶
type GetHandler func(log.Logger, client.Client, *runtime.Scheme, *hcov1beta1.HyperConverged) (Operand, error)
type GetHandlers ¶ added in v1.14.0
type HCOOperandHooks ¶ added in v1.16.0
type HCOOperandHooks interface {
HCOResourceHooks
// GetConditions get the CR conditions, if exists
GetConditions(runtime.Object) []metav1.Condition
// CheckComponentVersion on upgrade mode, check if the CR is already with the expected version
CheckComponentVersion(runtime.Object) bool
}
HCOOperandHooks Set of operand handler hooks, to be implement in each handler
type HCOResourceHooks ¶ added in v1.16.0
type HCOResourceHooks interface {
CRGetter
// GetEmptyCr Generate an empty resource, to be used as the input of the client.Get method. After calling this method, it will
// contain the actual values in K8s.
GetEmptyCr() client.Object
// UpdateCR check if there is a change between the required resource and the resource read from K8s, and update K8s accordingly.
UpdateCR(*common.HcoRequest, client.Client, runtime.Object, runtime.Object) (bool, bool, error)
}
HCOResourceHooks Set of resource handler hooks, to be implement in each handler
type Operand ¶
type Operand interface {
Ensure(req *common.HcoRequest) *EnsureResult
Reseter
}