From edb3bb4452a61a504754ff131133e075364bc79b Mon Sep 17 00:00:00 2001 From: zyy17 Date: Thu, 26 Sep 2024 15:45:12 +0800 Subject: [PATCH 01/12] feat(apis): add monitoring spec --- apis/v1alpha1/greptimedbcluster_types.go | 58 + apis/v1alpha1/zz_generated.deepcopy.go | 102 + .../greptime.io_greptimedbclusters.yaml | 3027 +++++++++++++++++ docs/api-references/docs.md | 86 + manifests/bundle.yaml | 3027 +++++++++++++++++ manifests/crds.yaml | 3027 +++++++++++++++++ 6 files changed, 9327 insertions(+) diff --git a/apis/v1alpha1/greptimedbcluster_types.go b/apis/v1alpha1/greptimedbcluster_types.go index 6d50d5b4..836ff345 100644 --- a/apis/v1alpha1/greptimedbcluster_types.go +++ b/apis/v1alpha1/greptimedbcluster_types.go @@ -15,6 +15,7 @@ package v1alpha1 import ( + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -322,6 +323,52 @@ type GreptimeDBClusterSpec struct { // The global logging configuration for all components. It can be overridden by the logging configuration of individual component. // +optional Logging *LoggingSpec `json:"logging,omitempty"` + + // Monitoring is the specification for monitor bootstrapping. It will create a standalone greptimedb instance to monitor the cluster. + // +optional + Monitoring *MonitoringSpec `json:"monitoring,omitempty"` +} + +// MonitoringSpec is the specification for monitor bootstrapping. It will create a standalone greptimedb instance to monitor the cluster. +type MonitoringSpec struct { + // Enabled indicates whether to enable the monitoring service. + // +required + Enabled bool `json:"enabled"` + + // The specification of the standalone greptimedb instance. + // +optional + Standalone *GreptimeDBStandaloneSpec `json:"standalone,omitempty"` + + // The specification of cluster logs collection. + LogsCollection *LogsCollectionSpec `json:"logsCollection,omitempty"` + + // The specification of the vector instance. + // +optional + Vector *VectorSpec `json:"vector,omitempty"` +} + +type LogsCollectionSpec struct { + // The specification of the log pipeline. + // +optional + Pipeline *LogPipeline `json:"pipeline,omitempty"` +} + +// LogPipeline is the specification for log pipeline. +type LogPipeline struct { + // The content of the pipeline configuration file in YAML format. + // +optional + Data string `json:"data,omitempty"` +} + +// VectorSpec is the specification for vector instance. +type VectorSpec struct { + // The image of the vector instance. + // +optional + Image string `json:"image,omitempty"` + + // The resources of the vector instance. + // +optional + Resource corev1.ResourceRequirements `json:"resource,omitempty"` } func (in *GreptimeDBCluster) GetBaseMainContainer() *MainContainerSpec { @@ -427,6 +474,10 @@ type GreptimeDBClusterStatus struct { // +optional Flownode FlownodeStatus `json:"flownode,omitempty"` + // The status of the monitoring service. + // +optional + Monitoring MonitoringStatus `json:"monitoring,omitempty"` + // Version is the version of greptimedb. // +optional Version string `json:"version,omitempty"` @@ -484,6 +535,13 @@ type FlownodeStatus struct { ReadyReplicas int32 `json:"readyReplicas"` } +// MonitoringStatus is the status of the monitoring service. +type MonitoringStatus struct { + // InternalDNSName is the internal DNS name of the monitoring service. For example, 'mycluster-standalone-monitor.default.svc.cluster.local'. + // +optional + InternalDNSName string `json:"internalDNSName,omitempty"` +} + func (in *GreptimeDBClusterStatus) GetCondition(conditionType ConditionType) *Condition { return GetCondition(in.Conditions, conditionType) } diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index f90e1573..730f7d2b 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -365,6 +365,11 @@ func (in *GreptimeDBClusterSpec) DeepCopyInto(out *GreptimeDBClusterSpec) { *out = new(LoggingSpec) (*in).DeepCopyInto(*out) } + if in.Monitoring != nil { + in, out := &in.Monitoring, &out.Monitoring + *out = new(MonitoringSpec) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GreptimeDBClusterSpec. @@ -384,6 +389,7 @@ func (in *GreptimeDBClusterStatus) DeepCopyInto(out *GreptimeDBClusterStatus) { in.Meta.DeepCopyInto(&out.Meta) out.Datanode = in.Datanode out.Flownode = in.Flownode + out.Monitoring = in.Monitoring if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions *out = make([]Condition, len(*in)) @@ -589,6 +595,21 @@ func (in *KafkaWAL) DeepCopy() *KafkaWAL { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LogPipeline) DeepCopyInto(out *LogPipeline) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogPipeline. +func (in *LogPipeline) DeepCopy() *LogPipeline { + if in == nil { + return nil + } + out := new(LogPipeline) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LoggingSpec) DeepCopyInto(out *LoggingSpec) { *out = *in @@ -614,6 +635,26 @@ func (in *LoggingSpec) DeepCopy() *LoggingSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LogsCollectionSpec) DeepCopyInto(out *LogsCollectionSpec) { + *out = *in + if in.Pipeline != nil { + in, out := &in.Pipeline, &out.Pipeline + *out = new(LogPipeline) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogsCollectionSpec. +func (in *LogsCollectionSpec) DeepCopy() *LogsCollectionSpec { + if in == nil { + return nil + } + out := new(LogsCollectionSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MainContainerSpec) DeepCopyInto(out *MainContainerSpec) { *out = *in @@ -715,6 +756,51 @@ func (in *MetaStatus) DeepCopy() *MetaStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitoringSpec) DeepCopyInto(out *MonitoringSpec) { + *out = *in + if in.Standalone != nil { + in, out := &in.Standalone, &out.Standalone + *out = new(GreptimeDBStandaloneSpec) + (*in).DeepCopyInto(*out) + } + if in.LogsCollection != nil { + in, out := &in.LogsCollection, &out.LogsCollection + *out = new(LogsCollectionSpec) + (*in).DeepCopyInto(*out) + } + if in.Vector != nil { + in, out := &in.Vector, &out.Vector + *out = new(VectorSpec) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitoringSpec. +func (in *MonitoringSpec) DeepCopy() *MonitoringSpec { + if in == nil { + return nil + } + out := new(MonitoringSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitoringStatus) DeepCopyInto(out *MonitoringStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitoringStatus. +func (in *MonitoringStatus) DeepCopy() *MonitoringStatus { + if in == nil { + return nil + } + out := new(MonitoringStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OSSStorage) DeepCopyInto(out *OSSStorage) { *out = *in @@ -976,6 +1062,22 @@ func (in *TLSSpec) DeepCopy() *TLSSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VectorSpec) DeepCopyInto(out *VectorSpec) { + *out = *in + in.Resource.DeepCopyInto(&out.Resource) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VectorSpec. +func (in *VectorSpec) DeepCopy() *VectorSpec { + if in == nil { + return nil + } + out := new(VectorSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WALProviderSpec) DeepCopyInto(out *WALProviderSpec) { *out = *in diff --git a/config/crd/resources/greptime.io_greptimedbclusters.yaml b/config/crd/resources/greptime.io_greptimedbclusters.yaml index 0f80ca57..8d6aae0f 100644 --- a/config/crd/resources/greptime.io_greptimedbclusters.yaml +++ b/config/crd/resources/greptime.io_greptimedbclusters.yaml @@ -14112,6 +14112,3028 @@ spec: required: - etcdEndpoints type: object + monitoring: + properties: + enabled: + type: boolean + logsCollection: + properties: + pipeline: + properties: + data: + type: string + type: object + type: object + standalone: + properties: + base: + properties: + activeDeadlineSeconds: + format: int64 + type: integer + additionalContainers: + items: + properties: + args: + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + type: string + imagePullPolicy: + type: string + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + name: + type: string + ports: + items: + properties: + containerPort: + format: int32 + type: integer + hostIP: + type: string + hostPort: + format: int32 + type: integer + name: + type: string + protocol: + default: TCP + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + restartPolicy: + type: string + securityContext: + properties: + allowPrivilegeEscalation: + type: boolean + capabilities: + properties: + add: + items: + type: string + type: array + drop: + items: + type: string + type: array + type: object + privileged: + type: boolean + procMount: + type: string + readOnlyRootFilesystem: + type: boolean + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + stdin: + type: boolean + stdinOnce: + type: boolean + terminationMessagePath: + type: string + terminationMessagePolicy: + type: string + tty: + type: boolean + volumeDevices: + items: + properties: + devicePath: + type: string + name: + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + type: string + required: + - name + type: object + type: array + affinity: + properties: + nodeAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + preference: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + weight: + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + properties: + nodeSelectorTerms: + items: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + type: array + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + podAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + type: object + podAntiAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + type: object + type: object + annotations: + additionalProperties: + type: string + type: object + dnsPolicy: + type: string + hostNetwork: + type: boolean + imagePullSecrets: + items: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + type: array + initContainers: + items: + properties: + args: + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + type: string + imagePullPolicy: + type: string + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + name: + type: string + ports: + items: + properties: + containerPort: + format: int32 + type: integer + hostIP: + type: string + hostPort: + format: int32 + type: integer + name: + type: string + protocol: + default: TCP + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + restartPolicy: + type: string + securityContext: + properties: + allowPrivilegeEscalation: + type: boolean + capabilities: + properties: + add: + items: + type: string + type: array + drop: + items: + type: string + type: array + type: object + privileged: + type: boolean + procMount: + type: string + readOnlyRootFilesystem: + type: boolean + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + stdin: + type: boolean + stdinOnce: + type: boolean + terminationMessagePath: + type: string + terminationMessagePolicy: + type: string + tty: + type: boolean + volumeDevices: + items: + properties: + devicePath: + type: string + name: + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + type: string + required: + - name + type: object + type: array + labels: + additionalProperties: + type: string + type: object + main: + properties: + args: + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + image: + type: string + imagePullPolicy: + type: string + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + readinessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + volumeMounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + type: string + type: object + nodeSelector: + additionalProperties: + type: string + type: object + restartPolicy: + type: string + schedulerName: + type: string + serviceAccountName: + type: string + terminationGracePeriodSeconds: + format: int64 + type: integer + tolerations: + items: + properties: + effect: + type: string + key: + type: string + operator: + type: string + tolerationSeconds: + format: int64 + type: integer + value: + type: string + type: object + type: array + volumes: + items: + properties: + awsElasticBlockStore: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + azureDisk: + properties: + cachingMode: + type: string + diskName: + type: string + diskURI: + type: string + fsType: + type: string + kind: + type: string + readOnly: + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + properties: + readOnly: + type: boolean + secretName: + type: string + shareName: + type: string + required: + - secretName + - shareName + type: object + cephfs: + properties: + monitors: + items: + type: string + type: array + path: + type: string + readOnly: + type: boolean + secretFile: + type: string + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + volumeID: + type: string + required: + - volumeID + type: object + configMap: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + readOnly: + type: boolean + volumeAttributes: + additionalProperties: + type: string + type: object + required: + - driver + type: object + downwardAPI: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + emptyDir: + properties: + medium: + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + ephemeral: + properties: + volumeClaimTemplate: + properties: + metadata: + type: object + spec: + properties: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name + type: object + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + selector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + type: string + volumeMode: + type: string + volumeName: + type: string + type: object + required: + - spec + type: object + type: object + fc: + properties: + fsType: + type: string + lun: + format: int32 + type: integer + readOnly: + type: boolean + targetWWNs: + items: + type: string + type: array + wwids: + items: + type: string + type: array + type: object + flexVolume: + properties: + driver: + type: string + fsType: + type: string + options: + additionalProperties: + type: string + type: object + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + required: + - driver + type: object + flocker: + properties: + datasetName: + type: string + datasetUUID: + type: string + type: object + gcePersistentDisk: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + pdName: + type: string + readOnly: + type: boolean + required: + - pdName + type: object + gitRepo: + properties: + directory: + type: string + repository: + type: string + revision: + type: string + required: + - repository + type: object + glusterfs: + properties: + endpoints: + type: string + path: + type: string + readOnly: + type: boolean + required: + - endpoints + - path + type: object + hostPath: + properties: + path: + type: string + type: + type: string + required: + - path + type: object + iscsi: + properties: + chapAuthDiscovery: + type: boolean + chapAuthSession: + type: boolean + fsType: + type: string + initiatorName: + type: string + iqn: + type: string + iscsiInterface: + type: string + lun: + format: int32 + type: integer + portals: + items: + type: string + type: array + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + targetPortal: + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + type: string + nfs: + properties: + path: + type: string + readOnly: + type: boolean + server: + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + properties: + claimName: + type: string + readOnly: + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + properties: + fsType: + type: string + pdID: + type: string + required: + - pdID + type: object + portworxVolume: + properties: + fsType: + type: string + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + projected: + properties: + defaultMode: + format: int32 + type: integer + sources: + items: + properties: + configMap: + properties: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + properties: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + type: object + quobyte: + properties: + group: + type: string + readOnly: + type: boolean + registry: + type: string + tenant: + type: string + user: + type: string + volume: + type: string + required: + - registry + - volume + type: object + rbd: + properties: + fsType: + type: string + image: + type: string + keyring: + type: string + monitors: + items: + type: string + type: array + pool: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + user: + type: string + required: + - image + - monitors + type: object + scaleIO: + properties: + fsType: + type: string + gateway: + type: string + protectionDomain: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + sslEnabled: + type: boolean + storageMode: + type: string + storagePool: + type: string + system: + type: string + volumeName: + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + optional: + type: boolean + secretName: + type: string + type: object + storageos: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + volumeName: + type: string + volumeNamespace: + type: string + type: object + vsphereVolume: + properties: + fsType: + type: string + storagePolicyID: + type: string + storagePolicyName: + type: string + volumePath: + type: string + required: + - volumePath + type: object + required: + - name + type: object + type: array + type: object + config: + type: string + datanodeStorage: + properties: + dataHome: + type: string + fs: + properties: + mountPath: + type: string + name: + type: string + storageClassName: + type: string + storageRetainPolicy: + enum: + - Retain + - Delete + type: string + storageSize: + pattern: (^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$) + type: string + type: object + type: object + httpPort: + format: int32 + type: integer + initializer: + properties: + image: + type: string + type: object + logging: + properties: + format: + enum: + - json + - text + type: string + level: + enum: + - info + - error + - warn + - debug + type: string + logsDir: + type: string + onlyLogToStdout: + type: boolean + persistentWithData: + type: boolean + type: object + mysqlPort: + format: int32 + type: integer + objectStorage: + properties: + cache: + properties: + cacheCapacity: + type: string + fs: + properties: + mountPath: + type: string + name: + type: string + storageClassName: + type: string + storageRetainPolicy: + enum: + - Retain + - Delete + type: string + storageSize: + pattern: (^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$) + type: string + type: object + type: object + gcs: + properties: + bucket: + type: string + endpoint: + type: string + root: + type: string + scope: + type: string + secretName: + type: string + required: + - bucket + - root + type: object + oss: + properties: + bucket: + type: string + endpoint: + type: string + region: + type: string + root: + type: string + secretName: + type: string + required: + - bucket + - region + - root + type: object + s3: + properties: + bucket: + type: string + endpoint: + type: string + region: + type: string + root: + type: string + secretName: + type: string + required: + - bucket + - region + - root + type: object + type: object + postgreSQLPort: + format: int32 + type: integer + prometheusMonitor: + properties: + enabled: + type: boolean + interval: + type: string + labels: + additionalProperties: + type: string + type: object + required: + - enabled + type: object + rpcPort: + format: int32 + type: integer + service: + properties: + annotations: + additionalProperties: + type: string + type: object + labels: + additionalProperties: + type: string + type: object + loadBalancerClass: + type: string + type: + type: string + type: object + tls: + properties: + secretName: + type: string + required: + - secretName + type: object + version: + type: string + wal: + properties: + kafka: + properties: + brokerEndpoints: + items: + type: string + type: array + required: + - brokerEndpoints + type: object + raftEngine: + properties: + fs: + properties: + mountPath: + type: string + name: + type: string + storageClassName: + type: string + storageRetainPolicy: + enum: + - Retain + - Delete + type: string + storageSize: + pattern: (^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$) + type: string + type: object + type: object + type: object + type: object + vector: + properties: + image: + type: string + resource: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + type: object + required: + - enabled + type: object mysqlPort: format: int32 maximum: 65535 @@ -14332,6 +17354,11 @@ spec: - readyReplicas - replicas type: object + monitoring: + properties: + internalDNSName: + type: string + type: object observedGeneration: format: int64 type: integer diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md index 7775deb8..0605b7da 100644 --- a/docs/api-references/docs.md +++ b/docs/api-references/docs.md @@ -339,6 +339,7 @@ _Appears in:_ | `objectStorage` _[ObjectStorageProviderSpec](#objectstorageproviderspec)_ | ObjectStorageProvider is the storage provider for the greptimedb cluster. | | | | `wal` _[WALProviderSpec](#walproviderspec)_ | WALProvider is the WAL provider for the greptimedb cluster. | | | | `logging` _[LoggingSpec](#loggingspec)_ | The global logging configuration for all components. It can be overridden by the logging configuration of individual component. | | | +| `monitoring` _[MonitoringSpec](#monitoringspec)_ | Monitoring is the specification for monitor bootstrapping. It will create a standalone greptimedb instance to monitor the cluster. | | | @@ -390,6 +391,7 @@ GreptimeDBStandaloneSpec defines the desired state of GreptimeDBStandalone _Appears in:_ - [GreptimeDBStandalone](#greptimedbstandalone) +- [MonitoringSpec](#monitoringspec) | Field | Description | Default | Validation | | --- | --- | --- | --- | @@ -462,6 +464,22 @@ _Appears in:_ | `text` | LogFormatText is the `text` format of the logging.
| +#### LogPipeline + + + +LogPipeline is the specification for log pipeline. + + + +_Appears in:_ +- [LogsCollectionSpec](#logscollectionspec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `data` _string_ | The content of the pipeline configuration file in YAML format. | | | + + #### LoggingLevel _Underlying type:_ _string_ @@ -507,6 +525,22 @@ _Appears in:_ | `format` _[LogFormat](#logformat)_ | Format is the format of the logging. | | Enum: [json text]
| +#### LogsCollectionSpec + + + + + + + +_Appears in:_ +- [MonitoringSpec](#monitoringspec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `pipeline` _[LogPipeline](#logpipeline)_ | The specification of the log pipeline. | | | + + #### MainContainerSpec @@ -577,6 +611,41 @@ _Appears in:_ | `etcdEndpoints` _string array_ | EtcdEndpoints is the endpoints of the etcd cluster. | | | +#### MonitoringSpec + + + +MonitoringSpec is the specification for monitor bootstrapping. It will create a standalone greptimedb instance to monitor the cluster. + + + +_Appears in:_ +- [GreptimeDBClusterSpec](#greptimedbclusterspec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `enabled` _boolean_ | Enabled indicates whether to enable the monitoring service. | | | +| `standalone` _[GreptimeDBStandaloneSpec](#greptimedbstandalonespec)_ | The specification of the standalone greptimedb instance. | | | +| `logsCollection` _[LogsCollectionSpec](#logscollectionspec)_ | The specification of cluster logs collection. | | | +| `vector` _[VectorSpec](#vectorspec)_ | The specification of the vector instance. | | | + + +#### MonitoringStatus + + + +MonitoringStatus is the status of the monitoring service. + + + +_Appears in:_ +- [GreptimeDBClusterStatus](#greptimedbclusterstatus) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `internalDNSName` _string_ | InternalDNSName is the internal DNS name of the monitoring service. For example, 'mycluster-standalone-monitor.default.svc.cluster.local'. | | | + + #### OSSStorage @@ -817,6 +886,23 @@ _Appears in:_ | `secretName` _string_ | SecretName is the name of the secret that contains the TLS certificates.
The secret must be in the same namespace with the greptime resource.
The secret must contain keys named `tls.crt` and `tls.key`. | | | +#### VectorSpec + + + +VectorSpec is the specification for vector instance. + + + +_Appears in:_ +- [MonitoringSpec](#monitoringspec) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `image` _string_ | The image of the vector instance. | | | +| `resource` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#resourcerequirements-v1-core)_ | The resources of the vector instance. | | | + + #### WALProviderSpec diff --git a/manifests/bundle.yaml b/manifests/bundle.yaml index 5c442b1f..3ba7f3d1 100644 --- a/manifests/bundle.yaml +++ b/manifests/bundle.yaml @@ -14118,6 +14118,3028 @@ spec: required: - etcdEndpoints type: object + monitoring: + properties: + enabled: + type: boolean + logsCollection: + properties: + pipeline: + properties: + data: + type: string + type: object + type: object + standalone: + properties: + base: + properties: + activeDeadlineSeconds: + format: int64 + type: integer + additionalContainers: + items: + properties: + args: + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + type: string + imagePullPolicy: + type: string + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + name: + type: string + ports: + items: + properties: + containerPort: + format: int32 + type: integer + hostIP: + type: string + hostPort: + format: int32 + type: integer + name: + type: string + protocol: + default: TCP + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + restartPolicy: + type: string + securityContext: + properties: + allowPrivilegeEscalation: + type: boolean + capabilities: + properties: + add: + items: + type: string + type: array + drop: + items: + type: string + type: array + type: object + privileged: + type: boolean + procMount: + type: string + readOnlyRootFilesystem: + type: boolean + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + stdin: + type: boolean + stdinOnce: + type: boolean + terminationMessagePath: + type: string + terminationMessagePolicy: + type: string + tty: + type: boolean + volumeDevices: + items: + properties: + devicePath: + type: string + name: + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + type: string + required: + - name + type: object + type: array + affinity: + properties: + nodeAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + preference: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + weight: + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + properties: + nodeSelectorTerms: + items: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + type: array + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + podAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + type: object + podAntiAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + type: object + type: object + annotations: + additionalProperties: + type: string + type: object + dnsPolicy: + type: string + hostNetwork: + type: boolean + imagePullSecrets: + items: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + type: array + initContainers: + items: + properties: + args: + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + type: string + imagePullPolicy: + type: string + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + name: + type: string + ports: + items: + properties: + containerPort: + format: int32 + type: integer + hostIP: + type: string + hostPort: + format: int32 + type: integer + name: + type: string + protocol: + default: TCP + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + restartPolicy: + type: string + securityContext: + properties: + allowPrivilegeEscalation: + type: boolean + capabilities: + properties: + add: + items: + type: string + type: array + drop: + items: + type: string + type: array + type: object + privileged: + type: boolean + procMount: + type: string + readOnlyRootFilesystem: + type: boolean + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + stdin: + type: boolean + stdinOnce: + type: boolean + terminationMessagePath: + type: string + terminationMessagePolicy: + type: string + tty: + type: boolean + volumeDevices: + items: + properties: + devicePath: + type: string + name: + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + type: string + required: + - name + type: object + type: array + labels: + additionalProperties: + type: string + type: object + main: + properties: + args: + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + image: + type: string + imagePullPolicy: + type: string + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + readinessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + volumeMounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + type: string + type: object + nodeSelector: + additionalProperties: + type: string + type: object + restartPolicy: + type: string + schedulerName: + type: string + serviceAccountName: + type: string + terminationGracePeriodSeconds: + format: int64 + type: integer + tolerations: + items: + properties: + effect: + type: string + key: + type: string + operator: + type: string + tolerationSeconds: + format: int64 + type: integer + value: + type: string + type: object + type: array + volumes: + items: + properties: + awsElasticBlockStore: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + azureDisk: + properties: + cachingMode: + type: string + diskName: + type: string + diskURI: + type: string + fsType: + type: string + kind: + type: string + readOnly: + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + properties: + readOnly: + type: boolean + secretName: + type: string + shareName: + type: string + required: + - secretName + - shareName + type: object + cephfs: + properties: + monitors: + items: + type: string + type: array + path: + type: string + readOnly: + type: boolean + secretFile: + type: string + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + volumeID: + type: string + required: + - volumeID + type: object + configMap: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + readOnly: + type: boolean + volumeAttributes: + additionalProperties: + type: string + type: object + required: + - driver + type: object + downwardAPI: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + emptyDir: + properties: + medium: + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + ephemeral: + properties: + volumeClaimTemplate: + properties: + metadata: + type: object + spec: + properties: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name + type: object + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + selector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + type: string + volumeMode: + type: string + volumeName: + type: string + type: object + required: + - spec + type: object + type: object + fc: + properties: + fsType: + type: string + lun: + format: int32 + type: integer + readOnly: + type: boolean + targetWWNs: + items: + type: string + type: array + wwids: + items: + type: string + type: array + type: object + flexVolume: + properties: + driver: + type: string + fsType: + type: string + options: + additionalProperties: + type: string + type: object + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + required: + - driver + type: object + flocker: + properties: + datasetName: + type: string + datasetUUID: + type: string + type: object + gcePersistentDisk: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + pdName: + type: string + readOnly: + type: boolean + required: + - pdName + type: object + gitRepo: + properties: + directory: + type: string + repository: + type: string + revision: + type: string + required: + - repository + type: object + glusterfs: + properties: + endpoints: + type: string + path: + type: string + readOnly: + type: boolean + required: + - endpoints + - path + type: object + hostPath: + properties: + path: + type: string + type: + type: string + required: + - path + type: object + iscsi: + properties: + chapAuthDiscovery: + type: boolean + chapAuthSession: + type: boolean + fsType: + type: string + initiatorName: + type: string + iqn: + type: string + iscsiInterface: + type: string + lun: + format: int32 + type: integer + portals: + items: + type: string + type: array + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + targetPortal: + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + type: string + nfs: + properties: + path: + type: string + readOnly: + type: boolean + server: + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + properties: + claimName: + type: string + readOnly: + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + properties: + fsType: + type: string + pdID: + type: string + required: + - pdID + type: object + portworxVolume: + properties: + fsType: + type: string + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + projected: + properties: + defaultMode: + format: int32 + type: integer + sources: + items: + properties: + configMap: + properties: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + properties: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + type: object + quobyte: + properties: + group: + type: string + readOnly: + type: boolean + registry: + type: string + tenant: + type: string + user: + type: string + volume: + type: string + required: + - registry + - volume + type: object + rbd: + properties: + fsType: + type: string + image: + type: string + keyring: + type: string + monitors: + items: + type: string + type: array + pool: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + user: + type: string + required: + - image + - monitors + type: object + scaleIO: + properties: + fsType: + type: string + gateway: + type: string + protectionDomain: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + sslEnabled: + type: boolean + storageMode: + type: string + storagePool: + type: string + system: + type: string + volumeName: + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + optional: + type: boolean + secretName: + type: string + type: object + storageos: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + volumeName: + type: string + volumeNamespace: + type: string + type: object + vsphereVolume: + properties: + fsType: + type: string + storagePolicyID: + type: string + storagePolicyName: + type: string + volumePath: + type: string + required: + - volumePath + type: object + required: + - name + type: object + type: array + type: object + config: + type: string + datanodeStorage: + properties: + dataHome: + type: string + fs: + properties: + mountPath: + type: string + name: + type: string + storageClassName: + type: string + storageRetainPolicy: + enum: + - Retain + - Delete + type: string + storageSize: + pattern: (^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$) + type: string + type: object + type: object + httpPort: + format: int32 + type: integer + initializer: + properties: + image: + type: string + type: object + logging: + properties: + format: + enum: + - json + - text + type: string + level: + enum: + - info + - error + - warn + - debug + type: string + logsDir: + type: string + onlyLogToStdout: + type: boolean + persistentWithData: + type: boolean + type: object + mysqlPort: + format: int32 + type: integer + objectStorage: + properties: + cache: + properties: + cacheCapacity: + type: string + fs: + properties: + mountPath: + type: string + name: + type: string + storageClassName: + type: string + storageRetainPolicy: + enum: + - Retain + - Delete + type: string + storageSize: + pattern: (^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$) + type: string + type: object + type: object + gcs: + properties: + bucket: + type: string + endpoint: + type: string + root: + type: string + scope: + type: string + secretName: + type: string + required: + - bucket + - root + type: object + oss: + properties: + bucket: + type: string + endpoint: + type: string + region: + type: string + root: + type: string + secretName: + type: string + required: + - bucket + - region + - root + type: object + s3: + properties: + bucket: + type: string + endpoint: + type: string + region: + type: string + root: + type: string + secretName: + type: string + required: + - bucket + - region + - root + type: object + type: object + postgreSQLPort: + format: int32 + type: integer + prometheusMonitor: + properties: + enabled: + type: boolean + interval: + type: string + labels: + additionalProperties: + type: string + type: object + required: + - enabled + type: object + rpcPort: + format: int32 + type: integer + service: + properties: + annotations: + additionalProperties: + type: string + type: object + labels: + additionalProperties: + type: string + type: object + loadBalancerClass: + type: string + type: + type: string + type: object + tls: + properties: + secretName: + type: string + required: + - secretName + type: object + version: + type: string + wal: + properties: + kafka: + properties: + brokerEndpoints: + items: + type: string + type: array + required: + - brokerEndpoints + type: object + raftEngine: + properties: + fs: + properties: + mountPath: + type: string + name: + type: string + storageClassName: + type: string + storageRetainPolicy: + enum: + - Retain + - Delete + type: string + storageSize: + pattern: (^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$) + type: string + type: object + type: object + type: object + type: object + vector: + properties: + image: + type: string + resource: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + type: object + required: + - enabled + type: object mysqlPort: format: int32 maximum: 65535 @@ -14338,6 +17360,11 @@ spec: - readyReplicas - replicas type: object + monitoring: + properties: + internalDNSName: + type: string + type: object observedGeneration: format: int64 type: integer diff --git a/manifests/crds.yaml b/manifests/crds.yaml index 8fcf0d2d..8d51f9ce 100644 --- a/manifests/crds.yaml +++ b/manifests/crds.yaml @@ -14111,6 +14111,3028 @@ spec: required: - etcdEndpoints type: object + monitoring: + properties: + enabled: + type: boolean + logsCollection: + properties: + pipeline: + properties: + data: + type: string + type: object + type: object + standalone: + properties: + base: + properties: + activeDeadlineSeconds: + format: int64 + type: integer + additionalContainers: + items: + properties: + args: + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + type: string + imagePullPolicy: + type: string + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + name: + type: string + ports: + items: + properties: + containerPort: + format: int32 + type: integer + hostIP: + type: string + hostPort: + format: int32 + type: integer + name: + type: string + protocol: + default: TCP + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + restartPolicy: + type: string + securityContext: + properties: + allowPrivilegeEscalation: + type: boolean + capabilities: + properties: + add: + items: + type: string + type: array + drop: + items: + type: string + type: array + type: object + privileged: + type: boolean + procMount: + type: string + readOnlyRootFilesystem: + type: boolean + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + stdin: + type: boolean + stdinOnce: + type: boolean + terminationMessagePath: + type: string + terminationMessagePolicy: + type: string + tty: + type: boolean + volumeDevices: + items: + properties: + devicePath: + type: string + name: + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + type: string + required: + - name + type: object + type: array + affinity: + properties: + nodeAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + preference: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + weight: + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + properties: + nodeSelectorTerms: + items: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + type: array + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + podAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + type: object + podAntiAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + type: object + type: object + annotations: + additionalProperties: + type: string + type: object + dnsPolicy: + type: string + hostNetwork: + type: boolean + imagePullSecrets: + items: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + type: array + initContainers: + items: + properties: + args: + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + type: string + imagePullPolicy: + type: string + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + name: + type: string + ports: + items: + properties: + containerPort: + format: int32 + type: integer + hostIP: + type: string + hostPort: + format: int32 + type: integer + name: + type: string + protocol: + default: TCP + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + restartPolicy: + type: string + securityContext: + properties: + allowPrivilegeEscalation: + type: boolean + capabilities: + properties: + add: + items: + type: string + type: array + drop: + items: + type: string + type: array + type: object + privileged: + type: boolean + procMount: + type: string + readOnlyRootFilesystem: + type: boolean + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + stdin: + type: boolean + stdinOnce: + type: boolean + terminationMessagePath: + type: string + terminationMessagePolicy: + type: string + tty: + type: boolean + volumeDevices: + items: + properties: + devicePath: + type: string + name: + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + type: string + required: + - name + type: object + type: array + labels: + additionalProperties: + type: string + type: object + main: + properties: + args: + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + image: + type: string + imagePullPolicy: + type: string + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + readinessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + volumeMounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + type: string + type: object + nodeSelector: + additionalProperties: + type: string + type: object + restartPolicy: + type: string + schedulerName: + type: string + serviceAccountName: + type: string + terminationGracePeriodSeconds: + format: int64 + type: integer + tolerations: + items: + properties: + effect: + type: string + key: + type: string + operator: + type: string + tolerationSeconds: + format: int64 + type: integer + value: + type: string + type: object + type: array + volumes: + items: + properties: + awsElasticBlockStore: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + azureDisk: + properties: + cachingMode: + type: string + diskName: + type: string + diskURI: + type: string + fsType: + type: string + kind: + type: string + readOnly: + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + properties: + readOnly: + type: boolean + secretName: + type: string + shareName: + type: string + required: + - secretName + - shareName + type: object + cephfs: + properties: + monitors: + items: + type: string + type: array + path: + type: string + readOnly: + type: boolean + secretFile: + type: string + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + volumeID: + type: string + required: + - volumeID + type: object + configMap: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + readOnly: + type: boolean + volumeAttributes: + additionalProperties: + type: string + type: object + required: + - driver + type: object + downwardAPI: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + emptyDir: + properties: + medium: + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + ephemeral: + properties: + volumeClaimTemplate: + properties: + metadata: + type: object + spec: + properties: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name + type: object + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + selector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + type: string + volumeMode: + type: string + volumeName: + type: string + type: object + required: + - spec + type: object + type: object + fc: + properties: + fsType: + type: string + lun: + format: int32 + type: integer + readOnly: + type: boolean + targetWWNs: + items: + type: string + type: array + wwids: + items: + type: string + type: array + type: object + flexVolume: + properties: + driver: + type: string + fsType: + type: string + options: + additionalProperties: + type: string + type: object + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + required: + - driver + type: object + flocker: + properties: + datasetName: + type: string + datasetUUID: + type: string + type: object + gcePersistentDisk: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + pdName: + type: string + readOnly: + type: boolean + required: + - pdName + type: object + gitRepo: + properties: + directory: + type: string + repository: + type: string + revision: + type: string + required: + - repository + type: object + glusterfs: + properties: + endpoints: + type: string + path: + type: string + readOnly: + type: boolean + required: + - endpoints + - path + type: object + hostPath: + properties: + path: + type: string + type: + type: string + required: + - path + type: object + iscsi: + properties: + chapAuthDiscovery: + type: boolean + chapAuthSession: + type: boolean + fsType: + type: string + initiatorName: + type: string + iqn: + type: string + iscsiInterface: + type: string + lun: + format: int32 + type: integer + portals: + items: + type: string + type: array + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + targetPortal: + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + type: string + nfs: + properties: + path: + type: string + readOnly: + type: boolean + server: + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + properties: + claimName: + type: string + readOnly: + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + properties: + fsType: + type: string + pdID: + type: string + required: + - pdID + type: object + portworxVolume: + properties: + fsType: + type: string + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + projected: + properties: + defaultMode: + format: int32 + type: integer + sources: + items: + properties: + configMap: + properties: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + properties: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + type: object + quobyte: + properties: + group: + type: string + readOnly: + type: boolean + registry: + type: string + tenant: + type: string + user: + type: string + volume: + type: string + required: + - registry + - volume + type: object + rbd: + properties: + fsType: + type: string + image: + type: string + keyring: + type: string + monitors: + items: + type: string + type: array + pool: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + user: + type: string + required: + - image + - monitors + type: object + scaleIO: + properties: + fsType: + type: string + gateway: + type: string + protectionDomain: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + sslEnabled: + type: boolean + storageMode: + type: string + storagePool: + type: string + system: + type: string + volumeName: + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + optional: + type: boolean + secretName: + type: string + type: object + storageos: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + volumeName: + type: string + volumeNamespace: + type: string + type: object + vsphereVolume: + properties: + fsType: + type: string + storagePolicyID: + type: string + storagePolicyName: + type: string + volumePath: + type: string + required: + - volumePath + type: object + required: + - name + type: object + type: array + type: object + config: + type: string + datanodeStorage: + properties: + dataHome: + type: string + fs: + properties: + mountPath: + type: string + name: + type: string + storageClassName: + type: string + storageRetainPolicy: + enum: + - Retain + - Delete + type: string + storageSize: + pattern: (^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$) + type: string + type: object + type: object + httpPort: + format: int32 + type: integer + initializer: + properties: + image: + type: string + type: object + logging: + properties: + format: + enum: + - json + - text + type: string + level: + enum: + - info + - error + - warn + - debug + type: string + logsDir: + type: string + onlyLogToStdout: + type: boolean + persistentWithData: + type: boolean + type: object + mysqlPort: + format: int32 + type: integer + objectStorage: + properties: + cache: + properties: + cacheCapacity: + type: string + fs: + properties: + mountPath: + type: string + name: + type: string + storageClassName: + type: string + storageRetainPolicy: + enum: + - Retain + - Delete + type: string + storageSize: + pattern: (^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$) + type: string + type: object + type: object + gcs: + properties: + bucket: + type: string + endpoint: + type: string + root: + type: string + scope: + type: string + secretName: + type: string + required: + - bucket + - root + type: object + oss: + properties: + bucket: + type: string + endpoint: + type: string + region: + type: string + root: + type: string + secretName: + type: string + required: + - bucket + - region + - root + type: object + s3: + properties: + bucket: + type: string + endpoint: + type: string + region: + type: string + root: + type: string + secretName: + type: string + required: + - bucket + - region + - root + type: object + type: object + postgreSQLPort: + format: int32 + type: integer + prometheusMonitor: + properties: + enabled: + type: boolean + interval: + type: string + labels: + additionalProperties: + type: string + type: object + required: + - enabled + type: object + rpcPort: + format: int32 + type: integer + service: + properties: + annotations: + additionalProperties: + type: string + type: object + labels: + additionalProperties: + type: string + type: object + loadBalancerClass: + type: string + type: + type: string + type: object + tls: + properties: + secretName: + type: string + required: + - secretName + type: object + version: + type: string + wal: + properties: + kafka: + properties: + brokerEndpoints: + items: + type: string + type: array + required: + - brokerEndpoints + type: object + raftEngine: + properties: + fs: + properties: + mountPath: + type: string + name: + type: string + storageClassName: + type: string + storageRetainPolicy: + enum: + - Retain + - Delete + type: string + storageSize: + pattern: (^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$) + type: string + type: object + type: object + type: object + type: object + vector: + properties: + image: + type: string + resource: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + type: object + required: + - enabled + type: object mysqlPort: format: int32 maximum: 65535 @@ -14331,6 +17353,11 @@ spec: - readyReplicas - replicas type: object + monitoring: + properties: + internalDNSName: + type: string + type: object observedGeneration: format: int64 type: integer From 61d6a49b69917d860eea7a291dc453f6a744dde6 Mon Sep 17 00:00:00 2001 From: zyy17 Date: Thu, 26 Sep 2024 17:18:36 +0800 Subject: [PATCH 02/12] feat: implement monitoring bootstrap of GreptimeDBCluster --- apis/v1alpha1/greptimedbcluster_types.go | 47 ++++ .../greptime.io_greptimedbclusters.yaml | 8 + controllers/common/common.go | 7 + controllers/constant/constant.go | 9 + controllers/greptimedbcluster/controller.go | 1 + .../greptimedbcluster/deployers/common.go | 127 ++++++++- .../deployers/config/config.go | 25 ++ .../deployers/config/pipeline.yaml | 28 ++ .../config/vector-config-template.yaml | 66 +++++ .../greptimedbcluster/deployers/datanode.go | 28 +- .../greptimedbcluster/deployers/flownode.go | 9 +- .../greptimedbcluster/deployers/frontend.go | 6 + .../greptimedbcluster/deployers/meta.go | 20 +- .../greptimedbcluster/deployers/monitoring.go | 246 ++++++++++++++++++ docs/api-references/docs.md | 2 +- go.mod | 1 + go.sum | 2 + manifests/bundle.yaml | 8 + manifests/crds.yaml | 8 + pkg/deployer/builder.go | 11 + pkg/deployer/constants.go | 6 +- 21 files changed, 626 insertions(+), 39 deletions(-) create mode 100644 controllers/greptimedbcluster/deployers/config/config.go create mode 100644 controllers/greptimedbcluster/deployers/config/pipeline.yaml create mode 100644 controllers/greptimedbcluster/deployers/config/vector-config-template.yaml create mode 100644 controllers/greptimedbcluster/deployers/monitoring.go diff --git a/apis/v1alpha1/greptimedbcluster_types.go b/apis/v1alpha1/greptimedbcluster_types.go index 836ff345..5d1a3d3b 100644 --- a/apis/v1alpha1/greptimedbcluster_types.go +++ b/apis/v1alpha1/greptimedbcluster_types.go @@ -347,12 +347,20 @@ type MonitoringSpec struct { Vector *VectorSpec `json:"vector,omitempty"` } +// LogsCollectionSpec is the specification for cluster logs collection. type LogsCollectionSpec struct { // The specification of the log pipeline. // +optional Pipeline *LogPipeline `json:"pipeline,omitempty"` } +func (in *LogsCollectionSpec) GetPipeline() *LogPipeline { + if in != nil { + return in.Pipeline + } + return nil +} + // LogPipeline is the specification for log pipeline. type LogPipeline struct { // The content of the pipeline configuration file in YAML format. @@ -360,6 +368,13 @@ type LogPipeline struct { Data string `json:"data,omitempty"` } +func (in *LogPipeline) GetData() string { + if in != nil { + return in.Data + } + return "" +} + // VectorSpec is the specification for vector instance. type VectorSpec struct { // The image of the vector instance. @@ -371,6 +386,31 @@ type VectorSpec struct { Resource corev1.ResourceRequirements `json:"resource,omitempty"` } +func (in *MonitoringSpec) IsEnabled() bool { + return in != nil && in.Enabled +} + +func (in *MonitoringSpec) GetStandalone() *GreptimeDBStandaloneSpec { + if in != nil { + return in.Standalone + } + return nil +} + +func (in *MonitoringSpec) GetLogsCollection() *LogsCollectionSpec { + if in != nil { + return in.LogsCollection + } + return nil +} + +func (in *MonitoringSpec) GetVector() *VectorSpec { + if in != nil { + return in.Vector + } + return nil +} + func (in *GreptimeDBCluster) GetBaseMainContainer() *MainContainerSpec { if in != nil && in.Spec.Base != nil { return in.Spec.Base.MainContainer @@ -456,6 +496,13 @@ func (in *GreptimeDBCluster) GetPrometheusMonitor() *PrometheusMonitorSpec { return nil } +func (in *GreptimeDBCluster) GetMonitoring() *MonitoringSpec { + if in != nil { + return in.Spec.Monitoring + } + return nil +} + // GreptimeDBClusterStatus defines the observed state of GreptimeDBCluster type GreptimeDBClusterStatus struct { // Frontend is the status of frontend node. diff --git a/config/crd/resources/greptime.io_greptimedbclusters.yaml b/config/crd/resources/greptime.io_greptimedbclusters.yaml index 8d6aae0f..bf6a528c 100644 --- a/config/crd/resources/greptime.io_greptimedbclusters.yaml +++ b/config/crd/resources/greptime.io_greptimedbclusters.yaml @@ -16914,6 +16914,8 @@ spec: type: object httpPort: format: int32 + maximum: 65535 + minimum: 0 type: integer initializer: properties: @@ -16943,6 +16945,8 @@ spec: type: object mysqlPort: format: int32 + maximum: 65535 + minimum: 0 type: integer objectStorage: properties: @@ -17021,6 +17025,8 @@ spec: type: object postgreSQLPort: format: int32 + maximum: 65535 + minimum: 0 type: integer prometheusMonitor: properties: @@ -17037,6 +17043,8 @@ spec: type: object rpcPort: format: int32 + maximum: 65535 + minimum: 0 type: integer service: properties: diff --git a/controllers/common/common.go b/controllers/common/common.go index db886378..91a3bc80 100644 --- a/controllers/common/common.go +++ b/controllers/common/common.go @@ -257,3 +257,10 @@ func GetPVCs(ctx context.Context, k8sClient client.Client, namespace, name strin return claims.Items, nil } +func MonitoringServiceName(name string) string { + return name + "-monitor" +} + +func LogsPipelineName(namespace, name string) string { + return namespace + "-" + name + "-logs" +} diff --git a/controllers/constant/constant.go b/controllers/constant/constant.go index dba9d48b..a11bdef1 100644 --- a/controllers/constant/constant.go +++ b/controllers/constant/constant.go @@ -28,4 +28,13 @@ const ( InitConfigVolumeName = "init-config" TLSVolumeName = "tls" DefaultTLSMode = "prefer" + + // LogsTableName is the table name of storing greptimedb logs. + LogsTableName = "gtlogs" + + // DefaultVectorConfigName is the default name of vector config. + DefaultVectorConfigName = "vector-config" + + // DefaultLogsVolumeName is the default name of logs volume. + DefaultLogsVolumeName = "logs" ) diff --git a/controllers/greptimedbcluster/controller.go b/controllers/greptimedbcluster/controller.go index 9ab13af3..66b40aff 100644 --- a/controllers/greptimedbcluster/controller.go +++ b/controllers/greptimedbcluster/controller.go @@ -63,6 +63,7 @@ func Setup(mgr ctrl.Manager, _ *options.Options) error { // sync will execute the sync logic of multiple deployers in order. reconciler.Deployers = []deployer.Deployer{ + deployers.NewMonitoringDeployer(mgr), deployers.NewMetaDeployer(mgr), deployers.NewDatanodeDeployer(mgr), deployers.NewFrontendDeployer(mgr), diff --git a/controllers/greptimedbcluster/deployers/common.go b/controllers/greptimedbcluster/deployers/common.go index 7a241d75..a51be8c5 100644 --- a/controllers/greptimedbcluster/deployers/common.go +++ b/controllers/greptimedbcluster/deployers/common.go @@ -15,11 +15,15 @@ package deployers import ( + "bytes" "context" "fmt" + "io/fs" + "text/template" monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/util/retry" ctrl "sigs.k8s.io/controller-runtime" @@ -28,6 +32,7 @@ import ( "github.com/GreptimeTeam/greptimedb-operator/apis/v1alpha1" "github.com/GreptimeTeam/greptimedb-operator/controllers/common" "github.com/GreptimeTeam/greptimedb-operator/controllers/constant" + "github.com/GreptimeTeam/greptimedb-operator/controllers/greptimedbcluster/deployers/config" "github.com/GreptimeTeam/greptimedb-operator/pkg/dbconfig" "github.com/GreptimeTeam/greptimedb-operator/pkg/deployer" ) @@ -110,18 +115,136 @@ func (c *CommonBuilder) MountConfigDir(template *corev1.PodTemplateSpec) { // AddLogsVolume will create a shared volume for logs and mount it to the main container and sidecar container. func (c *CommonBuilder) AddLogsVolume(template *corev1.PodTemplateSpec, mountPath string) { template.Spec.Volumes = append(template.Spec.Volumes, corev1.Volume{ - Name: "logs", + Name: constant.DefaultLogsVolumeName, VolumeSource: corev1.VolumeSource{ EmptyDir: &corev1.EmptyDirVolumeSource{}, }, }) template.Spec.Containers[constant.MainContainerIndex].VolumeMounts = append(template.Spec.Containers[constant.MainContainerIndex].VolumeMounts, corev1.VolumeMount{ - Name: "logs", + Name: constant.DefaultLogsVolumeName, MountPath: mountPath, }) } +func (c *CommonBuilder) AddVectorConfigVolume(template *corev1.PodTemplateSpec) { + template.Spec.Volumes = append(template.Spec.Volumes, corev1.Volume{ + Name: constant.DefaultVectorConfigName, + VolumeSource: corev1.VolumeSource{ + ConfigMap: &corev1.ConfigMapVolumeSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: constant.DefaultVectorConfigName, + }, + }, + }, + }) +} + +func (c *CommonBuilder) AddVectorSidecar(template *corev1.PodTemplateSpec, kind v1alpha1.ComponentKind) { + template.Spec.Containers = append(template.Spec.Containers, corev1.Container{ + Name: "vector", + Image: c.Cluster.Spec.Monitoring.Vector.Image, + Args: []string{ + "--config", "/etc/vector/vector.yaml", + }, + Env: c.env(kind), + VolumeMounts: []corev1.VolumeMount{ + { + Name: constant.DefaultLogsVolumeName, + MountPath: "/logs", + }, + { + Name: constant.DefaultVectorConfigName, + MountPath: "/etc/vector", + }, + }, + }) +} + +func (c *CommonBuilder) GenerateVectorConfigMap() (*corev1.ConfigMap, error) { + standaloneName := common.ResourceName(c.Cluster.Name+"-monitor", v1alpha1.StandaloneKind) + svc := fmt.Sprintf("%s.%s.svc.cluster.local", standaloneName, c.Cluster.Namespace) + vars := map[string]string{ + "ClusterName": c.Cluster.Name, + "LogsTableName": constant.LogsTableName, + "PipelineName": common.LogsPipelineName(c.Cluster.Namespace, c.Cluster.Name), + "LoggingService": fmt.Sprintf("http://%s:4000", svc), + "MetricService": fmt.Sprintf("http://%s:4000/v1/prometheus/write?db=public", svc), + } + + vectorConfigTemplate, err := c.vectorConfigTemplate() + if err != nil { + return nil, err + } + + var buf bytes.Buffer + tmpl, err := template.New("vector-config").Parse(vectorConfigTemplate) + if err != nil { + return nil, err + } + + if err := tmpl.Execute(&buf, vars); err != nil { + return nil, err + } + + configmap := &corev1.ConfigMap{ + TypeMeta: metav1.TypeMeta{ + Kind: "ConfigMap", + APIVersion: "v1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: constant.DefaultVectorConfigName, + Namespace: c.Cluster.Namespace, + }, + Data: map[string]string{ + "vector.yaml": buf.String(), + }, + } + + return configmap, nil +} + +func (c *CommonBuilder) vectorConfigTemplate() (string, error) { + data, err := fs.ReadFile(config.VectorConfigTemplate, "vector-config-template.yaml") + if err != nil { + return "", err + } + return string(data), nil +} + +func (c *CommonBuilder) env(kind v1alpha1.ComponentKind) []corev1.EnvVar { + return []corev1.EnvVar{ + { + Name: deployer.EnvPodIP, + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + FieldPath: "status.podIP", + }, + }, + }, + { + Name: deployer.EnvPodName, + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + FieldPath: "metadata.name", + }, + }, + }, + { + Name: deployer.EnvPodNamespace, + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + FieldPath: "metadata.namespace", + }, + }, + }, + { + Name: deployer.EnvRole, + Value: string(kind), + }, + } +} + func UpdateStatus(ctx context.Context, input *v1alpha1.GreptimeDBCluster, kc client.Client, opts ...client.SubResourceUpdateOption) error { cluster := input.DeepCopy() status := cluster.Status diff --git a/controllers/greptimedbcluster/deployers/config/config.go b/controllers/greptimedbcluster/deployers/config/config.go new file mode 100644 index 00000000..de979766 --- /dev/null +++ b/controllers/greptimedbcluster/deployers/config/config.go @@ -0,0 +1,25 @@ +// Copyright 2024 Greptime Team +// +// 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 +// +// http://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. + +package config + +import ( + "embed" +) + +//go:embed vector-config-template.yaml +var VectorConfigTemplate embed.FS + +//go:embed pipeline.yaml +var DefaultPipeline embed.FS diff --git a/controllers/greptimedbcluster/deployers/config/pipeline.yaml b/controllers/greptimedbcluster/deployers/config/pipeline.yaml new file mode 100644 index 00000000..5c6114fb --- /dev/null +++ b/controllers/greptimedbcluster/deployers/config/pipeline.yaml @@ -0,0 +1,28 @@ +processors: + - date: + fields: + - timestamp # 2024-08-30T08:55:48.817419Z + formats: + - "%Y-%m-%dT%H:%M:%S.%6fZ" + +transform: + - fields: + - level + - target + - module_path + - file + - pod + - pod_ip + - namespace + - cluster + - role + type: string + index: tag + - fields: + - message + - err + type: string + index: fulltext + - field: timestamp + type: time + index: timestamp diff --git a/controllers/greptimedbcluster/deployers/config/vector-config-template.yaml b/controllers/greptimedbcluster/deployers/config/vector-config-template.yaml new file mode 100644 index 00000000..09e80d90 --- /dev/null +++ b/controllers/greptimedbcluster/deployers/config/vector-config-template.yaml @@ -0,0 +1,66 @@ +sources: + logs: + type: file + data_dir: /logs + include: + - /logs/*.* + max_read_bytes: 536870912 + + metrics: + type: prometheus_scrape + endpoints: + - http://${POD_IP}:4000/metrics + instance_tag: instance + endpoint_tag: endpoint + honor_labels: true + +transforms: + transform_logs: + type: remap + inputs: + - logs + source: | + . = parse_json!(.message) + .message = .fields.message + .pod = "${POD_NAME}" + .pod_ip = "${POD_IP}" + .namespace = "${POD_NAMESPACE}" + .cluster = "{{ .ClusterName }}" + .role = "${ROLE}" + if exists(.fields."log.target") { + .target = .fields."log.target" + } + if exists(.fields."log.module_path") { + .module_path = .fields."log.module_path" + } + if exists(.fields."log.file") { + .file = .fields."log.file" + } + if exists(.fields."err") { + .err = .fields.err + } + + add_metrics_labels: + type: remap + inputs: + - metrics + source: | + .tags.namespace = "${POD_NAMESPACE}" + .tags.cluster = "{{ .ClusterName }}" + .tags.pod = "${POD_NAME}" + +sinks: + sink_greptimedb_logs: + type: greptimedb_logs + table: {{ .LogsTableName }} + pipeline_name: {{ .PipelineName }} + compression: gzip + inputs: + - transform_logs + endpoint: {{ .LoggingService }} + + sink_greptimedb_metrics: + type: prometheus_remote_write + inputs: + - add_metrics_labels + endpoint: {{ .MetricService }} diff --git a/controllers/greptimedbcluster/deployers/datanode.go b/controllers/greptimedbcluster/deployers/datanode.go index 1ff1c2d1..62f71b93 100644 --- a/controllers/greptimedbcluster/deployers/datanode.go +++ b/controllers/greptimedbcluster/deployers/datanode.go @@ -447,6 +447,9 @@ func (b *datanodeBuilder) generatePodTemplateSpec() corev1.PodTemplateSpec { podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Args = b.generateMainContainerArgs() } + podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Ports = b.containerPorts() + podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Env = append(podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Env, b.env(v1alpha1.DatanodeComponentKind)...) + b.mountConfigDir(podTemplateSpec) b.addVolumeMounts(podTemplateSpec) b.addInitConfigDirVolume(podTemplateSpec) @@ -456,7 +459,11 @@ func (b *datanodeBuilder) generatePodTemplateSpec() corev1.PodTemplateSpec { b.AddLogsVolume(podTemplateSpec, logging.GetLogsDir()) } - podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Ports = b.containerPorts() + if b.Cluster.GetMonitoring() != nil && b.Cluster.GetMonitoring().GetVector() != nil { + b.AddVectorConfigVolume(podTemplateSpec) + b.AddVectorSidecar(podTemplateSpec, v1alpha1.DatanodeComponentKind) + } + podTemplateSpec.Spec.InitContainers = append(podTemplateSpec.Spec.InitContainers, *b.generateInitializer()) podTemplateSpec.ObjectMeta.Labels = util.MergeStringMap(podTemplateSpec.ObjectMeta.Labels, map[string]string{ constant.GreptimeDBComponentName: common.ResourceName(b.Cluster.Name, b.ComponentKind), @@ -513,24 +520,7 @@ func (b *datanodeBuilder) generateInitializer() *corev1.Container { }, // TODO(zyy17): the datanode don't support to accept hostname. - Env: []corev1.EnvVar{ - { - Name: deployer.EnvPodIP, - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.podIP", - }, - }, - }, - { - Name: deployer.EnvPodName, - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "metadata.name", - }, - }, - }, - }, + Env: b.env(v1alpha1.DatanodeComponentKind), } return initializer diff --git a/controllers/greptimedbcluster/deployers/flownode.go b/controllers/greptimedbcluster/deployers/flownode.go index 5155bc72..e718097b 100644 --- a/controllers/greptimedbcluster/deployers/flownode.go +++ b/controllers/greptimedbcluster/deployers/flownode.go @@ -250,6 +250,9 @@ func (b *flownodeBuilder) generatePodTemplateSpec() corev1.PodTemplateSpec { podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Args = b.generateMainContainerArgs() } + podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Ports = b.containerPorts() + podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Env = append(podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Env, b.env(v1alpha1.FlownodeComponentKind)...) + b.mountConfigDir(podTemplateSpec) b.addInitConfigDirVolume(podTemplateSpec) @@ -257,7 +260,11 @@ func (b *flownodeBuilder) generatePodTemplateSpec() corev1.PodTemplateSpec { b.AddLogsVolume(podTemplateSpec, logging.GetLogsDir()) } - podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Ports = b.containerPorts() + if b.Cluster.GetMonitoring() != nil && b.Cluster.GetMonitoring().GetVector() != nil { + b.AddVectorConfigVolume(podTemplateSpec) + b.AddVectorSidecar(podTemplateSpec, v1alpha1.FlownodeComponentKind) + } + podTemplateSpec.Spec.InitContainers = append(podTemplateSpec.Spec.InitContainers, *b.generateInitializer()) podTemplateSpec.ObjectMeta.Labels = util.MergeStringMap(podTemplateSpec.ObjectMeta.Labels, map[string]string{ constant.GreptimeDBComponentName: common.ResourceName(b.Cluster.Name, b.ComponentKind), diff --git a/controllers/greptimedbcluster/deployers/frontend.go b/controllers/greptimedbcluster/deployers/frontend.go index 255c02c9..80451e44 100644 --- a/controllers/greptimedbcluster/deployers/frontend.go +++ b/controllers/greptimedbcluster/deployers/frontend.go @@ -271,6 +271,7 @@ func (b *frontendBuilder) generatePodTemplateSpec() *corev1.PodTemplateSpec { }) podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Ports = b.containerPorts() + podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Env = append(podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Env, b.env(v1alpha1.FrontendComponentKind)...) b.MountConfigDir(podTemplateSpec) @@ -278,6 +279,11 @@ func (b *frontendBuilder) generatePodTemplateSpec() *corev1.PodTemplateSpec { b.AddLogsVolume(podTemplateSpec, logging.GetLogsDir()) } + if b.Cluster.GetMonitoring() != nil && b.Cluster.GetMonitoring().GetVector() != nil { + b.AddVectorConfigVolume(podTemplateSpec) + b.AddVectorSidecar(podTemplateSpec, v1alpha1.FrontendComponentKind) + } + if b.Cluster.Spec.Frontend.TLS != nil { b.mountTLSSecret(podTemplateSpec) } diff --git a/controllers/greptimedbcluster/deployers/meta.go b/controllers/greptimedbcluster/deployers/meta.go index bcca7227..09f5f14c 100644 --- a/controllers/greptimedbcluster/deployers/meta.go +++ b/controllers/greptimedbcluster/deployers/meta.go @@ -321,7 +321,7 @@ func (b *metaBuilder) generatePodTemplateSpec() *corev1.PodTemplateSpec { } podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Ports = b.containerPorts() - podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Env = append(podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Env, b.env()...) + podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Env = append(podTemplateSpec.Spec.Containers[constant.MainContainerIndex].Env, b.env(v1alpha1.MetaComponentKind)...) b.MountConfigDir(podTemplateSpec) @@ -329,6 +329,11 @@ func (b *metaBuilder) generatePodTemplateSpec() *corev1.PodTemplateSpec { b.AddLogsVolume(podTemplateSpec, logging.GetLogsDir()) } + if b.Cluster.GetMonitoring() != nil && b.Cluster.GetMonitoring().GetVector() != nil { + b.AddVectorConfigVolume(podTemplateSpec) + b.AddVectorSidecar(podTemplateSpec, v1alpha1.MetaComponentKind) + } + podTemplateSpec.ObjectMeta.Labels = util.MergeStringMap(podTemplateSpec.ObjectMeta.Labels, map[string]string{ constant.GreptimeDBComponentName: common.ResourceName(b.Cluster.Name, b.ComponentKind), }) @@ -376,16 +381,3 @@ func (b *metaBuilder) containerPorts() []corev1.ContainerPort { }, } } - -func (b *metaBuilder) env() []corev1.EnvVar { - return []corev1.EnvVar{ - { - Name: deployer.EnvPodIP, - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.podIP", - }, - }, - }, - } -} diff --git a/controllers/greptimedbcluster/deployers/monitoring.go b/controllers/greptimedbcluster/deployers/monitoring.go new file mode 100644 index 00000000..626b1717 --- /dev/null +++ b/controllers/greptimedbcluster/deployers/monitoring.go @@ -0,0 +1,246 @@ +// Copyright 2024 Greptime Team +// +// 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 +// +// http://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. + +package deployers + +import ( + "bytes" + "context" + "fmt" + "io" + "io/fs" + "mime/multipart" + "net/http" + "strings" + "time" + + "github.com/avast/retry-go" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/klog/v2" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/GreptimeTeam/greptimedb-operator/apis/v1alpha1" + "github.com/GreptimeTeam/greptimedb-operator/controllers/common" + "github.com/GreptimeTeam/greptimedb-operator/controllers/greptimedbcluster/deployers/config" + "github.com/GreptimeTeam/greptimedb-operator/pkg/deployer" +) + +type MonitoringDeployer struct { + *CommonDeployer +} + +var _ deployer.Deployer = &MonitoringDeployer{} + +func NewMonitoringDeployer(mgr ctrl.Manager) *MonitoringDeployer { + return &MonitoringDeployer{ + CommonDeployer: NewFromManager(mgr), + } +} + +func (d *MonitoringDeployer) NewBuilder(crdObject client.Object) deployer.Builder { + return &monitoringBuilder{CommonBuilder: d.NewCommonBuilder(crdObject, v1alpha1.StandaloneKind)} +} + +func (d *MonitoringDeployer) Generate(crdObject client.Object) ([]client.Object, error) { + objects, err := d.NewBuilder(crdObject). + BuildGreptimeDBStandalone(). + BuildConfigMap(). + SetControllerAndAnnotation(). + Generate() + + if err != nil { + return nil, err + } + + return objects, nil +} + +func (d *MonitoringDeployer) CheckAndUpdateStatus(ctx context.Context, crdObject client.Object) (bool, error) { + cluster, err := d.GetCluster(crdObject) + if err != nil { + return false, err + } + + if cluster.GetMonitoring() == nil || cluster.GetMonitoring().GetStandalone() == nil { + return true, nil + } + + var ( + standalone = new(v1alpha1.GreptimeDBStandalone) + + objectKey = client.ObjectKey{ + Namespace: cluster.Namespace, + Name: common.MonitoringServiceName(cluster.Name), + } + ) + + err = d.Get(ctx, objectKey, standalone) + if errors.IsNotFound(err) { + return false, nil + } + + if standalone.Status.StandalonePhase == v1alpha1.PhaseRunning { + if err := d.createPipeline(cluster); err != nil { + klog.Errorf("failed to create pipeline for standalone, err: '%v'", err) + return false, err + } + + cluster.Status.Monitoring.InternalDNSName = fmt.Sprintf("%s.%s.svc.cluster.local", common.ResourceName(common.MonitoringServiceName(cluster.Name), v1alpha1.StandaloneKind), cluster.Namespace) + if err := UpdateStatus(ctx, cluster, d.Client); err != nil { + klog.Errorf("Failed to update status: %s", err) + } + return true, nil + } + + return false, nil +} + +func (d *MonitoringDeployer) createPipeline(cluster *v1alpha1.GreptimeDBCluster) error { + var b bytes.Buffer + w := multipart.NewWriter(&b) + + fw, err := w.CreateFormFile("file", "pipeline.yaml") + if err != nil { + return err + } + + pipeline, err := d.defaultPipeline() + if err != nil { + return err + } + + // If the pipeline is specified in the CR, use that instead. + if p := cluster.GetMonitoring().GetLogsCollection().GetPipeline().GetData(); p != "" { + pipeline = p + } + + _, err = io.Copy(fw, strings.NewReader(pipeline)) + if err != nil { + return err + } + w.Close() + + standaloneName := common.ResourceName(common.MonitoringServiceName(cluster.Name), v1alpha1.StandaloneKind) + + // FIXME(zyy17): Make the port configurable. + svc := fmt.Sprintf("%s.%s.svc.cluster.local:4000", standaloneName, cluster.Namespace) + req, err := http.NewRequest("POST", fmt.Sprintf("http://%s/v1/events/pipelines/%s", svc, common.LogsPipelineName(cluster.Namespace, cluster.Name)), &b) + if err != nil { + return err + } + req.Header.Set("Content-Type", w.FormDataContentType()) + + hc := &http.Client{ + Timeout: 5 * time.Second, + } + + operation := func() error { + resp, err := hc.Do(req) + if err != nil { + klog.Warningf("failed to create pipeline: %v", err) + return err + } + defer resp.Body.Close() + + responseBody, err := io.ReadAll(resp.Body) + if err != nil { + return err + } + + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("failed to create pipeline: '%s'", string(responseBody)) + } + + return nil + } + + // The server may not be ready to accept the request, so we retry a few times. + if err = retry.Do( + operation, + retry.Attempts(10), + retry.Delay(500*time.Millisecond), + retry.DelayType(retry.FixedDelay), + ); err != nil { + return err + } + + return nil +} + +// defaultPipeline returns the default pipeline that will be used by the standalone greptimedb instance to collect greptimedb logs. +func (d *MonitoringDeployer) defaultPipeline() (string, error) { + data, err := fs.ReadFile(config.DefaultPipeline, "pipeline.yaml") + if err != nil { + return "", err + } + return string(data), nil +} + +var _ deployer.Builder = &monitoringBuilder{} + +type monitoringBuilder struct { + *CommonBuilder +} + +func (b *monitoringBuilder) BuildGreptimeDBStandalone() deployer.Builder { + if b.Cluster.GetMonitoring() == nil || b.Cluster.GetMonitoring().GetStandalone() == nil { + return b + } + + if b.Err != nil { + return b + } + + standalone := &v1alpha1.GreptimeDBStandalone{ + TypeMeta: metav1.TypeMeta{ + Kind: "GreptimeDBStandalone", + APIVersion: "greptime.io/v1alpha1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: common.MonitoringServiceName(b.Cluster.Name), + Namespace: b.Cluster.Namespace, + }, + Spec: *b.Cluster.GetMonitoring().GetStandalone().DeepCopy(), + } + + b.Objects = append(b.Objects, standalone) + + return b +} + +func (b *monitoringBuilder) BuildConfigMap() deployer.Builder { + if b.Cluster.GetMonitoring() == nil || b.Cluster.GetMonitoring().GetVector() == nil { + return b + } + + if b.Err != nil { + return b + } + + cm, err := b.GenerateVectorConfigMap() + if err != nil { + b.Err = err + return b + } + + b.Objects = append(b.Objects, cm) + + return b +} + +func (b *monitoringBuilder) Generate() ([]client.Object, error) { + return b.Objects, b.Err +} diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md index 0605b7da..709f03f8 100644 --- a/docs/api-references/docs.md +++ b/docs/api-references/docs.md @@ -529,7 +529,7 @@ _Appears in:_ - +LogsCollectionSpec is the specification for cluster logs collection. diff --git a/go.mod b/go.mod index 1c235dbc..422d8d77 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.21 require ( dario.cat/mergo v1.0.1 + github.com/avast/retry-go v3.0.0+incompatible github.com/gin-gonic/gin v1.10.0 github.com/google/go-cmp v0.6.0 github.com/jackc/pgx/v5 v5.6.0 diff --git a/go.sum b/go.sum index 3186402c..e89c8aef 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHSxpiH9JdtuBj0= +github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= diff --git a/manifests/bundle.yaml b/manifests/bundle.yaml index 3ba7f3d1..149c7240 100644 --- a/manifests/bundle.yaml +++ b/manifests/bundle.yaml @@ -16920,6 +16920,8 @@ spec: type: object httpPort: format: int32 + maximum: 65535 + minimum: 0 type: integer initializer: properties: @@ -16949,6 +16951,8 @@ spec: type: object mysqlPort: format: int32 + maximum: 65535 + minimum: 0 type: integer objectStorage: properties: @@ -17027,6 +17031,8 @@ spec: type: object postgreSQLPort: format: int32 + maximum: 65535 + minimum: 0 type: integer prometheusMonitor: properties: @@ -17043,6 +17049,8 @@ spec: type: object rpcPort: format: int32 + maximum: 65535 + minimum: 0 type: integer service: properties: diff --git a/manifests/crds.yaml b/manifests/crds.yaml index 8d51f9ce..ca36d526 100644 --- a/manifests/crds.yaml +++ b/manifests/crds.yaml @@ -16913,6 +16913,8 @@ spec: type: object httpPort: format: int32 + maximum: 65535 + minimum: 0 type: integer initializer: properties: @@ -16942,6 +16944,8 @@ spec: type: object mysqlPort: format: int32 + maximum: 65535 + minimum: 0 type: integer objectStorage: properties: @@ -17020,6 +17024,8 @@ spec: type: object postgreSQLPort: format: int32 + maximum: 65535 + minimum: 0 type: integer prometheusMonitor: properties: @@ -17036,6 +17042,8 @@ spec: type: object rpcPort: format: int32 + maximum: 65535 + minimum: 0 type: integer service: properties: diff --git a/pkg/deployer/builder.go b/pkg/deployer/builder.go index d70e256f..9d46914c 100644 --- a/pkg/deployer/builder.go +++ b/pkg/deployer/builder.go @@ -25,6 +25,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + greptimev1alpha1 "github.com/GreptimeTeam/greptimedb-operator/apis/v1alpha1" "github.com/GreptimeTeam/greptimedb-operator/pkg/util" ) @@ -50,6 +51,9 @@ type Builder interface { // BuildPodMonitor builds a Prometheus podmonitor. BuildPodMonitor() Builder + // BuildGreptimeDBStandalone builds a GreptimeDBStandalone. + BuildGreptimeDBStandalone() Builder + // SetControllerAndAnnotation sets the controller reference and annotation for the object. SetControllerAndAnnotation() Builder @@ -89,6 +93,10 @@ func (b *DefaultBuilder) BuildPodMonitor() Builder { return b } +func (b *DefaultBuilder) BuildGreptimeDBStandalone() Builder { + return b +} + func (b *DefaultBuilder) SetControllerAndAnnotation() Builder { var ( spec interface{} @@ -112,6 +120,9 @@ func (b *DefaultBuilder) SetControllerAndAnnotation() Builder { case *monitoringv1.PodMonitor: spec = v.Spec controlled = v + case *greptimev1alpha1.GreptimeDBStandalone: + spec = v.Spec + controlled = v default: b.Err = fmt.Errorf("unsupported object type: %T", obj) } diff --git a/pkg/deployer/constants.go b/pkg/deployer/constants.go index 228d690f..9b42a4e8 100644 --- a/pkg/deployer/constants.go +++ b/pkg/deployer/constants.go @@ -15,6 +15,8 @@ package deployer const ( - EnvPodIP = "POD_IP" - EnvPodName = "POD_NAME" + EnvPodIP = "POD_IP" + EnvPodName = "POD_NAME" + EnvPodNamespace = "POD_NAMESPACE" + EnvRole = "ROLE" ) From 87c73dfda8a1fcc44cfabfe0d0a59a5a8fbc94a8 Mon Sep 17 00:00:00 2001 From: zyy17 Date: Thu, 26 Sep 2024 19:55:38 +0800 Subject: [PATCH 03/12] fix: install CRD failed --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fab5d0ee..ec7df45c 100644 --- a/Makefile +++ b/Makefile @@ -181,7 +181,7 @@ endif .PHONY: install install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config. - $(KUSTOMIZE) build config/crd | kubectl apply -f - + $(KUSTOMIZE) build config/crd | kubectl apply -f - --server-side .PHONY: uninstall uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. @@ -190,7 +190,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified .PHONY: deploy deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. cd config/manager && $(KUSTOMIZE) edit set image controller=${IMAGE_REPO}/greptimedb-operator:${IMAGE_TAG} - $(KUSTOMIZE) build config/default | kubectl apply -f - + $(KUSTOMIZE) build config/default | kubectl apply -f - --server-side .PHONY: undeploy undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. From 88fc3cb6f3fe0cefadd3bc8a35636dc22f42f301 Mon Sep 17 00:00:00 2001 From: zyy17 Date: Thu, 26 Sep 2024 20:25:14 +0800 Subject: [PATCH 04/12] refactor: add default spec for monitoring --- apis/v1alpha1/common.go | 21 +++ apis/v1alpha1/constants.go | 12 ++ apis/v1alpha1/defaulting.go | 56 ++++++++ .../greptimedbcluster/test03/expect.yaml | 124 ++++++++++++++++++ .../greptimedbcluster/test03/input.yaml | 26 ++++ 5 files changed, 239 insertions(+) create mode 100644 apis/v1alpha1/testdata/greptimedbcluster/test03/expect.yaml create mode 100644 apis/v1alpha1/testdata/greptimedbcluster/test03/input.yaml diff --git a/apis/v1alpha1/common.go b/apis/v1alpha1/common.go index 6a35fe4f..19217662 100644 --- a/apis/v1alpha1/common.go +++ b/apis/v1alpha1/common.go @@ -650,6 +650,13 @@ func (in *S3Storage) GetSecretName() string { return "" } +func (in *S3Storage) GetRoot() string { + if in != nil { + return in.Root + } + return "" +} + // OSSStorage defines the Aliyun OSS storage specification. type OSSStorage struct { // The data will be stored in the bucket. @@ -682,6 +689,13 @@ func (in *OSSStorage) GetSecretName() string { return "" } +func (in *OSSStorage) GetRoot() string { + if in != nil { + return in.Root + } + return "" +} + // GCSStorage defines the Google GCS storage specification. type GCSStorage struct { // The data will be stored in the bucket. @@ -714,6 +728,13 @@ func (in *GCSStorage) GetSecretName() string { return "" } +func (in *GCSStorage) GetRoot() string { + if in != nil { + return in.Root + } + return "" +} + // PrometheusMonitorSpec defines the PodMonitor configuration. type PrometheusMonitorSpec struct { // Enabled indicates whether the PodMonitor is enabled. diff --git a/apis/v1alpha1/constants.go b/apis/v1alpha1/constants.go index df260e36..dde40402 100644 --- a/apis/v1alpha1/constants.go +++ b/apis/v1alpha1/constants.go @@ -58,8 +58,20 @@ const ( // DefaultInitializerImage is the default image for the GreptimeDB initializer. DefaultInitializerImage = "greptime/greptimedb-initializer:latest" + // DefaultGreptimeDBImage is the default image for the GreptimeDB. + DefaultGreptimeDBImage = "greptime/greptimedb:latest" + // DefaultLoggingLevel is the default logging level for the GreptimeDB. DefaultLoggingLevel = LoggingLevelInfo + + // DefaultVectorImage is the default image for the vector. + DefaultVectorImage = "timberio/vector:latest" + + // DefaultVectorCPURequest is the default CPU request for the vector. + DefaultVectorCPURequest = "50m" + + // DefaultVectorMemoryRequest is the default memory request for the vector. + DefaultVectorMemoryRequest = "128Mi" ) // The following constants are the constant configuration for the GreptimeDBCluster and GreptimeDBStandalone. diff --git a/apis/v1alpha1/defaulting.go b/apis/v1alpha1/defaulting.go index ef5f1f69..1bbc6577 100644 --- a/apis/v1alpha1/defaulting.go +++ b/apis/v1alpha1/defaulting.go @@ -15,10 +15,12 @@ package v1alpha1 import ( + "fmt" "strings" "dario.cat/mergo" corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/utils/pointer" ) @@ -78,6 +80,29 @@ func (in *GreptimeDBCluster) defaultSpec() *GreptimeDBClusterSpec { defaultSpec.Logging = defaultLogging() + if in.GetMonitoring().IsEnabled() { + defaultSpec.Monitoring = &MonitoringSpec{ + Standalone: in.defaultMonitoringStandaloneSpec(), + LogsCollection: &LogsCollectionSpec{}, + Vector: &VectorSpec{ + Image: DefaultVectorImage, + Resource: corev1.ResourceRequirements{ + Requests: corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse(DefaultVectorCPURequest), + corev1.ResourceMemory: resource.MustParse(DefaultVectorMemoryRequest), + }, + Limits: corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse(DefaultVectorCPURequest), + corev1.ResourceMemory: resource.MustParse(DefaultVectorMemoryRequest), + }, + }, + }, + } + + // Set the default logging format to JSON if monitoring is enabled. + defaultSpec.Logging.Format = LogFormatJSON + } + return defaultSpec } @@ -135,6 +160,37 @@ func (in *GreptimeDBCluster) defaultFlownodeSpec() *FlownodeSpec { } } +func (in *GreptimeDBCluster) defaultMonitoringStandaloneSpec() *GreptimeDBStandaloneSpec { + standalone := new(GreptimeDBStandalone) + standalone.Spec = *standalone.defaultSpec() + + if image := in.GetBaseMainContainer().GetImage(); image != "" { + standalone.Spec.Base.MainContainer.Image = image + } else { + standalone.Spec.Base.MainContainer.Image = DefaultGreptimeDBImage + } + + standalone.Spec.Version = getVersionFromImage(standalone.Spec.Base.MainContainer.Image) + + if osp := in.GetObjectStorageProvider(); osp != nil { + standalone.Spec.ObjectStorageProvider = osp.DeepCopy() + + if root := osp.GetS3Storage().GetRoot(); root != "" { + standalone.Spec.ObjectStorageProvider.S3.Root = fmt.Sprintf("%s/monitoring", root) + } + + if root := osp.GetOSSStorage().GetRoot(); root != "" { + standalone.Spec.ObjectStorageProvider.GCS.Root = fmt.Sprintf("%s/monitoring", root) + } + + if root := osp.GetGCSStorage().GetRoot(); root != "" { + standalone.Spec.ObjectStorageProvider.OSS.Root = fmt.Sprintf("%s/monitoring", root) + } + } + + return &standalone.Spec +} + func (in *GreptimeDBCluster) mergeTemplate() error { if err := in.mergeFrontendTemplate(); err != nil { return err diff --git a/apis/v1alpha1/testdata/greptimedbcluster/test03/expect.yaml b/apis/v1alpha1/testdata/greptimedbcluster/test03/expect.yaml new file mode 100644 index 00000000..e9821344 --- /dev/null +++ b/apis/v1alpha1/testdata/greptimedbcluster/test03/expect.yaml @@ -0,0 +1,124 @@ +apiVersion: greptime.io/v1alpha1 +kind: GreptimeDBCluster +metadata: + name: test02 + namespace: default +spec: + base: + main: + image: greptime/greptimedb:latest + livenessProbe: + httpGet: + path: /health + port: 4000 + version: latest + initializer: + image: greptime/greptimedb-initializer:latest + httpPort: 4000 + rpcPort: 4001 + mysqlPort: 4002 + postgreSQLPort: 4003 + objectStorage: + s3: + bucket: greptimedb + endpoint: s3.amazonaws.com + region: us-west-2 + root: /greptimedb + secretName: s3-credentials + logging: + format: json + level: info + logsDir: /data/greptimedb/logs + onlyLogToStdout: false + persistentWithData: false + frontend: + replicas: 1 + service: + type: ClusterIP + template: + main: + image: greptime/greptimedb:latest + livenessProbe: + httpGet: + path: /health + port: 4000 + meta: + etcdEndpoints: + - etcd.etcd-cluster.svc.cluster.local:2379 + # Should be true if wal.kafka is set. + enableRegionFailover: false + httpPort: 4000 + rpcPort: 3002 + replicas: 1 + template: + main: + image: greptime/greptimedb:latest + livenessProbe: + httpGet: + path: /health + port: 4000 + datanode: + httpPort: 4000 + rpcPort: 4001 + replicas: 1 + storage: + dataHome: /data/greptimedb + fs: + name: datanode + mountPath: /data/greptimedb + storageRetainPolicy: Retain + storageSize: 10Gi + template: + main: + image: greptime/greptimedb:latest + livenessProbe: + httpGet: + path: /health + port: 4000 + monitoring: + enabled: true + logsCollection: {} + standalone: + base: + main: + image: greptime/greptimedb:latest + livenessProbe: + httpGet: + path: /health + port: 4000 + datanodeStorage: + dataHome: /data/greptimedb + fs: + mountPath: /data/greptimedb + name: datanode + storageRetainPolicy: Retain + storageSize: 10Gi + httpPort: 4000 + logging: + format: text + level: info + logsDir: /data/greptimedb/logs + onlyLogToStdout: false + persistentWithData: false + mysqlPort: 4002 + objectStorage: + s3: + bucket: greptimedb + endpoint: s3.amazonaws.com + region: us-west-2 + root: /greptimedb/monitoring + secretName: s3-credentials + postgreSQLPort: 4003 + rpcPort: 4001 + service: + type: ClusterIP + version: latest + vector: + image: timberio/vector:latest + resource: + limits: + cpu: 50m + memory: 128Mi + requests: + cpu: 50m + memory: 128Mi diff --git a/apis/v1alpha1/testdata/greptimedbcluster/test03/input.yaml b/apis/v1alpha1/testdata/greptimedbcluster/test03/input.yaml new file mode 100644 index 00000000..b7dcabe8 --- /dev/null +++ b/apis/v1alpha1/testdata/greptimedbcluster/test03/input.yaml @@ -0,0 +1,26 @@ +apiVersion: greptime.io/v1alpha1 +kind: GreptimeDBCluster +metadata: + name: test02 + namespace: default +spec: + base: + main: + image: greptime/greptimedb:latest + frontend: + replicas: 1 + meta: + replicas: 1 + etcdEndpoints: + - etcd.etcd-cluster.svc.cluster.local:2379 + datanode: + replicas: 1 + objectStorage: + s3: + bucket: greptimedb + endpoint: s3.amazonaws.com + region: us-west-2 + root: /greptimedb + secretName: s3-credentials + monitoring: + enabled: true From 6ac33c8ec5b13a8256eba63eb57c82507ccd0142 Mon Sep 17 00:00:00 2001 From: zyy17 Date: Thu, 26 Sep 2024 21:10:35 +0800 Subject: [PATCH 05/12] refactor: add mergeLogging() --- apis/v1alpha1/defaulting.go | 53 +++++++++++++++++++ .../greptimedbcluster/test00/expect.yaml | 18 +++++++ .../greptimedbcluster/test01/expect.yaml | 18 +++++++ .../greptimedbcluster/test02/expect.yaml | 18 +++++++ .../greptimedbcluster/test03/expect.yaml | 18 +++++++ controllers/greptimedbcluster/controller.go | 1 + pkg/dbconfig/common.go | 12 +---- pkg/dbconfig/datanode_config.go | 2 +- pkg/dbconfig/flownode_config.go | 2 +- pkg/dbconfig/frontend_config.go | 2 +- pkg/dbconfig/meta_config.go | 2 +- pkg/dbconfig/standalone_config.go | 2 +- 12 files changed, 133 insertions(+), 15 deletions(-) diff --git a/apis/v1alpha1/defaulting.go b/apis/v1alpha1/defaulting.go index 1bbc6577..547fc509 100644 --- a/apis/v1alpha1/defaulting.go +++ b/apis/v1alpha1/defaulting.go @@ -45,6 +45,11 @@ func (in *GreptimeDBCluster) SetDefaults() error { return err } + // Merge the logging settings into the GreptimeDBClusterSpec. + if err := in.mergeLogging(); err != nil { + return err + } + return nil } @@ -111,6 +116,7 @@ func (in *GreptimeDBCluster) defaultFrontend() *FrontendSpec { ComponentSpec: ComponentSpec{ Template: &PodTemplateSpec{}, Replicas: pointer.Int32(DefaultReplicas), + Logging: &LoggingSpec{}, }, RPCPort: DefaultRPCPort, HTTPPort: DefaultHTTPPort, @@ -131,6 +137,7 @@ func (in *GreptimeDBCluster) defaultMeta() *MetaSpec { ComponentSpec: ComponentSpec{ Template: &PodTemplateSpec{}, Replicas: pointer.Int32(DefaultReplicas), + Logging: &LoggingSpec{}, }, RPCPort: DefaultMetaRPCPort, HTTPPort: DefaultHTTPPort, @@ -143,6 +150,7 @@ func (in *GreptimeDBCluster) defaultDatanode() *DatanodeSpec { ComponentSpec: ComponentSpec{ Template: &PodTemplateSpec{}, Replicas: pointer.Int32(DefaultReplicas), + Logging: &LoggingSpec{}, }, RPCPort: DefaultRPCPort, HTTPPort: DefaultHTTPPort, @@ -155,6 +163,7 @@ func (in *GreptimeDBCluster) defaultFlownodeSpec() *FlownodeSpec { ComponentSpec: ComponentSpec{ Template: &PodTemplateSpec{}, Replicas: pointer.Int32(DefaultReplicas), + Logging: &LoggingSpec{}, }, RPCPort: DefaultRPCPort, } @@ -267,6 +276,50 @@ func (in *GreptimeDBCluster) mergeFlownodeTemplate() error { return nil } +func (in *GreptimeDBCluster) mergeLogging() error { + if logging := in.GetMeta().GetLogging(); logging != nil { + if err := mergo.Merge(logging, in.GetLogging().DeepCopy()); err != nil { + return err + } + if in.GetMonitoring().IsEnabled() { + // Set the default logging format to JSON if monitoring is enabled. + logging.Format = LogFormatJSON + } + } + + if logging := in.GetDatanode().GetLogging(); logging != nil { + if err := mergo.Merge(logging, in.GetLogging().DeepCopy()); err != nil { + return err + } + if in.GetMonitoring().IsEnabled() { + // Set the default logging format to JSON if monitoring is enabled. + logging.Format = LogFormatJSON + } + } + + if logging := in.GetFrontend().GetLogging(); logging != nil { + if err := mergo.Merge(logging, in.GetLogging().DeepCopy()); err != nil { + return err + } + if in.GetMonitoring().IsEnabled() { + // Set the default logging format to JSON if monitoring is enabled. + logging.Format = LogFormatJSON + } + } + + if logging := in.GetFlownode().GetLogging(); logging != nil { + if err := mergo.Merge(logging, in.GetLogging().DeepCopy()); err != nil { + return err + } + if in.GetMonitoring().IsEnabled() { + // Set the default logging format to JSON if monitoring is enabled. + logging.Format = LogFormatJSON + } + } + + return nil +} + func (in *GreptimeDBStandalone) SetDefaults() error { if in == nil { return nil diff --git a/apis/v1alpha1/testdata/defaulting/greptimedbcluster/test00/expect.yaml b/apis/v1alpha1/testdata/defaulting/greptimedbcluster/test00/expect.yaml index 0fcdba90..e4b0bd8b 100644 --- a/apis/v1alpha1/testdata/defaulting/greptimedbcluster/test00/expect.yaml +++ b/apis/v1alpha1/testdata/defaulting/greptimedbcluster/test00/expect.yaml @@ -32,6 +32,12 @@ spec: rpcPort: 4001 service: type: ClusterIP + logging: + format: text + level: info + logsDir: /data/greptimedb/logs + onlyLogToStdout: false + persistentWithData: false template: main: image: greptime/greptimedb:latest @@ -43,6 +49,12 @@ spec: etcdEndpoints: - etcd.etcd-cluster.svc.cluster.local:2379 enableRegionFailover: false + logging: + format: text + level: info + logsDir: /data/greptimedb/logs + onlyLogToStdout: false + persistentWithData: false httpPort: 4000 rpcPort: 3002 replicas: 1 @@ -56,6 +68,12 @@ spec: datanode: httpPort: 4000 rpcPort: 4001 + logging: + format: text + level: info + logsDir: /data/greptimedb/logs + onlyLogToStdout: false + persistentWithData: false replicas: 3 storage: dataHome: /data/greptimedb diff --git a/apis/v1alpha1/testdata/defaulting/greptimedbcluster/test01/expect.yaml b/apis/v1alpha1/testdata/defaulting/greptimedbcluster/test01/expect.yaml index 46caa6ea..26eff18d 100644 --- a/apis/v1alpha1/testdata/defaulting/greptimedbcluster/test01/expect.yaml +++ b/apis/v1alpha1/testdata/defaulting/greptimedbcluster/test01/expect.yaml @@ -39,6 +39,12 @@ spec: rpcPort: 4001 service: type: ClusterIP + logging: + format: text + level: info + logsDir: /data/greptimedb/logs + onlyLogToStdout: false + persistentWithData: false template: main: image: greptime/greptimedb:latest @@ -60,6 +66,12 @@ spec: enableRegionFailover: false etcdEndpoints: - etcd.etcd-cluster.svc.cluster.local:2379 + logging: + format: text + level: info + logsDir: /data/greptimedb/logs + onlyLogToStdout: false + persistentWithData: false httpPort: 4000 rpcPort: 3002 replicas: 1 @@ -84,6 +96,12 @@ spec: httpPort: 4000 rpcPort: 4001 replicas: 1 + logging: + format: text + level: info + logsDir: /data/greptimedb/logs + onlyLogToStdout: false + persistentWithData: false storage: dataHome: /data/greptimedb fs: diff --git a/apis/v1alpha1/testdata/defaulting/greptimedbcluster/test02/expect.yaml b/apis/v1alpha1/testdata/defaulting/greptimedbcluster/test02/expect.yaml index 128e42d6..468d29c5 100644 --- a/apis/v1alpha1/testdata/defaulting/greptimedbcluster/test02/expect.yaml +++ b/apis/v1alpha1/testdata/defaulting/greptimedbcluster/test02/expect.yaml @@ -43,6 +43,12 @@ spec: rpcPort: 4001 service: type: ClusterIP + logging: + format: text + level: info + logsDir: /data/greptimedb/logs + onlyLogToStdout: false + persistentWithData: false template: main: image: greptime/greptimedb:latest @@ -55,6 +61,12 @@ spec: - etcd.etcd-cluster.svc.cluster.local:2379 # Should be true if wal.kafka is set. enableRegionFailover: true + logging: + format: text + level: info + logsDir: /data/greptimedb/logs + onlyLogToStdout: false + persistentWithData: false httpPort: 4000 rpcPort: 3002 replicas: 1 @@ -69,6 +81,12 @@ spec: httpPort: 4000 rpcPort: 4001 replicas: 1 + logging: + format: text + level: info + logsDir: /data/greptimedb/logs + onlyLogToStdout: false + persistentWithData: false storage: dataHome: /data/greptimedb fs: diff --git a/apis/v1alpha1/testdata/greptimedbcluster/test03/expect.yaml b/apis/v1alpha1/testdata/greptimedbcluster/test03/expect.yaml index e9821344..ac86b503 100644 --- a/apis/v1alpha1/testdata/greptimedbcluster/test03/expect.yaml +++ b/apis/v1alpha1/testdata/greptimedbcluster/test03/expect.yaml @@ -35,6 +35,12 @@ spec: replicas: 1 service: type: ClusterIP + logging: + format: json + level: info + logsDir: /data/greptimedb/logs + onlyLogToStdout: false + persistentWithData: false template: main: image: greptime/greptimedb:latest @@ -47,6 +53,12 @@ spec: - etcd.etcd-cluster.svc.cluster.local:2379 # Should be true if wal.kafka is set. enableRegionFailover: false + logging: + format: json + level: info + logsDir: /data/greptimedb/logs + onlyLogToStdout: false + persistentWithData: false httpPort: 4000 rpcPort: 3002 replicas: 1 @@ -68,6 +80,12 @@ spec: mountPath: /data/greptimedb storageRetainPolicy: Retain storageSize: 10Gi + logging: + format: json + level: info + logsDir: /data/greptimedb/logs + onlyLogToStdout: false + persistentWithData: false template: main: image: greptime/greptimedb:latest diff --git a/controllers/greptimedbcluster/controller.go b/controllers/greptimedbcluster/controller.go index 66b40aff..50ec3440 100644 --- a/controllers/greptimedbcluster/controller.go +++ b/controllers/greptimedbcluster/controller.go @@ -80,6 +80,7 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { Owns(&corev1.Service{}). Owns(&appsv1.StatefulSet{}). Owns(&appsv1.Deployment{}). + Owns(&v1alpha1.GreptimeDBStandalone{}). Complete(r) } diff --git a/pkg/dbconfig/common.go b/pkg/dbconfig/common.go index 80fcfba3..17538bc8 100644 --- a/pkg/dbconfig/common.go +++ b/pkg/dbconfig/common.go @@ -154,19 +154,11 @@ type LoggingConfig struct { } // ConfigureLogging configures the logging config with the given logging spec. -func (c *LoggingConfig) ConfigureLogging(global *v1alpha1.LoggingSpec, component *v1alpha1.LoggingSpec) { - if global == nil && component == nil { +func (c *LoggingConfig) ConfigureLogging(spec *v1alpha1.LoggingSpec) { + if spec == nil { return } - // Use the component logging config if it's not nil. - var spec *v1alpha1.LoggingSpec - if component != nil { - spec = component - } else { - spec = global - } - if spec.IsOnlyLogToStdout() { c.Dir = nil } else if spec.LogsDir != "" { diff --git a/pkg/dbconfig/datanode_config.go b/pkg/dbconfig/datanode_config.go index 03084b4b..37842648 100644 --- a/pkg/dbconfig/datanode_config.go +++ b/pkg/dbconfig/datanode_config.go @@ -69,7 +69,7 @@ func (c *DatanodeConfig) ConfigureByCluster(cluster *v1alpha1.GreptimeDBCluster) c.WalBrokerEndpoints = kafka.GetBrokerEndpoints() } - c.ConfigureLogging(cluster.GetLogging(), cluster.GetDatanode().GetLogging()) + c.ConfigureLogging(cluster.GetDatanode().GetLogging()) return nil } diff --git a/pkg/dbconfig/flownode_config.go b/pkg/dbconfig/flownode_config.go index 2cc48298..913bb11c 100644 --- a/pkg/dbconfig/flownode_config.go +++ b/pkg/dbconfig/flownode_config.go @@ -41,7 +41,7 @@ func (c *FlownodeConfig) ConfigureByCluster(cluster *v1alpha1.GreptimeDBCluster) } } - c.ConfigureLogging(cluster.GetLogging(), cluster.GetFlownode().GetLogging()) + c.ConfigureLogging(cluster.GetFlownode().GetLogging()) return nil } diff --git a/pkg/dbconfig/frontend_config.go b/pkg/dbconfig/frontend_config.go index e3b0152a..da9ee5e2 100644 --- a/pkg/dbconfig/frontend_config.go +++ b/pkg/dbconfig/frontend_config.go @@ -37,7 +37,7 @@ func (c *FrontendConfig) ConfigureByCluster(cluster *v1alpha1.GreptimeDBCluster) } } - c.ConfigureLogging(cluster.GetLogging(), cluster.GetFrontend().GetLogging()) + c.ConfigureLogging(cluster.GetFrontend().GetLogging()) return nil } diff --git a/pkg/dbconfig/meta_config.go b/pkg/dbconfig/meta_config.go index 20f3b8c3..a8b5df41 100644 --- a/pkg/dbconfig/meta_config.go +++ b/pkg/dbconfig/meta_config.go @@ -62,7 +62,7 @@ func (c *MetaConfig) ConfigureByCluster(cluster *v1alpha1.GreptimeDBCluster) err c.WalBrokerEndpoints = kafka.GetBrokerEndpoints() } - c.ConfigureLogging(cluster.GetLogging(), cluster.GetMeta().GetLogging()) + c.ConfigureLogging(cluster.GetMeta().GetLogging()) return nil } diff --git a/pkg/dbconfig/standalone_config.go b/pkg/dbconfig/standalone_config.go index f813dfa1..1d6d3080 100644 --- a/pkg/dbconfig/standalone_config.go +++ b/pkg/dbconfig/standalone_config.go @@ -70,7 +70,7 @@ func (c *StandaloneConfig) ConfigureByStandalone(standalone *v1alpha1.GreptimeDB c.WalBrokerEndpoints = kafka.GetBrokerEndpoints() } - c.ConfigureLogging(standalone.GetLogging(), nil) + c.ConfigureLogging(standalone.GetLogging()) return nil } From bc81e72cc87141bd7f6c64f504d5b8199ff7c3ab Mon Sep 17 00:00:00 2001 From: zyy17 Date: Thu, 26 Sep 2024 21:14:44 +0800 Subject: [PATCH 06/12] refactor: modify default value of vector image --- apis/v1alpha1/constants.go | 2 +- apis/v1alpha1/testdata/greptimedbcluster/test03/expect.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apis/v1alpha1/constants.go b/apis/v1alpha1/constants.go index dde40402..ebb5bbfd 100644 --- a/apis/v1alpha1/constants.go +++ b/apis/v1alpha1/constants.go @@ -65,7 +65,7 @@ const ( DefaultLoggingLevel = LoggingLevelInfo // DefaultVectorImage is the default image for the vector. - DefaultVectorImage = "timberio/vector:latest" + DefaultVectorImage = "timberio/vector:nightly-alpine" // DefaultVectorCPURequest is the default CPU request for the vector. DefaultVectorCPURequest = "50m" diff --git a/apis/v1alpha1/testdata/greptimedbcluster/test03/expect.yaml b/apis/v1alpha1/testdata/greptimedbcluster/test03/expect.yaml index ac86b503..0476968e 100644 --- a/apis/v1alpha1/testdata/greptimedbcluster/test03/expect.yaml +++ b/apis/v1alpha1/testdata/greptimedbcluster/test03/expect.yaml @@ -132,7 +132,7 @@ spec: type: ClusterIP version: latest vector: - image: timberio/vector:latest + image: timberio/vector:nightly-alpine resource: limits: cpu: 50m From 449eb9f684fa06017e933b16c82610113256a35c Mon Sep 17 00:00:00 2001 From: zyy17 Date: Thu, 26 Sep 2024 21:17:35 +0800 Subject: [PATCH 07/12] docs: add example of monitoring --- examples/README.md | 1 + .../cluster/enable-monitoring/cluster.yaml | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 examples/cluster/enable-monitoring/cluster.yaml diff --git a/examples/README.md b/examples/README.md index 5c1f7cb3..ecf21848 100644 --- a/examples/README.md +++ b/examples/README.md @@ -16,6 +16,7 @@ The following examples suppose that you have installed the etcd cluster in the ` - [AWS NLB](./cluster/aws-nlb/cluster.yaml): Create a GreptimeDB cluster with the AWS NLB service. Please ensure you have already configured it. - [Standalone WAL](./cluster/standalone-wal/cluster.yaml): Create a GreptimeDB cluster with standalone storage for WAL. - [Configure Logging](./cluster/configure-logging/cluster.yaml): Create a GreptimeDB cluster with custom logging configuration. +- [Enable Monitoring Bootstrap](./cluster/enable-monitoring/cluster.yaml): Create a GreptimeDB cluster with monitoring enabled. ## Standalone diff --git a/examples/cluster/enable-monitoring/cluster.yaml b/examples/cluster/enable-monitoring/cluster.yaml new file mode 100644 index 00000000..510ab839 --- /dev/null +++ b/examples/cluster/enable-monitoring/cluster.yaml @@ -0,0 +1,18 @@ +apiVersion: greptime.io/v1alpha1 +kind: GreptimeDBCluster +metadata: + name: basic +spec: + base: + main: + image: greptime/greptimedb:latest + frontend: + replicas: 1 + meta: + replicas: 1 + etcdEndpoints: + - "etcd.etcd-cluster.svc.cluster.local:2379" + datanode: + replicas: 1 + monitoring: + enabled: true From 62cff8e843989f550932dba6eafa4eb5db3b6a2e Mon Sep 17 00:00:00 2001 From: zyy17 Date: Mon, 30 Sep 2024 12:08:59 +0800 Subject: [PATCH 08/12] test: add TestClusterEnableMonitoring e2e --- .../greptimedbcluster/test_basic_cluster.go | 2 + .../test_cluster_enable_flow.go | 3 + .../test_cluster_enable_monitoring.go | 101 ++++++++++++++++++ .../test_cluster_enable_remote_wal.go | 3 + .../test_cluster_standalone_wal.go | 3 + .../greptimedbcluster/test_scale_cluster.go | 3 + tests/e2e/greptimedbcluster_test.go | 4 + .../test_basic_standalone.go | 3 + .../resources/cluster/basic/cluster.yaml | 18 ---- .../cluster/enable-flow/cluster.yaml | 18 ---- .../cluster/enable-monitoring/cluster.yaml | 21 ++++ .../cluster/enable-remote-wal/cluster.yaml | 14 --- .../resources/cluster/scale/cluster.yaml | 18 ---- .../cluster/standalone-wal/cluster.yaml | 6 +- .../standalone/basic/standalone.yaml | 18 ---- 15 files changed, 144 insertions(+), 91 deletions(-) create mode 100644 tests/e2e/greptimedbcluster/test_cluster_enable_monitoring.go create mode 100644 tests/e2e/testdata/resources/cluster/enable-monitoring/cluster.yaml diff --git a/tests/e2e/greptimedbcluster/test_basic_cluster.go b/tests/e2e/greptimedbcluster/test_basic_cluster.go index 6d9a08e8..cd3953d0 100644 --- a/tests/e2e/greptimedbcluster/test_basic_cluster.go +++ b/tests/e2e/greptimedbcluster/test_basic_cluster.go @@ -60,6 +60,8 @@ func TestBasicCluster(ctx context.Context, h *helper.Helper) { return nil }, helper.DefaultTimeout, time.Second).ShouldNot(HaveOccurred()) + err = h.Get(ctx, client.ObjectKey{Name: testCluster.Name, Namespace: testCluster.Namespace}, testCluster) + Expect(err).NotTo(HaveOccurred(), "failed to get cluster") By("Execute distributed SQL test") frontendAddr, err := h.PortForward(ctx, testCluster.Namespace, common.ResourceName(testCluster.Name, greptimev1alpha1.FrontendComponentKind), int(testCluster.Spec.PostgreSQLPort)) Expect(err).NotTo(HaveOccurred(), "failed to port forward frontend service") diff --git a/tests/e2e/greptimedbcluster/test_cluster_enable_flow.go b/tests/e2e/greptimedbcluster/test_cluster_enable_flow.go index c3718562..aa52c78b 100644 --- a/tests/e2e/greptimedbcluster/test_cluster_enable_flow.go +++ b/tests/e2e/greptimedbcluster/test_cluster_enable_flow.go @@ -60,6 +60,9 @@ func TestClusterEnableFlow(ctx context.Context, h *helper.Helper) { return nil }, helper.DefaultTimeout, time.Second).ShouldNot(HaveOccurred()) + err = h.Get(ctx, client.ObjectKey{Name: testCluster.Name, Namespace: testCluster.Namespace}, testCluster) + Expect(err).NotTo(HaveOccurred(), "failed to get cluster") + By("Execute distributed SQL test") frontendAddr, err := h.PortForward(ctx, testCluster.Namespace, common.ResourceName(testCluster.Name, greptimev1alpha1.FrontendComponentKind), int(testCluster.Spec.PostgreSQLPort)) Expect(err).NotTo(HaveOccurred(), "failed to port forward frontend service") diff --git a/tests/e2e/greptimedbcluster/test_cluster_enable_monitoring.go b/tests/e2e/greptimedbcluster/test_cluster_enable_monitoring.go new file mode 100644 index 00000000..aad3e0da --- /dev/null +++ b/tests/e2e/greptimedbcluster/test_cluster_enable_monitoring.go @@ -0,0 +1,101 @@ +// Copyright 2024 Greptime Team +// +// 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 +// +// http://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. + +package greptimedbcluster + +import ( + "context" + "fmt" + "net" + "time" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "sigs.k8s.io/controller-runtime/pkg/client" + + greptimev1alpha1 "github.com/GreptimeTeam/greptimedb-operator/apis/v1alpha1" + "github.com/GreptimeTeam/greptimedb-operator/controllers/common" + "github.com/GreptimeTeam/greptimedb-operator/tests/e2e/helper" +) + +// TestClusterEnableMonitoring tests a cluster that enables monitoring. +func TestClusterEnableMonitoring(ctx context.Context, h *helper.Helper) { + const ( + testCRFile = "./testdata/resources/cluster/enable-monitoring/cluster.yaml" + testSQLFile = "./testdata/sql/cluster/partition.sql" + ) + + By(fmt.Sprintf("greptimecluster test with CR file %s and SQL file %s", testCRFile, testSQLFile)) + + testCluster := new(greptimev1alpha1.GreptimeDBCluster) + err := h.LoadCR(testCRFile, testCluster) + Expect(err).NotTo(HaveOccurred(), "failed to load greptimedbcluster yaml file") + + err = h.Create(ctx, testCluster) + Expect(err).NotTo(HaveOccurred(), "failed to create greptimedbcluster") + + By("Check the status of testCluster") + Eventually(func() error { + clusterPhase, err := h.GetPhase(ctx, testCluster.Namespace, testCluster.Name, new(greptimev1alpha1.GreptimeDBCluster)) + if err != nil { + return err + } + + if clusterPhase != greptimev1alpha1.PhaseRunning { + return fmt.Errorf("cluster is not running") + } + + return nil + }, helper.DefaultTimeout, time.Second).ShouldNot(HaveOccurred()) + + err = h.Get(ctx, client.ObjectKey{Name: testCluster.Name, Namespace: testCluster.Namespace}, testCluster) + Expect(err).NotTo(HaveOccurred(), "failed to get cluster") + By("Execute distributed SQL test") + frontendAddr, err := h.PortForward(ctx, testCluster.Namespace, common.ResourceName(testCluster.Name, greptimev1alpha1.FrontendComponentKind), int(testCluster.Spec.PostgreSQLPort)) + Expect(err).NotTo(HaveOccurred(), "failed to port forward frontend service") + Eventually(func() error { + conn, err := net.Dial("tcp", frontendAddr) + if err != nil { + return err + } + conn.Close() + return nil + }, helper.DefaultTimeout, time.Second).ShouldNot(HaveOccurred()) + + err = h.RunSQLTest(ctx, frontendAddr, testSQLFile) + Expect(err).NotTo(HaveOccurred(), "failed to run sql test") + + By("Kill the port forwarding process") + h.KillPortForwardProcess() + + By("Delete cluster") + err = h.Delete(ctx, testCluster) + Expect(err).NotTo(HaveOccurred(), "failed to delete cluster") + Eventually(func() error { + // The cluster will be deleted eventually. + return h.Get(ctx, client.ObjectKey{Name: testCluster.Name, Namespace: testCluster.Namespace}, testCluster) + }, helper.DefaultTimeout, time.Second).Should(HaveOccurred()) + + By("The PVC of the datanode should be retained") + datanodePVCs, err := h.GetPVCs(ctx, testCluster.Namespace, testCluster.Name, greptimev1alpha1.DatanodeComponentKind, common.FileStorageTypeDatanode) + Expect(err).NotTo(HaveOccurred(), "failed to get datanode PVCs") + Expect(int32(len(datanodePVCs))).To(Equal(*testCluster.Spec.Datanode.Replicas), "the number of datanode PVCs should be equal to the number of datanode replicas") + + By("Remove the PVC of the datanode") + for _, pvc := range datanodePVCs { + err = h.Delete(ctx, &pvc) + Expect(err).NotTo(HaveOccurred(), "failed to delete datanode PVC") + } +} diff --git a/tests/e2e/greptimedbcluster/test_cluster_enable_remote_wal.go b/tests/e2e/greptimedbcluster/test_cluster_enable_remote_wal.go index a58d0793..1d2cac2d 100644 --- a/tests/e2e/greptimedbcluster/test_cluster_enable_remote_wal.go +++ b/tests/e2e/greptimedbcluster/test_cluster_enable_remote_wal.go @@ -60,6 +60,9 @@ func TestClusterEnableRemoteWal(ctx context.Context, h *helper.Helper) { return nil }, helper.DefaultTimeout, time.Second).ShouldNot(HaveOccurred()) + err = h.Get(ctx, client.ObjectKey{Name: testCluster.Name, Namespace: testCluster.Namespace}, testCluster) + Expect(err).NotTo(HaveOccurred(), "failed to get cluster") + By("Execute distributed SQL test") frontendAddr, err := h.PortForward(ctx, testCluster.Namespace, common.ResourceName(testCluster.Name, greptimev1alpha1.FrontendComponentKind), int(testCluster.Spec.PostgreSQLPort)) Expect(err).NotTo(HaveOccurred(), "failed to port forward frontend service") diff --git a/tests/e2e/greptimedbcluster/test_cluster_standalone_wal.go b/tests/e2e/greptimedbcluster/test_cluster_standalone_wal.go index e49c3e6a..1dcb38b0 100644 --- a/tests/e2e/greptimedbcluster/test_cluster_standalone_wal.go +++ b/tests/e2e/greptimedbcluster/test_cluster_standalone_wal.go @@ -60,6 +60,9 @@ func TestClusterStandaloneWAL(ctx context.Context, h *helper.Helper) { return nil }, helper.DefaultTimeout, time.Second).ShouldNot(HaveOccurred()) + err = h.Get(ctx, client.ObjectKey{Name: testCluster.Name, Namespace: testCluster.Namespace}, testCluster) + Expect(err).NotTo(HaveOccurred(), "failed to get cluster") + By("Execute distributed SQL test") frontendAddr, err := h.PortForward(ctx, testCluster.Namespace, common.ResourceName(testCluster.Name, greptimev1alpha1.FrontendComponentKind), int(testCluster.Spec.PostgreSQLPort)) Expect(err).NotTo(HaveOccurred(), "failed to port forward frontend service") diff --git a/tests/e2e/greptimedbcluster/test_scale_cluster.go b/tests/e2e/greptimedbcluster/test_scale_cluster.go index 93a8490b..d7911cc3 100644 --- a/tests/e2e/greptimedbcluster/test_scale_cluster.go +++ b/tests/e2e/greptimedbcluster/test_scale_cluster.go @@ -61,6 +61,9 @@ func TestScaleCluster(ctx context.Context, h *helper.Helper) { return nil }, helper.DefaultTimeout, time.Second).ShouldNot(HaveOccurred()) + err = h.Get(ctx, client.ObjectKey{Name: testCluster.Name, Namespace: testCluster.Namespace}, testCluster) + Expect(err).NotTo(HaveOccurred(), "failed to get cluster") + By("Execute distributed SQL test") frontendAddr, err := h.PortForward(ctx, testCluster.Namespace, common.ResourceName(testCluster.Name, greptimev1alpha1.FrontendComponentKind), int(testCluster.Spec.PostgreSQLPort)) Expect(err).NotTo(HaveOccurred(), "failed to port forward frontend service") diff --git a/tests/e2e/greptimedbcluster_test.go b/tests/e2e/greptimedbcluster_test.go index 22e186ac..2fe69449 100644 --- a/tests/e2e/greptimedbcluster_test.go +++ b/tests/e2e/greptimedbcluster_test.go @@ -52,4 +52,8 @@ var _ = Describe("Test GreptimeDBCluster", func() { It("Test a cluster with standalone WAL", func() { greptimedbcluster.TestClusterStandaloneWAL(ctx, h) }) + + It("Test a cluster that enables monitoring", func() { + greptimedbcluster.TestClusterEnableMonitoring(ctx, h) + }) }) diff --git a/tests/e2e/greptimedbstandalone/test_basic_standalone.go b/tests/e2e/greptimedbstandalone/test_basic_standalone.go index 9dc92cb3..5e50042a 100644 --- a/tests/e2e/greptimedbstandalone/test_basic_standalone.go +++ b/tests/e2e/greptimedbstandalone/test_basic_standalone.go @@ -46,6 +46,9 @@ func TestBasicStandalone(ctx context.Context, h *helper.Helper) { err = h.Create(ctx, testStandalone) Expect(err).NotTo(HaveOccurred(), "failed to create greptimedbstandalone") + err = h.Get(ctx, client.ObjectKey{Name: testStandalone.Name, Namespace: testStandalone.Namespace}, testStandalone) + Expect(err).NotTo(HaveOccurred(), "failed to get standalone") + By("Check the status of testStandalone") Eventually(func() error { phase, err := h.GetPhase(ctx, testStandalone.Namespace, testStandalone.Name, new(greptimev1alpha1.GreptimeDBStandalone)) diff --git a/tests/e2e/testdata/resources/cluster/basic/cluster.yaml b/tests/e2e/testdata/resources/cluster/basic/cluster.yaml index a2d34028..6e4cd67e 100644 --- a/tests/e2e/testdata/resources/cluster/basic/cluster.yaml +++ b/tests/e2e/testdata/resources/cluster/basic/cluster.yaml @@ -1,17 +1,3 @@ -# Copyright 2022 Greptime Team -# -# 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 -# -# http://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. - apiVersion: greptime.io/v1alpha1 kind: GreptimeDBCluster metadata: @@ -31,7 +17,3 @@ spec: - etcd.etcd-cluster:2379 datanode: replicas: 3 - httpPort: 4000 - rpcPort: 4001 - mysqlPort: 4002 - postgreSQLPort: 4003 diff --git a/tests/e2e/testdata/resources/cluster/enable-flow/cluster.yaml b/tests/e2e/testdata/resources/cluster/enable-flow/cluster.yaml index 5206a505..7ef68935 100644 --- a/tests/e2e/testdata/resources/cluster/enable-flow/cluster.yaml +++ b/tests/e2e/testdata/resources/cluster/enable-flow/cluster.yaml @@ -1,17 +1,3 @@ -# Copyright 2022 Greptime Team -# -# 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 -# -# http://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. - apiVersion: greptime.io/v1alpha1 kind: GreptimeDBCluster metadata: @@ -33,7 +19,3 @@ spec: replicas: 3 flownode: replicas: 2 - httpPort: 4000 - rpcPort: 4001 - mysqlPort: 4002 - postgreSQLPort: 4003 diff --git a/tests/e2e/testdata/resources/cluster/enable-monitoring/cluster.yaml b/tests/e2e/testdata/resources/cluster/enable-monitoring/cluster.yaml new file mode 100644 index 00000000..c3561f99 --- /dev/null +++ b/tests/e2e/testdata/resources/cluster/enable-monitoring/cluster.yaml @@ -0,0 +1,21 @@ +apiVersion: greptime.io/v1alpha1 +kind: GreptimeDBCluster +metadata: + name: e2e-cluster-enable-monitoring + namespace: default +spec: + initializer: + image: localhost:5001/greptime/greptimedb-initializer:latest + base: + main: + image: localhost:5001/greptime/greptimedb:latest + frontend: + replicas: 1 + meta: + replicas: 1 + etcdEndpoints: + - "etcd.etcd-cluster.svc.cluster.local:2379" + datanode: + replicas: 1 + monitoring: + enabled: true diff --git a/tests/e2e/testdata/resources/cluster/enable-remote-wal/cluster.yaml b/tests/e2e/testdata/resources/cluster/enable-remote-wal/cluster.yaml index 04d579e8..60087ed4 100644 --- a/tests/e2e/testdata/resources/cluster/enable-remote-wal/cluster.yaml +++ b/tests/e2e/testdata/resources/cluster/enable-remote-wal/cluster.yaml @@ -1,17 +1,3 @@ -# Copyright 2024 Greptime Team -# -# 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 -# -# http://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. - apiVersion: greptime.io/v1alpha1 kind: GreptimeDBCluster metadata: diff --git a/tests/e2e/testdata/resources/cluster/scale/cluster.yaml b/tests/e2e/testdata/resources/cluster/scale/cluster.yaml index a2d535ea..eab65cac 100644 --- a/tests/e2e/testdata/resources/cluster/scale/cluster.yaml +++ b/tests/e2e/testdata/resources/cluster/scale/cluster.yaml @@ -1,17 +1,3 @@ -# Copyright 2024 Greptime Team -# -# 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 -# -# http://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. - apiVersion: greptime.io/v1alpha1 kind: GreptimeDBCluster metadata: @@ -34,7 +20,3 @@ spec: storage: fs: storageRetainPolicy: Delete - httpPort: 4000 - rpcPort: 4001 - mysqlPort: 4002 - postgreSQLPort: 4003 diff --git a/tests/e2e/testdata/resources/cluster/standalone-wal/cluster.yaml b/tests/e2e/testdata/resources/cluster/standalone-wal/cluster.yaml index 4b67ce7a..3e2fc079 100644 --- a/tests/e2e/testdata/resources/cluster/standalone-wal/cluster.yaml +++ b/tests/e2e/testdata/resources/cluster/standalone-wal/cluster.yaml @@ -1,7 +1,7 @@ apiVersion: greptime.io/v1alpha1 kind: GreptimeDBCluster metadata: - name: cluster-with-standalone-wal + name: e2e-cluster-with-standalone-wal namespace: default spec: base: @@ -15,10 +15,6 @@ spec: - "etcd.etcd-cluster:2379" datanode: replicas: 1 - httpPort: 4000 - rpcPort: 4001 - mysqlPort: 4002 - postgreSQLPort: 4003 wal: raftEngine: fs: diff --git a/tests/e2e/testdata/resources/standalone/basic/standalone.yaml b/tests/e2e/testdata/resources/standalone/basic/standalone.yaml index 6ce933fd..4b3ae88a 100644 --- a/tests/e2e/testdata/resources/standalone/basic/standalone.yaml +++ b/tests/e2e/testdata/resources/standalone/basic/standalone.yaml @@ -1,17 +1,3 @@ -# Copyright 2024 Greptime Team -# -# 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 -# -# http://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. - apiVersion: greptime.io/v1alpha1 kind: GreptimeDBStandalone metadata: @@ -21,7 +7,3 @@ spec: base: main: image: localhost:5001/greptime/greptimedb:latest - httpPort: 4000 - rpcPort: 4001 - mysqlPort: 4002 - postgreSQLPort: 4003 From 5d0499b76ce821823feeca96de677f4d3521d25e Mon Sep 17 00:00:00 2001 From: zyy17 Date: Mon, 30 Sep 2024 15:37:45 +0800 Subject: [PATCH 09/12] fix: e2e errors --- apis/v1alpha1/constants.go | 4 ++-- apis/v1alpha1/defaulting.go | 4 ++-- apis/v1alpha1/greptimedbcluster_types.go | 1 + controllers/greptimedbcluster/deployers/monitoring.go | 2 +- tests/e2e/greptimedbstandalone/test_basic_standalone.go | 6 +++--- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/apis/v1alpha1/constants.go b/apis/v1alpha1/constants.go index ebb5bbfd..2387fca3 100644 --- a/apis/v1alpha1/constants.go +++ b/apis/v1alpha1/constants.go @@ -19,8 +19,8 @@ const ( // DefaultVersion is the default version of the GreptimeDB. DefaultVersion = "Unknown" - // DefautlHealthEndpoint is the default health endpoint for the liveness probe. - DefautlHealthEndpoint = "/health" + // DefaultHealthEndpoint is the default health endpoint for the liveness probe. + DefaultHealthEndpoint = "/health" // DefaultHTTPPort is the default HTTP port for the GreptimeDB. DefaultHTTPPort int32 = 4000 diff --git a/apis/v1alpha1/defaulting.go b/apis/v1alpha1/defaulting.go index 547fc509..1c54f2e2 100644 --- a/apis/v1alpha1/defaulting.go +++ b/apis/v1alpha1/defaulting.go @@ -61,7 +61,7 @@ func (in *GreptimeDBCluster) defaultSpec() *GreptimeDBClusterSpec { LivenessProbe: &corev1.Probe{ ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ - Path: DefautlHealthEndpoint, + Path: DefaultHealthEndpoint, Port: intstr.FromInt32(DefaultHTTPPort), }, }, @@ -344,7 +344,7 @@ func (in *GreptimeDBStandalone) defaultSpec() *GreptimeDBStandaloneSpec { LivenessProbe: &corev1.Probe{ ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ - Path: DefautlHealthEndpoint, + Path: DefaultHealthEndpoint, Port: intstr.FromInt32(DefaultHTTPPort), }, }, diff --git a/apis/v1alpha1/greptimedbcluster_types.go b/apis/v1alpha1/greptimedbcluster_types.go index 5d1a3d3b..7b022b4d 100644 --- a/apis/v1alpha1/greptimedbcluster_types.go +++ b/apis/v1alpha1/greptimedbcluster_types.go @@ -340,6 +340,7 @@ type MonitoringSpec struct { Standalone *GreptimeDBStandaloneSpec `json:"standalone,omitempty"` // The specification of cluster logs collection. + // +optional LogsCollection *LogsCollectionSpec `json:"logsCollection,omitempty"` // The specification of the vector instance. diff --git a/controllers/greptimedbcluster/deployers/monitoring.go b/controllers/greptimedbcluster/deployers/monitoring.go index 626b1717..bffdb9bb 100644 --- a/controllers/greptimedbcluster/deployers/monitoring.go +++ b/controllers/greptimedbcluster/deployers/monitoring.go @@ -136,7 +136,7 @@ func (d *MonitoringDeployer) createPipeline(cluster *v1alpha1.GreptimeDBCluster) standaloneName := common.ResourceName(common.MonitoringServiceName(cluster.Name), v1alpha1.StandaloneKind) // FIXME(zyy17): Make the port configurable. - svc := fmt.Sprintf("%s.%s.svc.cluster.local:4000", standaloneName, cluster.Namespace) + svc := fmt.Sprintf("%s.%s.svc.cluster.local:%d", standaloneName, cluster.Namespace, v1alpha1.DefaultHTTPPort) req, err := http.NewRequest("POST", fmt.Sprintf("http://%s/v1/events/pipelines/%s", svc, common.LogsPipelineName(cluster.Namespace, cluster.Name)), &b) if err != nil { return err diff --git a/tests/e2e/greptimedbstandalone/test_basic_standalone.go b/tests/e2e/greptimedbstandalone/test_basic_standalone.go index 5e50042a..f9c6776f 100644 --- a/tests/e2e/greptimedbstandalone/test_basic_standalone.go +++ b/tests/e2e/greptimedbstandalone/test_basic_standalone.go @@ -46,9 +46,6 @@ func TestBasicStandalone(ctx context.Context, h *helper.Helper) { err = h.Create(ctx, testStandalone) Expect(err).NotTo(HaveOccurred(), "failed to create greptimedbstandalone") - err = h.Get(ctx, client.ObjectKey{Name: testStandalone.Name, Namespace: testStandalone.Namespace}, testStandalone) - Expect(err).NotTo(HaveOccurred(), "failed to get standalone") - By("Check the status of testStandalone") Eventually(func() error { phase, err := h.GetPhase(ctx, testStandalone.Namespace, testStandalone.Name, new(greptimev1alpha1.GreptimeDBStandalone)) @@ -63,6 +60,9 @@ func TestBasicStandalone(ctx context.Context, h *helper.Helper) { return nil }, helper.DefaultTimeout, time.Second).ShouldNot(HaveOccurred()) + err = h.Get(ctx, client.ObjectKey{Name: testStandalone.Name, Namespace: testStandalone.Namespace}, testStandalone) + Expect(err).NotTo(HaveOccurred(), "failed to get standalone") + By("Run SQL test") frontendAddr, err := h.PortForward(ctx, testStandalone.Namespace, common.ResourceName(testStandalone.Name, greptimev1alpha1.StandaloneKind), int(testStandalone.Spec.PostgreSQLPort)) Expect(err).NotTo(HaveOccurred(), "failed to port forward frontend service") From d1870e6b09def5ba11d942efd6f35565882fbe49 Mon Sep 17 00:00:00 2001 From: zyy17 Date: Mon, 30 Sep 2024 17:34:12 +0800 Subject: [PATCH 10/12] test(e2e): test monitoring data --- .../test_cluster_enable_monitoring.go | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/tests/e2e/greptimedbcluster/test_cluster_enable_monitoring.go b/tests/e2e/greptimedbcluster/test_cluster_enable_monitoring.go index aad3e0da..9874cd08 100644 --- a/tests/e2e/greptimedbcluster/test_cluster_enable_monitoring.go +++ b/tests/e2e/greptimedbcluster/test_cluster_enable_monitoring.go @@ -18,11 +18,14 @@ import ( "context" "fmt" "net" + "sort" "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/google/go-cmp/cmp" + "github.com/jackc/pgx/v5" "sigs.k8s.io/controller-runtime/pkg/client" greptimev1alpha1 "github.com/GreptimeTeam/greptimedb-operator/apis/v1alpha1" @@ -62,6 +65,7 @@ func TestClusterEnableMonitoring(ctx context.Context, h *helper.Helper) { err = h.Get(ctx, client.ObjectKey{Name: testCluster.Name, Namespace: testCluster.Namespace}, testCluster) Expect(err).NotTo(HaveOccurred(), "failed to get cluster") + By("Execute distributed SQL test") frontendAddr, err := h.PortForward(ctx, testCluster.Namespace, common.ResourceName(testCluster.Name, greptimev1alpha1.FrontendComponentKind), int(testCluster.Spec.PostgreSQLPort)) Expect(err).NotTo(HaveOccurred(), "failed to port forward frontend service") @@ -77,6 +81,19 @@ func TestClusterEnableMonitoring(ctx context.Context, h *helper.Helper) { err = h.RunSQLTest(ctx, frontendAddr, testSQLFile) Expect(err).NotTo(HaveOccurred(), "failed to run sql test") + monitoringAddr, err := h.PortForward(ctx, testCluster.Namespace, common.ResourceName(common.MonitoringServiceName(testCluster.Name), greptimev1alpha1.StandaloneKind), int(testCluster.Spec.PostgreSQLPort)) + Expect(err).NotTo(HaveOccurred(), "failed to port forward monitoring service") + Eventually(func() error { + conn, err := net.Dial("tcp", monitoringAddr) + if err != nil { + return err + } + conn.Close() + return nil + }, helper.DefaultTimeout, time.Second).ShouldNot(HaveOccurred()) + err = testMonitoringStandalone(ctx, monitoringAddr) + Expect(err).NotTo(HaveOccurred(), "failed to test monitoring") + By("Kill the port forwarding process") h.KillPortForwardProcess() @@ -99,3 +116,62 @@ func TestClusterEnableMonitoring(ctx context.Context, h *helper.Helper) { Expect(err).NotTo(HaveOccurred(), "failed to delete datanode PVC") } } + +func testMonitoringStandalone(ctx context.Context, addr string) error { + // connect public database by default. + url := fmt.Sprintf("postgres://postgres@%s/public?sslmode=disable", addr) + + fmt.Printf("Connecting to %s\n", url) + conn, err := pgx.Connect(ctx, url) + if err != nil { + return err + } + defer conn.Close(ctx) + + // Check metrics table. + if err := checkCollectedRoles(ctx, conn, "SELECT DISTINCT app FROM greptime_app_version", []string{"greptime-datanode", "greptime-frontend", "greptime-metasrv"}); err != nil { + return err + } + + // Check logs table. + if err := checkCollectedRoles(ctx, conn, "SELECT DISTINCT role FROM gtlogs", []string{"datanode", "frontend", "meta"}); err != nil { + return err + } + + var count int + if err = conn.QueryRow(context.Background(), "SELECT COUNT(*) FROM gtlogs").Scan(&count); err != nil { + return err + } + // The number of logs should be greater than 0. + if count == 0 { + return fmt.Errorf("no logs found") + } + + return nil +} + +func checkCollectedRoles(ctx context.Context, conn *pgx.Conn, query string, expected []string) error { + rows, err := conn.Query(ctx, query) + if err != nil { + return err + } + defer rows.Close() + + var result []string + for rows.Next() { + var role string + err = rows.Scan(&role) + if err != nil { + return err + } + result = append(result, role) + } + sort.Strings(result) + sort.Strings(expected) + + if !cmp.Equal(result, expected) { + return fmt.Errorf("results mismatch, got %v, expect %v", result, expected) + } + + return nil +} From bbdb0c4b9f7fcae0fb1555eeb66a9b108fc8a692 Mon Sep 17 00:00:00 2001 From: zyy17 Date: Mon, 30 Sep 2024 17:45:04 +0800 Subject: [PATCH 11/12] refactor: refactor by code review comment --- apis/v1alpha1/defaulting.go | 4 ++-- .../greptimedbcluster/deployers/monitoring.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apis/v1alpha1/defaulting.go b/apis/v1alpha1/defaulting.go index 1c54f2e2..380a160f 100644 --- a/apis/v1alpha1/defaulting.go +++ b/apis/v1alpha1/defaulting.go @@ -189,11 +189,11 @@ func (in *GreptimeDBCluster) defaultMonitoringStandaloneSpec() *GreptimeDBStanda } if root := osp.GetOSSStorage().GetRoot(); root != "" { - standalone.Spec.ObjectStorageProvider.GCS.Root = fmt.Sprintf("%s/monitoring", root) + standalone.Spec.ObjectStorageProvider.OSS.Root = fmt.Sprintf("%s/monitoring", root) } if root := osp.GetGCSStorage().GetRoot(); root != "" { - standalone.Spec.ObjectStorageProvider.OSS.Root = fmt.Sprintf("%s/monitoring", root) + standalone.Spec.ObjectStorageProvider.GCS.Root = fmt.Sprintf("%s/monitoring", root) } } diff --git a/controllers/greptimedbcluster/deployers/monitoring.go b/controllers/greptimedbcluster/deployers/monitoring.go index bffdb9bb..acb42059 100644 --- a/controllers/greptimedbcluster/deployers/monitoring.go +++ b/controllers/greptimedbcluster/deployers/monitoring.go @@ -137,17 +137,17 @@ func (d *MonitoringDeployer) createPipeline(cluster *v1alpha1.GreptimeDBCluster) // FIXME(zyy17): Make the port configurable. svc := fmt.Sprintf("%s.%s.svc.cluster.local:%d", standaloneName, cluster.Namespace, v1alpha1.DefaultHTTPPort) - req, err := http.NewRequest("POST", fmt.Sprintf("http://%s/v1/events/pipelines/%s", svc, common.LogsPipelineName(cluster.Namespace, cluster.Name)), &b) - if err != nil { - return err - } - req.Header.Set("Content-Type", w.FormDataContentType()) - hc := &http.Client{ Timeout: 5 * time.Second, } operation := func() error { + req, err := http.NewRequest("POST", fmt.Sprintf("http://%s/v1/events/pipelines/%s", svc, common.LogsPipelineName(cluster.Namespace, cluster.Name)), &b) + if err != nil { + return err + } + req.Header.Set("Content-Type", w.FormDataContentType()) + resp, err := hc.Do(req) if err != nil { klog.Warningf("failed to create pipeline: %v", err) From 45f1664b6bcefa519c6ba5fd19922bb5315c36c7 Mon Sep 17 00:00:00 2001 From: zyy17 Date: Wed, 9 Oct 2024 12:05:07 +0800 Subject: [PATCH 12/12] refactor: code review --- controllers/greptimedbcluster/deployers/common.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/greptimedbcluster/deployers/common.go b/controllers/greptimedbcluster/deployers/common.go index a51be8c5..bcbd8219 100644 --- a/controllers/greptimedbcluster/deployers/common.go +++ b/controllers/greptimedbcluster/deployers/common.go @@ -168,8 +168,8 @@ func (c *CommonBuilder) GenerateVectorConfigMap() (*corev1.ConfigMap, error) { "ClusterName": c.Cluster.Name, "LogsTableName": constant.LogsTableName, "PipelineName": common.LogsPipelineName(c.Cluster.Namespace, c.Cluster.Name), - "LoggingService": fmt.Sprintf("http://%s:4000", svc), - "MetricService": fmt.Sprintf("http://%s:4000/v1/prometheus/write?db=public", svc), + "LoggingService": fmt.Sprintf("http://%s:%d", svc, v1alpha1.DefaultHTTPPort), + "MetricService": fmt.Sprintf("http://%s:%d/v1/prometheus/write?db=public", svc, v1alpha1.DefaultHTTPPort), } vectorConfigTemplate, err := c.vectorConfigTemplate()