utils

package
v0.0.0-...-0cd9e6e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PartOfLogging is the value for app.kubernetes.io/part-of on all logging-operator resources.
	PartOfLogging = "logging"
	// ManagedByOperator is the value for app.kubernetes.io/managed-by on resources created by the operator.
	ManagedByOperator = "logging-operator"
	// OperatorDeploymentName is the name of the logging-operator Deployment; used for app.kubernetes.io/managed-by-operator.
	OperatorDeploymentName = "logging-operator"
)
View Source
const (
	Debug = 1
	Info  = 2
	Warn  = -1
	Error = -2
)
View Source
const (
	InProgress = "In Progress"
	Success    = "Successful"
	Failed     = "Failed"
)
View Source
const (
	Interval              = time.Second * 10
	TerminatingPodTimeout = time.Minute * 2
)
View Source
const (
	BufferSize int = 100
)

Variables

View Source
var (
	ErrPodMonitorNotPresent = fmt.Errorf("no PodMonitor registered with the API")
	SelectorLabels          = map[string]string{"name": "logging-operator"}
)
View Source
var (
	BasePath = "assets/"

	LoggingServiceStatus = "ReconcileCycleStatus"

	FluentdComponentName      = "logging-fluentd"
	FluentdStatus             = "ReconcileFluentdStatus"
	FluentdConfigMapDirectory = "fluentd.configmap/conf.d"
	FluentdDaemonSet          = path.Join(BasePath, "daemon-set.yaml")
	FluentdServiceTemplate    = path.Join(BasePath, "service.yaml")
	FluentdLabels             = map[string]string{"component": "logging-fluentd"}

	FluentbitComponentName = "logging-fluentbit"
	FluentbitStatus        = "ReconcileFluentbitStatus"
	FluentbitDaemonSet     = path.Join(BasePath, "daemon-set.yaml")
	FluentbitService       = path.Join(BasePath, "service.yaml")
	FluentbitLabels        = map[string]string{"component": "logging-fluentbit"}

	ForwarderFluentbitComponentName  = "logging-fluentbit-forwarder"
	HAFluentStatus                   = "ReconcileHAFluentStatus"
	ForwarderFluentbitDaemonSet      = path.Join(BasePath, "flb-forwarder-daemon-set.yaml")
	ForwarderFluentbitService        = path.Join(BasePath, "flb-forwarder-service.yaml")
	ForwarderFluentbitLabels         = map[string]string{"component": "logging-fluentbit-forwarder"}
	AggregatorFluentbitComponentName = "logging-fluentbit-aggregator"
	AggregatorFluentbitStatefulSet   = path.Join(BasePath, "flb-aggregator-stateful-set.yaml")
	AggregatorFluentbitService       = path.Join(BasePath, "flb-aggregator-service.yaml")
	AggregatorFluentbitConfigMap     = path.Join(BasePath, "flb-aggregator-configmap.yaml")
	AggregatorFluentbitLabels        = map[string]string{"component": "logging-fluentbit-aggregator"}

	ForwarderFluentbitConfigMapDirectory  = "forwarder.configmap/conf.d"
	AggregatorFluentbitConfigMapDirectory = "aggregator.configmap/conf.d"
	FluentbitConfigMapDirectory           = "fluentbit.configmap/conf.d"

	EventsReaderComponentName = "events-reader"
	EventsReaderStatus        = "ReconcileEventsReaderStatus"
	EventsReaderDeployment    = path.Join(BasePath, "deployment.yaml")
	EventsReaderService       = path.Join(BasePath, "service.yaml")

	MonitoringAgentComponentName = "monitoring-agent-logging-plugin"
	MonitoringAgentStatus        = "ReconcileMonitoringAgentLoggingPluginStatus"
	MonitoringAgentSecret        = path.Join(BasePath, "secret.yaml")
	MonitoringAgentDeployment    = path.Join(BasePath, "deployment.yaml")
	MonitoringAgentService       = path.Join(BasePath, "service.yaml")

	GraylogComponentName            = "graylog-service"
	GraylogServiceAccountName       = "logging-graylog"
	GraylogDeploymentName           = "graylog"
	GraylogStatefulsetName          = "graylog"
	GraylogClaimName                = "graylog-claim"
	MongoClaimName                  = "mongo-claim"
	GraylogStatus                   = "ReconcileGraylogStatus"
	GraylogConfig                   = "config/"
	GraylogServiceAccount           = path.Join(BasePath, "service-account.yaml")
	GraylogStatefulset              = path.Join(BasePath, "statefulset.yaml")
	GraylogService                  = path.Join(BasePath, "service.yaml")
	GraylogConfigMapDirectory       = path.Join(GraylogConfig, "configmap")
	GraylogGrokPatterns             = path.Join(GraylogConfig, "grok_patterns.json")
	GraylogDefaultStream            = "Default Stream"
	GraylogAllMessagesStream        = "All messages"
	GraylogAuditIndexSet            = "Audit index set"
	GraylogAuditStream              = "Audit logs"
	GraylogSystemIndexSet           = "Default index set"
	GraylogSystemStream             = "System logs"
	GraylogAccessIndexSet           = "Access index set"
	GraylogAccessStream             = "Access logs"
	GraylogIntegrationIndexSet      = "Integration index set"
	GraylogIntegrationStream        = "Integration logs"
	GraylogBillCycleIndexSet        = "Bill Cycle index set"
	GraylogBillCycleStream          = "Bill Cycle logs"
	GraylogNginxIndexSet            = "Ingress-nginx index set"
	GraylogNginxStream              = "Nginx logs"
	GraylogDefaultIndexSet          = "Default index set"
	GraylogKubernetesEventsStream   = "Kubernetes events"
	GraylogKubernetesEventsIndexSet = "Kubernetes events index set"
	GraylogStreamsIndexTitles       = map[string]string{
		GraylogAuditStream:            GraylogAuditIndexSet,
		GraylogSystemStream:           GraylogSystemIndexSet,
		GraylogAccessStream:           GraylogAccessIndexSet,
		GraylogIntegrationStream:      GraylogIntegrationIndexSet,
		GraylogBillCycleStream:        GraylogBillCycleIndexSet,
		GraylogNginxStream:            GraylogNginxIndexSet,
		GraylogKubernetesEventsStream: GraylogKubernetesEventsIndexSet,
	}
	GraylogIndexConfigs = map[string]string{
		GraylogAuditIndexSet:            path.Join(GraylogConfig, "indexes/audit_index.json"),
		GraylogSystemIndexSet:           path.Join(GraylogConfig, "indexes/default_index.json"),
		GraylogAccessIndexSet:           path.Join(GraylogConfig, "indexes/access_index.json"),
		GraylogIntegrationIndexSet:      path.Join(GraylogConfig, "indexes/integration_index.json"),
		GraylogBillCycleIndexSet:        path.Join(GraylogConfig, "indexes/bill_cycle_index.json"),
		GraylogNginxIndexSet:            path.Join(GraylogConfig, "indexes/nginx_index.json"),
		GraylogDefaultIndexSet:          path.Join(GraylogConfig, "indexes/default_index.json"),
		GraylogKubernetesEventsIndexSet: path.Join(GraylogConfig, "indexes/k8s_event_index.json"),
	}
	GraylogStreamsDescriptions = map[string]string{
		GraylogAuditStream:            "Audit log messages from OC nodes sent through fluent bit",
		GraylogSystemStream:           "System log messages from OC nodes sent through fluent bit",
		GraylogAccessStream:           "Access log messages from OC nodes sent through fluent bit",
		GraylogIntegrationStream:      "Integration log messages from OC nodes sent through fluent bit",
		GraylogBillCycleStream:        "Bill Cycle log messages from OC nodes sent through fluent bit",
		GraylogNginxStream:            "Nginx log messages from OC nodes sent through fluent bit",
		GraylogKubernetesEventsStream: "Kubernetes events as logs sent through fluent bit",
	}
	GraylogInput                               = path.Join(GraylogConfig, "input.json")
	GraylogMessageProcessors                   = path.Join(GraylogConfig, "messageprocessors.json")
	GraylogAuthHeader                          = path.Join(GraylogConfig, "auth_header.json")
	GraylogArchivesDirectory                   = path.Join(GraylogConfig, "archives.json")
	GraylogReplaceTimestampExtractorName       = "replace_timestamp"
	GraylogKubernetesExtractorName             = "kuber_extractor"
	GraylogKubernetesLabelsExtractorName       = "kuber_labels_extractor"
	GraylogDockerExtractorName                 = "docker_extractor"
	GraylogMicroserviceFrameworkExtractorName  = "Microservice Framework Backend"
	GraylogReplaceTimestampExtractorAsset      = "replace_timestamp_extractor.json"
	GraylogKubernetesExtractorAsset            = "kubernetes_extractor.json"
	GraylogKubernetesLabelsExtractorAsset      = "kubernetes_labels_extractor.json"
	GraylogDockerExtractorAsset                = "docker_extractor.json"
	GraylogMicroserviceFrameworkExtractorAsset = "microservice_framework_extractor.json"
	Graylog4ExtractorsBasePath                 = path.Join(GraylogConfig, "extractors/graylog_4/")
	Graylog5ExtractorsBasePath                 = path.Join(GraylogConfig, "extractors/graylog_5/")
	Graylog4Extractors                         = map[string]string{
		GraylogReplaceTimestampExtractorName:      path.Join(Graylog4ExtractorsBasePath, GraylogReplaceTimestampExtractorAsset),
		GraylogKubernetesExtractorName:            path.Join(Graylog4ExtractorsBasePath, GraylogKubernetesExtractorAsset),
		GraylogKubernetesLabelsExtractorName:      path.Join(Graylog4ExtractorsBasePath, GraylogKubernetesLabelsExtractorAsset),
		GraylogDockerExtractorName:                path.Join(Graylog4ExtractorsBasePath, GraylogDockerExtractorAsset),
		GraylogMicroserviceFrameworkExtractorName: path.Join(Graylog4ExtractorsBasePath, GraylogMicroserviceFrameworkExtractorAsset),
	}
	Graylog5Extractors = map[string]string{
		GraylogReplaceTimestampExtractorName:      path.Join(Graylog5ExtractorsBasePath, GraylogReplaceTimestampExtractorAsset),
		GraylogKubernetesExtractorName:            path.Join(Graylog5ExtractorsBasePath, GraylogKubernetesExtractorAsset),
		GraylogKubernetesLabelsExtractorName:      path.Join(Graylog5ExtractorsBasePath, GraylogKubernetesLabelsExtractorAsset),
		GraylogDockerExtractorName:                path.Join(Graylog5ExtractorsBasePath, GraylogDockerExtractorAsset),
		GraylogMicroserviceFrameworkExtractorName: path.Join(Graylog5ExtractorsBasePath, GraylogMicroserviceFrameworkExtractorAsset),
	}
	GraylogAuditProcessingRule              = "Route Audit logs"
	GraylogSystemLogsProcessingRule         = "Route System logs"
	GraylogRemoveKubernetesRule             = "Remove kubernetes field"
	GraylogRemoveKubernetesLabelsRule       = "Remove kubernetes_labels field"
	GraylogUnsupportedSymbolsRule           = "Processing unsupported symbols"
	GraylogKubernetesEventsRule             = "Route Kubernetes events"
	GraylogRemoveKubernetesRuleStream       = GraylogDefaultStream
	GraylogRemoveKubernetesLabelsRuleStream = GraylogDefaultStream
	GraylogUnsupportedSymbolsRuleStream     = GraylogDefaultStream
	GraylogAccessProcessingRule             = "Route Access logs"
	GraylogIntegrationProcessingRule        = "Route Integration logs"
	GraylogBillCycleProcessingRule          = "Route Bill Cycle logs"
	GraylogNginxProcessingRule              = "Route Nginx logs"
	GraylogStreamsRules                     = map[string]string{
		GraylogAuditStream:                      GraylogAuditProcessingRule,
		GraylogSystemStream:                     GraylogSystemLogsProcessingRule,
		GraylogAccessStream:                     GraylogAccessProcessingRule,
		GraylogIntegrationStream:                GraylogIntegrationProcessingRule,
		GraylogBillCycleStream:                  GraylogBillCycleProcessingRule,
		GraylogNginxStream:                      GraylogNginxProcessingRule,
		GraylogRemoveKubernetesRuleStream:       GraylogRemoveKubernetesRule,
		GraylogRemoveKubernetesLabelsRuleStream: GraylogRemoveKubernetesLabelsRule,
		GraylogUnsupportedSymbolsRuleStream:     GraylogUnsupportedSymbolsRule,
		GraylogKubernetesEventsStream:           GraylogKubernetesEventsRule,
	}
	GraylogRuleConfigs = map[string]string{
		GraylogAuditProcessingRule:        path.Join(GraylogConfig, "processing_rules/audit_logs.rule"),
		GraylogSystemLogsProcessingRule:   path.Join(GraylogConfig, "processing_rules/system_logs.rule"),
		GraylogAccessProcessingRule:       path.Join(GraylogConfig, "processing_rules/access_logs.rule"),
		GraylogIntegrationProcessingRule:  path.Join(GraylogConfig, "processing_rules/int_logs.rule"),
		GraylogBillCycleProcessingRule:    path.Join(GraylogConfig, "processing_rules/bill_cycle_logs.rule"),
		GraylogNginxProcessingRule:        path.Join(GraylogConfig, "processing_rules/nginx_logs.rule"),
		GraylogRemoveKubernetesRule:       path.Join(GraylogConfig, "processing_rules/remove_kubernetes.rule"),
		GraylogRemoveKubernetesLabelsRule: path.Join(GraylogConfig, "processing_rules/remove_kubernetes_labels.rule"),
		GraylogUnsupportedSymbolsRule:     path.Join(GraylogConfig, "processing_rules/unsupported_symbols.rule"),
		GraylogKubernetesEventsRule:       path.Join(GraylogConfig, "processing_rules/k8s_event_logs.rule"),
	}
	GraylogRuleDescriptions = map[string]string{
		GraylogAuditProcessingRule:        "Route Audit logs to the appropriate stream",
		GraylogSystemLogsProcessingRule:   "Route System logs to the appropriate stream",
		GraylogAccessProcessingRule:       "Route Access logs to the appropriate stream",
		GraylogIntegrationProcessingRule:  "Route Integration logs to the appropriate stream",
		GraylogBillCycleProcessingRule:    "Route Bill Cycle logs to the appropriate stream",
		GraylogNginxProcessingRule:        "Route Nginx logs to the appropriate stream",
		GraylogRemoveKubernetesRule:       "Remove kubernetes field",
		GraylogRemoveKubernetesLabelsRule: "Remove kubernetes labels field",
		GraylogUnsupportedSymbolsRule:     "Processing unsupported symbols (Replace '/' to '_')",
		GraylogKubernetesEventsRule:       "Route Kubernetes events to the appropriate stream",
	}
	GraylogDashboard                = path.Join(GraylogConfig, "dashboard.json")
	GraylogDashboardInstallation    = path.Join(GraylogConfig, "dashboardInstallation.json")
	GraylogPipeline                 = path.Join(GraylogConfig, "pipeline.json")
	GraylogCloudEventsSearch        = path.Join(GraylogConfig, "saved_searches/cloud-events-search.json")
	GraylogUserSessionHistorySearch = path.Join(GraylogConfig, "saved_searches/user-session-history-search.json")
	GraylogCloudEventsView          = path.Join(GraylogConfig, "saved_searches/cloud-events-view.json")
	GraylogUserSessionHistoryView   = path.Join(GraylogConfig, "saved_searches/user-session-history-view.json")
	GraylogOperatorRole             = path.Join(GraylogConfig, "roles/operator.json")
	GraylogAuditViewerRole          = path.Join(GraylogConfig, "roles/auditViewer.json")
	GraylogOperatorUser             = path.Join(GraylogConfig, "user_accounts/operator.json")
	GraylogAuditViewerUser          = path.Join(GraylogConfig, "user_accounts/auditViewer.json")
	GraylogAdminWithTrustedHeader   = path.Join(GraylogConfig, "user_accounts/admin_with_trusted_header.json")
	GraylogStartupTimeout           = time.Minute * 10
	GraylogMongoUpgradeJobTimeout   = time.Minute * 2
	GraylogLabels                   = map[string]string{"name": "graylog"}
	GraylogSecretSelector           = "graylog=secret"
	GraylogConfigFileName           = "graylog.conf"
	GraylogPasswordField            = "root_password_sha2"
	GraylogUserField                = "root_username"
	GraylogMongoUpgradeOrderedJobs  = []string{
		"mongo-upgrade-job-40",
		"mongo-upgrade-job-42",
		"mongo-upgrade-job-44",
		"mongo-upgrade-job-50",
	}
	GraylogMongoUpgradeAssets = map[string]string{
		"mongo-upgrade-job-40": path.Join(BasePath, "mongo-upgrade-job-40.yaml"),
		"mongo-upgrade-job-42": path.Join(BasePath, "mongo-upgrade-job-42.yaml"),
		"mongo-upgrade-job-44": path.Join(BasePath, "mongo-upgrade-job-44.yaml"),
		"mongo-upgrade-job-50": path.Join(BasePath, "mongo-upgrade-job-50.yaml"),
	}
	GraylogMongoUpgradeLabels = map[string]string{"name": "mongo-upgrade-job"}

	ComponentPendingStatus            = "ComponentPendingStatus"
	ComponentPendingTimeout           = time.Minute * 5
	FluentbitAggregatorPendingTimeout = time.Minute * 8

	ConnectionTimeout = 10

	InitialDelay = time.Second * 5
)
View Source
var (
	ResourceKey = "res"
)

