Documentation ¶
Index ¶
- Constants
- Variables
- func Btof64(b bool) float64
- func Contains(list []string, s string) bool
- func CreateFinalizer(ctx context.Context, c client.Client, inst client.Object, df string) error
- func DeletePrometheusRule(ctx context.Context, client client.Client, ruleName, ns string) error
- func GeneratePassword() (string, error)
- func GetAWSRegion(ctx context.Context, c client.Client) (string, error)
- func GetClusterID(ctx context.Context, c client.Client) (string, error)
- func GetClusterInfrastructure(ctx context.Context, c client.Client) (*v1.Infrastructure, error)
- func GetConfigMapOrDefault(ctx context.Context, c client.Client, name types.NamespacedName, ...) (*v1.ConfigMap, error)
- func GetForcedReconcileTimeOrDefault(defaultTo time.Duration) time.Duration
- func GetK8Client() (*kubernetes.Clientset, error)
- func GetMetricReconcileTimeOrDefault(defaultTo time.Duration) time.Duration
- func GetOrganizationTag() string
- func HasFinalizer(om *controllerruntime.ObjectMeta, finalizer string) bool
- func NewActionLogger(logger *logrus.Entry, action string) *logrus.Entry
- func NewActionLoggerWithFields(logger *logrus.Entry, fields logrus.Fields) *logrus.Entry
- func ReconcilePrometheusRule(ctx context.Context, client client.Client, ...) (*prometheusv1.PrometheusRule, error)
- func RemoveFinalizer(om *controllerruntime.ObjectMeta, finalizer string)
- func ResetMetric(name string)
- func ResetVpcAction()
- func SafeStringDereference(s *string) string
- func SafeTimeDereference(t *time.Time) time.Time
- func SetMetric(name string, labels map[string]string, value float64)
- func SetMetricCurrentTime(name string, labels map[string]string)
- func SetVpcAction(action string, status string, err string, code float64)
- func ShortenString(s string, n int) string
- func StartGaugeVector()
- func StringOrDefault(str, defaultTo string) string
- func UpdatePhase(ctx context.Context, client client.Client, inst client.Object, ...) error
- func UpdateSnapshotPhase(ctx context.Context, client client.Client, inst client.Object, ...) error
- func VerifyVersionUpgradeNeeded(currentVersion string, desiredVersion string) (bool, error)
- type OpenShiftPodCommander
- type PodCommander
- type PodCommanderMock
- type ReconcileResourceProvider
Constants ¶
const ( EnvForceReconcileTimeout = "ENV_FORCE_RECONCILE_TIMEOUT" EnvMetricsReconcileTimeout = "ENV_METRIC_RECONCILE_TIMEOUT" DefaultTagKeyPrefix = "integreatly.org/" // Set the reconcile duration for this controller. // Currently it will be called once every 5 minutes MetricsWatchDuration = 5 * time.Minute )
const ( DefaultPostgresMaintenanceMetricName = "cro_postgres_service_maintenance" DefaultPostgresInfoMetricName = "cro_postgres_info" DefaultPostgresAvailMetricName = "cro_postgres_available" DefaultPostgresConnectionMetricName = "cro_postgres_connection" DefaultPostgresStatusMetricName = "cro_postgres_status_phase" DefaultPostgresDeletionMetricName = "cro_postgres_deletion_timestamp" DefaultPostgresSnapshotStatusMetricName = "cro_postgres_snapshot_status_phase" DefaultPostgresAllocatedStorageMetricName = "cro_postgres_current_allocated_storage" DefaultPostgresMaxMemoryMetricName = "cro_postgres_max_memory" DefaultRedisMaintenanceMetricName = "cro_redis_service_maintenance" DefaultRedisInfoMetricName = "cro_redis_info" DefaultRedisAvailMetricName = "cro_redis_available" DefaultRedisConnectionMetricName = "cro_redis_connection" DefaultRedisStatusMetricName = "cro_redis_status_phase" DefaultRedisDeletionMetricName = "cro_redis_deletion_timestamp" DefaultRedisSnapshotStatusMetricName = "cro_redis_snapshot_status_phase" DefaultRedisSnapshotNotAvailable = "cro_redis_snapshot_not_found" DefaultPostgresSnapshotNotAvailable = "cro_postgres_snapshot_not_found" DefaultBlobStorageStatusMetricName = "cro_blobstorage_status_phase" DefaultVpcActionMetricName = "cro_vpc_action" BytesInGibiBytes = 1073741824 )
const (
LoggingKeyAction = "action"
)
Variables ¶
var ( // MetricVecs create the map of vectors MetricVecs map[string]prometheus.GaugeVec )
Functions ¶
func CreateFinalizer ¶
func DeletePrometheusRule ¶
DeletePrometheusRule will delete a prometheus rule object
func GeneratePassword ¶
func GetConfigMapOrDefault ¶
func GetForcedReconcileTimeOrDefault ¶
GetForcedReconcileTimeOrDefault returns envar for reconcile time else returns default time
func GetK8Client ¶
func GetK8Client() (*kubernetes.Clientset, error)
func GetMetricReconcileTimeOrDefault ¶
GetMetricReconcileTimeOrDefault returns envar for reconcile time else returns default time
func GetOrganizationTag ¶
func GetOrganizationTag() string
func HasFinalizer ¶
func HasFinalizer(om *controllerruntime.ObjectMeta, finalizer string) bool
func ReconcilePrometheusRule ¶
func ReconcilePrometheusRule(ctx context.Context, client client.Client, ruleName, ns, alertName, desc string, alertExp intstr.IntOrString, labels map[string]string) (*prometheusv1.PrometheusRule, error)
CreatePrometheusRule will create a PrometheusRule object
func RemoveFinalizer ¶
func RemoveFinalizer(om *controllerruntime.ObjectMeta, finalizer string)
func ResetMetric ¶ added in v0.33.0
func ResetMetric(name string)
func ResetVpcAction ¶ added in v0.35.0
func ResetVpcAction()
ResetVpcAction resets cro_vpc_action metric
func SafeStringDereference ¶
func SetMetricCurrentTime ¶
SetMetricCurrentTime Set current time wraps set metric
func SetVpcAction ¶ added in v0.35.0
SetVpcAction sets cro_vpc_action metric
func ShortenString ¶
ShortenString Cut string size, but maintain a reference to the original string using a hash of the full string in the result
func StartGaugeVector ¶
func StartGaugeVector()
StartGaugeVector periodic loop that is wiping all known vectors.
func StringOrDefault ¶
StringOrDefault checks string and returns given default string if empty
func UpdatePhase ¶
func UpdatePhase(ctx context.Context, client client.Client, inst client.Object, phase croType.StatusPhase, msg croType.StatusMessage) error
UpdatePhase Updates the custom resource with the current phase
func UpdateSnapshotPhase ¶
func UpdateSnapshotPhase(ctx context.Context, client client.Client, inst client.Object, phase croType.StatusPhase, msg croType.StatusMessage) error
UpdateSnapshotPhase Updates the snapshot custom resource with the current phase
Types ¶
type OpenShiftPodCommander ¶
type OpenShiftPodCommander struct {
ClientSet *kubernetes.Clientset
}
func (*OpenShiftPodCommander) ExecIntoPod ¶
func (pc *OpenShiftPodCommander) ExecIntoPod(dpl *appsv1.Deployment, cmd string) error
type PodCommander ¶
type PodCommander interface {
ExecIntoPod(dpl *appsv1.Deployment, cmd string) error
}
type PodCommanderMock ¶
type PodCommanderMock struct { // ExecIntoPodFunc mocks the ExecIntoPod method. ExecIntoPodFunc func(dpl *appsv1.Deployment, cmd string) error // contains filtered or unexported fields }
PodCommanderMock is a mock implementation of PodCommander.
func TestSomethingThatUsesPodCommander(t *testing.T) { // make and configure a mocked PodCommander mockedPodCommander := &PodCommanderMock{ ExecIntoPodFunc: func(dpl *appsv1.Deployment, cmd string) error { panic("mock out the ExecIntoPod method") }, } // use mockedPodCommander in code that requires PodCommander // and then make assertions. }
func (*PodCommanderMock) ExecIntoPod ¶
func (mock *PodCommanderMock) ExecIntoPod(dpl *appsv1.Deployment, cmd string) error
ExecIntoPod calls ExecIntoPodFunc.
func (*PodCommanderMock) ExecIntoPodCalls ¶
func (mock *PodCommanderMock) ExecIntoPodCalls() []struct { Dpl *appsv1.Deployment Cmd string }
ExecIntoPodCalls gets all the calls that were made to ExecIntoPod. Check the length with:
len(mockedPodCommander.ExecIntoPodCalls())
type ReconcileResourceProvider ¶
type ReconcileResourceProvider struct { Client client.Client Scheme *runtime.Scheme Logger *logrus.Entry }