Documentation ¶
Overview ¶
Copyright 2021 The Cockroach Authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func ClusterPlaceholder(name string) *api.CrdbCluster
- type Builder
- type Cluster
- func (cluster Cluster) CASecretName() string
- func (cluster Cluster) ClientTLSSecretName() string
- func (cluster Cluster) DeleteRestartTypeAnnotation()
- func (cluster Cluster) DiscoveryServiceName() string
- func (cluster Cluster) Domain() string
- func (cluster Cluster) Failed(atype api.ActionType) bool
- func (cluster Cluster) GetAnnotationContainerImage() string
- func (cluster Cluster) GetAnnotationHistory() string
- func (cluster Cluster) GetAnnotationRestartType() string
- func (cluster Cluster) GetCockroachDBImageName() string
- func (cluster Cluster) GetVersionAnnotation() string
- func (cluster Cluster) InitTime() metav1.Time
- func (cluster Cluster) IsFresh(fetcher Fetcher) (bool, error)
- func (cluster Cluster) IsSupportedImage() bool
- func (cluster Cluster) JobName() string
- func (cluster Cluster) LookupSupportedVersion(version string) (string, bool)
- func (cluster Cluster) Name() string
- func (cluster Cluster) Namespace() string
- func (cluster Cluster) NodeTLSSecretName() string
- func (cluster Cluster) ObjectKey() types.NamespacedName
- func (cluster Cluster) PublicServiceName() string
- func (cluster Cluster) ResetActionType(atype api.ActionType)
- func (cluster Cluster) SecureMode() string
- func (cluster Cluster) SetActionFailed(atype api.ActionType, errMsg string)
- func (cluster Cluster) SetActionFinished(atype api.ActionType)
- func (cluster Cluster) SetActionUnknown(atype api.ActionType)
- func (cluster Cluster) SetAnnotationCertExpiration(certExpiration string)
- func (cluster Cluster) SetAnnotationContainerImage(containerimage string)
- func (cluster Cluster) SetAnnotationVersion(version string)
- func (cluster Cluster) SetClusterStatus()
- func (cluster Cluster) SetClusterStatusOnFirstReconcile()
- func (cluster Cluster) SetClusterVersion(version string)
- func (cluster Cluster) SetCrdbContainerImage(containerimage string)
- func (cluster Cluster) SetFalse(ctype api.ClusterConditionType)
- func (cluster Cluster) SetTrue(ctype api.ClusterConditionType)
- func (cluster Cluster) Spec() *api.CrdbClusterSpec
- func (cluster Cluster) StatefulSetName() string
- func (cluster Cluster) Status() *api.CrdbClusterStatus
- func (cluster Cluster) True(ctype api.ClusterConditionType) bool
- func (cluster Cluster) Unwrap() *api.CrdbCluster
- type DiscoveryServiceBuilder
- type Fetcher
- type JobBuilder
- type KubeFetcher
- type KubePersister
- type ManagedResource
- type PdbBuilder
- type Persister
- type PublicServiceBuilder
- type Reconciler
- type Resource
- type StatefulSetBuilder
- func (b StatefulSetBuilder) Build(obj client.Object) error
- func (b StatefulSetBuilder) MakeContainers() []corev1.Container
- func (b StatefulSetBuilder) MakeInitContainers() []corev1.Container
- func (b StatefulSetBuilder) Placeholder() client.Object
- func (b StatefulSetBuilder) SetAnnotations(obj client.Object) error
- type TLSSecret
- func (s *TLSSecret) CA() []byte
- func (s *TLSSecret) CAKey() []byte
- func (s *TLSSecret) Key() []byte
- func (s *TLSSecret) PriveKey() []byte
- func (s *TLSSecret) Ready() bool
- func (s *TLSSecret) ReadyCA() bool
- func (s *TLSSecret) UpdateCAKey(cakey []byte, log logr.Logger) error
- func (s *TLSSecret) UpdateCertAndCA(cert, ca []byte, log logr.Logger) error
- func (s *TLSSecret) UpdateCertAndKeyAndCA(cert, key []byte, ca []byte, log logr.Logger) error
- func (s *TLSSecret) UpdateKey(key []byte) error
Constants ¶
const ( RELATED_IMAGE_PREFIX = "RELATED_IMAGE_COCKROACH_" NotSupportedVersion = "not_supported_version" CrdbContainerImageAnnotation = "crdb.io/containerimage" CrdbVersionAnnotation = "crdb.io/version" CrdbHistoryAnnotation = "crdb.io/history" CrdbRestartAnnotation = "crdb.io/restart" CrdbCertExpirationAnnotation = "crdb.io/certexpiration" CrdbRestartTypeAnnotation = "crdb.io/restarttype" )
const ( // JobContainerName used on spec for the container JobContainerName = "crdb" GetTagVersionCommand = "/cockroach/cockroach.sh version | grep 'Build Tag:'| awk '{print $3}'" )
const ( DataDirName = "datadir" DataDirMountPath = "/cockroach/cockroach-data/" DbContainerName = "db" )
Variables ¶
var CRDB_PREFIX string = "CRDB_"
Functions ¶
func ClusterPlaceholder ¶
func ClusterPlaceholder(name string) *api.CrdbCluster
Types ¶
type Builder ¶
Builder populates a given Kubernetes resource or creates its default instance (placeholder)
type Cluster ¶
type Cluster struct { Fetcher // contains filtered or unexported fields }
func NewCluster ¶
func NewCluster(original *api.CrdbCluster) Cluster
func (Cluster) CASecretName ¶
func (Cluster) ClientTLSSecretName ¶
func (Cluster) DeleteRestartTypeAnnotation ¶
func (cluster Cluster) DeleteRestartTypeAnnotation()
func (Cluster) DiscoveryServiceName ¶
func (Cluster) GetAnnotationContainerImage ¶
func (Cluster) GetAnnotationHistory ¶
func (Cluster) GetAnnotationRestartType ¶
func (Cluster) GetCockroachDBImageName ¶
func (Cluster) GetVersionAnnotation ¶
GetVersionAnnotation gets the current version of the cluster retrieved by version checker action
func (Cluster) IsSupportedImage ¶
func (Cluster) LookupSupportedVersion ¶
func (Cluster) NodeTLSSecretName ¶
func (Cluster) ObjectKey ¶
func (cluster Cluster) ObjectKey() types.NamespacedName
func (Cluster) PublicServiceName ¶
func (Cluster) ResetActionType ¶
func (cluster Cluster) ResetActionType(atype api.ActionType)
func (Cluster) SecureMode ¶
func (Cluster) SetActionFailed ¶
func (cluster Cluster) SetActionFailed(atype api.ActionType, errMsg string)
func (Cluster) SetActionFinished ¶
func (cluster Cluster) SetActionFinished(atype api.ActionType)
func (Cluster) SetActionUnknown ¶
func (cluster Cluster) SetActionUnknown(atype api.ActionType)
func (Cluster) SetAnnotationCertExpiration ¶
func (Cluster) SetAnnotationContainerImage ¶
func (Cluster) SetAnnotationVersion ¶
func (Cluster) SetClusterStatus ¶
func (cluster Cluster) SetClusterStatus()
func (Cluster) SetClusterStatusOnFirstReconcile ¶
func (cluster Cluster) SetClusterStatusOnFirstReconcile()
func (Cluster) SetClusterVersion ¶
func (Cluster) SetCrdbContainerImage ¶
func (Cluster) SetFalse ¶
func (cluster Cluster) SetFalse(ctype api.ClusterConditionType)
func (Cluster) SetTrue ¶
func (cluster Cluster) SetTrue(ctype api.ClusterConditionType)
func (Cluster) Spec ¶
func (cluster Cluster) Spec() *api.CrdbClusterSpec
func (Cluster) StatefulSetName ¶
func (Cluster) Status ¶
func (cluster Cluster) Status() *api.CrdbClusterStatus
func (Cluster) True ¶
func (cluster Cluster) True(ctype api.ClusterConditionType) bool
True checks if the api.ClusterConditionType is true
func (Cluster) Unwrap ¶
func (cluster Cluster) Unwrap() *api.CrdbCluster
type DiscoveryServiceBuilder ¶
This service only exists to create DNS entries for each pod in the StatefulSet such that they can resolve each other's IP addresses. It does not create a load-balanced ClusterIP and should not be used directly by clients in most circumstances.
func (DiscoveryServiceBuilder) Build ¶
func (b DiscoveryServiceBuilder) Build(obj client.Object) error
func (DiscoveryServiceBuilder) Placeholder ¶
func (b DiscoveryServiceBuilder) Placeholder() client.Object
type JobBuilder ¶
func (JobBuilder) MakeContainers ¶
func (b JobBuilder) MakeContainers() []corev1.Container
MakeContainers creates a slice of corev1.Containers which includes a single corev1.Container that is based on the CR.
func (JobBuilder) Placeholder ¶
func (b JobBuilder) Placeholder() client.Object
type ManagedResource ¶
ManagedResource is a `Resource` with labels which can be reconciled by `Reconciler`
func NewManagedKubeResource ¶
type PdbBuilder ¶
PdbBuilder models the PodDistruptionBudget that the operator maintains.
func (PdbBuilder) Build ¶
func (b PdbBuilder) Build(obj client.Object) error
Build creates a policy.PodDisruptionBudget for the StatefulSet.
func (PdbBuilder) Placeholder ¶
func (b PdbBuilder) Placeholder() client.Object
type Persister ¶
type Persister interface {
Persist(obj client.Object, mutateFn func() error) (upserted bool, err error)
}
Persister creates or updates the object in Kubernetes after calling the mutation function.
type PublicServiceBuilder ¶
func (PublicServiceBuilder) Placeholder ¶
func (b PublicServiceBuilder) Placeholder() client.Object
type Reconciler ¶
Reconciler reconciles managed Kubernetes resource with `Builder` results
func (Reconciler) Reconcile ¶
func (r Reconciler) Reconcile() (upserted bool, err error)
type StatefulSetBuilder ¶
func (StatefulSetBuilder) MakeContainers ¶
func (b StatefulSetBuilder) MakeContainers() []corev1.Container
MakeContainers creates a slice of corev1.Containers which includes a single corev1.Container that is based on the CR.
func (StatefulSetBuilder) MakeInitContainers ¶ added in v1.7.6
func (b StatefulSetBuilder) MakeInitContainers() []corev1.Container
MakeInitContainers creates a slice of corev1.Containers which includes a single corev1.Container that is based on the CR.
func (StatefulSetBuilder) Placeholder ¶
func (b StatefulSetBuilder) Placeholder() client.Object
func (StatefulSetBuilder) SetAnnotations ¶
func (b StatefulSetBuilder) SetAnnotations(obj client.Object) error
type TLSSecret ¶
type TLSSecret struct { Resource // contains filtered or unexported fields }
func CreateTLSSecret ¶
CreateTLSSecrete returns a TLSSecreat struct that is used to store the certs via secrets.
func (*TLSSecret) UpdateCAKey ¶
UpdateCAKey updates CA key
func (*TLSSecret) UpdateCertAndCA ¶
func (*TLSSecret) UpdateCertAndKeyAndCA ¶
UpdateCertAndKeyAndCA updates three different certificates at the same time. It save the TLSCertKey, the CA, and the TLSPrivateKey in a secret.