Functions

func CommonLabels

func CommonLabels() map[string]string

CommonLabels returns the labels applied to all resources (part-of, managed-by, managed-by-operator). Single source of truth for operator-created resources; mirrors Helm commonLabels.

func CreatePodMonitors

func CreatePodMonitors(config *rest.Config, ns string, services []*v1.Service, sInterval string, sTimeout string) error

CreatePodMonitors creates PodMonitors objects based on an array of Pod objects. If CR PodMonitor is not registered in the Cluster it will not attempt at creating resources.

func DataFromDirectory

func DataFromDirectory(assets embed.FS, directoryPath string, parameters any) (map[string]string, error)

func DownloadFile

func DownloadFile(fullURLFile string, fileName string) error

func DownloadFileTLS

func DownloadFileTLS(ctx context.Context, contentPackPath *v1.ContentPackPathHTTPConfig, fileName string, clientSet kubernetes.Interface, namespace string) error

func GeneratePodMonitor

func GeneratePodMonitor(s *v1.Service, sInterval string, sTimeout string) *promv1.PodMonitor

GeneratePodMonitor generates a prometheus-operator PodMonitor object based on the passed Service object.

func GetAggregatorIds

func GetAggregatorIds(num int) []int

func GetFromResourceMap

func GetFromResourceMap(resourceList core.ResourceList, key string) string

