Documentation
¶
Overview ¶
Package coreutil is defined to get/set some fields in complex core/v1alpha1 api structs
Index ¶
- func AuthTokenJWKSSecretName(db *v1alpha1.TiDB) string
- func ClientCASecretName[S scope.Object[F, T], F client.Object, T runtime.Object](f F) string
- func ClientCertKeyPairSecretName[S scope.Object[F, T], F client.Object, T runtime.Object](f F) string
- func Cluster[S scope.Object[F, T], F client.Object, T runtime.Object](f F) string
- func ClusterCASecretName[S scope.Object[F, T], F client.Object, T runtime.Object](f F) string
- func ClusterCertKeyPairSecretName[S scope.Object[F, T], F client.Object, T runtime.Object](f F) string
- func ClusterSubdomain(clusterName string) string
- func ClusterTLSVolume[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F) *corev1.Volume
- func ConfigMapLabels[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F) map[string]string
- func CurrentRevision[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F) string
- func EnabledFeatures(c *v1alpha1.Cluster) []metav1alpha1.Feature
- func Features[S scope.Object[F, T], F client.Object, T runtime.Object](f F) []metav1alpha1.Feature
- func FindStatusCondition[S scope.Object[F, T], F client.Object, T runtime.Object](f F, condType string) *metav1.Condition
- func InstanceAnnotations[S scope.Group[F, T], F client.Object, T runtime.Group](f F) map[string]string
- func InstanceLabels[S scope.Group[F, T], F client.Object, T runtime.Group](f F, rev string) map[string]string
- func IsAvailable[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F, minReadySeconds int64, now time.Time) bool
- func IsDeleting(instance runtime.Instance) bool
- func IsGroupHealthyAndUpToDate[S scope.Group[F, T], F client.Object, T runtime.Group](f F) bool
- func IsMainContainer(name string) bool
- func IsOffline[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F) bool
- func IsReady[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F) bool
- func IsSeparateSlowLogEnabled(db *v1alpha1.TiDB) bool
- func IsSynced[S scope.Object[F, T], F client.Object, T runtime.Object](f F) bool
- func IsTLSClusterEnabled(c *v1alpha1.Cluster) bool
- func IsTiDBGroupMySQLTLSEnabled(dbg *v1alpha1.TiDBGroup) bool
- func IsTiDBMySQLTLSEnabled(db *v1alpha1.TiDB) bool
- func IsTiDBMySQLTLSNoClientCert(db *v1alpha1.TiDB) bool
- func IsTiProxyBackendInsecureSkipTLSVerify(_ *v1alpha1.TiProxy) bool
- func IsTiProxyBackendMutualTLSEnabled(tiproxy *v1alpha1.TiProxy) bool
- func IsTiProxyBackendTLSEnabled(tiproxy *v1alpha1.TiProxy) bool
- func IsTiProxyGroupMySQLTLSEnabled(pg *v1alpha1.TiProxyGroup) bool
- func IsTiProxyHTTPServerNoClientCert(_ *v1alpha1.TiProxy) bool
- func IsTiProxyHTTPServerTLSEnabled(c *v1alpha1.Cluster, tiproxy *v1alpha1.TiProxy) bool
- func IsTiProxyMySQLNoClientCert(_ *v1alpha1.TiProxy) bool
- func IsTiProxyMySQLTLSEnabled(tiproxy *v1alpha1.TiProxy) bool
- func IsTokenBasedAuthEnabled(db *v1alpha1.TiDB) bool
- func LegacyTLSClusterClientSecretName(clusterName string) string
- func LongestReadyPeer[S scope.Object[F, T], F client.Object, T runtime.Object](in F, peers []F) F
- func MinReadySeconds[S scope.Group[F, T], F client.Object, T runtime.Group](f F) int64
- func NamePrefixAndSuffix[F client.Object](f F) (prefix, suffix string)
- func NotOfflined(reason string) *metav1.Condition
- func NotRunning(reason, detail string) *metav1.Condition
- func Offlined() *metav1.Condition
- func OwnerGroup[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F) *metav1.OwnerReference
- func PDClientPort(pd *v1alpha1.PD) int32
- func PDGroupClientPort(pdg *v1alpha1.PDGroup) int32
- func PDGroupPeerPort(pdg *v1alpha1.PDGroup) int32
- func PDPeerPort(pd *v1alpha1.PD) int32
- func PDServiceHost(pdg *v1alpha1.PDGroup) string
- func PDServiceURL(pdg *v1alpha1.PDGroup, isTLS bool) string
- func PVCOverlay[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F) []v1alpha1.NamedPersistentVolumeClaimOverlay
- func PVCs[S scope.Instance[F, T], F client.Object, T runtime.Instance](cluster *v1alpha1.Cluster, obj F, ps ...PVCPatch) []*corev1.PersistentVolumeClaim
- func PersistentVolumeClaimLabels[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F, volName string) map[string]string
- func PodLabels[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F) map[string]string
- func PodName[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F) string
- func Ready() *metav1.Condition
- func RemoveStatusCondition[S scope.Object[F, T], F client.Object, T runtime.Object](f F, condTypes ...string) bool
- func Replicas[S scope.Group[F, T], F client.Object, T runtime.Group](f F) int32
- func RetryIfInstancesReadyButNotAvailable[S scope.Instance[F, T], F client.Object, T runtime.Instance](ins []F, minReadySeconds int64) time.Duration
- func Running() *metav1.Condition
- func SchedulePolicies[S scope.Group[F, T], F client.Object, T runtime.Group](f F) []v1alpha1.SchedulePolicy
- func SchedulerClientPort(s *v1alpha1.Scheduler) int32
- func SchedulerGroupClientPort(sg *v1alpha1.SchedulerGroup) int32
- func SchedulingClientPort(s *v1alpha1.Scheduling) int32
- func SchedulingGroupClientPort(sg *v1alpha1.SchedulingGroup) int32
- func SessionTokenSigningCertSecretName(cluster *v1alpha1.Cluster, db *v1alpha1.TiDB) string
- func SetCluster[S scope.Object[F, T], F client.Object, T runtime.Object](f F, cluster string)
- func SetImage[S scope.Object[F, T], F client.Object, T runtime.Object](f F, image string)
- func SetReplicas[S scope.Group[F, T], F client.Object, T runtime.Group](f F, replicas int32)
- func SetStatusCondition[S scope.Object[F, T], F client.Object, T runtime.Object](f F, conds ...metav1.Condition) bool
- func SetStatusObservedGeneration[S scope.Object[F, T], F client.Object, T runtime.Object](f F) bool
- func SetStatusReplicas[S scope.Group[F, T], F client.Object, T runtime.Group](f F, newReplicas, newReady, newUpdate, newCurrent int32) bool
- func SetStatusRevision[S scope.Group[F, T], F client.Object, T runtime.Group](f F, newUpdate, newCurrent string, newCollisionCount int32) bool
- func SetStatusSelector[S scope.Group[F, T], F client.Object, T runtime.Group](f F) bool
- func SetStatusVersion[S scope.Group[F, T], F client.Object, T runtime.Group](f F) bool
- func SetTemplateAnnotations[S scope.Group[F, T], F client.Object, T runtime.Group](f F, anno map[string]string)
- func SetVersion[S scope.Object[F, T], F client.Object, T runtime.Object](f F, version string)
- func ShouldPauseReconcile(c *v1alpha1.Cluster) bool
- func ShouldSuspendCompute(c *v1alpha1.Cluster) bool
- func SprintCondition(cond *metav1.Condition) string
- func StatusConditions[S scope.Object[F, T], F client.Object, T runtime.Object](f F) []metav1.Condition
- func StatusVersion[S scope.Group[F, T], F client.Object, T runtime.Group](f F) string
- func Subdomain[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F) string
- func Suspended() *metav1.Condition
- func Suspending() *metav1.Condition
- func Synced() *metav1.Condition
- func TSOAdvertiseClientURLs(tso *v1alpha1.TSO) string
- func TSOAdvertiseClientURLsWithScheme(tso *v1alpha1.TSO, isTLS bool) string
- func TSOClientPort(tso *v1alpha1.TSO) int32
- func TSOGroupClientPort(tg *v1alpha1.TSOGroup) int32
- func TSOServiceHost(tg *v1alpha1.TSOGroup) string
- func TSOServiceURL(tg *v1alpha1.TSOGroup, isTLS bool) string
- func TemplateAnnotations[S scope.Group[F, T], F client.Object, T runtime.Group](f F) map[string]string
- func TiCDCAdvertiseURL(ticdc *v1alpha1.TiCDC) string
- func TiCDCGroupPort(cdcg *v1alpha1.TiCDCGroup) int32
- func TiCDCPort(cdc *v1alpha1.TiCDC) int32
- func TiDBClientPort(db *v1alpha1.TiDB) int32
- func TiDBGroupClientPort(dbg *v1alpha1.TiDBGroup) int32
- func TiDBGroupMySQLCASecretName(dbg *v1alpha1.TiDBGroup) string
- func TiDBGroupMySQLCertKeyPairSecretName(dbg *v1alpha1.TiDBGroup) string
- func TiDBGroupMySQLTLS(dbg *v1alpha1.TiDBGroup) *v1alpha1.TLS
- func TiDBGroupStatusPort(dbg *v1alpha1.TiDBGroup) int32
- func TiDBMySQLCASecretName(db *v1alpha1.TiDB) string
- func TiDBMySQLCertKeyPairSecretName(db *v1alpha1.TiDB) string
- func TiDBMySQLTLS(db *v1alpha1.TiDB) *v1alpha1.TLS
- func TiDBMySQLTLSVolume(db *v1alpha1.TiDB) *corev1.Volume
- func TiDBStatusPort(db *v1alpha1.TiDB) int32
- func TiFlashFlashPort(f *v1alpha1.TiFlash) int32
- func TiFlashGroupFlashPort(fg *v1alpha1.TiFlashGroup) int32
- func TiFlashGroupMetricsPort(fg *v1alpha1.TiFlashGroup) int32
- func TiFlashGroupProxyPort(fg *v1alpha1.TiFlashGroup) int32
- func TiFlashGroupProxyStatusPort(fg *v1alpha1.TiFlashGroup) int32
- func TiFlashMetricsPort(f *v1alpha1.TiFlash) int32
- func TiFlashProxyPort(f *v1alpha1.TiFlash) int32
- func TiFlashProxyStatusPort(f *v1alpha1.TiFlash) int32
- func TiFlashProxyStatusURL(f *v1alpha1.TiFlash, isTLS bool) string
- func TiKVAdvertiseClientURLs(tikv *v1alpha1.TiKV) string
- func TiKVAdvertiseStatusURLs(tikv *v1alpha1.TiKV) string
- func TiKVClientPort(kv *v1alpha1.TiKV) int32
- func TiKVGroupClientPort(kvg *v1alpha1.TiKVGroup) int32
- func TiKVGroupStatusPort(kvg *v1alpha1.TiKVGroup) int32
- func TiKVStatusPort(kv *v1alpha1.TiKV) int32
- func TiProxyAPIPort(tiproxy *v1alpha1.TiProxy) int32
- func TiProxyBackendCASecretName(tiproxy *v1alpha1.TiProxy) string
- func TiProxyBackendCertKeyPairSecretName(tiproxy *v1alpha1.TiProxy) string
- func TiProxyBackendTLS(db *v1alpha1.TiProxy) *v1alpha1.ClientTLS
- func TiProxyBackendTLSVolume(tiproxy *v1alpha1.TiProxy) *corev1.Volume
- func TiProxyClientPort(tiproxy *v1alpha1.TiProxy) int32
- func TiProxyGroupAPIPort(proxyg *v1alpha1.TiProxyGroup) int32
- func TiProxyGroupClientPort(proxyg *v1alpha1.TiProxyGroup) int32
- func TiProxyGroupMySQLCASecretName(pg *v1alpha1.TiProxyGroup) string
- func TiProxyGroupMySQLCertKeyPairSecretName(pg *v1alpha1.TiProxyGroup) string
- func TiProxyGroupMySQLTLS(pg *v1alpha1.TiProxyGroup) *v1alpha1.TLS
- func TiProxyGroupPeerPort(proxyg *v1alpha1.TiProxyGroup) int32
- func TiProxyHTTPServerCASecretName(tiproxy *v1alpha1.TiProxy) string
- func TiProxyHTTPServerCertKeyPairSecretName(tiproxy *v1alpha1.TiProxy) string
- func TiProxyHTTPServerTLS(_ *v1alpha1.TiProxy) *v1alpha1.TLS
- func TiProxyHTTPServerTLSVolume(tiproxy *v1alpha1.TiProxy) *corev1.Volume
- func TiProxyMySQLCASecretName(tiproxy *v1alpha1.TiProxy) string
- func TiProxyMySQLCertKeyPairSecretName(tiproxy *v1alpha1.TiProxy) string
- func TiProxyMySQLTLS(db *v1alpha1.TiProxy) *v1alpha1.TLS
- func TiProxyMySQLTLSVolume(tiproxy *v1alpha1.TiProxy) *corev1.Volume
- func TiProxyPeerPort(tiproxy *v1alpha1.TiProxy) int32
- func Topology[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F) v1alpha1.Topology
- func Unready(reason string) *metav1.Condition
- func Unsuspended() *metav1.Condition
- func Unsynced(reason string) *metav1.Condition
- func UpdateRevision[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F) string
- func Version[S scope.Object[F, T], F client.Object, T runtime.Object](in F) string
- func Volumes[S scope.Instance[F, T], F client.Object, T runtime.Instance](f F) []v1alpha1.Volume
- type PVCPatch
- type PVCPatchFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthTokenJWKSSecretName ¶
func ClientCASecretName ¶
func ClusterCASecretName ¶
func ClusterSubdomain ¶
ClusterSubdomain returns the subdomain for all components of the cluster
func ClusterTLSVolume ¶
func ConfigMapLabels ¶
func CurrentRevision ¶
func EnabledFeatures ¶
func EnabledFeatures(c *v1alpha1.Cluster) []metav1alpha1.Feature
func FindStatusCondition ¶
func InstanceAnnotations ¶
func InstanceLabels ¶
func IsAvailable ¶
func IsDeleting ¶
IsDeleting check whether an instance is deleting TODO: change to use scope
func IsGroupHealthyAndUpToDate ¶
IsGroupHealthyAndUpToDate is defined to check whether all replicas of the group are healthy and up to date TODO: simplify it by a condition
func IsMainContainer ¶
IsMainContainer checks whether the container is a main container Main container means the main component container of an instance
func IsTLSClusterEnabled ¶
IsTLSClusterEnabled returns whether the cluster has enabled mTLS.
func IsTiDBMySQLTLSEnabled ¶
IsTiDBMySQLTLSEnabled returns whether the TLS between TiDB server and MySQL client is enabled.
func IsTiProxyGroupMySQLTLSEnabled ¶
func IsTiProxyGroupMySQLTLSEnabled(pg *v1alpha1.TiProxyGroup) bool
func IsTiProxyMySQLTLSEnabled ¶
IsTiProxyMySQLTLSEnabled returns whether the TLS between TiProxy server and MySQL client is enabled.
func IsTokenBasedAuthEnabled ¶
func LegacyTLSClusterClientSecretName ¶
LegacyTLSClusterClientSecretName returns the mTLS secret name for the cluster client. NOTE: now BR still use this secret to visit the cluster Deprecated: use coreutil.ClientCASecretName and coreutil.CLientCertKeyPairSecretName
func LongestReadyPeer ¶
func LongestReadyPeer[ S scope.Object[F, T], F client.Object, T runtime.Object, ](in F, peers []F) F
LongestReadyPeer returns a ready peer who is ready for the longest time.
func MinReadySeconds ¶
func NamePrefixAndSuffix ¶
func NotOfflined ¶
func NotRunning ¶
func OwnerGroup ¶
func PDClientPort ¶
func PDGroupClientPort ¶
func PDGroupPeerPort ¶
func PDPeerPort ¶
func PDServiceHost ¶
func PVCOverlay ¶
func PodName ¶
PodName returns the default managed pod name of an instance TODO(liubo02): rename to more reasonable one TODO(liubo02): move to namer
func RemoveStatusCondition ¶
func RetryIfInstancesReadyButNotAvailable ¶
func RetryIfInstancesReadyButNotAvailable[ S scope.Instance[F, T], F client.Object, T runtime.Instance, ](ins []F, minReadySeconds int64) time.Duration
RetryIfInstancesReadyButNotAvailable returns a retry duration If any instances are ready but not available, updater may do nothing and cannot watch more changes of instances. So always retry if any instances are ready but not available.
func SchedulePolicies ¶
func SchedulerClientPort ¶
func SchedulerGroupClientPort ¶
func SchedulerGroupClientPort(sg *v1alpha1.SchedulerGroup) int32
func SchedulingClientPort ¶
func SchedulingClientPort(s *v1alpha1.Scheduling) int32
func SchedulingGroupClientPort ¶
func SchedulingGroupClientPort(sg *v1alpha1.SchedulingGroup) int32
func SessionTokenSigningCertSecretName ¶
SessionTokenSigningCertSecretName returns the secret name used in TiDB server for the session token signing cert. If the session token signing cert is not specified, it will return the TLS cluster secret name if TLS is enabled. If TLS is not enabled, it will return an empty string.
func SetCluster ¶
func SetReplicas ¶
func SetStatusCondition ¶
func SetStatusReplicas ¶
func SetStatusRevision ¶
func SetStatusSelector ¶
func SetStatusVersion ¶
func SetTemplateAnnotations ¶
func SetVersion ¶
func ShouldPauseReconcile ¶
func ShouldSuspendCompute ¶
ShouldSuspendCompute returns whether the cluster should suspend compute.
func SprintCondition ¶
func StatusConditions ¶
func StatusVersion ¶
func Suspending ¶
func TSOAdvertiseClientURLs ¶
func TSOClientPort ¶
func TSOGroupClientPort ¶
func TSOServiceHost ¶
func TemplateAnnotations ¶
func TiCDCAdvertiseURL ¶
func TiCDCGroupPort ¶
func TiCDCGroupPort(cdcg *v1alpha1.TiCDCGroup) int32
func TiDBClientPort ¶
func TiDBGroupClientPort ¶
func TiDBGroupStatusPort ¶
func TiDBMySQLCASecretName ¶
TiDBMySQLCASecretName returns the secret name for TiDB server to authenticate MySQL client.
func TiDBMySQLCertKeyPairSecretName ¶
TiDBMySQLCertKeyPairSecretName returns the secret name used in TiDB server for the TLS between TiDB server and MySQL client.
func TiDBStatusPort ¶
func TiFlashFlashPort ¶
func TiFlashGroupFlashPort ¶
func TiFlashGroupFlashPort(fg *v1alpha1.TiFlashGroup) int32
func TiFlashGroupMetricsPort ¶
func TiFlashGroupMetricsPort(fg *v1alpha1.TiFlashGroup) int32
func TiFlashGroupProxyPort ¶
func TiFlashGroupProxyPort(fg *v1alpha1.TiFlashGroup) int32
func TiFlashGroupProxyStatusPort ¶
func TiFlashGroupProxyStatusPort(fg *v1alpha1.TiFlashGroup) int32
func TiFlashMetricsPort ¶
func TiFlashProxyPort ¶
func TiFlashProxyStatusPort ¶
func TiKVAdvertiseClientURLs ¶
func TiKVAdvertiseStatusURLs ¶
func TiKVClientPort ¶
func TiKVGroupClientPort ¶
func TiKVGroupStatusPort ¶
func TiKVStatusPort ¶
func TiProxyAPIPort ¶
func TiProxyBackendTLSVolume ¶
func TiProxyClientPort ¶
func TiProxyGroupAPIPort ¶
func TiProxyGroupAPIPort(proxyg *v1alpha1.TiProxyGroup) int32
func TiProxyGroupClientPort ¶
func TiProxyGroupClientPort(proxyg *v1alpha1.TiProxyGroup) int32
func TiProxyGroupMySQLCASecretName ¶
func TiProxyGroupMySQLCASecretName(pg *v1alpha1.TiProxyGroup) string
func TiProxyGroupMySQLCertKeyPairSecretName ¶
func TiProxyGroupMySQLCertKeyPairSecretName(pg *v1alpha1.TiProxyGroup) string
func TiProxyGroupMySQLTLS ¶
func TiProxyGroupMySQLTLS(pg *v1alpha1.TiProxyGroup) *v1alpha1.TLS
func TiProxyGroupPeerPort ¶
func TiProxyGroupPeerPort(proxyg *v1alpha1.TiProxyGroup) int32
func TiProxyHTTPServerCASecretName ¶
TiProxyHTTPServerCASecretName returns the secret name for TiProxy http server to authenticate clients.
func TiProxyHTTPServerCertKeyPairSecretName ¶
TiProxyHTTPServerCertKeyPairSecretName returns the secret name used for tiproxy http server.
func TiProxyMySQLCASecretName ¶
TiProxyMySQLCASecretName returns the secret name for TiProxy server to authenticate MySQL client.
func TiProxyMySQLCertKeyPairSecretName ¶
TiProxyMySQLCertKeyPairSecretName returns the secret name used in TiProxy server for the TLS between TiProxy server and MySQL client.
func TiProxyPeerPort ¶
func Unsuspended ¶
func UpdateRevision ¶
Types ¶
type PVCPatch ¶
type PVCPatch interface {
Patch(vol *v1alpha1.Volume, pvc *corev1.PersistentVolumeClaim)
}
func WithLegacyK8sAppLabels ¶
func WithLegacyK8sAppLabels() PVCPatch
type PVCPatchFunc ¶
type PVCPatchFunc func(vol *v1alpha1.Volume, pvc *corev1.PersistentVolumeClaim)
func (PVCPatchFunc) Patch ¶
func (f PVCPatchFunc) Patch(vol *v1alpha1.Volume, pvc *corev1.PersistentVolumeClaim)