Documentation ¶
Overview ¶
Copyright DataStax, Inc. Please see the included license file for details.
Index ¶
- Constants
- Variables
- func DatacentersForNode(nodeName string) []types.NamespacedName
- func FilterPodListByCassNodeState(pods []*corev1.Pod, state string) []*corev1.Pod
- func FilterPodListByLabel(pods []*corev1.Pod, labelName string, labelVal string) []*corev1.Pod
- func FilterPodListByLabels(pods []*corev1.Pod, labelMap map[string]string) []*corev1.Pod
- func FindIpForHostId(endpointData httphelper.CassMetadataEndpoints, hostId string) (string, error)
- func HasStartedDecommissioning(pod *corev1.Pod, epData httphelper.CassMetadataEndpoints, ...) bool
- func IsDoneDecommissioning(pod *corev1.Pod, epData httphelper.CassMetadataEndpoints, ...) bool
- func ListAllStartedPods(pods []*corev1.Pod) []*corev1.Pod
- func MapPodsToEndpointDataByName(pods []*v1.Pod, epData httphelper.CassMetadataEndpoints) map[string]httphelper.EndpointState
- func MockSetControllerReference() func()
- func PodPtrsFromPodList(podList *corev1.PodList) []*corev1.Pod
- type RackInformation
- type ReconciliationContext
- func (rc *ReconciliationContext) CalculateRackInfoForDecomm(currentSize int) ([]*RackInformation, error)
- func (rc *ReconciliationContext) CalculateRackInformation() error
- func (rc *ReconciliationContext) CalculateReconciliationActions() (reconcile.Result, error)
- func (rc *ReconciliationContext) CheckAdditionalSeedEndpoints() result.ReconcileResult
- func (rc *ReconciliationContext) CheckCassandraNodeStatuses() result.ReconcileResult
- func (rc *ReconciliationContext) CheckClearActionConditions() result.ReconcileResult
- func (rc *ReconciliationContext) CheckConditionInitializedAndReady() result.ReconcileResult
- func (rc *ReconciliationContext) CheckConfigSecret() result.ReconcileResult
- func (rc *ReconciliationContext) CheckDcPodDisruptionBudget() result.ReconcileResult
- func (rc *ReconciliationContext) CheckDecommissioningNodes(epData httphelper.CassMetadataEndpoints) result.ReconcileResult
- func (rc *ReconciliationContext) CheckFullQueryLogging() result.ReconcileResult
- func (rc *ReconciliationContext) CheckHeadlessServices() result.ReconcileResult
- func (rc *ReconciliationContext) CheckInternodeCredentialCreation() result.ReconcileResult
- func (rc *ReconciliationContext) CheckPodsReady(endpointData httphelper.CassMetadataEndpoints) result.ReconcileResult
- func (rc *ReconciliationContext) CheckRackCreation() result.ReconcileResult
- func (rc *ReconciliationContext) CheckRackForceUpgrade() result.ReconcileResult
- func (rc *ReconciliationContext) CheckRackLabels() result.ReconcileResult
- func (rc *ReconciliationContext) CheckRackPodLabels() result.ReconcileResult
- func (rc *ReconciliationContext) CheckRackPodTemplate() result.ReconcileResult
- func (rc *ReconciliationContext) CheckRackScale() result.ReconcileResult
- func (rc *ReconciliationContext) CheckRackStoppedState() result.ReconcileResult
- func (rc *ReconciliationContext) CheckRollingRestart() result.ReconcileResult
- func (rc *ReconciliationContext) CheckStatefulSetControllerCaughtUp() result.ReconcileResult
- func (rc *ReconciliationContext) CheckSuperuserSecretCreation() result.ReconcileResult
- func (rc *ReconciliationContext) CreateEndpointsForAdditionalSeedService() result.ReconcileResult
- func (rc *ReconciliationContext) CreateHeadlessServices() result.ReconcileResult
- func (rc *ReconciliationContext) CreateUsers() result.ReconcileResult
- func (rc *ReconciliationContext) DecommissionNodeOnRack(rackName string, epData httphelper.CassMetadataEndpoints, lastPodSuffix string) error
- func (rc *ReconciliationContext) DecommissionNodes(epData httphelper.CassMetadataEndpoints) result.ReconcileResult
- func (rc *ReconciliationContext) DeletePodPvcs(pod *corev1.Pod) error
- func (rc *ReconciliationContext) EnsurePodsCanAbsorbDecommData(decommPod *corev1.Pod, epData httphelper.CassMetadataEndpoints) error
- func (rc *ReconciliationContext) GetAdditionalSeedEndpoint() (*corev1.Endpoints, error)
- func (rc *ReconciliationContext) GetClient() runtimeClient.Client
- func (rc *ReconciliationContext) GetContext() context.Context
- func (rc *ReconciliationContext) GetDatacenter() *api.CassandraDatacenter
- func (rc *ReconciliationContext) GetLogger() logr.Logger
- func (rc *ReconciliationContext) GetPodPVC(podNamespace string, podName string) (*corev1.PersistentVolumeClaim, error)
- func (rc *ReconciliationContext) GetStatefulSetForRack(nextRack *RackInformation) (*appsv1.StatefulSet, bool, error)
- func (rc *ReconciliationContext) GetUsedStorageForPods(epData httphelper.CassMetadataEndpoints) (map[string]float64, error)
- func (rc *ReconciliationContext) GetUsers() []api.CassandraUser
- func (rc *ReconciliationContext) IsValid(dc *api.CassandraDatacenter) error
- func (rc *ReconciliationContext) ProcessDeletion() result.ReconcileResult
- func (rc *ReconciliationContext) ReconcileAllRacks() (reconcile.Result, error)
- func (rc *ReconciliationContext) ReconcileNextRack(statefulSet *appsv1.StatefulSet) error
- func (rc *ReconciliationContext) ReconcilePods(statefulSet *appsv1.StatefulSet) error
- func (rc *ReconciliationContext) RemoveDecommissionedPodFromSts(pod *corev1.Pod) error
- func (rc *ReconciliationContext) SetDatacenterAsOwner(controlled metav1.Object) error
- func (rc *ReconciliationContext) UpdateAllowed() bool
- func (rc *ReconciliationContext) UpdateCassandraNodeStatus(force bool) error
- func (rc *ReconciliationContext) UpdateRackNodeCount(statefulSet *appsv1.StatefulSet, newNodeCount int32) error
- func (rc *ReconciliationContext) UpdateSecretWatches() error
- func (rc *ReconciliationContext) UpdateStatus() result.ReconcileResult
- func (rc *ReconciliationContext) UpdateStatusForUserActions() error
Constants ¶
const ( DefaultTerminationGracePeriodSeconds = 120 ServerConfigContainerName = "server-config-init" ServerBaseConfigContainerName = "server-config-init-base" CassandraContainerName = "cassandra" PvcName = "server-data" SystemLoggerContainerName = "server-system-logger" )
Variables ¶
var ( // Provides reasonable defaults for the logger container. DefaultsLoggerContainer = buildResourceRequirements(100, 64, 0, 128) // Provides reasonable defaults for the configuration container. DefaultsConfigInitContainer = buildResourceRequirements(1000, 256, 1000, 384) )
var ( ResultShouldNotRequeue reconcile.Result = reconcile.Result{Requeue: false} ResultShouldRequeueNow reconcile.Result = reconcile.Result{Requeue: true} ResultShouldRequeueSoon reconcile.Result = reconcile.Result{Requeue: true, RequeueAfter: 2 * time.Second} ResultShouldRequeueTenSecs reconcile.Result = reconcile.Result{Requeue: true, RequeueAfter: 10 * time.Second} QuietDurationFunc func(int) time.Duration = func(secs int) time.Duration { return time.Duration(secs) * time.Second } )
Functions ¶
func DatacentersForNode ¶
func DatacentersForNode(nodeName string) []types.NamespacedName
Get the dcNames and dcNamespaces for a node
func FilterPodListByLabel ¶
func FilterPodListByLabels ¶
Takes a list of *Pod and filters down to only the pods that match every label/val in the provided label map.
func FindIpForHostId ¶
func FindIpForHostId(endpointData httphelper.CassMetadataEndpoints, hostId string) (string, error)
func HasStartedDecommissioning ¶
func HasStartedDecommissioning(pod *corev1.Pod, epData httphelper.CassMetadataEndpoints, nodeStatuses api.CassandraStatusMap) bool
func IsDoneDecommissioning ¶
func IsDoneDecommissioning(pod *corev1.Pod, epData httphelper.CassMetadataEndpoints, nodeStatuses api.CassandraStatusMap, logger logr.Logger) bool
func MapPodsToEndpointDataByName ¶
func MapPodsToEndpointDataByName(pods []*v1.Pod, epData httphelper.CassMetadataEndpoints) map[string]httphelper.EndpointState
func MockSetControllerReference ¶
func MockSetControllerReference() func()
MockSetControllerReference returns a method that will automatically reverse the mock
Types ¶
type RackInformation ¶
RackInformation contains an identifying name and a node count for a logical rack
type ReconciliationContext ¶
type ReconciliationContext struct { Request *reconcile.Request Client runtimeClient.Client Scheme *runtime.Scheme Datacenter *api.CassandraDatacenter NodeMgmtClient httphelper.NodeMgmtClient Recorder record.EventRecorder ReqLogger logr.Logger SecretWatches dynamicwatch.DynamicWatches // According to golang recommendations the context should not be stored in a struct but given that // this is passed around as a parameter we feel that its a fair compromise. For further discussion // see: golang/go#22602 Ctx context.Context Services []*corev1.Service Endpoints *corev1.Endpoints // contains filtered or unexported fields }
ReconciliationContext contains all of the input necessary to calculate a list of ReconciliationActions
func CreateMockReconciliationContext ¶
func CreateMockReconciliationContext( reqLogger logr.Logger) *ReconciliationContext
CreateMockReconciliationContext ...
func CreateReconciliationContext ¶
func CreateReconciliationContext( ctx context.Context, req *reconcile.Request, cli runtimeClient.Client, scheme *runtime.Scheme, rec record.EventRecorder, secretWatches dynamicwatch.DynamicWatches) (*ReconciliationContext, error)
CreateReconciliationContext gathers all information needed for computeReconciliationActions into a struct.
func (*ReconciliationContext) CalculateRackInfoForDecomm ¶
func (rc *ReconciliationContext) CalculateRackInfoForDecomm(currentSize int) ([]*RackInformation, error)
func (*ReconciliationContext) CalculateRackInformation ¶
func (rc *ReconciliationContext) CalculateRackInformation() error
CalculateRackInformation determine how many nodes per rack are needed
func (*ReconciliationContext) CalculateReconciliationActions ¶
func (rc *ReconciliationContext) CalculateReconciliationActions() (reconcile.Result, error)
calculateReconciliationActions will iterate over an ordered list of reconcilers which will determine if any action needs to be taken on the CassandraDatacenter. If a change is needed then the apply function will be called on that reconciler and the request will be requeued for the next reconciler to handle in the subsequent reconcile loop, otherwise the next reconciler will be called.
func (*ReconciliationContext) CheckAdditionalSeedEndpoints ¶
func (rc *ReconciliationContext) CheckAdditionalSeedEndpoints() result.ReconcileResult
func (*ReconciliationContext) CheckCassandraNodeStatuses ¶
func (rc *ReconciliationContext) CheckCassandraNodeStatuses() result.ReconcileResult
func (*ReconciliationContext) CheckClearActionConditions ¶
func (rc *ReconciliationContext) CheckClearActionConditions() result.ReconcileResult
func (*ReconciliationContext) CheckConditionInitializedAndReady ¶
func (rc *ReconciliationContext) CheckConditionInitializedAndReady() result.ReconcileResult
func (*ReconciliationContext) CheckConfigSecret ¶
func (rc *ReconciliationContext) CheckConfigSecret() result.ReconcileResult
CheckConfigSecret When the ConfigSecret property is set, take the configuration from the specified secret and add to the datacenter configuration secret. The datacenter configuration is created by cass-operator. A second secret is used because cass-operator adds additional properties to the configuration, and we do not want to write that updated configuration back to the user's secret since we do not own it.
func (*ReconciliationContext) CheckDcPodDisruptionBudget ¶
func (rc *ReconciliationContext) CheckDcPodDisruptionBudget() result.ReconcileResult
func (*ReconciliationContext) CheckDecommissioningNodes ¶
func (rc *ReconciliationContext) CheckDecommissioningNodes(epData httphelper.CassMetadataEndpoints) result.ReconcileResult
Wait for decommissioning nodes to finish before continuing to reconcile
func (*ReconciliationContext) CheckFullQueryLogging ¶ added in v1.9.0
func (rc *ReconciliationContext) CheckFullQueryLogging() result.ReconcileResult
CheckFullQueryLogging sets FQL enabled or disabled. It calls the NodeMgmtClient which calls the Cassandra management API and returns a result.ReconcileResult.
func (*ReconciliationContext) CheckHeadlessServices ¶
func (rc *ReconciliationContext) CheckHeadlessServices() result.ReconcileResult
ReconcileHeadlessService ...
func (*ReconciliationContext) CheckInternodeCredentialCreation ¶
func (rc *ReconciliationContext) CheckInternodeCredentialCreation() result.ReconcileResult
func (*ReconciliationContext) CheckPodsReady ¶
func (rc *ReconciliationContext) CheckPodsReady(endpointData httphelper.CassMetadataEndpoints) result.ReconcileResult
CheckPodsReady loops over all the server pods and starts them
func (*ReconciliationContext) CheckRackCreation ¶
func (rc *ReconciliationContext) CheckRackCreation() result.ReconcileResult
func (*ReconciliationContext) CheckRackForceUpgrade ¶
func (rc *ReconciliationContext) CheckRackForceUpgrade() result.ReconcileResult
func (*ReconciliationContext) CheckRackLabels ¶
func (rc *ReconciliationContext) CheckRackLabels() result.ReconcileResult
func (*ReconciliationContext) CheckRackPodLabels ¶
func (rc *ReconciliationContext) CheckRackPodLabels() result.ReconcileResult
CheckRackPodLabels checks each pod and its volume(s) and makes sure they have the proper labels
func (*ReconciliationContext) CheckRackPodTemplate ¶
func (rc *ReconciliationContext) CheckRackPodTemplate() result.ReconcileResult
func (*ReconciliationContext) CheckRackScale ¶
func (rc *ReconciliationContext) CheckRackScale() result.ReconcileResult
CheckRackScale loops over each statefulset and makes sure that it has the right amount of desired replicas. At this time we can only increase the amount of replicas.
func (*ReconciliationContext) CheckRackStoppedState ¶
func (rc *ReconciliationContext) CheckRackStoppedState() result.ReconcileResult
func (*ReconciliationContext) CheckRollingRestart ¶
func (rc *ReconciliationContext) CheckRollingRestart() result.ReconcileResult
func (*ReconciliationContext) CheckStatefulSetControllerCaughtUp ¶
func (rc *ReconciliationContext) CheckStatefulSetControllerCaughtUp() result.ReconcileResult
func (*ReconciliationContext) CheckSuperuserSecretCreation ¶
func (rc *ReconciliationContext) CheckSuperuserSecretCreation() result.ReconcileResult
func (*ReconciliationContext) CreateEndpointsForAdditionalSeedService ¶
func (rc *ReconciliationContext) CreateEndpointsForAdditionalSeedService() result.ReconcileResult
func (*ReconciliationContext) CreateHeadlessServices ¶
func (rc *ReconciliationContext) CreateHeadlessServices() result.ReconcileResult
func (*ReconciliationContext) CreateUsers ¶
func (rc *ReconciliationContext) CreateUsers() result.ReconcileResult
func (*ReconciliationContext) DecommissionNodeOnRack ¶
func (rc *ReconciliationContext) DecommissionNodeOnRack(rackName string, epData httphelper.CassMetadataEndpoints, lastPodSuffix string) error
func (*ReconciliationContext) DecommissionNodes ¶
func (rc *ReconciliationContext) DecommissionNodes(epData httphelper.CassMetadataEndpoints) result.ReconcileResult
func (*ReconciliationContext) DeletePodPvcs ¶
func (rc *ReconciliationContext) DeletePodPvcs(pod *corev1.Pod) error
func (*ReconciliationContext) EnsurePodsCanAbsorbDecommData ¶
func (rc *ReconciliationContext) EnsurePodsCanAbsorbDecommData(decommPod *corev1.Pod, epData httphelper.CassMetadataEndpoints) error
func (*ReconciliationContext) GetAdditionalSeedEndpoint ¶
func (rc *ReconciliationContext) GetAdditionalSeedEndpoint() (*corev1.Endpoints, error)
func (*ReconciliationContext) GetClient ¶
func (rc *ReconciliationContext) GetClient() runtimeClient.Client
func (*ReconciliationContext) GetContext ¶
func (rc *ReconciliationContext) GetContext() context.Context
func (*ReconciliationContext) GetDatacenter ¶
func (rc *ReconciliationContext) GetDatacenter() *api.CassandraDatacenter
func (*ReconciliationContext) GetLogger ¶
func (rc *ReconciliationContext) GetLogger() logr.Logger
func (*ReconciliationContext) GetPodPVC ¶
func (rc *ReconciliationContext) GetPodPVC(podNamespace string, podName string) (*corev1.PersistentVolumeClaim, error)
func (*ReconciliationContext) GetStatefulSetForRack ¶
func (rc *ReconciliationContext) GetStatefulSetForRack( nextRack *RackInformation) (*appsv1.StatefulSet, bool, error)
GetStatefulSetForRack returns the statefulset for the rack and whether it currently exists and whether an error occurred
func (*ReconciliationContext) GetUsedStorageForPods ¶
func (rc *ReconciliationContext) GetUsedStorageForPods(epData httphelper.CassMetadataEndpoints) (map[string]float64, error)
func (*ReconciliationContext) GetUsers ¶
func (rc *ReconciliationContext) GetUsers() []api.CassandraUser
func (*ReconciliationContext) IsValid ¶
func (rc *ReconciliationContext) IsValid(dc *api.CassandraDatacenter) error
func (*ReconciliationContext) ProcessDeletion ¶
func (rc *ReconciliationContext) ProcessDeletion() result.ReconcileResult
ProcessDeletion ...
func (*ReconciliationContext) ReconcileAllRacks ¶
func (rc *ReconciliationContext) ReconcileAllRacks() (reconcile.Result, error)
ReconcileAllRacks determines if a rack needs to be reconciled.
func (*ReconciliationContext) ReconcileNextRack ¶
func (rc *ReconciliationContext) ReconcileNextRack(statefulSet *appsv1.StatefulSet) error
ReconcileNextRack ensures that the resources for a rack have been properly created
func (*ReconciliationContext) ReconcilePods ¶
func (rc *ReconciliationContext) ReconcilePods(statefulSet *appsv1.StatefulSet) error
ReconcilePods ...
func (*ReconciliationContext) RemoveDecommissionedPodFromSts ¶
func (rc *ReconciliationContext) RemoveDecommissionedPodFromSts(pod *corev1.Pod) error
func (*ReconciliationContext) SetDatacenterAsOwner ¶
func (rc *ReconciliationContext) SetDatacenterAsOwner(controlled metav1.Object) error
func (*ReconciliationContext) UpdateAllowed ¶ added in v1.20.0
func (rc *ReconciliationContext) UpdateAllowed() bool
func (*ReconciliationContext) UpdateCassandraNodeStatus ¶
func (rc *ReconciliationContext) UpdateCassandraNodeStatus(force bool) error
func (*ReconciliationContext) UpdateRackNodeCount ¶
func (rc *ReconciliationContext) UpdateRackNodeCount(statefulSet *appsv1.StatefulSet, newNodeCount int32) error
Updates the node count on a rack (statefulset)
func (*ReconciliationContext) UpdateSecretWatches ¶
func (rc *ReconciliationContext) UpdateSecretWatches() error
func (*ReconciliationContext) UpdateStatus ¶
func (rc *ReconciliationContext) UpdateStatus() result.ReconcileResult
func (*ReconciliationContext) UpdateStatusForUserActions ¶
func (rc *ReconciliationContext) UpdateStatusForUserActions() error
Source Files ¶
- construct_podtemplatespec.go
- construct_service.go
- construct_statefulset.go
- constructor.go
- context.go
- decommission_node.go
- defaults.go
- handler.go
- rackinformation.go
- reconcile_configsecret.go
- reconcile_datacenter.go
- reconcile_endpoints.go
- reconcile_fql.go
- reconcile_racks.go
- reconcile_racks_helpers.go
- reconcile_services.go
- secrets.go
- testing.go
- utils.go