func GetInstanceLabel

func GetInstanceLabel(name, namespace string) string

GetInstanceLabel returns a truncated label value for app.kubernetes.io/instance (name-namespace).

func GetLogLevel

func GetLogLevel() zapcore.Level

func GetTagFromImage

func GetTagFromImage(image string) string

func GetTimeNow

func GetTimeNow() string

func Logger

func Logger(name string) logr.Logger

func MergeInto

func MergeInto(dst, src map[string]string)

MergeInto copies all key-value pairs from src into dst. If src is nil, dst is unchanged. Caller must ensure dst is non-nil (e.g. after SetLabels or when building a map).

func MergeLabels

func MergeLabels(mapsToMerge ...map[string]string) map[string]string

MergeLabels returns a new map with all key-value pairs from the given maps. Later maps override earlier ones on key conflict. Nil maps are skipped.

func MustAssetReader

func MustAssetReader(assets embed.FS, asset string) string

MustAssetReader loads and return the asset for the given name as bytes reader. Panics when the asset loading would return an error.

func ParseTemplate

func ParseTemplate(fileContent, filePath string, parameters any) (string, error)

func PodTemplateLabels

func PodTemplateLabels(name, component, instance, version, technology string) map[string]string

PodTemplateLabels returns the label map for pod template (base + instance + version + technology). Use for CRs with PodMetadata or other pod-label needs.

func ReadFile

func ReadFile(filePath string) (string, error)

func ResourceExists

func ResourceExists(dc discovery.DiscoveryInterface, apiGroupVersion, kind string) (bool, error)

ResourceExists returns true if the given resource kind exists in the given api groupversion

func ResourceLabels

func ResourceLabels(name, component string) map[string]string

ResourceLabels returns name, app.kubernetes.io/name, component, plus CommonLabels. Use for any resource (Service, ConfigMap, ServiceAccount, workload, etc.) so labels stay consistent.

func SetLabelsForResource

func SetLabelsForResource(obj metav1.Object, in LabelInput, existing map[string]string)

SetLabelsForResource sets base + component labels on any resource (Service, ServiceAccount, ConfigMap, etc.). When existing is nil, the object's current labels (obj.GetLabels()) are used as the initial layer; when non-nil, existing is used instead (e.g. for ConfigMap pass extra labels like k8s-app here, or nil for no initial labels).

func SetLabelsForWorkload

func SetLabelsForWorkload(obj metav1.Object, templateLabels *map[string]string, in LabelInput)

SetLabelsForWorkload sets base + component labels on the resource and base + instance/version/technology on the pod template. ComponentLabels are applied to the resource only, not to spec.template.metadata.labels. Use for DaemonSet, StatefulSet, Deployment, Job — pass the object and &obj.Spec.Template.Labels.

func ToJSON

func ToJSON(object any) string

func ToString

func ToString(duration time.Duration) string

func TruncLabel

func TruncLabel(label string) string

TruncLabel truncates a label value to 63 characters (Kubernetes limit). Use for name, app.kubernetes.io/name.

func Unzip

func Unzip(src string, dest string) ([]string, error)

func WaitForHostActive

func WaitForHostActive(host string, port int, timeout time.Duration) error

Types

type Component

type Component struct {
	ComponentName string
	StatusName    string
}

type ComponentReconciler

type ComponentReconciler struct {
	Client        client.Client
	Scheme        *runtime.Scheme
	Log           logr.Logger
	StatusUpdater StatusUpdater
}

func (*ComponentReconciler) CreateResource

func (r *ComponentReconciler) CreateResource(cr *loggingService.LoggingService, o K8sResource, setRefOptional ...bool) error

func (*ComponentReconciler) DeleteResource

func (r *ComponentReconciler) DeleteResource(o K8sResource) error

func (*ComponentReconciler) GetResource

func (r *ComponentReconciler) GetResource(o K8sResource) error

GetResource tries to get resource inside namespace or on cluster level.

func (*ComponentReconciler) UpdateResource

func (r *ComponentReconciler) UpdateResource(o K8sResource) error

type ComponentsPendingReconciler

type ComponentsPendingReconciler struct {
	*ComponentReconciler
	ComponentList *[]Component
}

func NewComponentsPendingReconciler

func NewComponentsPendingReconciler(client client.Client, scheme *runtime.Scheme, updater StatusUpdater, pendingComponents *[]Component) ComponentsPendingReconciler

func (*ComponentsPendingReconciler) Run

func (*ComponentsPendingReconciler) ToComponentNameList

func (r *ComponentsPendingReconciler) ToComponentNameList(componentList *[]Component) []string

type Creds

type Creds struct {
	Name     string
	Password string
	Token    string
}

type DynamicParameters

type DynamicParameters struct {
	ContainerRuntimeType string
}

type K8sResource

type K8sResource interface {
	runtime.Object
	k8smetav1.Object

	GetObjectMeta() k8smetav1.Object
}

K8sResource abstract k8s resource which can be reconciled

type LabelInput

type LabelInput struct {
	Name            string
	Component       string
	Instance        string
	Version         string
	Technology      string
	ComponentLabels map[string]string
}

LabelInput holds parameters for setting labels on operator-managed resources. ComponentLabels are applied to resource metadata only (not to pod templates) and override base labels on key conflict.

func BaseOnlyLabelInput

func BaseOnlyLabelInput(name, component string) LabelInput

BaseOnlyLabelInput returns LabelInput with base labels only (no instance, version, technology). Use for ServiceAccount, ClusterRole, Service, ServiceMonitor, etc. per label specification.

type PodManager

type PodManager struct {
	// contains filtered or unexported fields
}

func NewPodManager

func NewPodManager(client client.Client, namespace string, log logr.Logger) PodManager

func (*PodManager) DeletePods

func (manager *PodManager) DeletePods(labelSelectors map[string]string) (bool, error)

func (*PodManager) FindPods

func (manager *PodManager) FindPods(labelSelectors map[string]string) (podList *core.PodList, err error)

func (*PodManager) IsDaemonSetAvailable

func (manager *PodManager) IsDaemonSetAvailable(serviceName string) (bool, error)

func (*PodManager) IsDaemonSetExists

func (manager *PodManager) IsDaemonSetExists(serviceName string) (bool, error)

func (*PodManager) IsDeploymentExists

func (manager *PodManager) IsDeploymentExists(serviceName string) (bool, error)

func (*PodManager) IsDeploymentReplicasSynchronised

func (manager *PodManager) IsDeploymentReplicasSynchronised(serviceName string) (bool, error)

func (*PodManager) IsJobSucceeded

func (manager *PodManager) IsJobSucceeded(jobName string) (bool, error)

func (*PodManager) IsStatefulsetReplicasSynchronised

func (manager *PodManager) IsStatefulsetReplicasSynchronised(serviceName string) (bool, error)

func (*PodManager) ToPodNameList

func (manager *PodManager) ToPodNameList(podList *core.PodList) []string

func (*PodManager) WaitForJobSucceeded

func (manager *PodManager) WaitForJobSucceeded(jobName string, timeout time.Duration) (bool, error)

func (*PodManager) WaitForStatefulsetUpdated

func (manager *PodManager) WaitForStatefulsetUpdated(serviceName string, timeout time.Duration) (bool, error)

func (*PodManager) WaitForTerminatingPods

func (manager *PodManager) WaitForTerminatingPods(terminatedPodNames []string, labelSelectors map[string]string) (bool, error)

type RestClient

type RestClient struct {
	Client *http.Client
	Auth   *Creds
	Host   string
}

func (*RestClient) SetAuthHeader

func (restClient *RestClient) SetAuthHeader(request *http.Request)

type SkipStatusUpdatePredicate

type SkipStatusUpdatePredicate struct {
	// contains filtered or unexported fields
}

func NewPredicate

func NewPredicate(logger logr.Logger) SkipStatusUpdatePredicate

func (*SkipStatusUpdatePredicate) Create

func (predicate *SkipStatusUpdatePredicate) Create(event event.CreateEvent) bool

func (*SkipStatusUpdatePredicate) Delete

func (predicate *SkipStatusUpdatePredicate) Delete(event event.DeleteEvent) bool

func (*SkipStatusUpdatePredicate) Generic

func (predicate *SkipStatusUpdatePredicate) Generic(event event.GenericEvent) bool

func (*SkipStatusUpdatePredicate) IsStatusUpdated

func (predicate *SkipStatusUpdatePredicate) IsStatusUpdated(oldInstance runtime.Object, newInstance runtime.Object) bool

func (*SkipStatusUpdatePredicate) Update

func (predicate *SkipStatusUpdatePredicate) Update(event event.UpdateEvent) bool

type StatusUpdater

type StatusUpdater struct {
	// contains filtered or unexported fields
}

func NewStatusUpdater

func NewStatusUpdater(client client.Client, resource *loggingService.LoggingService) StatusUpdater

func (*StatusUpdater) GetCondition

func (updater *StatusUpdater) GetCondition(newConditionReason string) (int, *loggingService.LoggingServiceCondition)

func (*StatusUpdater) IsStatusFailed

func (updater *StatusUpdater) IsStatusFailed(conditionReason string) bool

func (*StatusUpdater) RemoveStatus

func (updater *StatusUpdater) RemoveStatus(reason string) bool

func (*StatusUpdater) RemoveTemporaryStatuses

func (updater *StatusUpdater) RemoveTemporaryStatuses()

func (*StatusUpdater) UpdateStatus

func (updater *StatusUpdater) UpdateStatus(reason string, statusType string, status bool, message string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL