diff --git a/cmd/controller-manager/main.go b/cmd/controller-manager/main.go index 68e26cbb3a..18ad3e6fb1 100644 --- a/cmd/controller-manager/main.go +++ b/cmd/controller-manager/main.go @@ -36,6 +36,7 @@ import ( "github.com/pingcap/tidb-operator/pkg/controller/tidbcluster" "github.com/pingcap/tidb-operator/pkg/controller/tidbinitializer" "github.com/pingcap/tidb-operator/pkg/controller/tidbmonitor" + "github.com/pingcap/tidb-operator/pkg/controller/tidbngmonitoring" "github.com/pingcap/tidb-operator/pkg/features" "github.com/pingcap/tidb-operator/pkg/metrics" "github.com/pingcap/tidb-operator/pkg/scheme" @@ -166,6 +167,7 @@ func main() { backupschedule.NewController(deps), tidbinitializer.NewController(deps), tidbmonitor.NewController(deps), + tidbngmonitoring.NewController(deps), } if cliCfg.PodWebhookEnabled { controllers = append(controllers, periodicity.NewController(deps)) diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md index 85b06294eb..62e1136095 100644 --- a/docs/api-references/docs.md +++ b/docs/api-references/docs.md @@ -4143,12 +4143,14 @@ and component-level overrides

DMDiscoverySpec, DiscoverySpec, MasterSpec, +NGMonitoringSpec, PDSpec, PumpSpec, TiCDCSpec, TiDBSpec, TiFlashSpec, TiKVSpec, +TidbNGMonitoringSpec, WorkerSpec)

@@ -4801,6 +4803,18 @@ CrdKind + + +TiDBNGMonitoring
+ + +CrdKind + + + + + +

DMClusterCondition

@@ -7926,6 +7940,7 @@ string

(Appears on: MasterStatus, +NGMonitoringStatus, PDStatus, PumpStatus, TiCDCStatus, @@ -8014,6 +8029,153 @@ Kubernetes core/v1.PullPolicy +

NGMonitoringSpec

+

+(Appears on: +TidbNGMonitoringSpec) +

+

+

NGMonitoringSpec is spec of ng monitoring

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldDescription
+ComponentSpec
+ + +ComponentSpec + + +
+

+(Members of ComponentSpec are embedded into this type.) +

+
+ResourceRequirements
+ + +Kubernetes core/v1.ResourceRequirements + + +
+

+(Members of ResourceRequirements are embedded into this type.) +

+
+baseImage
+ +string + +
+

Base image of the component, image tag is now allowed during validation

+
+storageClassName
+ +string + +
+

StorageClassName is the persistent volume for ng monitoring. +Defaults to Kubernetes default storage class.

+
+storageVolumes
+ + +[]StorageVolume + + +
+

StorageVolumes configures additional storage for NG Monitoring pods.

+
+config
+ +github.com/pingcap/tidb-operator/pkg/apis/util/config.GenericConfig + +
+

Config is the configuration of ng monitoring

+
+

NGMonitoringStatus

+

+(Appears on: +TidbNGMonitoringStatus) +

+

+

NGMonitoringStatus is latest status of ng monitoring

+

+ + + + + + + + + + + + + + + + + + + + + +
FieldDescription
+synced
+ +bool + +
+
+phase
+ + +MemberPhase + + +
+
+statefulSet
+ + +Kubernetes apps/v1.StatefulSetStatus + + +
+

Networks

(Appears on: @@ -12865,6 +13027,7 @@ LocalStorageProvider

StorageVolume

(Appears on: +NGMonitoringSpec, PDSpec, TiCDCSpec, TiDBSpec, @@ -20320,7 +20483,8 @@ string TidbClusterAutoScalerSpec, TidbClusterSpec, TidbInitializerSpec, -TidbMonitorSpec) +TidbMonitorSpec, +TidbNGMonitoringSpec)

TidbClusterRef reference to a TidbCluster

@@ -21720,6 +21884,269 @@ Kubernetes apps/v1.StatefulSetStatus +

TidbNGMonitoring

+

+

TidbNGMonitoring contains the spec and status of tidb ng monitor

+

+ + + + + + + + + + + + + + + + + + + + + +
FieldDescription
+metadata
+ + +Kubernetes meta/v1.ObjectMeta + + +
+Refer to the Kubernetes API documentation for the fields of the +metadata field. +
+spec
+ + +TidbNGMonitoringSpec + + +
+

Spec contains all spec about tidb ng monitor

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ComponentSpec
+ + +ComponentSpec + + +
+

+(Members of ComponentSpec are embedded into this type.) +

+

ComponentSpec is common spec. +NOTE: the same field will be overridden by component’s spec.

+
+clusters
+ + +[]TidbClusterRef + + +
+

Clusters reference TiDB cluster

+
+paused
+ +bool + +
+

Paused pause controller if it is true

+
+pvReclaimPolicy
+ + +Kubernetes core/v1.PersistentVolumeReclaimPolicy + + +
+

Persistent volume reclaim policy applied to the PVs that consumed by tidb ng monitoring

+
+clusterDomain
+ +string + +
+

ClusterDomain is the Kubernetes Cluster Domain of tidb ng monitoring

+
+ngMonitoring
+ + +NGMonitoringSpec + + +
+

NGMonitoring is spec of ng monitoring

+
+
+status
+ + +TidbNGMonitoringStatus + + +
+

Status is most recently observed status of tidb ng monitor

+
+

TidbNGMonitoringSpec

+

+(Appears on: +TidbNGMonitoring) +

+

+

TidbNGMonitoringSpec is spec of tidb ng monitoring

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldDescription
+ComponentSpec
+ + +ComponentSpec + + +
+

+(Members of ComponentSpec are embedded into this type.) +

+

ComponentSpec is common spec. +NOTE: the same field will be overridden by component’s spec.

+
+clusters
+ + +[]TidbClusterRef + + +
+

Clusters reference TiDB cluster

+
+paused
+ +bool + +
+

Paused pause controller if it is true

+
+pvReclaimPolicy
+ + +Kubernetes core/v1.PersistentVolumeReclaimPolicy + + +
+

Persistent volume reclaim policy applied to the PVs that consumed by tidb ng monitoring

+
+clusterDomain
+ +string + +
+

ClusterDomain is the Kubernetes Cluster Domain of tidb ng monitoring

+
+ngMonitoring
+ + +NGMonitoringSpec + + +
+

NGMonitoring is spec of ng monitoring

+
+

TidbNGMonitoringStatus

+

+(Appears on: +TidbNGMonitoring) +

+

+

TidbNGMonitoringStatus is status of tidb ng monitoring

+

+ + + + + + + + + + + + + +
FieldDescription
+ngMonitoring
+ + +NGMonitoringStatus + + +
+

NGMonitoring is status of ng monitoring

+

TikvAutoScalerSpec

(Appears on: diff --git a/manifests/crd.yaml b/manifests/crd.yaml index b519752d9b..d078dc747e 100644 --- a/manifests/crd.yaml +++ b/manifests/crd.yaml @@ -31922,3 +31922,4645 @@ status: plural: "" conditions: [] storedVersions: [] + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null + name: tidbngmonitorings.pingcap.com +spec: + group: pingcap.com + names: + kind: TidbNGMonitoring + listKind: TidbNGMonitoringList + plural: tidbngmonitorings + shortNames: + - tngm + singular: tidbngmonitoring + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + additionalVolumeMounts: + 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 + additionalVolumes: + 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 + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + 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 + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + 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 + 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 + 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: + readOnly: + type: boolean + 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 + resources: + properties: + 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 + 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 + 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 + 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 + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + 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 + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + required: + - sources + 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 + 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 + 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 + 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 + 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 + 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 + type: array + required: + - nodeSelectorTerms + type: object + 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 + 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 + 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 + 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 + 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 + clusterDomain: + type: string + clusters: + items: + properties: + clusterDomain: + type: string + name: + type: string + namespace: + type: string + required: + - name + type: object + maxItems: 1 + minItems: 1 + type: array + configUpdateStrategy: + type: string + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + hostNetwork: + type: boolean + image: + type: string + imagePullPolicy: + type: string + imagePullSecrets: + items: + properties: + name: + type: string + type: object + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + ngMonitoring: + properties: + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + additionalVolumeMounts: + 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 + additionalVolumes: + 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 + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + 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 + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + 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 + 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 + 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: + readOnly: + type: boolean + 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 + resources: + properties: + 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 + 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 + 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 + 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 + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + 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 + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + required: + - sources + 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 + 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 + 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 + 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 + 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 + 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 + type: array + required: + - nodeSelectorTerms + type: object + 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 + 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 + 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 + 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 + 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 + baseImage: + default: pingcap/ng-monitoring + type: string + config: + x-kubernetes-preserve-unknown-fields: true + configUpdateStrategy: + type: string + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + hostNetwork: + type: boolean + image: + type: string + imagePullPolicy: + type: string + imagePullSecrets: + items: + properties: + name: + type: string + type: object + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + 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 + nodeSelector: + additionalProperties: + type: string + type: object + podManagementPolicy: + type: string + podSecurityContext: + properties: + fsGroup: + format: int64 + type: integer + fsGroupChangePolicy: + type: string + 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 + supplementalGroups: + items: + format: int64 + type: integer + type: array + sysctls: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + runAsUserName: + type: string + type: object + type: object + priorityClassName: + type: string + 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 + schedulerName: + type: string + statefulSetUpdateStrategy: + type: string + storageClassName: + type: string + storageVolumes: + items: + properties: + mountPath: + type: string + name: + type: string + storageClassName: + type: string + storageSize: + type: string + required: + - name + - storageSize + type: object + type: array + 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 + topologySpreadConstraints: + items: + properties: + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-map-keys: + - topologyKey + x-kubernetes-list-type: map + version: + type: string + type: object + nodeSelector: + additionalProperties: + type: string + type: object + paused: + type: boolean + podManagementPolicy: + type: string + podSecurityContext: + properties: + fsGroup: + format: int64 + type: integer + fsGroupChangePolicy: + type: string + 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 + supplementalGroups: + items: + format: int64 + type: integer + type: array + sysctls: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + runAsUserName: + type: string + type: object + type: object + priorityClassName: + type: string + pvReclaimPolicy: + default: Retain + type: string + schedulerName: + type: string + statefulSetUpdateStrategy: + 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 + topologySpreadConstraints: + items: + properties: + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-map-keys: + - topologyKey + x-kubernetes-list-type: map + version: + type: string + required: + - clusters + - ngMonitoring + type: object + status: + properties: + ngMonitoring: + properties: + phase: + type: string + statefulSet: + properties: + collisionCount: + format: int32 + type: integer + conditions: + items: + properties: + lastTransitionTime: + format: date-time + type: string + message: + type: string + reason: + type: string + status: + type: string + type: + type: string + required: + - status + - type + type: object + type: array + currentReplicas: + format: int32 + type: integer + currentRevision: + type: string + observedGeneration: + format: int64 + type: integer + readyReplicas: + format: int32 + type: integer + replicas: + format: int32 + type: integer + updateRevision: + type: string + updatedReplicas: + format: int32 + type: integer + required: + - replicas + type: object + synced: + type: boolean + type: object + type: object + required: + - metadata + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/manifests/crd/v1/pingcap.com_tidbngmonitorings.yaml b/manifests/crd/v1/pingcap.com_tidbngmonitorings.yaml new file mode 100644 index 0000000000..9794f47131 --- /dev/null +++ b/manifests/crd/v1/pingcap.com_tidbngmonitorings.yaml @@ -0,0 +1,4642 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null + name: tidbngmonitorings.pingcap.com +spec: + group: pingcap.com + names: + kind: TidbNGMonitoring + listKind: TidbNGMonitoringList + plural: tidbngmonitorings + shortNames: + - tngm + singular: tidbngmonitoring + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + additionalVolumeMounts: + 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 + additionalVolumes: + 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 + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + 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 + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + 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 + 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 + 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: + readOnly: + type: boolean + 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 + resources: + properties: + 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 + 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 + 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 + 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 + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + 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 + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + required: + - sources + 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 + 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 + 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 + 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 + 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 + 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 + type: array + required: + - nodeSelectorTerms + type: object + 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 + 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 + 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 + 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 + 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 + clusterDomain: + type: string + clusters: + items: + properties: + clusterDomain: + type: string + name: + type: string + namespace: + type: string + required: + - name + type: object + maxItems: 1 + minItems: 1 + type: array + configUpdateStrategy: + type: string + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + hostNetwork: + type: boolean + image: + type: string + imagePullPolicy: + type: string + imagePullSecrets: + items: + properties: + name: + type: string + type: object + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + ngMonitoring: + properties: + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + additionalVolumeMounts: + 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 + additionalVolumes: + 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 + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + 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 + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + 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 + 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 + 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: + readOnly: + type: boolean + 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 + resources: + properties: + 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 + 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 + 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 + 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 + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + 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 + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + required: + - sources + 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 + 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 + 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 + 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 + 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 + 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 + type: array + required: + - nodeSelectorTerms + type: object + 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 + 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 + 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 + 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 + 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 + baseImage: + default: pingcap/ng-monitoring + type: string + config: + x-kubernetes-preserve-unknown-fields: true + configUpdateStrategy: + type: string + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + hostNetwork: + type: boolean + image: + type: string + imagePullPolicy: + type: string + imagePullSecrets: + items: + properties: + name: + type: string + type: object + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + 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 + nodeSelector: + additionalProperties: + type: string + type: object + podManagementPolicy: + type: string + podSecurityContext: + properties: + fsGroup: + format: int64 + type: integer + fsGroupChangePolicy: + type: string + 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 + supplementalGroups: + items: + format: int64 + type: integer + type: array + sysctls: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + runAsUserName: + type: string + type: object + type: object + priorityClassName: + type: string + 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 + schedulerName: + type: string + statefulSetUpdateStrategy: + type: string + storageClassName: + type: string + storageVolumes: + items: + properties: + mountPath: + type: string + name: + type: string + storageClassName: + type: string + storageSize: + type: string + required: + - name + - storageSize + type: object + type: array + 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 + topologySpreadConstraints: + items: + properties: + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-map-keys: + - topologyKey + x-kubernetes-list-type: map + version: + type: string + type: object + nodeSelector: + additionalProperties: + type: string + type: object + paused: + type: boolean + podManagementPolicy: + type: string + podSecurityContext: + properties: + fsGroup: + format: int64 + type: integer + fsGroupChangePolicy: + type: string + 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 + supplementalGroups: + items: + format: int64 + type: integer + type: array + sysctls: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + runAsUserName: + type: string + type: object + type: object + priorityClassName: + type: string + pvReclaimPolicy: + default: Retain + type: string + schedulerName: + type: string + statefulSetUpdateStrategy: + 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 + topologySpreadConstraints: + items: + properties: + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-map-keys: + - topologyKey + x-kubernetes-list-type: map + version: + type: string + required: + - clusters + - ngMonitoring + type: object + status: + properties: + ngMonitoring: + properties: + phase: + type: string + statefulSet: + properties: + collisionCount: + format: int32 + type: integer + conditions: + items: + properties: + lastTransitionTime: + format: date-time + type: string + message: + type: string + reason: + type: string + status: + type: string + type: + type: string + required: + - status + - type + type: object + type: array + currentReplicas: + format: int32 + type: integer + currentRevision: + type: string + observedGeneration: + format: int64 + type: integer + readyReplicas: + format: int32 + type: integer + replicas: + format: int32 + type: integer + updateRevision: + type: string + updatedReplicas: + format: int32 + type: integer + required: + - replicas + type: object + synced: + type: boolean + type: object + type: object + required: + - metadata + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/manifests/crd/v1beta1/pingcap.com_tidbngmonitorings.yaml b/manifests/crd/v1beta1/pingcap.com_tidbngmonitorings.yaml new file mode 100644 index 0000000000..f299709b57 --- /dev/null +++ b/manifests/crd/v1beta1/pingcap.com_tidbngmonitorings.yaml @@ -0,0 +1,4638 @@ + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null + name: tidbngmonitorings.pingcap.com +spec: + group: pingcap.com + names: + kind: TidbNGMonitoring + listKind: TidbNGMonitoringList + plural: tidbngmonitorings + shortNames: + - tngm + singular: tidbngmonitoring + preserveUnknownFields: false + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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: + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + additionalVolumeMounts: + 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 + additionalVolumes: + 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 + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + 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 + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + 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 + 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 + 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: + readOnly: + type: boolean + 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 + resources: + properties: + 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 + 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 + 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 + 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 + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + 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 + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + required: + - sources + 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 + 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 + 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 + 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 + 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 + 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 + type: array + required: + - nodeSelectorTerms + type: object + 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 + 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 + 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 + 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 + 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 + clusterDomain: + type: string + clusters: + items: + properties: + clusterDomain: + type: string + name: + type: string + namespace: + type: string + required: + - name + type: object + maxItems: 1 + minItems: 1 + type: array + configUpdateStrategy: + type: string + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + hostNetwork: + type: boolean + image: + type: string + imagePullPolicy: + type: string + imagePullSecrets: + items: + properties: + name: + type: string + type: object + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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: + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + ngMonitoring: + properties: + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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: + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + additionalVolumeMounts: + 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 + additionalVolumes: + 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 + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + 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 + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + 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 + 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 + 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: + readOnly: + type: boolean + 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 + resources: + properties: + 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 + 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 + 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 + 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 + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + 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 + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + required: + - sources + 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 + 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 + 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 + 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 + 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 + 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 + type: array + required: + - nodeSelectorTerms + type: object + 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 + 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 + 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 + 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 + 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 + baseImage: + type: string + config: + x-kubernetes-preserve-unknown-fields: true + configUpdateStrategy: + type: string + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + hostNetwork: + type: boolean + image: + type: string + imagePullPolicy: + type: string + imagePullSecrets: + items: + properties: + name: + type: string + type: object + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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: + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + 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 + nodeSelector: + additionalProperties: + type: string + type: object + podManagementPolicy: + type: string + podSecurityContext: + properties: + fsGroup: + format: int64 + type: integer + fsGroupChangePolicy: + type: string + 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 + supplementalGroups: + items: + format: int64 + type: integer + type: array + sysctls: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + runAsUserName: + type: string + type: object + type: object + priorityClassName: + type: string + 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 + schedulerName: + type: string + statefulSetUpdateStrategy: + type: string + storageClassName: + type: string + storageVolumes: + items: + properties: + mountPath: + type: string + name: + type: string + storageClassName: + type: string + storageSize: + type: string + required: + - name + - storageSize + type: object + type: array + 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 + topologySpreadConstraints: + items: + properties: + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-map-keys: + - topologyKey + x-kubernetes-list-type: map + version: + type: string + type: object + nodeSelector: + additionalProperties: + type: string + type: object + paused: + type: boolean + podManagementPolicy: + type: string + podSecurityContext: + properties: + fsGroup: + format: int64 + type: integer + fsGroupChangePolicy: + type: string + 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 + supplementalGroups: + items: + format: int64 + type: integer + type: array + sysctls: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + runAsUserName: + type: string + type: object + type: object + priorityClassName: + type: string + pvReclaimPolicy: + type: string + schedulerName: + type: string + statefulSetUpdateStrategy: + 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 + topologySpreadConstraints: + items: + properties: + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-map-keys: + - topologyKey + x-kubernetes-list-type: map + version: + type: string + required: + - clusters + - ngMonitoring + type: object + status: + properties: + ngMonitoring: + properties: + phase: + type: string + statefulSet: + properties: + collisionCount: + format: int32 + type: integer + conditions: + items: + properties: + lastTransitionTime: + format: date-time + type: string + message: + type: string + reason: + type: string + status: + type: string + type: + type: string + required: + - status + - type + type: object + type: array + currentReplicas: + format: int32 + type: integer + currentRevision: + type: string + observedGeneration: + format: int64 + type: integer + readyReplicas: + format: int32 + type: integer + replicas: + format: int32 + type: integer + updateRevision: + type: string + updatedReplicas: + format: int32 + type: integer + required: + - replicas + type: object + synced: + type: boolean + type: object + type: object + required: + - metadata + - spec + type: object + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/manifests/crd_v1beta1.yaml b/manifests/crd_v1beta1.yaml index 10ffea4bb2..0ecea84eed 100644 --- a/manifests/crd_v1beta1.yaml +++ b/manifests/crd_v1beta1.yaml @@ -31900,3 +31900,4641 @@ status: plural: "" conditions: [] storedVersions: [] + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null + name: tidbngmonitorings.pingcap.com +spec: + group: pingcap.com + names: + kind: TidbNGMonitoring + listKind: TidbNGMonitoringList + plural: tidbngmonitorings + shortNames: + - tngm + singular: tidbngmonitoring + preserveUnknownFields: false + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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: + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + additionalVolumeMounts: + 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 + additionalVolumes: + 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 + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + 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 + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + 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 + 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 + 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: + readOnly: + type: boolean + 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 + resources: + properties: + 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 + 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 + 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 + 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 + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + 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 + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + required: + - sources + 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 + 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 + 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 + 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 + 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 + 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 + type: array + required: + - nodeSelectorTerms + type: object + 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 + 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 + 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 + 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 + 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 + clusterDomain: + type: string + clusters: + items: + properties: + clusterDomain: + type: string + name: + type: string + namespace: + type: string + required: + - name + type: object + maxItems: 1 + minItems: 1 + type: array + configUpdateStrategy: + type: string + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + hostNetwork: + type: boolean + image: + type: string + imagePullPolicy: + type: string + imagePullSecrets: + items: + properties: + name: + type: string + type: object + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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: + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + ngMonitoring: + properties: + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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: + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + additionalVolumeMounts: + 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 + additionalVolumes: + 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 + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + 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 + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + 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 + 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 + 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: + readOnly: + type: boolean + 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 + resources: + properties: + 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 + 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 + 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 + 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 + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + 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 + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + required: + - sources + 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 + 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 + 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 + 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 + 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 + 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 + type: array + required: + - nodeSelectorTerms + type: object + 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 + 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 + 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 + 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 + 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 + baseImage: + type: string + config: + x-kubernetes-preserve-unknown-fields: true + configUpdateStrategy: + type: string + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + hostNetwork: + type: boolean + image: + type: string + imagePullPolicy: + type: string + imagePullSecrets: + items: + properties: + name: + type: string + type: object + 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 + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + 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 + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + 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 + 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 + 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: + 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 + 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 + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + 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 + 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 + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + 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 + 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 + 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 + nodeSelector: + additionalProperties: + type: string + type: object + podManagementPolicy: + type: string + podSecurityContext: + properties: + fsGroup: + format: int64 + type: integer + fsGroupChangePolicy: + type: string + 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 + supplementalGroups: + items: + format: int64 + type: integer + type: array + sysctls: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + runAsUserName: + type: string + type: object + type: object + priorityClassName: + type: string + 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 + schedulerName: + type: string + statefulSetUpdateStrategy: + type: string + storageClassName: + type: string + storageVolumes: + items: + properties: + mountPath: + type: string + name: + type: string + storageClassName: + type: string + storageSize: + type: string + required: + - name + - storageSize + type: object + type: array + 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 + topologySpreadConstraints: + items: + properties: + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-map-keys: + - topologyKey + x-kubernetes-list-type: map + version: + type: string + type: object + nodeSelector: + additionalProperties: + type: string + type: object + paused: + type: boolean + podManagementPolicy: + type: string + podSecurityContext: + properties: + fsGroup: + format: int64 + type: integer + fsGroupChangePolicy: + type: string + 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 + supplementalGroups: + items: + format: int64 + type: integer + type: array + sysctls: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + runAsUserName: + type: string + type: object + type: object + priorityClassName: + type: string + pvReclaimPolicy: + type: string + schedulerName: + type: string + statefulSetUpdateStrategy: + 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 + topologySpreadConstraints: + items: + properties: + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-map-keys: + - topologyKey + x-kubernetes-list-type: map + version: + type: string + required: + - clusters + - ngMonitoring + type: object + status: + properties: + ngMonitoring: + properties: + phase: + type: string + statefulSet: + properties: + collisionCount: + format: int32 + type: integer + conditions: + items: + properties: + lastTransitionTime: + format: date-time + type: string + message: + type: string + reason: + type: string + status: + type: string + type: + type: string + required: + - status + - type + type: object + type: array + currentReplicas: + format: int32 + type: integer + currentRevision: + type: string + observedGeneration: + format: int64 + type: integer + readyReplicas: + format: int32 + type: integer + replicas: + format: int32 + type: integer + updateRevision: + type: string + updatedReplicas: + format: int32 + type: integer + required: + - replicas + type: object + synced: + type: boolean + type: object + type: object + required: + - metadata + - spec + type: object + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/pkg/apis/label/label.go b/pkg/apis/label/label.go index 60a558c9d8..abc84fda9d 100644 --- a/pkg/apis/label/label.go +++ b/pkg/apis/label/label.go @@ -154,6 +154,9 @@ const ( // DMWorkerLabelVal is dm-worker label value DMWorkerLabelVal string = "dm-worker" + // NGMonitorLabelVal is ng-monitoring label value + NGMonitorLabelVal string = "ng-monitoring" + // PrometheusVal is Prometheus label value PrometheusVal string = "prometheus" @@ -229,6 +232,13 @@ func NewMonitor() Label { } } +func NewTiDBNGMonitoring() Label { + return Label{ + NameLabelKey: "tidb-ng-monitoring", + ManagedByLabelKey: TiDBOperator, + } +} + func NewGroup() Label { return Label{ NameLabelKey: "tidb-cluster-group", @@ -377,6 +387,16 @@ func (l Label) Grafana() Label { return l.Application(GrafanaVal) } +// NGMonitoring assigns ng monitoring to component key in label +func (l Label) NGMonitoring() Label { + return l.Component(NGMonitorLabelVal) +} + +// IsNGMonitoring returns whether label is a NGMonitoring component +func (l Label) IsNGMonitoring() bool { + return l[ComponentLabelKey] == NGMonitorLabelVal +} + // IsMonitor returns whether label is a Monitor component func (l Label) IsMonitor() bool { return l[ComponentLabelKey] == TiDBMonitorVal diff --git a/pkg/apis/pingcap/v1alpha1/crd_kinds.go b/pkg/apis/pingcap/v1alpha1/crd_kinds.go index eb0b044447..dc03fbd366 100644 --- a/pkg/apis/pingcap/v1alpha1/crd_kinds.go +++ b/pkg/apis/pingcap/v1alpha1/crd_kinds.go @@ -53,6 +53,10 @@ const ( TidbClusterAutoScalerKind = "TidbClusterAutoScaler" TidbClusterAutoScalerKindKey = "tidbclusterautoscaler" + TiDBNGMonitoringName = "tidbngmonitorings" + TiDBNGMonitoringKind = "TidbNGMonitoring" + TiDBNGMonitoringKindKey = "tidbngmonitoring" + SpecPath = "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1." ) @@ -74,6 +78,7 @@ type CrdKinds struct { TiDBMonitor CrdKind TiDBInitializer CrdKind TidbClusterAutoScaler CrdKind + TiDBNGMonitoring CrdKind } var DefaultCrdKinds = CrdKinds{ @@ -86,4 +91,5 @@ var DefaultCrdKinds = CrdKinds{ TiDBMonitor: CrdKind{Plural: TiDBMonitorName, Kind: TiDBMonitorKind, ShortNames: []string{"tm"}, SpecName: SpecPath + TiDBMonitorKind}, TiDBInitializer: CrdKind{Plural: TiDBInitializerName, Kind: TiDBInitializerKind, ShortNames: []string{"ti"}, SpecName: SpecPath + TiDBInitializerKind}, TidbClusterAutoScaler: CrdKind{Plural: TidbClusterAutoScalerName, Kind: TidbClusterAutoScalerKind, ShortNames: []string{"ta"}, SpecName: SpecPath + TidbClusterAutoScalerKind}, + TiDBNGMonitoring: CrdKind{Plural: TiDBNGMonitoringName, Kind: TiDBNGMonitoringKind, ShortNames: []string{"tngm"}, SpecName: SpecPath + TiDBNGMonitoringKind}, } diff --git a/pkg/apis/pingcap/v1alpha1/openapi_generated.go b/pkg/apis/pingcap/v1alpha1/openapi_generated.go index f15a986b51..4b58fed9ab 100644 --- a/pkg/apis/pingcap/v1alpha1/openapi_generated.go +++ b/pkg/apis/pingcap/v1alpha1/openapi_generated.go @@ -75,6 +75,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.MasterKeyKMSConfig": schema_pkg_apis_pingcap_v1alpha1_MasterKeyKMSConfig(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.MasterSpec": schema_pkg_apis_pingcap_v1alpha1_MasterSpec(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.MonitorContainer": schema_pkg_apis_pingcap_v1alpha1_MonitorContainer(ref), + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.NGMonitoringSpec": schema_pkg_apis_pingcap_v1alpha1_NGMonitoringSpec(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.OpenTracing": schema_pkg_apis_pingcap_v1alpha1_OpenTracing(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.OpenTracingReporter": schema_pkg_apis_pingcap_v1alpha1_OpenTracingReporter(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.OpenTracingSampler": schema_pkg_apis_pingcap_v1alpha1_OpenTracingSampler(ref), @@ -169,6 +170,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbMonitorList": schema_pkg_apis_pingcap_v1alpha1_TidbMonitorList(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbMonitorRef": schema_pkg_apis_pingcap_v1alpha1_TidbMonitorRef(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbMonitorSpec": schema_pkg_apis_pingcap_v1alpha1_TidbMonitorSpec(ref), + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbNGMonitoring": schema_pkg_apis_pingcap_v1alpha1_TidbNGMonitoring(ref), + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbNGMonitoringList": schema_pkg_apis_pingcap_v1alpha1_TidbNGMonitoringList(ref), + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbNGMonitoringSpec": schema_pkg_apis_pingcap_v1alpha1_TidbNGMonitoringSpec(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TikvAutoScalerSpec": schema_pkg_apis_pingcap_v1alpha1_TikvAutoScalerSpec(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TikvAutoScalerStatus": schema_pkg_apis_pingcap_v1alpha1_TikvAutoScalerStatus(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TxnLocalLatches": schema_pkg_apis_pingcap_v1alpha1_TxnLocalLatches(ref), @@ -3570,6 +3574,314 @@ func schema_pkg_apis_pingcap_v1alpha1_MonitorContainer(ref common.ReferenceCallb } } +func schema_pkg_apis_pingcap_v1alpha1_NGMonitoringSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NGMonitoringSpec is spec of ng monitoring", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "version": { + SchemaProps: spec.SchemaProps{ + Description: "Version of the component. Override the cluster-level version if non-empty Optional: Defaults to cluster-level setting", + Type: []string{"string"}, + Format: "", + }, + }, + "imagePullPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "ImagePullPolicy of the component. Override the cluster-level imagePullPolicy if present Optional: Defaults to cluster-level setting", + Type: []string{"string"}, + Format: "", + }, + }, + "imagePullSecrets": { + SchemaProps: spec.SchemaProps{ + Description: "ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + }, + }, + }, + "hostNetwork": { + SchemaProps: spec.SchemaProps{ + Description: "Whether Hostnetwork of the component is enabled. Override the cluster-level setting if present Optional: Defaults to cluster-level setting", + Type: []string{"boolean"}, + Format: "", + }, + }, + "affinity": { + SchemaProps: spec.SchemaProps{ + Description: "Affinity of the component. Override the cluster-level setting if present. Optional: Defaults to cluster-level setting", + Ref: ref("k8s.io/api/core/v1.Affinity"), + }, + }, + "priorityClassName": { + SchemaProps: spec.SchemaProps{ + Description: "PriorityClassName of the component. Override the cluster-level one if present Optional: Defaults to cluster-level setting", + Type: []string{"string"}, + Format: "", + }, + }, + "schedulerName": { + SchemaProps: spec.SchemaProps{ + Description: "SchedulerName of the component. Override the cluster-level one if present Optional: Defaults to cluster-level setting", + Type: []string{"string"}, + Format: "", + }, + }, + "nodeSelector": { + SchemaProps: spec.SchemaProps{ + Description: "NodeSelector of the component. Merged into the cluster-level nodeSelector if non-empty Optional: Defaults to cluster-level setting", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "annotations": { + SchemaProps: spec.SchemaProps{ + Description: "Annotations for the component. Merge into the cluster-level annotations if non-empty Optional: Defaults to cluster-level setting", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels for the component. Merge into the cluster-level labels if non-empty Optional: Defaults to cluster-level setting", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "tolerations": { + SchemaProps: spec.SchemaProps{ + Description: "Tolerations of the component. Override the cluster-level tolerations if non-empty Optional: Defaults to cluster-level setting", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Toleration"), + }, + }, + }, + }, + }, + "podSecurityContext": { + SchemaProps: spec.SchemaProps{ + Description: "PodSecurityContext of the component", + Ref: ref("k8s.io/api/core/v1.PodSecurityContext"), + }, + }, + "configUpdateStrategy": { + SchemaProps: spec.SchemaProps{ + Description: "ConfigUpdateStrategy of the component. Override the cluster-level updateStrategy if present Optional: Defaults to cluster-level setting", + Type: []string{"string"}, + Format: "", + }, + }, + "env": { + SchemaProps: spec.SchemaProps{ + Description: "List of environment variables to set in the container, like v1.Container.Env. Note that the following env names cannot be used and will be overridden by TiDB Operator builtin envs - NAMESPACE - TZ - SERVICE_NAME - PEER_SERVICE_NAME - HEADLESS_SERVICE_NAME - SET_NAME - HOSTNAME - CLUSTER_NAME - POD_NAME - BINLOG_ENABLED - SLOW_LOG_FILE", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.EnvVar"), + }, + }, + }, + }, + }, + "initContainers": { + SchemaProps: spec.SchemaProps{ + Description: "Init containers of the components", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Container"), + }, + }, + }, + }, + }, + "additionalContainers": { + SchemaProps: spec.SchemaProps{ + Description: "Additional containers of the component.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Container"), + }, + }, + }, + }, + }, + "additionalVolumes": { + SchemaProps: spec.SchemaProps{ + Description: "Additional volumes of component pod.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Volume"), + }, + }, + }, + }, + }, + "additionalVolumeMounts": { + SchemaProps: spec.SchemaProps{ + Description: "Additional volume mounts of component pod.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.VolumeMount"), + }, + }, + }, + }, + }, + "terminationGracePeriodSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "statefulSetUpdateStrategy": { + SchemaProps: spec.SchemaProps{ + Description: "StatefulSetUpdateStrategy indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template.", + Type: []string{"string"}, + Format: "", + }, + }, + "podManagementPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "PodManagementPolicy of TiDB cluster StatefulSets", + Type: []string{"string"}, + Format: "", + }, + }, + "topologySpreadConstraints": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "topologyKey", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. This field is is only honored by clusters that enables the EvenPodsSpread feature. All topologySpreadConstraints are ANDed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TopologySpreadConstraint"), + }, + }, + }, + }, + }, + "limits": { + SchemaProps: spec.SchemaProps{ + Description: "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + "requests": { + SchemaProps: spec.SchemaProps{ + Description: "Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + "baseImage": { + SchemaProps: spec.SchemaProps{ + Description: "Base image of the component, image tag is now allowed during validation", + Type: []string{"string"}, + Format: "", + }, + }, + "storageClassName": { + SchemaProps: spec.SchemaProps{ + Description: "StorageClassName is the persistent volume for ng monitoring. Defaults to Kubernetes default storage class.", + Type: []string{"string"}, + Format: "", + }, + }, + "storageVolumes": { + SchemaProps: spec.SchemaProps{ + Description: "StorageVolumes configures additional storage for NG Monitoring pods.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.StorageVolume"), + }, + }, + }, + }, + }, + "config": { + SchemaProps: spec.SchemaProps{ + Description: "Config is the configuration of ng monitoring", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/util/config.GenericConfig"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.StorageVolume", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TopologySpreadConstraint", "github.com/pingcap/tidb-operator/pkg/apis/util/config.GenericConfig", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/api/core/v1.VolumeMount", "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + } +} + func schema_pkg_apis_pingcap_v1alpha1_OpenTracing(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -11360,129 +11672,377 @@ func schema_pkg_apis_pingcap_v1alpha1_TidbClusterSpec(ref common.ReferenceCallba }, }, }, - "labels": { + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Base labels for TiDB cluster, all Pods in the cluster should have these labels. Can be overrode by labels in the specific component spec.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "tolerations": { + SchemaProps: spec.SchemaProps{ + Description: "Base tolerations of TiDB cluster Pods, components may add more tolerations upon this respectively", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Toleration"), + }, + }, + }, + }, + }, + "timezone": { + SchemaProps: spec.SchemaProps{ + Description: "Time zone of TiDB cluster Pods Optional: Defaults to UTC", + Type: []string{"string"}, + Format: "", + }, + }, + "enableDynamicConfiguration": { + SchemaProps: spec.SchemaProps{ + Description: "EnableDynamicConfiguration indicates whether to append `--advertise-status-addr` to the startup parameters of TiKV.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "clusterDomain": { + SchemaProps: spec.SchemaProps{ + Description: "ClusterDomain is the Kubernetes Cluster Domain of TiDB cluster Optional: Defaults to \"\"", + Type: []string{"string"}, + Format: "", + }, + }, + "cluster": { + SchemaProps: spec.SchemaProps{ + Description: "Cluster is the external cluster, if configured, the components in this TidbCluster will join to this configured cluster.", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbClusterRef"), + }, + }, + "pdAddresses": { + SchemaProps: spec.SchemaProps{ + Description: "PDAddresses are the external PD addresses, if configured, the PDs in this TidbCluster will join to the configured PD cluster.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "statefulSetUpdateStrategy": { + SchemaProps: spec.SchemaProps{ + Description: "StatefulSetUpdateStrategy of TiDB cluster StatefulSets", + Type: []string{"string"}, + Format: "", + }, + }, + "podManagementPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "PodManagementPolicy of TiDB cluster StatefulSets", + Type: []string{"string"}, + Format: "", + }, + }, + "podSecurityContext": { + SchemaProps: spec.SchemaProps{ + Description: "PodSecurityContext of the component", + Ref: ref("k8s.io/api/core/v1.PodSecurityContext"), + }, + }, + "topologySpreadConstraints": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "topologyKey", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. This field is is only honored by clusters that enables the EvenPodsSpread feature. All topologySpreadConstraints are ANDed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TopologySpreadConstraint"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.DiscoverySpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.HelperSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PumpSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TLSCluster", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiCDCSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiFlashSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbClusterRef", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TopologySpreadConstraint", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration"}, + } +} + +func schema_pkg_apis_pingcap_v1alpha1_TidbInitializer(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TidbInitializer is a TiDB cluster initializing job", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Spec defines the desired state of TidbInitializer", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbInitializerSpec"), + }, + }, + }, + Required: []string{"spec"}, + }, + }, + Dependencies: []string{ + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbInitializerSpec"}, + } +} + +func schema_pkg_apis_pingcap_v1alpha1_TidbInitializerList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbInitializer"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbInitializer"}, + } +} + +func schema_pkg_apis_pingcap_v1alpha1_TidbInitializerSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TidbInitializer spec encode the desired state of tidb initializer Job", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "image": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "cluster": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbClusterRef"), + }, + }, + "podSecurityContext": { + SchemaProps: spec.SchemaProps{ + Description: "PodSecurityContext of the component", + Ref: ref("k8s.io/api/core/v1.PodSecurityContext"), + }, + }, + "imagePullPolicy": { SchemaProps: spec.SchemaProps{ - Description: "Base labels for TiDB cluster, all Pods in the cluster should have these labels. Can be overrode by labels in the specific component spec.", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - }, + Type: []string{"string"}, + Format: "", }, }, - "tolerations": { + "imagePullSecrets": { SchemaProps: spec.SchemaProps{ - Description: "Base tolerations of TiDB cluster Pods, components may add more tolerations upon this respectively", + Description: "ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images.", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/api/core/v1.Toleration"), + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), }, }, }, }, }, - "timezone": { + "permitHost": { SchemaProps: spec.SchemaProps{ - Description: "Time zone of TiDB cluster Pods Optional: Defaults to UTC", + Description: "permitHost is the host which will only be allowed to connect to the TiDB.", Type: []string{"string"}, Format: "", }, }, - "enableDynamicConfiguration": { + "initSql": { SchemaProps: spec.SchemaProps{ - Description: "EnableDynamicConfiguration indicates whether to append `--advertise-status-addr` to the startup parameters of TiKV.", - Type: []string{"boolean"}, + Description: "InitSql is the SQL statements executed after the TiDB cluster is bootstrapped.", + Type: []string{"string"}, Format: "", }, }, - "clusterDomain": { + "initSqlConfigMap": { SchemaProps: spec.SchemaProps{ - Description: "ClusterDomain is the Kubernetes Cluster Domain of TiDB cluster Optional: Defaults to \"\"", + Description: "InitSqlConfigMapName reference a configmap that provide init-sql, take high precedence than initSql if set", Type: []string{"string"}, Format: "", }, }, - "cluster": { + "passwordSecret": { SchemaProps: spec.SchemaProps{ - Description: "Cluster is the external cluster, if configured, the components in this TidbCluster will join to this configured cluster.", - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbClusterRef"), + Type: []string{"string"}, + Format: "", }, }, - "pdAddresses": { + "resources": { SchemaProps: spec.SchemaProps{ - Description: "PDAddresses are the external PD addresses, if configured, the PDs in this TidbCluster will join to the configured PD cluster.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - }, + Ref: ref("k8s.io/api/core/v1.ResourceRequirements"), }, }, - "statefulSetUpdateStrategy": { + "timezone": { SchemaProps: spec.SchemaProps{ - Description: "StatefulSetUpdateStrategy of TiDB cluster StatefulSets", + Description: "Time zone of TiDB initializer Pods", Type: []string{"string"}, Format: "", }, }, - "podManagementPolicy": { + "tlsClientSecretName": { SchemaProps: spec.SchemaProps{ - Description: "PodManagementPolicy of TiDB cluster StatefulSets", + Description: "TLSClientSecretName is the name of secret which stores tidb server client certificate Optional: Defaults to nil", Type: []string{"string"}, Format: "", }, }, - "podSecurityContext": { - SchemaProps: spec.SchemaProps{ - Description: "PodSecurityContext of the component", - Ref: ref("k8s.io/api/core/v1.PodSecurityContext"), - }, - }, - "topologySpreadConstraints": { + }, + Required: []string{"image", "cluster"}, + }, + }, + Dependencies: []string{ + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbClusterRef", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.ResourceRequirements"}, + } +} + +func schema_pkg_apis_pingcap_v1alpha1_TidbInitializerStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ - "x-kubernetes-list-map-keys": []interface{}{ - "topologyKey", - }, - "x-kubernetes-list-type": "map", + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge", }, }, SchemaProps: spec.SchemaProps{ - Description: "TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. This field is is only honored by clusters that enables the EvenPodsSpread feature. All topologySpreadConstraints are ANDed.", + Description: "The latest available observations of an object's current state. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TopologySpreadConstraint"), + Ref: ref("k8s.io/api/batch/v1.JobCondition"), }, }, }, }, }, + "startTime": { + SchemaProps: spec.SchemaProps{ + Description: "Represents time when the job was acknowledged by the job controller. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "completionTime": { + SchemaProps: spec.SchemaProps{ + Description: "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "active": { + SchemaProps: spec.SchemaProps{ + Description: "The number of actively running pods.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "succeeded": { + SchemaProps: spec.SchemaProps{ + Description: "The number of pods which reached phase Succeeded.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "failed": { + SchemaProps: spec.SchemaProps{ + Description: "The number of pods which reached phase Failed.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "phase": { + SchemaProps: spec.SchemaProps{ + Description: "Phase is a user readable state inferred from the underlying Job status and TidbCluster status", + Type: []string{"string"}, + Format: "", + }, + }, }, }, }, Dependencies: []string{ - "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.DiscoverySpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.HelperSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PumpSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TLSCluster", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiCDCSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiFlashSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbClusterRef", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TopologySpreadConstraint", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration"}, + "k8s.io/api/batch/v1.JobCondition", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, } } -func schema_pkg_apis_pingcap_v1alpha1_TidbInitializer(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_pingcap_v1alpha1_TidbMonitor(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "TidbInitializer is a TiDB cluster initializing job", + Description: "TidbMonitor encode the spec and status of the monitoring component of a TiDB cluster", Type: []string{"object"}, Properties: map[string]spec.Schema{ "kind": { @@ -11501,8 +12061,8 @@ func schema_pkg_apis_pingcap_v1alpha1_TidbInitializer(ref common.ReferenceCallba }, "spec": { SchemaProps: spec.SchemaProps{ - Description: "Spec defines the desired state of TidbInitializer", - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbInitializerSpec"), + Description: "Spec defines the desired state of TidbMonitor", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbMonitorSpec"), }, }, }, @@ -11510,15 +12070,16 @@ func schema_pkg_apis_pingcap_v1alpha1_TidbInitializer(ref common.ReferenceCallba }, }, Dependencies: []string{ - "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbInitializerSpec"}, + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbMonitorSpec"}, } } -func schema_pkg_apis_pingcap_v1alpha1_TidbInitializerList(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_pingcap_v1alpha1_TidbMonitorList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, + Description: "TidbMonitorList is TidbMonitor list", + Type: []string{"object"}, Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ @@ -11536,53 +12097,134 @@ func schema_pkg_apis_pingcap_v1alpha1_TidbInitializerList(ref common.ReferenceCa }, "items": { SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbInitializer"), - }, - }, - }, + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbMonitor"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbMonitor"}, + } +} + +func schema_pkg_apis_pingcap_v1alpha1_TidbMonitorRef(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TidbMonitorRef reference to a TidbMonitor", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "Namespace is the namespace that TidbMonitor object locates, default to the same namespace with TidbClusterAutoScaler", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is the name of TidbMonitor object", + Type: []string{"string"}, + Format: "", + }, + }, + "grafanaEnabled": { + SchemaProps: spec.SchemaProps{ + Description: "GrafanaEnabled indicate whether the grafana is enabled for this target tidbmonitor", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"name"}, + }, + }, + } +} + +func schema_pkg_apis_pingcap_v1alpha1_TidbMonitorSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TidbMonitor spec encode the desired state of tidb monitoring component", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "clusters": { + SchemaProps: spec.SchemaProps{ + Description: "monitored TiDB cluster info", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbClusterRef"), + }, + }, + }, + }, + }, + "prometheus": { + SchemaProps: spec.SchemaProps{ + Description: "Prometheus spec", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PrometheusSpec"), + }, + }, + "grafana": { + SchemaProps: spec.SchemaProps{ + Description: "Grafana spec", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.GrafanaSpec"), + }, + }, + "reloader": { + SchemaProps: spec.SchemaProps{ + Description: "Reloader spec", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.ReloaderSpec"), + }, + }, + "initializer": { + SchemaProps: spec.SchemaProps{ + Description: "Initializer spec", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.InitializerSpec"), + }, + }, + "dm": { + SchemaProps: spec.SchemaProps{ + Description: "monitored DM cluster spec", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.DMMonitorSpec"), }, }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbInitializer"}, - } -} - -func schema_pkg_apis_pingcap_v1alpha1_TidbInitializerSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "TidbInitializer spec encode the desired state of tidb initializer Job", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "image": { + "thanos": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Description: "Thanos spec", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.ThanosSpec"), }, }, - "cluster": { + "prometheusReloader": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbClusterRef"), + Description: "PrometheusReloader set prometheus reloader configuration", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PrometheusReloaderSpec"), }, }, - "podSecurityContext": { + "pvReclaimPolicy": { SchemaProps: spec.SchemaProps{ - Description: "PodSecurityContext of the component", - Ref: ref("k8s.io/api/core/v1.PodSecurityContext"), + Description: "Persistent volume reclaim policy applied to the PVs that consumed by TiDB cluster", + Type: []string{"string"}, + Format: "", }, }, "imagePullPolicy": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Description: "ImagePullPolicy of TidbMonitor Pods", + Type: []string{"string"}, + Format: "", }, }, "imagePullSecrets": { @@ -11598,175 +12240,209 @@ func schema_pkg_apis_pingcap_v1alpha1_TidbInitializerSpec(ref common.ReferenceCa }, }, }, - "permitHost": { + "persistent": { SchemaProps: spec.SchemaProps{ - Description: "permitHost is the host which will only be allowed to connect to the TiDB.", - Type: []string{"string"}, + Description: "If Persistent enabled, storageClassName must be set to an existing storage. Defaults to false.", + Type: []string{"boolean"}, Format: "", }, }, - "initSql": { + "storageClassName": { SchemaProps: spec.SchemaProps{ - Description: "InitSql is the SQL statements executed after the TiDB cluster is bootstrapped.", + Description: "The storageClassName of the persistent volume for TidbMonitor data storage. Defaults to Kubernetes default storage class.", Type: []string{"string"}, Format: "", }, }, - "initSqlConfigMap": { + "storage": { SchemaProps: spec.SchemaProps{ - Description: "InitSqlConfigMapName reference a configmap that provide init-sql, take high precedence than initSql if set", + Description: "Size of the persistent volume.", Type: []string{"string"}, Format: "", }, }, - "passwordSecret": { + "nodeSelector": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Description: "NodeSelector of the TidbMonitor.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, }, }, - "resources": { + "annotations": { SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/api/core/v1.ResourceRequirements"), + Description: "Annotations for the TidbMonitor. Optional: Defaults to cluster-level setting", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, }, }, - "timezone": { + "labels": { SchemaProps: spec.SchemaProps{ - Description: "Time zone of TiDB initializer Pods", + Description: "Labels for the TidbMonitor.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "tolerations": { + SchemaProps: spec.SchemaProps{ + Description: "Tolerations of the TidbMonitor.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Toleration"), + }, + }, + }, + }, + }, + "kubePrometheusURL": { + SchemaProps: spec.SchemaProps{ + Description: "kubePrometheusURL is where tidb-monitoring get the common metrics of kube-prometheus. Ref: https://github.com/coreos/kube-prometheus", Type: []string{"string"}, Format: "", }, }, - "tlsClientSecretName": { + "alertmanagerURL": { SchemaProps: spec.SchemaProps{ - Description: "TLSClientSecretName is the name of secret which stores tidb server client certificate Optional: Defaults to nil", + Description: "alertmanagerURL is where tidb-monitoring push alerts to. Ref: https://prometheus.io/docs/alerting/alertmanager/", Type: []string{"string"}, Format: "", }, }, - }, - Required: []string{"image", "cluster"}, - }, - }, - Dependencies: []string{ - "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbClusterRef", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.ResourceRequirements"}, - } -} - -func schema_pkg_apis_pingcap_v1alpha1_TidbInitializerStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-patch-merge-key": "type", - "x-kubernetes-patch-strategy": "merge", - }, + "alertManagerRulesVersion": { + SchemaProps: spec.SchemaProps{ + Description: "alertManagerRulesVersion is the version of the tidb cluster that used for alert rules. default to current tidb cluster version, for example: v3.0.15", + Type: []string{"string"}, + Format: "", }, + }, + "additionalContainers": { SchemaProps: spec.SchemaProps{ - Description: "The latest available observations of an object's current state. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/", + Description: "Additional containers of the TidbMonitor.", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/api/batch/v1.JobCondition"), + Ref: ref("k8s.io/api/core/v1.Container"), }, }, }, }, }, - "startTime": { + "clusterScoped": { SchemaProps: spec.SchemaProps{ - Description: "Represents time when the job was acknowledged by the job controller. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + Description: "ClusterScoped indicates whether this monitor should manage Kubernetes cluster-wide TiDB clusters", + Type: []string{"boolean"}, + Format: "", }, }, - "completionTime": { + "externalLabels": { SchemaProps: spec.SchemaProps{ - Description: "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + Description: "The labels to add to any time series or alerts when communicating with external systems (federation, remote storage, Alertmanager).", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, }, }, - "active": { + "replicaExternalLabelName": { SchemaProps: spec.SchemaProps{ - Description: "The number of actively running pods.", - Type: []string{"integer"}, - Format: "int32", + Description: "Name of Prometheus external label used to denote replica name. Defaults to the value of `prometheus_replica`. External label will _not_ be added when value is set to empty string (`\"\"`).", + Type: []string{"string"}, + Format: "", }, }, - "succeeded": { + "replicas": { SchemaProps: spec.SchemaProps{ - Description: "The number of pods which reached phase Succeeded.", + Description: "Replicas is the number of desired replicas. Defaults to 1.", Type: []string{"integer"}, Format: "int32", }, }, - "failed": { + "shards": { SchemaProps: spec.SchemaProps{ - Description: "The number of pods which reached phase Failed.", + Description: "EXPERIMENTAL: Number of shards to distribute targets onto. Number of replicas multiplied by shards is the total number of Pods created. Note that scaling down shards will not reshard data onto remaining instances, it must be manually moved. Increasing shards will not reshard data either but it will continue to be available from the same instances. To query globally use Thanos sidecar and Thanos querier or remote write data to a central location. Sharding is done on the content of the `__address__` target meta-label.", Type: []string{"integer"}, Format: "int32", }, }, - "phase": { + "additionalVolumes": { SchemaProps: spec.SchemaProps{ - Description: "Phase is a user readable state inferred from the underlying Job status and TidbCluster status", - Type: []string{"string"}, - Format: "", + Description: "Additional volumes of TidbMonitor pod.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Volume"), + }, + }, + }, }, }, - }, - }, - }, - Dependencies: []string{ - "k8s.io/api/batch/v1.JobCondition", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, - } -} - -func schema_pkg_apis_pingcap_v1alpha1_TidbMonitor(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "TidbMonitor encode the spec and status of the monitoring component of a TiDB cluster", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { + "podSecurityContext": { SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", + Description: "PodSecurityContext of TidbMonitor pod.", + Ref: ref("k8s.io/api/core/v1.PodSecurityContext"), }, }, - "apiVersion": { + "enableAlertRules": { SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, + Description: "EnableAlertRules adds alert rules to the Prometheus config even if `AlertmanagerURL` is not configured.", + Type: []string{"boolean"}, Format: "", }, }, - "spec": { + "timezone": { SchemaProps: spec.SchemaProps{ - Description: "Spec defines the desired state of TidbMonitor", - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbMonitorSpec"), + Description: "Time zone of TidbMonitor Optional: Defaults to UTC", + Type: []string{"string"}, + Format: "", }, }, }, - Required: []string{"spec"}, + Required: []string{"prometheus", "reloader", "initializer"}, }, }, Dependencies: []string{ - "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbMonitorSpec"}, + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.DMMonitorSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.GrafanaSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.InitializerSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PrometheusReloaderSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PrometheusSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.ReloaderSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.ThanosSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbClusterRef", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume"}, } } -func schema_pkg_apis_pingcap_v1alpha1_TidbMonitorList(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_pingcap_v1alpha1_TidbNGMonitoring(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "TidbMonitorList is TidbMonitor list", + Description: "TidbNGMonitoring contains the spec and status of tidb ng monitor", Type: []string{"object"}, Properties: map[string]spec.Schema{ "kind": { @@ -11783,134 +12459,80 @@ func schema_pkg_apis_pingcap_v1alpha1_TidbMonitorList(ref common.ReferenceCallba Format: "", }, }, - "items": { + "spec": { SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbMonitor"), - }, - }, - }, + Description: "Spec contains all spec about tidb ng monitor", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbNGMonitoringSpec"), }, }, }, - Required: []string{"items"}, + Required: []string{"spec"}, }, }, Dependencies: []string{ - "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbMonitor"}, + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbNGMonitoringSpec"}, } } -func schema_pkg_apis_pingcap_v1alpha1_TidbMonitorRef(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_pingcap_v1alpha1_TidbNGMonitoringList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "TidbMonitorRef reference to a TidbMonitor", + Description: "TidbNGMonitoringList is TidbNGMonitoring list", Type: []string{"object"}, Properties: map[string]spec.Schema{ - "namespace": { + "kind": { SchemaProps: spec.SchemaProps{ - Description: "Namespace is the namespace that TidbMonitor object locates, default to the same namespace with TidbClusterAutoScaler", + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", Type: []string{"string"}, Format: "", }, }, - "name": { + "apiVersion": { SchemaProps: spec.SchemaProps{ - Description: "Name is the name of TidbMonitor object", + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", Type: []string{"string"}, Format: "", }, }, - "grafanaEnabled": { + "items": { SchemaProps: spec.SchemaProps{ - Description: "GrafanaEnabled indicate whether the grafana is enabled for this target tidbmonitor", - Type: []string{"boolean"}, - Format: "", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbNGMonitoring"), + }, + }, + }, }, }, }, - Required: []string{"name"}, + Required: []string{"items"}, }, }, + Dependencies: []string{ + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbNGMonitoring"}, } } -func schema_pkg_apis_pingcap_v1alpha1_TidbMonitorSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_pingcap_v1alpha1_TidbNGMonitoringSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "TidbMonitor spec encode the desired state of tidb monitoring component", + Description: "TidbNGMonitoringSpec is spec of tidb ng monitoring", Type: []string{"object"}, Properties: map[string]spec.Schema{ - "clusters": { - SchemaProps: spec.SchemaProps{ - Description: "monitored TiDB cluster info", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbClusterRef"), - }, - }, - }, - }, - }, - "prometheus": { - SchemaProps: spec.SchemaProps{ - Description: "Prometheus spec", - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PrometheusSpec"), - }, - }, - "grafana": { - SchemaProps: spec.SchemaProps{ - Description: "Grafana spec", - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.GrafanaSpec"), - }, - }, - "reloader": { - SchemaProps: spec.SchemaProps{ - Description: "Reloader spec", - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.ReloaderSpec"), - }, - }, - "initializer": { - SchemaProps: spec.SchemaProps{ - Description: "Initializer spec", - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.InitializerSpec"), - }, - }, - "dm": { - SchemaProps: spec.SchemaProps{ - Description: "monitored DM cluster spec", - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.DMMonitorSpec"), - }, - }, - "thanos": { - SchemaProps: spec.SchemaProps{ - Description: "Thanos spec", - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.ThanosSpec"), - }, - }, - "prometheusReloader": { - SchemaProps: spec.SchemaProps{ - Description: "PrometheusReloader set prometheus reloader configuration", - Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PrometheusReloaderSpec"), - }, - }, - "pvReclaimPolicy": { + "version": { SchemaProps: spec.SchemaProps{ - Description: "Persistent volume reclaim policy applied to the PVs that consumed by TiDB cluster", + Description: "Version of the component. Override the cluster-level version if non-empty Optional: Defaults to cluster-level setting", Type: []string{"string"}, Format: "", }, }, "imagePullPolicy": { SchemaProps: spec.SchemaProps{ - Description: "ImagePullPolicy of TidbMonitor Pods", + Description: "ImagePullPolicy of the component. Override the cluster-level imagePullPolicy if present Optional: Defaults to cluster-level setting", Type: []string{"string"}, Format: "", }, @@ -11928,30 +12550,36 @@ func schema_pkg_apis_pingcap_v1alpha1_TidbMonitorSpec(ref common.ReferenceCallba }, }, }, - "persistent": { + "hostNetwork": { SchemaProps: spec.SchemaProps{ - Description: "If Persistent enabled, storageClassName must be set to an existing storage. Defaults to false.", + Description: "Whether Hostnetwork of the component is enabled. Override the cluster-level setting if present Optional: Defaults to cluster-level setting", Type: []string{"boolean"}, Format: "", }, }, - "storageClassName": { + "affinity": { SchemaProps: spec.SchemaProps{ - Description: "The storageClassName of the persistent volume for TidbMonitor data storage. Defaults to Kubernetes default storage class.", + Description: "Affinity of the component. Override the cluster-level setting if present. Optional: Defaults to cluster-level setting", + Ref: ref("k8s.io/api/core/v1.Affinity"), + }, + }, + "priorityClassName": { + SchemaProps: spec.SchemaProps{ + Description: "PriorityClassName of the component. Override the cluster-level one if present Optional: Defaults to cluster-level setting", Type: []string{"string"}, Format: "", }, }, - "storage": { + "schedulerName": { SchemaProps: spec.SchemaProps{ - Description: "Size of the persistent volume.", + Description: "SchedulerName of the component. Override the cluster-level one if present Optional: Defaults to cluster-level setting", Type: []string{"string"}, Format: "", }, }, "nodeSelector": { SchemaProps: spec.SchemaProps{ - Description: "NodeSelector of the TidbMonitor.", + Description: "NodeSelector of the component. Merged into the cluster-level nodeSelector if non-empty Optional: Defaults to cluster-level setting", Type: []string{"object"}, AdditionalProperties: &spec.SchemaOrBool{ Allows: true, @@ -11966,7 +12594,7 @@ func schema_pkg_apis_pingcap_v1alpha1_TidbMonitorSpec(ref common.ReferenceCallba }, "annotations": { SchemaProps: spec.SchemaProps{ - Description: "Annotations for the TidbMonitor. Optional: Defaults to cluster-level setting", + Description: "Annotations for the component. Merge into the cluster-level annotations if non-empty Optional: Defaults to cluster-level setting", Type: []string{"object"}, AdditionalProperties: &spec.SchemaOrBool{ Allows: true, @@ -11981,7 +12609,7 @@ func schema_pkg_apis_pingcap_v1alpha1_TidbMonitorSpec(ref common.ReferenceCallba }, "labels": { SchemaProps: spec.SchemaProps{ - Description: "Labels for the TidbMonitor.", + Description: "Labels for the component. Merge into the cluster-level labels if non-empty Optional: Defaults to cluster-level setting", Type: []string{"object"}, AdditionalProperties: &spec.SchemaOrBool{ Allows: true, @@ -11996,7 +12624,7 @@ func schema_pkg_apis_pingcap_v1alpha1_TidbMonitorSpec(ref common.ReferenceCallba }, "tolerations": { SchemaProps: spec.SchemaProps{ - Description: "Tolerations of the TidbMonitor.", + Description: "Tolerations of the component. Override the cluster-level tolerations if non-empty Optional: Defaults to cluster-level setting", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -12007,30 +12635,48 @@ func schema_pkg_apis_pingcap_v1alpha1_TidbMonitorSpec(ref common.ReferenceCallba }, }, }, - "kubePrometheusURL": { + "podSecurityContext": { SchemaProps: spec.SchemaProps{ - Description: "kubePrometheusURL is where tidb-monitoring get the common metrics of kube-prometheus. Ref: https://github.com/coreos/kube-prometheus", - Type: []string{"string"}, - Format: "", + Description: "PodSecurityContext of the component", + Ref: ref("k8s.io/api/core/v1.PodSecurityContext"), }, }, - "alertmanagerURL": { + "configUpdateStrategy": { SchemaProps: spec.SchemaProps{ - Description: "alertmanagerURL is where tidb-monitoring push alerts to. Ref: https://prometheus.io/docs/alerting/alertmanager/", + Description: "ConfigUpdateStrategy of the component. Override the cluster-level updateStrategy if present Optional: Defaults to cluster-level setting", Type: []string{"string"}, Format: "", }, }, - "alertManagerRulesVersion": { + "env": { SchemaProps: spec.SchemaProps{ - Description: "alertManagerRulesVersion is the version of the tidb cluster that used for alert rules. default to current tidb cluster version, for example: v3.0.15", - Type: []string{"string"}, - Format: "", + Description: "List of environment variables to set in the container, like v1.Container.Env. Note that the following env names cannot be used and will be overridden by TiDB Operator builtin envs - NAMESPACE - TZ - SERVICE_NAME - PEER_SERVICE_NAME - HEADLESS_SERVICE_NAME - SET_NAME - HOSTNAME - CLUSTER_NAME - POD_NAME - BINLOG_ENABLED - SLOW_LOG_FILE", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.EnvVar"), + }, + }, + }, + }, + }, + "initContainers": { + SchemaProps: spec.SchemaProps{ + Description: "Init containers of the components", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Container"), + }, + }, + }, }, }, "additionalContainers": { SchemaProps: spec.SchemaProps{ - Description: "Additional containers of the TidbMonitor.", + Description: "Additional containers of the component.", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -12041,88 +12687,120 @@ func schema_pkg_apis_pingcap_v1alpha1_TidbMonitorSpec(ref common.ReferenceCallba }, }, }, - "clusterScoped": { + "additionalVolumes": { SchemaProps: spec.SchemaProps{ - Description: "ClusterScoped indicates whether this monitor should manage Kubernetes cluster-wide TiDB clusters", - Type: []string{"boolean"}, - Format: "", + Description: "Additional volumes of component pod.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Volume"), + }, + }, + }, }, }, - "externalLabels": { + "additionalVolumeMounts": { SchemaProps: spec.SchemaProps{ - Description: "The labels to add to any time series or alerts when communicating with external systems (federation, remote storage, Alertmanager).", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, + Description: "Additional volume mounts of component pod.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Ref: ref("k8s.io/api/core/v1.VolumeMount"), }, }, }, }, }, - "replicaExternalLabelName": { + "terminationGracePeriodSeconds": { SchemaProps: spec.SchemaProps{ - Description: "Name of Prometheus external label used to denote replica name. Defaults to the value of `prometheus_replica`. External label will _not_ be added when value is set to empty string (`\"\"`).", + Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "statefulSetUpdateStrategy": { + SchemaProps: spec.SchemaProps{ + Description: "StatefulSetUpdateStrategy indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template.", Type: []string{"string"}, Format: "", }, }, - "replicas": { + "podManagementPolicy": { SchemaProps: spec.SchemaProps{ - Description: "Replicas is the number of desired replicas. Defaults to 1.", - Type: []string{"integer"}, - Format: "int32", + Description: "PodManagementPolicy of TiDB cluster StatefulSets", + Type: []string{"string"}, + Format: "", }, }, - "shards": { + "topologySpreadConstraints": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "topologyKey", + }, + "x-kubernetes-list-type": "map", + }, + }, SchemaProps: spec.SchemaProps{ - Description: "EXPERIMENTAL: Number of shards to distribute targets onto. Number of replicas multiplied by shards is the total number of Pods created. Note that scaling down shards will not reshard data onto remaining instances, it must be manually moved. Increasing shards will not reshard data either but it will continue to be available from the same instances. To query globally use Thanos sidecar and Thanos querier or remote write data to a central location. Sharding is done on the content of the `__address__` target meta-label.", - Type: []string{"integer"}, - Format: "int32", + Description: "TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. This field is is only honored by clusters that enables the EvenPodsSpread feature. All topologySpreadConstraints are ANDed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TopologySpreadConstraint"), + }, + }, + }, }, }, - "additionalVolumes": { + "clusters": { SchemaProps: spec.SchemaProps{ - Description: "Additional volumes of TidbMonitor pod.", + Description: "Clusters reference TiDB cluster", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("k8s.io/api/core/v1.Volume"), + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbClusterRef"), }, }, }, }, }, - "podSecurityContext": { + "paused": { SchemaProps: spec.SchemaProps{ - Description: "PodSecurityContext of TidbMonitor pod.", - Ref: ref("k8s.io/api/core/v1.PodSecurityContext"), + Description: "Paused pause controller if it is true", + Type: []string{"boolean"}, + Format: "", }, }, - "enableAlertRules": { + "pvReclaimPolicy": { SchemaProps: spec.SchemaProps{ - Description: "EnableAlertRules adds alert rules to the Prometheus config even if `AlertmanagerURL` is not configured.", - Type: []string{"boolean"}, + Description: "Persistent volume reclaim policy applied to the PVs that consumed by tidb ng monitoring", + Type: []string{"string"}, Format: "", }, }, - "timezone": { + "clusterDomain": { SchemaProps: spec.SchemaProps{ - Description: "Time zone of TidbMonitor Optional: Defaults to UTC", + Description: "ClusterDomain is the Kubernetes Cluster Domain of tidb ng monitoring", Type: []string{"string"}, Format: "", }, }, + "ngMonitoring": { + SchemaProps: spec.SchemaProps{ + Description: "NGMonitoring is spec of ng monitoring", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.NGMonitoringSpec"), + }, + }, }, - Required: []string{"prometheus", "reloader", "initializer"}, + Required: []string{"clusters", "ngMonitoring"}, }, }, Dependencies: []string{ - "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.DMMonitorSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.GrafanaSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.InitializerSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PrometheusReloaderSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PrometheusSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.ReloaderSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.ThanosSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbClusterRef", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume"}, + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.NGMonitoringSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TidbClusterRef", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TopologySpreadConstraint", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/api/core/v1.VolumeMount"}, } } diff --git a/pkg/apis/pingcap/v1alpha1/register.go b/pkg/apis/pingcap/v1alpha1/register.go index 11e2bf2076..676aa948ed 100644 --- a/pkg/apis/pingcap/v1alpha1/register.go +++ b/pkg/apis/pingcap/v1alpha1/register.go @@ -68,6 +68,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &TidbClusterAutoScalerList{}, &DMCluster{}, &DMClusterList{}, + &TidbNGMonitoring{}, + &TidbNGMonitoringList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) diff --git a/pkg/apis/pingcap/v1alpha1/tidbcluster_component.go b/pkg/apis/pingcap/v1alpha1/tidbcluster_component.go index d9c74b1aff..702be06bf4 100644 --- a/pkg/apis/pingcap/v1alpha1/tidbcluster_component.go +++ b/pkg/apis/pingcap/v1alpha1/tidbcluster_component.go @@ -66,6 +66,7 @@ const ( ComponentDMDiscovery ComponentDMMaster ComponentDMWorker + ComponentNGMonitoring ) type componentAccessorImpl struct { diff --git a/pkg/apis/pingcap/v1alpha1/tidbngmonitoring.go b/pkg/apis/pingcap/v1alpha1/tidbngmonitoring.go new file mode 100644 index 0000000000..4995e036a1 --- /dev/null +++ b/pkg/apis/pingcap/v1alpha1/tidbngmonitoring.go @@ -0,0 +1,39 @@ +// Copyright 2021 PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1alpha1 + +import "fmt" + +func (tngm *TidbNGMonitoring) GetInstanceName() string { + return tngm.Name +} + +// NGMonitoringImage return the image used by NGMonitoring. +func (tngm *TidbNGMonitoring) NGMonitoringImage() string { + image := tngm.Spec.NGMonitoring.Image + baseImage := tngm.Spec.NGMonitoring.BaseImage + // base image takes higher priority + if baseImage != "" { + version := tngm.Spec.NGMonitoring.Version + if version == nil { + version = tngm.Spec.Version + } + if *version == "" { + image = baseImage + } else { + image = fmt.Sprintf("%s:%s", baseImage, *version) + } + } + return image +} diff --git a/pkg/apis/pingcap/v1alpha1/tidbngmonitoring_component.go b/pkg/apis/pingcap/v1alpha1/tidbngmonitoring_component.go new file mode 100644 index 0000000000..9b1d9bf757 --- /dev/null +++ b/pkg/apis/pingcap/v1alpha1/tidbngmonitoring_component.go @@ -0,0 +1,47 @@ +// Copyright 2021 PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1alpha1 + +func (tngm *TidbNGMonitoring) BaseNGMonitoringSpec() ComponentAccessor { + return buildTiDBNGMonitoringComponentAccessor(ComponentNGMonitoring, tngm, &tngm.Spec.NGMonitoring.ComponentSpec) +} + +func buildTiDBNGMonitoringComponentAccessor(c Component, tngm *TidbNGMonitoring, componentSpec *ComponentSpec) ComponentAccessor { + commonSpec := tngm.Spec.ComponentSpec + impl := &componentAccessorImpl{ + name: tngm.GetName(), + kind: TiDBNGMonitoringKind, + component: c, + imagePullSecrets: commonSpec.ImagePullSecrets, + hostNetwork: commonSpec.HostNetwork, + affinity: commonSpec.Affinity, + priorityClassName: commonSpec.PriorityClassName, + clusterNodeSelector: commonSpec.NodeSelector, + clusterLabels: commonSpec.Labels, + clusterAnnotations: commonSpec.Annotations, + tolerations: commonSpec.Tolerations, + configUpdateStrategy: ConfigUpdateStrategyRollingUpdate, + podSecurityContext: commonSpec.PodSecurityContext, + topologySpreadConstraints: commonSpec.TopologySpreadConstraints, + + ComponentSpec: componentSpec, + } + if commonSpec.ImagePullPolicy != nil { + impl.imagePullPolicy = *commonSpec.ImagePullPolicy + } + if commonSpec.SchedulerName != nil { + impl.schedulerName = *commonSpec.SchedulerName + } + return impl +} diff --git a/pkg/apis/pingcap/v1alpha1/tidbngmonitoring_types.go b/pkg/apis/pingcap/v1alpha1/tidbngmonitoring_types.go new file mode 100644 index 0000000000..6f68f9c06c --- /dev/null +++ b/pkg/apis/pingcap/v1alpha1/tidbngmonitoring_types.go @@ -0,0 +1,125 @@ +// Copyright 2021 PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1alpha1 + +import ( + "github.com/pingcap/tidb-operator/pkg/apis/util/config" + apps "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// TidbNGMonitoring contains the spec and status of tidb ng monitor +// +// +genclient +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:shortName="tngm" +// +kubebuilder:subresource:status +type TidbNGMonitoring struct { + metav1.TypeMeta `json:",inline"` + + // +k8s:openapi-gen=false + metav1.ObjectMeta `json:"metadata"` + + // Spec contains all spec about tidb ng monitor + Spec TidbNGMonitoringSpec `json:"spec"` + + // Status is most recently observed status of tidb ng monitor + // + // +k8s:openapi-gen=false + Status TidbNGMonitoringStatus `json:"status,omitempty"` +} + +// TidbNGMonitoringList is TidbNGMonitoring list +// +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type TidbNGMonitoringList struct { + metav1.TypeMeta `json:",inline"` + + // +k8s:openapi-gen=false + metav1.ListMeta `json:"metadata"` + + Items []TidbNGMonitoring `json:"items"` +} + +// TidbNGMonitoringSpec is spec of tidb ng monitoring +// +// +k8s:openapi-gen=true +type TidbNGMonitoringSpec struct { + // ComponentSpec is common spec. + // NOTE: the same field will be overridden by component's spec. + ComponentSpec `json:",inline"` + + // Clusters reference TiDB cluster + // + // +kubebuilder:validation:MaxItems=1 + // +kubebuilder:validation:MinItems=1 + Clusters []TidbClusterRef `json:"clusters"` + + // Paused pause controller if it is true + Paused bool `json:"paused,omitempty"` + + // Persistent volume reclaim policy applied to the PVs that consumed by tidb ng monitoring + // + // +kubebuilder:default=Retain + PVReclaimPolicy *corev1.PersistentVolumeReclaimPolicy `json:"pvReclaimPolicy,omitempty"` + + // ClusterDomain is the Kubernetes Cluster Domain of tidb ng monitoring + ClusterDomain string `json:"clusterDomain,omitempty"` + + // NGMonitoring is spec of ng monitoring + NGMonitoring NGMonitoringSpec `json:"ngMonitoring"` +} + +// TidbNGMonitoringStatus is status of tidb ng monitoring +type TidbNGMonitoringStatus struct { + // NGMonitoring is status of ng monitoring + NGMonitoring NGMonitoringStatus `json:"ngMonitoring,omitempty"` +} + +// NGMonitoringSpec is spec of ng monitoring +// +// +k8s:openapi-gen=true +type NGMonitoringSpec struct { + ComponentSpec `json:",inline"` + corev1.ResourceRequirements `json:",inline"` + + // Base image of the component, image tag is now allowed during validation + // + // +kubebuilder:default=pingcap/ng-monitoring + BaseImage string `json:"baseImage,omitempty"` + + // StorageClassName is the persistent volume for ng monitoring. + // Defaults to Kubernetes default storage class. + StorageClassName *string `json:"storageClassName,omitempty"` + + // StorageVolumes configures additional storage for NG Monitoring pods. + StorageVolumes []StorageVolume `json:"storageVolumes,omitempty"` + + // Config is the configuration of ng monitoring + // + // +kubebuilder:validation:Schemaless + // +kubebuilder:validation:XPreserveUnknownFields + Config *config.GenericConfig `json:"config,omitempty"` +} + +// NGMonitoringStatus is latest status of ng monitoring +type NGMonitoringStatus struct { + Synced bool `json:"synced,omitempty"` + Phase MemberPhase `json:"phase,omitempty"` + + StatefulSet *apps.StatefulSetStatus `json:"statefulSet,omitempty"` +} diff --git a/pkg/apis/pingcap/v1alpha1/types.go b/pkg/apis/pingcap/v1alpha1/types.go index 55c18a13f2..58fbe14457 100644 --- a/pkg/apis/pingcap/v1alpha1/types.go +++ b/pkg/apis/pingcap/v1alpha1/types.go @@ -74,6 +74,8 @@ const ( RaftLogTailerMemberType MemberType = "raftlog" // TidbMonitorMemberType is tidbmonitor type TidbMonitorMemberType MemberType = "tidbmonitor" + // NGMonitoringMemberType is ng monitoring type + NGMonitoringMemberType MemberType = "ng-monitoring" // UnknownMemberType is unknown container type UnknownMemberType MemberType = "unknown" ) diff --git a/pkg/apis/pingcap/v1alpha1/validation/validation.go b/pkg/apis/pingcap/v1alpha1/validation/validation.go index a4f16606f1..fee33cce10 100644 --- a/pkg/apis/pingcap/v1alpha1/validation/validation.go +++ b/pkg/apis/pingcap/v1alpha1/validation/validation.go @@ -62,6 +62,15 @@ func ValidateDMCluster(dc *v1alpha1.DMCluster) field.ErrorList { return allErrs } +// ValidateTiDBNGMonitoring validates a TidbNGMonitoring +func ValidateTiDBNGMonitoring(tngm *v1alpha1.TidbNGMonitoring) field.ErrorList { + allErrs := field.ErrorList{} + + allErrs = append(allErrs, validateTidbNGMonitorinSpec(&tngm.Spec, field.NewPath("spec"))...) + + return allErrs +} + func ValidateTidbMonitor(monitor *v1alpha1.TidbMonitor) field.ErrorList { allErrs := field.ErrorList{} // validate monitor service @@ -309,6 +318,29 @@ func validateWorkerSpec(spec *v1alpha1.WorkerSpec, fldPath *field.Path) field.Er return allErrs } +func validateTidbNGMonitorinSpec(spec *v1alpha1.TidbNGMonitoringSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + if len(spec.Clusters) < 1 { + allErrs = append(allErrs, field.Invalid(fldPath.Child("clusters"), len(spec.Clusters), "must have at least one item")) + } + allErrs = append(allErrs, validateComponentSpec(&spec.ComponentSpec, fldPath)...) + allErrs = append(allErrs, validateNGMonitoringSpec(&spec.NGMonitoring, fldPath.Child("ngMonitoring"))...) + + return allErrs +} + +func validateNGMonitoringSpec(spec *v1alpha1.NGMonitoringSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + allErrs = append(allErrs, validateComponentSpec(&spec.ComponentSpec, fldPath)...) + if len(spec.StorageVolumes) > 0 { + allErrs = append(allErrs, validateStorageVolumes(spec.StorageVolumes, fldPath.Child("storageVolumes"))...) + } + + return allErrs +} + func validateComponentSpec(spec *v1alpha1.ComponentSpec, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} // TODO validate other fields diff --git a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go index 42ccb04153..a5e65dde69 100644 --- a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go @@ -979,6 +979,7 @@ func (in *CrdKinds) DeepCopyInto(out *CrdKinds) { in.TiDBMonitor.DeepCopyInto(&out.TiDBMonitor) in.TiDBInitializer.DeepCopyInto(&out.TiDBInitializer) in.TidbClusterAutoScaler.DeepCopyInto(&out.TidbClusterAutoScaler) + in.TiDBNGMonitoring.DeepCopyInto(&out.TiDBNGMonitoring) return } @@ -2607,6 +2608,61 @@ func (in *MonitorContainer) DeepCopy() *MonitorContainer { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NGMonitoringSpec) DeepCopyInto(out *NGMonitoringSpec) { + *out = *in + in.ComponentSpec.DeepCopyInto(&out.ComponentSpec) + in.ResourceRequirements.DeepCopyInto(&out.ResourceRequirements) + if in.StorageClassName != nil { + in, out := &in.StorageClassName, &out.StorageClassName + *out = new(string) + **out = **in + } + if in.StorageVolumes != nil { + in, out := &in.StorageVolumes, &out.StorageVolumes + *out = make([]StorageVolume, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Config != nil { + in, out := &in.Config, &out.Config + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NGMonitoringSpec. +func (in *NGMonitoringSpec) DeepCopy() *NGMonitoringSpec { + if in == nil { + return nil + } + out := new(NGMonitoringSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NGMonitoringStatus) DeepCopyInto(out *NGMonitoringStatus) { + *out = *in + if in.StatefulSet != nil { + in, out := &in.StatefulSet, &out.StatefulSet + *out = new(appsv1.StatefulSetStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NGMonitoringStatus. +func (in *NGMonitoringStatus) DeepCopy() *NGMonitoringStatus { + if in == nil { + return nil + } + out := new(NGMonitoringStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Networks) DeepCopyInto(out *Networks) { *out = *in @@ -8681,6 +8737,112 @@ func (in *TidbMonitorStatus) DeepCopy() *TidbMonitorStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TidbNGMonitoring) DeepCopyInto(out *TidbNGMonitoring) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TidbNGMonitoring. +func (in *TidbNGMonitoring) DeepCopy() *TidbNGMonitoring { + if in == nil { + return nil + } + out := new(TidbNGMonitoring) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TidbNGMonitoring) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TidbNGMonitoringList) DeepCopyInto(out *TidbNGMonitoringList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TidbNGMonitoring, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TidbNGMonitoringList. +func (in *TidbNGMonitoringList) DeepCopy() *TidbNGMonitoringList { + if in == nil { + return nil + } + out := new(TidbNGMonitoringList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TidbNGMonitoringList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TidbNGMonitoringSpec) DeepCopyInto(out *TidbNGMonitoringSpec) { + *out = *in + in.ComponentSpec.DeepCopyInto(&out.ComponentSpec) + if in.Clusters != nil { + in, out := &in.Clusters, &out.Clusters + *out = make([]TidbClusterRef, len(*in)) + copy(*out, *in) + } + if in.PVReclaimPolicy != nil { + in, out := &in.PVReclaimPolicy, &out.PVReclaimPolicy + *out = new(v1.PersistentVolumeReclaimPolicy) + **out = **in + } + in.NGMonitoring.DeepCopyInto(&out.NGMonitoring) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TidbNGMonitoringSpec. +func (in *TidbNGMonitoringSpec) DeepCopy() *TidbNGMonitoringSpec { + if in == nil { + return nil + } + out := new(TidbNGMonitoringSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TidbNGMonitoringStatus) DeepCopyInto(out *TidbNGMonitoringStatus) { + *out = *in + in.NGMonitoring.DeepCopyInto(&out.NGMonitoring) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TidbNGMonitoringStatus. +func (in *TidbNGMonitoringStatus) DeepCopy() *TidbNGMonitoringStatus { + if in == nil { + return nil + } + out := new(TidbNGMonitoringStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TikvAutoScalerSpec) DeepCopyInto(out *TikvAutoScalerSpec) { *out = *in diff --git a/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/fake/fake_pingcap_client.go b/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/fake/fake_pingcap_client.go index 9b1b6ce0da..1e5dfbc8c7 100644 --- a/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/fake/fake_pingcap_client.go +++ b/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/fake/fake_pingcap_client.go @@ -61,6 +61,10 @@ func (c *FakePingcapV1alpha1) TidbMonitors(namespace string) v1alpha1.TidbMonito return &FakeTidbMonitors{c, namespace} } +func (c *FakePingcapV1alpha1) TidbNGMonitorings(namespace string) v1alpha1.TidbNGMonitoringInterface { + return &FakeTidbNGMonitorings{c, namespace} +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakePingcapV1alpha1) RESTClient() rest.Interface { diff --git a/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/fake/fake_tidbngmonitoring.go b/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/fake/fake_tidbngmonitoring.go new file mode 100644 index 0000000000..3d71363003 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/fake/fake_tidbngmonitoring.go @@ -0,0 +1,139 @@ +// Copyright PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeTidbNGMonitorings implements TidbNGMonitoringInterface +type FakeTidbNGMonitorings struct { + Fake *FakePingcapV1alpha1 + ns string +} + +var tidbngmonitoringsResource = schema.GroupVersionResource{Group: "pingcap.com", Version: "v1alpha1", Resource: "tidbngmonitorings"} + +var tidbngmonitoringsKind = schema.GroupVersionKind{Group: "pingcap.com", Version: "v1alpha1", Kind: "TidbNGMonitoring"} + +// Get takes name of the tidbNGMonitoring, and returns the corresponding tidbNGMonitoring object, and an error if there is any. +func (c *FakeTidbNGMonitorings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TidbNGMonitoring, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(tidbngmonitoringsResource, c.ns, name), &v1alpha1.TidbNGMonitoring{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.TidbNGMonitoring), err +} + +// List takes label and field selectors, and returns the list of TidbNGMonitorings that match those selectors. +func (c *FakeTidbNGMonitorings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TidbNGMonitoringList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(tidbngmonitoringsResource, tidbngmonitoringsKind, c.ns, opts), &v1alpha1.TidbNGMonitoringList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.TidbNGMonitoringList{ListMeta: obj.(*v1alpha1.TidbNGMonitoringList).ListMeta} + for _, item := range obj.(*v1alpha1.TidbNGMonitoringList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested tidbNGMonitorings. +func (c *FakeTidbNGMonitorings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(tidbngmonitoringsResource, c.ns, opts)) + +} + +// Create takes the representation of a tidbNGMonitoring and creates it. Returns the server's representation of the tidbNGMonitoring, and an error, if there is any. +func (c *FakeTidbNGMonitorings) Create(ctx context.Context, tidbNGMonitoring *v1alpha1.TidbNGMonitoring, opts v1.CreateOptions) (result *v1alpha1.TidbNGMonitoring, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(tidbngmonitoringsResource, c.ns, tidbNGMonitoring), &v1alpha1.TidbNGMonitoring{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.TidbNGMonitoring), err +} + +// Update takes the representation of a tidbNGMonitoring and updates it. Returns the server's representation of the tidbNGMonitoring, and an error, if there is any. +func (c *FakeTidbNGMonitorings) Update(ctx context.Context, tidbNGMonitoring *v1alpha1.TidbNGMonitoring, opts v1.UpdateOptions) (result *v1alpha1.TidbNGMonitoring, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(tidbngmonitoringsResource, c.ns, tidbNGMonitoring), &v1alpha1.TidbNGMonitoring{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.TidbNGMonitoring), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeTidbNGMonitorings) UpdateStatus(ctx context.Context, tidbNGMonitoring *v1alpha1.TidbNGMonitoring, opts v1.UpdateOptions) (*v1alpha1.TidbNGMonitoring, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(tidbngmonitoringsResource, "status", c.ns, tidbNGMonitoring), &v1alpha1.TidbNGMonitoring{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.TidbNGMonitoring), err +} + +// Delete takes name of the tidbNGMonitoring and deletes it. Returns an error if one occurs. +func (c *FakeTidbNGMonitorings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(tidbngmonitoringsResource, c.ns, name), &v1alpha1.TidbNGMonitoring{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeTidbNGMonitorings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(tidbngmonitoringsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.TidbNGMonitoringList{}) + return err +} + +// Patch applies the patch and returns the patched tidbNGMonitoring. +func (c *FakeTidbNGMonitorings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TidbNGMonitoring, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(tidbngmonitoringsResource, c.ns, name, pt, data, subresources...), &v1alpha1.TidbNGMonitoring{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.TidbNGMonitoring), err +} diff --git a/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/generated_expansion.go index 5615cd2462..3682b0f785 100644 --- a/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/generated_expansion.go @@ -32,3 +32,5 @@ type TidbClusterAutoScalerExpansion interface{} type TidbInitializerExpansion interface{} type TidbMonitorExpansion interface{} + +type TidbNGMonitoringExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/pingcap_client.go b/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/pingcap_client.go index 5f002baf64..cbad91e845 100644 --- a/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/pingcap_client.go +++ b/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/pingcap_client.go @@ -32,6 +32,7 @@ type PingcapV1alpha1Interface interface { TidbClusterAutoScalersGetter TidbInitializersGetter TidbMonitorsGetter + TidbNGMonitoringsGetter } // PingcapV1alpha1Client is used to interact with features provided by the pingcap.com group. @@ -75,6 +76,10 @@ func (c *PingcapV1alpha1Client) TidbMonitors(namespace string) TidbMonitorInterf return newTidbMonitors(c, namespace) } +func (c *PingcapV1alpha1Client) TidbNGMonitorings(namespace string) TidbNGMonitoringInterface { + return newTidbNGMonitorings(c, namespace) +} + // NewForConfig creates a new PingcapV1alpha1Client for the given config. func NewForConfig(c *rest.Config) (*PingcapV1alpha1Client, error) { config := *c diff --git a/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/tidbngmonitoring.go b/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/tidbngmonitoring.go new file mode 100644 index 0000000000..10fb448b0d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pingcap/v1alpha1/tidbngmonitoring.go @@ -0,0 +1,192 @@ +// Copyright PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" + scheme "github.com/pingcap/tidb-operator/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// TidbNGMonitoringsGetter has a method to return a TidbNGMonitoringInterface. +// A group's client should implement this interface. +type TidbNGMonitoringsGetter interface { + TidbNGMonitorings(namespace string) TidbNGMonitoringInterface +} + +// TidbNGMonitoringInterface has methods to work with TidbNGMonitoring resources. +type TidbNGMonitoringInterface interface { + Create(ctx context.Context, tidbNGMonitoring *v1alpha1.TidbNGMonitoring, opts v1.CreateOptions) (*v1alpha1.TidbNGMonitoring, error) + Update(ctx context.Context, tidbNGMonitoring *v1alpha1.TidbNGMonitoring, opts v1.UpdateOptions) (*v1alpha1.TidbNGMonitoring, error) + UpdateStatus(ctx context.Context, tidbNGMonitoring *v1alpha1.TidbNGMonitoring, opts v1.UpdateOptions) (*v1alpha1.TidbNGMonitoring, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.TidbNGMonitoring, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TidbNGMonitoringList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TidbNGMonitoring, err error) + TidbNGMonitoringExpansion +} + +// tidbNGMonitorings implements TidbNGMonitoringInterface +type tidbNGMonitorings struct { + client rest.Interface + ns string +} + +// newTidbNGMonitorings returns a TidbNGMonitorings +func newTidbNGMonitorings(c *PingcapV1alpha1Client, namespace string) *tidbNGMonitorings { + return &tidbNGMonitorings{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the tidbNGMonitoring, and returns the corresponding tidbNGMonitoring object, and an error if there is any. +func (c *tidbNGMonitorings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TidbNGMonitoring, err error) { + result = &v1alpha1.TidbNGMonitoring{} + err = c.client.Get(). + Namespace(c.ns). + Resource("tidbngmonitorings"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of TidbNGMonitorings that match those selectors. +func (c *tidbNGMonitorings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TidbNGMonitoringList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.TidbNGMonitoringList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("tidbngmonitorings"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested tidbNGMonitorings. +func (c *tidbNGMonitorings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("tidbngmonitorings"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a tidbNGMonitoring and creates it. Returns the server's representation of the tidbNGMonitoring, and an error, if there is any. +func (c *tidbNGMonitorings) Create(ctx context.Context, tidbNGMonitoring *v1alpha1.TidbNGMonitoring, opts v1.CreateOptions) (result *v1alpha1.TidbNGMonitoring, err error) { + result = &v1alpha1.TidbNGMonitoring{} + err = c.client.Post(). + Namespace(c.ns). + Resource("tidbngmonitorings"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(tidbNGMonitoring). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a tidbNGMonitoring and updates it. Returns the server's representation of the tidbNGMonitoring, and an error, if there is any. +func (c *tidbNGMonitorings) Update(ctx context.Context, tidbNGMonitoring *v1alpha1.TidbNGMonitoring, opts v1.UpdateOptions) (result *v1alpha1.TidbNGMonitoring, err error) { + result = &v1alpha1.TidbNGMonitoring{} + err = c.client.Put(). + Namespace(c.ns). + Resource("tidbngmonitorings"). + Name(tidbNGMonitoring.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(tidbNGMonitoring). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *tidbNGMonitorings) UpdateStatus(ctx context.Context, tidbNGMonitoring *v1alpha1.TidbNGMonitoring, opts v1.UpdateOptions) (result *v1alpha1.TidbNGMonitoring, err error) { + result = &v1alpha1.TidbNGMonitoring{} + err = c.client.Put(). + Namespace(c.ns). + Resource("tidbngmonitorings"). + Name(tidbNGMonitoring.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(tidbNGMonitoring). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the tidbNGMonitoring and deletes it. Returns an error if one occurs. +func (c *tidbNGMonitorings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("tidbngmonitorings"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *tidbNGMonitorings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("tidbngmonitorings"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched tidbNGMonitoring. +func (c *tidbNGMonitorings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TidbNGMonitoring, err error) { + result = &v1alpha1.TidbNGMonitoring{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("tidbngmonitorings"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 768801e8b7..b782237010 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -68,6 +68,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Pingcap().V1alpha1().TidbInitializers().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("tidbmonitors"): return &genericInformer{resource: resource.GroupResource(), informer: f.Pingcap().V1alpha1().TidbMonitors().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("tidbngmonitorings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Pingcap().V1alpha1().TidbNGMonitorings().Informer()}, nil } diff --git a/pkg/client/informers/externalversions/pingcap/v1alpha1/interface.go b/pkg/client/informers/externalversions/pingcap/v1alpha1/interface.go index a6f82de153..55e62f9461 100644 --- a/pkg/client/informers/externalversions/pingcap/v1alpha1/interface.go +++ b/pkg/client/informers/externalversions/pingcap/v1alpha1/interface.go @@ -39,6 +39,8 @@ type Interface interface { TidbInitializers() TidbInitializerInformer // TidbMonitors returns a TidbMonitorInformer. TidbMonitors() TidbMonitorInformer + // TidbNGMonitorings returns a TidbNGMonitoringInformer. + TidbNGMonitorings() TidbNGMonitoringInformer } type version struct { @@ -96,3 +98,8 @@ func (v *version) TidbInitializers() TidbInitializerInformer { func (v *version) TidbMonitors() TidbMonitorInformer { return &tidbMonitorInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } + +// TidbNGMonitorings returns a TidbNGMonitoringInformer. +func (v *version) TidbNGMonitorings() TidbNGMonitoringInformer { + return &tidbNGMonitoringInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/pingcap/v1alpha1/tidbngmonitoring.go b/pkg/client/informers/externalversions/pingcap/v1alpha1/tidbngmonitoring.go new file mode 100644 index 0000000000..6580140a5d --- /dev/null +++ b/pkg/client/informers/externalversions/pingcap/v1alpha1/tidbngmonitoring.go @@ -0,0 +1,87 @@ +// Copyright PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + pingcapv1alpha1 "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" + versioned "github.com/pingcap/tidb-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/pingcap/tidb-operator/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/pingcap/tidb-operator/pkg/client/listers/pingcap/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// TidbNGMonitoringInformer provides access to a shared informer and lister for +// TidbNGMonitorings. +type TidbNGMonitoringInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.TidbNGMonitoringLister +} + +type tidbNGMonitoringInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewTidbNGMonitoringInformer constructs a new informer for TidbNGMonitoring type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTidbNGMonitoringInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredTidbNGMonitoringInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredTidbNGMonitoringInformer constructs a new informer for TidbNGMonitoring type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredTidbNGMonitoringInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PingcapV1alpha1().TidbNGMonitorings(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PingcapV1alpha1().TidbNGMonitorings(namespace).Watch(context.TODO(), options) + }, + }, + &pingcapv1alpha1.TidbNGMonitoring{}, + resyncPeriod, + indexers, + ) +} + +func (f *tidbNGMonitoringInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredTidbNGMonitoringInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *tidbNGMonitoringInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&pingcapv1alpha1.TidbNGMonitoring{}, f.defaultInformer) +} + +func (f *tidbNGMonitoringInformer) Lister() v1alpha1.TidbNGMonitoringLister { + return v1alpha1.NewTidbNGMonitoringLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/listers/pingcap/v1alpha1/expansion_generated.go b/pkg/client/listers/pingcap/v1alpha1/expansion_generated.go index a3399796f9..c1b495df0f 100644 --- a/pkg/client/listers/pingcap/v1alpha1/expansion_generated.go +++ b/pkg/client/listers/pingcap/v1alpha1/expansion_generated.go @@ -86,3 +86,11 @@ type TidbMonitorListerExpansion interface{} // TidbMonitorNamespaceListerExpansion allows custom methods to be added to // TidbMonitorNamespaceLister. type TidbMonitorNamespaceListerExpansion interface{} + +// TidbNGMonitoringListerExpansion allows custom methods to be added to +// TidbNGMonitoringLister. +type TidbNGMonitoringListerExpansion interface{} + +// TidbNGMonitoringNamespaceListerExpansion allows custom methods to be added to +// TidbNGMonitoringNamespaceLister. +type TidbNGMonitoringNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/pingcap/v1alpha1/tidbngmonitoring.go b/pkg/client/listers/pingcap/v1alpha1/tidbngmonitoring.go new file mode 100644 index 0000000000..2e846157b9 --- /dev/null +++ b/pkg/client/listers/pingcap/v1alpha1/tidbngmonitoring.go @@ -0,0 +1,96 @@ +// Copyright PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// TidbNGMonitoringLister helps list TidbNGMonitorings. +// All objects returned here must be treated as read-only. +type TidbNGMonitoringLister interface { + // List lists all TidbNGMonitorings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.TidbNGMonitoring, err error) + // TidbNGMonitorings returns an object that can list and get TidbNGMonitorings. + TidbNGMonitorings(namespace string) TidbNGMonitoringNamespaceLister + TidbNGMonitoringListerExpansion +} + +// tidbNGMonitoringLister implements the TidbNGMonitoringLister interface. +type tidbNGMonitoringLister struct { + indexer cache.Indexer +} + +// NewTidbNGMonitoringLister returns a new TidbNGMonitoringLister. +func NewTidbNGMonitoringLister(indexer cache.Indexer) TidbNGMonitoringLister { + return &tidbNGMonitoringLister{indexer: indexer} +} + +// List lists all TidbNGMonitorings in the indexer. +func (s *tidbNGMonitoringLister) List(selector labels.Selector) (ret []*v1alpha1.TidbNGMonitoring, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.TidbNGMonitoring)) + }) + return ret, err +} + +// TidbNGMonitorings returns an object that can list and get TidbNGMonitorings. +func (s *tidbNGMonitoringLister) TidbNGMonitorings(namespace string) TidbNGMonitoringNamespaceLister { + return tidbNGMonitoringNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// TidbNGMonitoringNamespaceLister helps list and get TidbNGMonitorings. +// All objects returned here must be treated as read-only. +type TidbNGMonitoringNamespaceLister interface { + // List lists all TidbNGMonitorings in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.TidbNGMonitoring, err error) + // Get retrieves the TidbNGMonitoring from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.TidbNGMonitoring, error) + TidbNGMonitoringNamespaceListerExpansion +} + +// tidbNGMonitoringNamespaceLister implements the TidbNGMonitoringNamespaceLister +// interface. +type tidbNGMonitoringNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all TidbNGMonitorings in the indexer for a given namespace. +func (s tidbNGMonitoringNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.TidbNGMonitoring, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.TidbNGMonitoring)) + }) + return ret, err +} + +// Get retrieves the TidbNGMonitoring from the indexer for a given namespace and name. +func (s tidbNGMonitoringNamespaceLister) Get(name string) (*v1alpha1.TidbNGMonitoring, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("tidbngmonitoring"), name) + } + return obj.(*v1alpha1.TidbNGMonitoring), nil +} diff --git a/pkg/controller/controller_utils.go b/pkg/controller/controller_utils.go index 5440651f08..21d570e5bf 100644 --- a/pkg/controller/controller_utils.go +++ b/pkg/controller/controller_utils.go @@ -57,6 +57,9 @@ var ( // tidbClusterAutoScalerKind cotnains the schema.GroupVersionKind for TidbClusterAutoScaler controller type. tidbClusterAutoScalerKind = v1alpha1.SchemeGroupVersion.WithKind("TidbClusterAutoScaler") + + // tidbNGMonitoringKind cotnains the schema.GroupVersionKind for TidbNGMonitoring controller type. + tidbNGMonitoringKind = v1alpha1.SchemeGroupVersion.WithKind("TidbNGMonitoring") ) // RequeueError is used to requeue the item, this error type should't be considered as a real error @@ -195,6 +198,19 @@ func GetTiDBClusterAutoScalerOwnerRef(tac *v1alpha1.TidbClusterAutoScaler) metav } } +func GetTiDBNGMonitoringOwnerRef(tngm *v1alpha1.TidbNGMonitoring) metav1.OwnerReference { + controller := true + blockOwnerDeletion := true + return metav1.OwnerReference{ + APIVersion: tidbNGMonitoringKind.GroupVersion().String(), + Kind: tidbNGMonitoringKind.Kind, + Name: tngm.GetName(), + UID: tngm.GetUID(), + Controller: &controller, + BlockOwnerDeletion: &blockOwnerDeletion, + } +} + // GetServiceType returns member's service type func GetServiceType(services []v1alpha1.Service, serviceName string) corev1.ServiceType { for _, svc := range services { diff --git a/pkg/controller/dependences.go b/pkg/controller/dependences.go index 6e648341e0..f8c24ea9a1 100644 --- a/pkg/controller/dependences.go +++ b/pkg/controller/dependences.go @@ -216,6 +216,7 @@ type Dependencies struct { BackupScheduleLister listers.BackupScheduleLister TiDBInitializerLister listers.TidbInitializerLister TiDBMonitorLister listers.TidbMonitorLister + TiDBNGMonitoringLister listers.TidbNGMonitoringLister // Controls Controls @@ -348,6 +349,7 @@ func newDependencies( BackupScheduleLister: informerFactory.Pingcap().V1alpha1().BackupSchedules().Lister(), TiDBInitializerLister: informerFactory.Pingcap().V1alpha1().TidbInitializers().Lister(), TiDBMonitorLister: informerFactory.Pingcap().V1alpha1().TidbMonitors().Lister(), + TiDBNGMonitoringLister: informerFactory.Pingcap().V1alpha1().TidbNGMonitorings().Lister(), }, nil } diff --git a/pkg/controller/tidbngmonitoring/tidb_ng_monitoring_control.go b/pkg/controller/tidbngmonitoring/tidb_ng_monitoring_control.go new file mode 100644 index 0000000000..8791234d0b --- /dev/null +++ b/pkg/controller/tidbngmonitoring/tidb_ng_monitoring_control.go @@ -0,0 +1,164 @@ +// Copyright 2021 PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +package tidbngmonitoring + +import ( + "context" + "fmt" + + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" + v1alpha1validation "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1/validation" + "github.com/pingcap/tidb-operator/pkg/controller" + "github.com/pingcap/tidb-operator/pkg/manager" + + v1 "k8s.io/api/core/v1" + apiequality "k8s.io/apimachinery/pkg/api/equality" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + errorutils "k8s.io/apimachinery/pkg/util/errors" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/client-go/tools/record" + "k8s.io/client-go/util/retry" + "k8s.io/klog" +) + +type ReclaimPolicyManager interface { + SyncTiDBNGMonitoring(monitor *v1alpha1.TidbNGMonitoring) error +} + +// ControlInterface provide function about control TidbNGMonitoring +type ControlInterface interface { + // Reconcile a TidbNGMonitoring + Reconcile(*v1alpha1.TidbNGMonitoring) error + + // Update a TidbNGMonitoring + Update(*v1alpha1.TidbNGMonitoring) (*v1alpha1.TidbNGMonitoring, error) +} + +func NewDefaultTiDBNGMonitoringControl( + deps *controller.Dependencies, + ngmMnger manager.TiDBNGMonitoringManager, + reclaimPolicyManager ReclaimPolicyManager, + recorder record.EventRecorder, +) ControlInterface { + + return &defaultTiDBNGMonitoringControl{ + deps: deps, + recorder: recorder, + ngmMnger: ngmMnger, + reclaimPolicyManager: reclaimPolicyManager, + } +} + +type defaultTiDBNGMonitoringControl struct { + deps *controller.Dependencies + recorder record.EventRecorder + + ngmMnger manager.TiDBNGMonitoringManager + reclaimPolicyManager ReclaimPolicyManager +} + +func (c *defaultTiDBNGMonitoringControl) Reconcile(tngm *v1alpha1.TidbNGMonitoring) error { + if !c.validate(tngm) { + return nil // fatal error, no need to retry on invalid object + } + + var errs []error + + oldStatus := tngm.Status.DeepCopy() + + // reconcile + err := c.reconcile(tngm) + if err != nil { + errs = append(errs, err) + } + + if apiequality.Semantic.DeepEqual(&tngm.Status, oldStatus) { + return errorutils.NewAggregate(errs) + } + + // update resource + _, err = c.Update(tngm.DeepCopy()) + if err != nil { + errs = append(errs, err) + } + + return errorutils.NewAggregate(errs) +} + +func (c *defaultTiDBNGMonitoringControl) reconcile(tngm *v1alpha1.TidbNGMonitoring) error { + if tngm.DeletionTimestamp != nil { + return nil + } + + // reoncile reclaim policy of pvc + err := c.reclaimPolicyManager.SyncTiDBNGMonitoring(tngm) + if err != nil { + return err + } + + // reconcile ng monitoring + err = c.ngmMnger.Sync(tngm) + if err != nil { + return err + } + + return nil +} + +func (c *defaultTiDBNGMonitoringControl) Update(tngm *v1alpha1.TidbNGMonitoring) (*v1alpha1.TidbNGMonitoring, error) { + var ( + ns string = tngm.GetNamespace() + name string = tngm.GetName() + status *v1alpha1.TidbNGMonitoringStatus = tngm.Status.DeepCopy() + update *v1alpha1.TidbNGMonitoring + ) + + // don't wait due to limited number of clients, but backoff after the default number of steps + err := retry.RetryOnConflict(retry.DefaultRetry, func() error { + var updateErr error + + update, updateErr = c.deps.Clientset.PingcapV1alpha1().TidbNGMonitorings(ns).UpdateStatus(context.TODO(), tngm, metav1.UpdateOptions{}) + if updateErr == nil { + klog.Infof("TidbNGMonitoring: [%s/%s] updated successfully", ns, name) + return nil + } + + klog.V(4).Infof("failed to update TidbNGMonitoring: [%s/%s], error: %v", ns, name, updateErr) + + if updated, err := c.deps.TiDBNGMonitoringLister.TidbNGMonitorings(ns).Get(name); err == nil { + // make a copy so we don't mutate the shared cache + tngm = updated.DeepCopy() + tngm.Status = *status + } else { + utilruntime.HandleError(fmt.Errorf("error getting updated TidbNGMonitoring %s/%s from lister: %v", ns, name, err)) + } + + return updateErr + }) + if err != nil { + klog.Errorf("failed to update TidbMonTiDBNGMonitoringitor: [%s/%s], error: %v", ns, name, err) + } + return update, err +} + +func (c *defaultTiDBNGMonitoringControl) validate(tngm *v1alpha1.TidbNGMonitoring) bool { + errs := v1alpha1validation.ValidateTiDBNGMonitoring(tngm) + if len(errs) > 0 { + aggregatedErr := errs.ToAggregate() + klog.Errorf("tidb ng monitoring %s/%s is not valid and must be fixed first, aggregated error: %v", tngm.GetNamespace(), tngm.GetName(), aggregatedErr) + c.recorder.Event(tngm, v1.EventTypeWarning, "FailedValidation", aggregatedErr.Error()) + return false + } + return true +} diff --git a/pkg/controller/tidbngmonitoring/tidb_ng_monitoring_controller.go b/pkg/controller/tidbngmonitoring/tidb_ng_monitoring_controller.go new file mode 100644 index 0000000000..48d42992e7 --- /dev/null +++ b/pkg/controller/tidbngmonitoring/tidb_ng_monitoring_controller.go @@ -0,0 +1,136 @@ +// Copyright 2021 PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +package tidbngmonitoring + +import ( + "fmt" + "time" + + "github.com/pingcap/tidb-operator/pkg/controller" + "github.com/pingcap/tidb-operator/pkg/manager/meta" + "github.com/pingcap/tidb-operator/pkg/manager/tidbngmonitoring" + + perrors "github.com/pingcap/errors" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/tools/cache" + "k8s.io/client-go/util/workqueue" + "k8s.io/klog" +) + +// Controller sync TidbNGMonitoring +type Controller struct { + deps *controller.Dependencies + control ControlInterface + queue workqueue.RateLimitingInterface +} + +func NewController(deps *controller.Dependencies) *Controller { + control := NewDefaultTiDBNGMonitoringControl( + deps, + tidbngmonitoring.NewNGMonitorManager(deps), + meta.NewReclaimPolicyManager(deps), + deps.Recorder, + ) + + c := &Controller{ + deps: deps, + control: control, + queue: workqueue.NewNamedRateLimitingQueue( + controller.NewControllerRateLimiter(1*time.Second, 100*time.Second), + "tidb-ng-monitoring", + ), + } + + tnmInformer := deps.InformerFactory.Pingcap().V1alpha1().TidbNGMonitorings() + stsInformer := deps.KubeInformerFactory.Apps().V1().StatefulSets() + controller.WatchForObject(tnmInformer.Informer(), c.queue) + controller.WatchForController( + stsInformer.Informer(), + c.queue, + func(ns, name string) (runtime.Object, error) { + return c.deps.TiDBNGMonitoringLister.TidbNGMonitorings(ns).Get(name) + }, + nil, + ) + + return c +} + +func (c *Controller) Run(workers int, stopCh <-chan struct{}) { + defer utilruntime.HandleCrash() + defer c.queue.ShutDown() + + klog.Info("Starting tidbngmonitor controller") + defer klog.Info("Shutting down tidbngmonitor controller") + + for i := 0; i < workers; i++ { + go wait.Until(c.worker, time.Second, stopCh) + } + + <-stopCh +} + +func (c *Controller) worker() { + for c.processNextWorkItem() { + } +} + +func (c *Controller) processNextWorkItem() bool { + keyIface, quit := c.queue.Get() + if quit { + return false + } + defer c.queue.Done(keyIface) + + key := keyIface.(string) + err := c.sync(key) + if err != nil { + if perrors.Find(err, controller.IsRequeueError) != nil { + klog.Infof("TidbNGMonitoring %v still need sync: %v, requeuing", key, err) + } else { + utilruntime.HandleError(fmt.Errorf("TidbNGMonitoring %v sync failed, err: %v", key, err)) + } + c.queue.AddRateLimited(key) + } else { + c.queue.Forget(err) + } + + return true +} + +func (c *Controller) sync(key string) error { + startTime := time.Now() + defer func() { + klog.V(4).Infof("Finished syncing TidbNGMonitoring %s (%v)", key, time.Since(startTime)) + }() + + ns, name, err := cache.SplitMetaNamespaceKey(key) + if err != nil { + return err + } + + tngm, err := c.deps.TiDBNGMonitoringLister.TidbNGMonitorings(ns).Get(name) + if errors.IsNotFound(err) { + klog.Infof("TidbNGMonitoring %s has been deleted", key) + return nil + } + if err != nil { + return err + } + + return c.control.Reconcile(tngm) +} diff --git a/pkg/manager/manager.go b/pkg/manager/manager.go index 2592b5a58a..63630db865 100644 --- a/pkg/manager/manager.go +++ b/pkg/manager/manager.go @@ -13,7 +13,9 @@ package manager -import "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" +import ( + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" +) // Manager implements the logic for syncing tidbcluster. type Manager interface { @@ -25,3 +27,7 @@ type DMManager interface { // Sync implements the logic for syncing dmcluster. SyncDM(*v1alpha1.DMCluster) error } + +type TiDBNGMonitoringManager interface { + Sync(*v1alpha1.TidbNGMonitoring) error +} diff --git a/pkg/manager/member/dm_master_member_manager.go b/pkg/manager/member/dm_master_member_manager.go index 712e860254..428e4a7a7f 100644 --- a/pkg/manager/member/dm_master_member_manager.go +++ b/pkg/manager/member/dm_master_member_manager.go @@ -23,6 +23,7 @@ import ( "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" "github.com/pingcap/tidb-operator/pkg/manager" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" "github.com/pingcap/tidb-operator/pkg/util" apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -193,7 +194,7 @@ func (m *masterMemberManager) syncMasterStatefulSetForDMCluster(dc *v1alpha1.DMC return err } if setNotExist { - err = SetStatefulSetLastAppliedConfigAnnotation(newMasterSet) + err = mngerutils.SetStatefulSetLastAppliedConfigAnnotation(newMasterSet) if err != nil { return err } @@ -207,8 +208,8 @@ func (m *masterMemberManager) syncMasterStatefulSetForDMCluster(dc *v1alpha1.DMC // Force update takes precedence over scaling because force upgrade won't take effect when cluster gets stuck at scaling if !dc.Status.Master.Synced && NeedForceUpgrade(dc.Annotations) { dc.Status.Master.Phase = v1alpha1.UpgradePhase - setUpgradePartition(newMasterSet, 0) - errSTS := UpdateStatefulSet(m.deps.StatefulSetControl, dc, newMasterSet, oldMasterSet) + mngerutils.SetUpgradePartition(newMasterSet, 0) + errSTS := mngerutils.UpdateStatefulSet(m.deps.StatefulSetControl, dc, newMasterSet, oldMasterSet) return controller.RequeueErrorf("dmcluster: [%s/%s]'s dm-master needs force upgrade, %v", ns, dcName, errSTS) } @@ -240,7 +241,7 @@ func (m *masterMemberManager) syncMasterStatefulSetForDMCluster(dc *v1alpha1.DMC } } - return UpdateStatefulSet(m.deps.StatefulSetControl, dc, newMasterSet, oldMasterSet) + return mngerutils.UpdateStatefulSet(m.deps.StatefulSetControl, dc, newMasterSet, oldMasterSet) } // shouldRecover checks whether we should perform recovery operation. @@ -466,7 +467,7 @@ func getNewMasterHeadlessServiceForDMCluster(dc *v1alpha1.DMCluster) *corev1.Ser } func (m *masterMemberManager) masterStatefulSetIsUpgrading(set *apps.StatefulSet, dc *v1alpha1.DMCluster) (bool, error) { - if statefulSetIsUpgrading(set) { + if mngerutils.StatefulSetIsUpgrading(set) { return true, nil } instanceName := dc.GetInstanceName() @@ -749,7 +750,7 @@ func getMasterConfigMap(dc *v1alpha1.DMCluster) (*corev1.ConfigMap, error) { }, } - if err := AddConfigMapDigestSuffix(cm); err != nil { + if err := mngerutils.AddConfigMapDigestSuffix(cm); err != nil { return nil, err } return cm, nil diff --git a/pkg/manager/member/dm_master_member_manager_test.go b/pkg/manager/member/dm_master_member_manager_test.go index aeec33857e..b5cdb1040d 100644 --- a/pkg/manager/member/dm_master_member_manager_test.go +++ b/pkg/manager/member/dm_master_member_manager_test.go @@ -25,6 +25,7 @@ import ( "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" "github.com/pingcap/tidb-operator/pkg/dmapi" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1" @@ -1345,7 +1346,7 @@ ssl-key = "/var/lib/dm-master-tls/tls.key" g.Expect(err).To(Succeed()) // startup-script is better to be tested in e2e tt.expected.Data["startup-script"] = cm.Data["startup-script"] - g.Expect(AddConfigMapDigestSuffix(tt.expected)).To(Succeed()) + g.Expect(mngerutils.AddConfigMapDigestSuffix(tt.expected)).To(Succeed()) if diff := cmp.Diff(*tt.expected, *cm); diff != "" { t.Errorf("unexpected plugin configuration (-want, +got): %s", diff) } diff --git a/pkg/manager/member/dm_master_upgrader.go b/pkg/manager/member/dm_master_upgrader.go index 0811b11015..41a3dbcc70 100644 --- a/pkg/manager/member/dm_master_upgrader.go +++ b/pkg/manager/member/dm_master_upgrader.go @@ -19,6 +19,8 @@ import ( "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" + apps "k8s.io/api/apps/v1" "k8s.io/klog" ) @@ -73,7 +75,7 @@ func (u *masterUpgrader) gracefulUpgrade(dc *v1alpha1.DMCluster, oldSet *apps.St return nil } - setUpgradePartition(newSet, *oldSet.Spec.UpdateStrategy.RollingUpdate.Partition) + mngerutils.SetUpgradePartition(newSet, *oldSet.Spec.UpdateStrategy.RollingUpdate.Partition) podOrdinals := helper.GetPodOrdinals(*oldSet.Spec.Replicas, oldSet).List() for _i := len(podOrdinals) - 1; _i >= 0; _i-- { i := podOrdinals[_i] @@ -96,7 +98,7 @@ func (u *masterUpgrader) gracefulUpgrade(dc *v1alpha1.DMCluster, oldSet *apps.St } //if controller.PodWebhookEnabled { - // setUpgradePartition(newSet, i) + // mngerutils.SetUpgradePartition(newSet, i) // return nil //} @@ -120,7 +122,7 @@ func (u *masterUpgrader) upgradeMasterPod(dc *v1alpha1.DMCluster, ordinal int32, return controller.RequeueErrorf("dmcluster: [%s/%s]'s dm-master member: evicting [%s]'s leader", ns, dcName, upgradePodName) } - setUpgradePartition(newSet, ordinal) + mngerutils.SetUpgradePartition(newSet, ordinal) return nil } diff --git a/pkg/manager/member/dm_master_upgrader_test.go b/pkg/manager/member/dm_master_upgrader_test.go index ed74e7b8cb..c3f07ec8ad 100644 --- a/pkg/manager/member/dm_master_upgrader_test.go +++ b/pkg/manager/member/dm_master_upgrader_test.go @@ -18,17 +18,17 @@ import ( "testing" "github.com/pingcap/tidb-operator/pkg/apis/label" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" + "github.com/pingcap/tidb-operator/pkg/controller" "github.com/pingcap/tidb-operator/pkg/dmapi" - podinformers "k8s.io/client-go/informers/core/v1" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" . "github.com/onsi/gomega" - "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" - "github.com/pingcap/tidb-operator/pkg/controller" apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + podinformers "k8s.io/client-go/informers/core/v1" "k8s.io/utils/pointer" ) @@ -79,7 +79,7 @@ func TestMasterUpgraderUpgrade(t *testing.T) { if test.changeOldSet != nil { test.changeOldSet(oldSet) } - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) newSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(3) diff --git a/pkg/manager/member/dm_worker_member_manager.go b/pkg/manager/member/dm_worker_member_manager.go index 22706d3291..11e72a1779 100644 --- a/pkg/manager/member/dm_worker_member_manager.go +++ b/pkg/manager/member/dm_worker_member_manager.go @@ -22,6 +22,7 @@ import ( "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" "github.com/pingcap/tidb-operator/pkg/manager" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" "github.com/pingcap/tidb-operator/pkg/util" apps "k8s.io/api/apps/v1" @@ -191,7 +192,7 @@ func (m *workerMemberManager) syncWorkerStatefulSetForDMCluster(dc *v1alpha1.DMC } if stsNotExist { - err = SetStatefulSetLastAppliedConfigAnnotation(newSts) + err = mngerutils.SetStatefulSetLastAppliedConfigAnnotation(newSts) if err != nil { return err } @@ -217,7 +218,7 @@ func (m *workerMemberManager) syncWorkerStatefulSetForDMCluster(dc *v1alpha1.DMC } } - return UpdateStatefulSet(m.deps.StatefulSetControl, dc, newSts, oldSts) + return mngerutils.UpdateStatefulSet(m.deps.StatefulSetControl, dc, newSts, oldSts) } func (m *workerMemberManager) syncDMClusterStatus(dc *v1alpha1.DMCluster, set *apps.StatefulSet) error { @@ -288,7 +289,7 @@ func (m *workerMemberManager) syncDMClusterStatus(dc *v1alpha1.DMCluster, set *a } func (m *workerMemberManager) workerStatefulSetIsUpgrading(set *apps.StatefulSet, dc *v1alpha1.DMCluster) (bool, error) { - if statefulSetIsUpgrading(set) { + if mngerutils.StatefulSetIsUpgrading(set) { return true, nil } instanceName := dc.GetInstanceName() @@ -556,7 +557,7 @@ func getWorkerConfigMap(dc *v1alpha1.DMCluster) (*corev1.ConfigMap, error) { }, } - if err := AddConfigMapDigestSuffix(cm); err != nil { + if err := mngerutils.AddConfigMapDigestSuffix(cm); err != nil { return nil, err } return cm, nil diff --git a/pkg/manager/member/dm_worker_member_manager_test.go b/pkg/manager/member/dm_worker_member_manager_test.go index 1147f17f2a..d5d94c83ab 100644 --- a/pkg/manager/member/dm_worker_member_manager_test.go +++ b/pkg/manager/member/dm_worker_member_manager_test.go @@ -20,14 +20,13 @@ import ( "testing" "github.com/pingcap/tidb-operator/pkg/apis/label" - - "github.com/google/go-cmp/cmp" - "k8s.io/apimachinery/pkg/util/intstr" - - . "github.com/onsi/gomega" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" "github.com/pingcap/tidb-operator/pkg/dmapi" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" + + "github.com/google/go-cmp/cmp" + . "github.com/onsi/gomega" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1" @@ -35,6 +34,7 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/client-go/tools/cache" "k8s.io/utils/pointer" "sigs.k8s.io/controller-runtime/pkg/client" @@ -654,7 +654,7 @@ func TestWorkerSyncConfigUpdate(t *testing.T) { g.Expect(r.listCm).To(Succeed()) g.Expect(r.cms).To(HaveLen(2)) g.Expect(r.getSet).To(Succeed()) - using := FindConfigMapVolume(&r.set.Spec.Template.Spec, func(name string) bool { + using := mngerutils.FindConfigMapVolume(&r.set.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, controller.DMWorkerMemberName("test")) }) g.Expect(using).NotTo(BeEmpty()) diff --git a/pkg/manager/member/pd_member_manager.go b/pkg/manager/member/pd_member_manager.go index 89fc00f9d6..0a7fe1ba1c 100644 --- a/pkg/manager/member/pd_member_manager.go +++ b/pkg/manager/member/pd_member_manager.go @@ -21,12 +21,14 @@ import ( "strconv" "strings" - "github.com/Masterminds/semver" "github.com/pingcap/tidb-operator/pkg/apis/label" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" "github.com/pingcap/tidb-operator/pkg/manager" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" "github.com/pingcap/tidb-operator/pkg/util" + + "github.com/Masterminds/semver" apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -202,7 +204,7 @@ func (m *pdMemberManager) syncPDStatefulSetForTidbCluster(tc *v1alpha1.TidbClust return err } if setNotExist { - err = SetStatefulSetLastAppliedConfigAnnotation(newPDSet) + err = mngerutils.SetStatefulSetLastAppliedConfigAnnotation(newPDSet) if err != nil { return err } @@ -216,8 +218,8 @@ func (m *pdMemberManager) syncPDStatefulSetForTidbCluster(tc *v1alpha1.TidbClust // Force update takes precedence over scaling because force upgrade won't take effect when cluster gets stuck at scaling if !tc.Status.PD.Synced && !templateEqual(newPDSet, oldPDSet) && (NeedForceUpgrade(tc.Annotations) || *oldPDSet.Spec.Replicas < 2) { tc.Status.PD.Phase = v1alpha1.UpgradePhase - setUpgradePartition(newPDSet, 0) - errSTS := UpdateStatefulSet(m.deps.StatefulSetControl, tc, newPDSet, oldPDSet) + mngerutils.SetUpgradePartition(newPDSet, 0) + errSTS := mngerutils.UpdateStatefulSet(m.deps.StatefulSetControl, tc, newPDSet, oldPDSet) return controller.RequeueErrorf("tidbcluster: [%s/%s]'s pd needs force upgrade, %v", ns, tcName, errSTS) } @@ -246,7 +248,7 @@ func (m *pdMemberManager) syncPDStatefulSetForTidbCluster(tc *v1alpha1.TidbClust } } - return UpdateStatefulSet(m.deps.StatefulSetControl, tc, newPDSet, oldPDSet) + return mngerutils.UpdateStatefulSet(m.deps.StatefulSetControl, tc, newPDSet, oldPDSet) } // shouldRecover checks whether we should perform recovery operation. @@ -414,12 +416,12 @@ func (m *pdMemberManager) syncPDConfigMap(tc *v1alpha1.TidbCluster, set *apps.St var inUseName string if set != nil { - inUseName = FindConfigMapVolume(&set.Spec.Template.Spec, func(name string) bool { + inUseName = mngerutils.FindConfigMapVolume(&set.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, controller.PDMemberName(tc.Name)) }) } - err = updateConfigMapIfNeed(m.deps.ConfigMapLister, tc.BasePDSpec().ConfigUpdateStrategy(), inUseName, newCm) + err = mngerutils.UpdateConfigMapIfNeed(m.deps.ConfigMapLister, tc.BasePDSpec().ConfigUpdateStrategy(), inUseName, newCm) if err != nil { return nil, err } @@ -508,7 +510,7 @@ func getNewPDHeadlessServiceForTidbCluster(tc *v1alpha1.TidbCluster) *corev1.Ser } func (m *pdMemberManager) pdStatefulSetIsUpgrading(set *apps.StatefulSet, tc *v1alpha1.TidbCluster) (bool, error) { - if statefulSetIsUpgrading(set) { + if mngerutils.StatefulSetIsUpgrading(set) { return true, nil } instanceName := tc.GetInstanceName() diff --git a/pkg/manager/member/pd_upgrader.go b/pkg/manager/member/pd_upgrader.go index d6c7b07cb0..703205d652 100644 --- a/pkg/manager/member/pd_upgrader.go +++ b/pkg/manager/member/pd_upgrader.go @@ -16,9 +16,11 @@ package member import ( "fmt" - "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" + + "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" apps "k8s.io/api/apps/v1" "k8s.io/klog" ) @@ -74,7 +76,7 @@ func (u *pdUpgrader) gracefulUpgrade(tc *v1alpha1.TidbCluster, oldSet *apps.Stat return nil } - setUpgradePartition(newSet, *oldSet.Spec.UpdateStrategy.RollingUpdate.Partition) + mngerutils.SetUpgradePartition(newSet, *oldSet.Spec.UpdateStrategy.RollingUpdate.Partition) podOrdinals := helper.GetPodOrdinals(*oldSet.Spec.Replicas, oldSet).List() for _i := len(podOrdinals) - 1; _i >= 0; _i-- { i := podOrdinals[_i] @@ -97,7 +99,7 @@ func (u *pdUpgrader) gracefulUpgrade(tc *v1alpha1.TidbCluster, oldSet *apps.Stat } if u.deps.CLIConfig.PodWebhookEnabled { - setUpgradePartition(newSet, i) + mngerutils.SetUpgradePartition(newSet, i) return nil } @@ -141,7 +143,7 @@ func (u *pdUpgrader) upgradePDPod(tc *v1alpha1.TidbCluster, ordinal int32, newSe return controller.RequeueErrorf("tidbcluster: [%s/%s]'s pd member: [%s] is transferring leader to pd member: [%s]", ns, tcName, upgradePdName, targetName) } } - setUpgradePartition(newSet, ordinal) + mngerutils.SetUpgradePartition(newSet, ordinal) return nil } diff --git a/pkg/manager/member/pd_upgrader_test.go b/pkg/manager/member/pd_upgrader_test.go index 6ca0fb0684..8839903b45 100644 --- a/pkg/manager/member/pd_upgrader_test.go +++ b/pkg/manager/member/pd_upgrader_test.go @@ -17,11 +17,13 @@ import ( "fmt" "testing" - . "github.com/onsi/gomega" "github.com/pingcap/tidb-operator/pkg/apis/label" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" "github.com/pingcap/tidb-operator/pkg/pdapi" + + . "github.com/onsi/gomega" apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -76,7 +78,7 @@ func TestPDUpgraderUpgrade(t *testing.T) { if test.changeOldSet != nil { test.changeOldSet(oldSet) } - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) newSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(3) diff --git a/pkg/manager/member/pump_member_manager.go b/pkg/manager/member/pump_member_manager.go index 9a000a8f64..0b9ede92eb 100644 --- a/pkg/manager/member/pump_member_manager.go +++ b/pkg/manager/member/pump_member_manager.go @@ -26,8 +26,10 @@ import ( "github.com/pingcap/tidb-operator/pkg/binlog" "github.com/pingcap/tidb-operator/pkg/controller" "github.com/pingcap/tidb-operator/pkg/manager" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" "github.com/pingcap/tidb-operator/pkg/pdapi" "github.com/pingcap/tidb-operator/pkg/util" + apps "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -102,7 +104,7 @@ func (m *pumpMemberManager) syncPumpStatefulSetForTidbCluster(tc *v1alpha1.TidbC return err } if notFound { - err = SetStatefulSetLastAppliedConfigAnnotation(newSet) + err = mngerutils.SetStatefulSetLastAppliedConfigAnnotation(newSet) if err != nil { return err } @@ -124,7 +126,7 @@ func (m *pumpMemberManager) syncPumpStatefulSetForTidbCluster(tc *v1alpha1.TidbC return nil } - return UpdateStatefulSet(m.deps.StatefulSetControl, tc, newSet, oldSet) + return mngerutils.UpdateStatefulSet(m.deps.StatefulSetControl, tc, newSet, oldSet) } func (p *pumpMemberManager) buildBinlogClient(tc *v1alpha1.TidbCluster, control pdapi.PDControlInterface) (client binlogClient, err error) { @@ -243,12 +245,12 @@ func (m *pumpMemberManager) syncConfigMap(tc *v1alpha1.TidbCluster, set *appsv1. var inUseName string if set != nil { - inUseName = FindConfigMapVolume(&set.Spec.Template.Spec, func(name string) bool { + inUseName = mngerutils.FindConfigMapVolume(&set.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, controller.PumpMemberName(tc.Name)) }) } - err = updateConfigMapIfNeed(m.deps.ConfigMapLister, basePumpSpec.ConfigUpdateStrategy(), inUseName, newCm) + err = mngerutils.UpdateConfigMapIfNeed(m.deps.ConfigMapLister, basePumpSpec.ConfigUpdateStrategy(), inUseName, newCm) if err != nil { return nil, err } @@ -533,7 +535,7 @@ func getPumpLogLevel(tc *v1alpha1.TidbCluster) string { } func (m *pumpMemberManager) pumpStatefulSetIsUpgrading(set *apps.StatefulSet, tc *v1alpha1.TidbCluster) (bool, error) { - if statefulSetIsUpgrading(set) { + if mngerutils.StatefulSetIsUpgrading(set) { return true, nil } selector, err := label.New(). diff --git a/pkg/manager/member/pump_member_manager_test.go b/pkg/manager/member/pump_member_manager_test.go index 081325194c..fee2dab9f5 100644 --- a/pkg/manager/member/pump_member_manager_test.go +++ b/pkg/manager/member/pump_member_manager_test.go @@ -19,11 +19,13 @@ import ( "strings" "testing" - "github.com/google/go-cmp/cmp" - . "github.com/onsi/gomega" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/apis/util/config" "github.com/pingcap/tidb-operator/pkg/controller" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" + + "github.com/google/go-cmp/cmp" + . "github.com/onsi/gomega" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -395,7 +397,7 @@ func TestSyncConfigUpdate(t *testing.T) { g.Expect(r.listCm).To(Succeed()) g.Expect(r.cms).To(HaveLen(2)) g.Expect(r.getSet).To(Succeed()) - using := FindConfigMapVolume(&r.set.Spec.Template.Spec, func(name string) bool { + using := mngerutils.FindConfigMapVolume(&r.set.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, controller.PumpMemberName("test")) }) g.Expect(using).NotTo(BeEmpty()) diff --git a/pkg/manager/member/ticdc_member_manager.go b/pkg/manager/member/ticdc_member_manager.go index 1538d6767e..600ee17c89 100644 --- a/pkg/manager/member/ticdc_member_manager.go +++ b/pkg/manager/member/ticdc_member_manager.go @@ -18,13 +18,15 @@ import ( "path" "strings" - "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" "github.com/pingcap/tidb-operator/pkg/apis/label" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" "github.com/pingcap/tidb-operator/pkg/manager" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" "github.com/pingcap/tidb-operator/pkg/pdapi" "github.com/pingcap/tidb-operator/pkg/util" + + "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -105,14 +107,14 @@ func (m *ticdcMemberManager) syncTiCDCConfigMap(tc *v1alpha1.TidbCluster, set *a var inUseName string if set != nil { - inUseName = FindConfigMapVolume(&set.Spec.Template.Spec, func(name string) bool { + inUseName = mngerutils.FindConfigMapVolume(&set.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, controller.TiCDCMemberName(tc.Name)) }) } klog.V(3).Info("get ticdc in use config map name: ", inUseName) - err = updateConfigMapIfNeed(m.deps.ConfigMapLister, tc.BaseTiCDCSpec().ConfigUpdateStrategy(), inUseName, newCm) + err = mngerutils.UpdateConfigMapIfNeed(m.deps.ConfigMapLister, tc.BaseTiCDCSpec().ConfigUpdateStrategy(), inUseName, newCm) if err != nil { return nil, err } @@ -171,7 +173,7 @@ func (m *ticdcMemberManager) syncStatefulSet(tc *v1alpha1.TidbCluster) error { klog.Infof("TidbCluster: %s/%s, waiting for PD cluster running", ns, tcName) return nil } - err = SetStatefulSetLastAppliedConfigAnnotation(newSts) + err = mngerutils.SetStatefulSetLastAppliedConfigAnnotation(newSts) if err != nil { return err } @@ -197,7 +199,7 @@ func (m *ticdcMemberManager) syncStatefulSet(tc *v1alpha1.TidbCluster) error { } } - return UpdateStatefulSet(m.deps.StatefulSetControl, tc, newSts, oldSts) + return mngerutils.UpdateStatefulSet(m.deps.StatefulSetControl, tc, newSts, oldSts) } func (m *ticdcMemberManager) syncTiCDCStatus(tc *v1alpha1.TidbCluster, sts *apps.StatefulSet) error { @@ -557,7 +559,7 @@ func labelTiCDC(tc *v1alpha1.TidbCluster) label.Label { } func ticdcStatefulSetIsUpgrading(podLister corelisters.PodLister, pdControl pdapi.PDControlInterface, set *apps.StatefulSet, tc *v1alpha1.TidbCluster) (bool, error) { - if statefulSetIsUpgrading(set) { + if mngerutils.StatefulSetIsUpgrading(set) { return true, nil } instanceName := tc.GetInstanceName() diff --git a/pkg/manager/member/ticdc_upgrader.go b/pkg/manager/member/ticdc_upgrader.go index da16d728cb..644c61743f 100644 --- a/pkg/manager/member/ticdc_upgrader.go +++ b/pkg/manager/member/ticdc_upgrader.go @@ -16,9 +16,11 @@ package member import ( "fmt" - "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" + + "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" apps "k8s.io/api/apps/v1" "k8s.io/klog" ) @@ -82,7 +84,7 @@ func (u *ticdcUpgrader) Upgrade(tc *v1alpha1.TidbCluster, oldSet *apps.StatefulS return nil } - setUpgradePartition(newSet, *oldSet.Spec.UpdateStrategy.RollingUpdate.Partition) + mngerutils.SetUpgradePartition(newSet, *oldSet.Spec.UpdateStrategy.RollingUpdate.Partition) podOrdinals := helper.GetPodOrdinals(*oldSet.Spec.Replicas, oldSet).List() for _i := len(podOrdinals) - 1; _i >= 0; _i-- { i := podOrdinals[_i] @@ -102,7 +104,7 @@ func (u *ticdcUpgrader) Upgrade(tc *v1alpha1.TidbCluster, oldSet *apps.StatefulS } continue } - setUpgradePartition(newSet, i) + mngerutils.SetUpgradePartition(newSet, i) return nil } diff --git a/pkg/manager/member/ticdc_upgrader_test.go b/pkg/manager/member/ticdc_upgrader_test.go index bc29d86965..219c9bff1d 100644 --- a/pkg/manager/member/ticdc_upgrader_test.go +++ b/pkg/manager/member/ticdc_upgrader_test.go @@ -16,10 +16,12 @@ package member import ( "testing" - . "github.com/onsi/gomega" "github.com/pingcap/tidb-operator/pkg/apis/label" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" + + . "github.com/onsi/gomega" apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -64,7 +66,7 @@ func TestTiCDCUpgrader_Upgrade(t *testing.T) { if test.changeOldSet != nil { test.changeOldSet(oldSet) } - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) err := upgrader.Upgrade(tc, oldSet, newSet) if test.errorExpect { @@ -179,7 +181,7 @@ func TestTiCDCUpgrader_Upgrade(t *testing.T) { tc.Status.TiCDC.Synced = true }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) }, errorExpect: false, expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet) { @@ -198,7 +200,7 @@ func TestTiCDCUpgrader_Upgrade(t *testing.T) { tc.Status.TiCDC.Synced = true }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) }, errorExpect: false, expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet) { @@ -217,7 +219,7 @@ func TestTiCDCUpgrader_Upgrade(t *testing.T) { tc.Status.TiCDC.Synced = true }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) }, errorExpect: false, expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet) { @@ -236,7 +238,7 @@ func TestTiCDCUpgrader_Upgrade(t *testing.T) { tc.Status.TiCDC.Synced = true }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) }, errorExpect: false, expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet) { @@ -255,7 +257,7 @@ func TestTiCDCUpgrader_Upgrade(t *testing.T) { tc.Status.TiCDC.Synced = true }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) }, errorExpect: false, expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet) { diff --git a/pkg/manager/member/tidb_member_manager.go b/pkg/manager/member/tidb_member_manager.go index ea81d028a3..d017d50202 100644 --- a/pkg/manager/member/tidb_member_manager.go +++ b/pkg/manager/member/tidb_member_manager.go @@ -20,12 +20,14 @@ import ( "strconv" "strings" - "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" "github.com/pingcap/tidb-operator/pkg/apis/label" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" "github.com/pingcap/tidb-operator/pkg/manager" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" "github.com/pingcap/tidb-operator/pkg/util" + + "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/equality" @@ -203,7 +205,7 @@ func (m *tidbMemberManager) syncTiDBStatefulSetForTidbCluster(tc *v1alpha1.TidbC } if setNotExist { - err = SetStatefulSetLastAppliedConfigAnnotation(newTiDBSet) + err = mngerutils.SetStatefulSetLastAppliedConfigAnnotation(newTiDBSet) if err != nil { return err } @@ -240,7 +242,7 @@ func (m *tidbMemberManager) syncTiDBStatefulSetForTidbCluster(tc *v1alpha1.TidbC } } - return UpdateStatefulSet(m.deps.StatefulSetControl, tc, newTiDBSet, oldTiDBSet) + return mngerutils.UpdateStatefulSet(m.deps.StatefulSetControl, tc, newTiDBSet, oldTiDBSet) } func (m *tidbMemberManager) shouldRecover(tc *v1alpha1.TidbCluster) bool { @@ -357,14 +359,14 @@ func (m *tidbMemberManager) syncTiDBConfigMap(tc *v1alpha1.TidbCluster, set *app var inUseName string if set != nil { - inUseName = FindConfigMapVolume(&set.Spec.Template.Spec, func(name string) bool { + inUseName = mngerutils.FindConfigMapVolume(&set.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, controller.TiDBMemberName(tc.Name)) }) } klog.V(3).Info("get tidb in use config map name: ", inUseName) - err = updateConfigMapIfNeed(m.deps.ConfigMapLister, tc.BaseTiDBSpec().ConfigUpdateStrategy(), inUseName, newCm) + err = mngerutils.UpdateConfigMapIfNeed(m.deps.ConfigMapLister, tc.BaseTiDBSpec().ConfigUpdateStrategy(), inUseName, newCm) if err != nil { return nil, err } @@ -897,7 +899,7 @@ func (m *tidbMemberManager) syncTidbClusterStatus(tc *v1alpha1.TidbCluster, set } func tidbStatefulSetIsUpgrading(podLister corelisters.PodLister, set *apps.StatefulSet, tc *v1alpha1.TidbCluster) (bool, error) { - if statefulSetIsUpgrading(set) { + if mngerutils.StatefulSetIsUpgrading(set) { return true, nil } selector, err := label.New(). diff --git a/pkg/manager/member/tidb_member_manager_test.go b/pkg/manager/member/tidb_member_manager_test.go index 7481c92418..13913a9b3b 100644 --- a/pkg/manager/member/tidb_member_manager_test.go +++ b/pkg/manager/member/tidb_member_manager_test.go @@ -21,12 +21,14 @@ import ( "testing" "time" - "github.com/google/go-cmp/cmp" - . "github.com/onsi/gomega" "github.com/pingcap/tidb-operator/pkg/apis/label" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/apis/util/toml" "github.com/pingcap/tidb-operator/pkg/controller" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" + + "github.com/google/go-cmp/cmp" + . "github.com/onsi/gomega" apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1" @@ -1009,7 +1011,7 @@ func TestGetNewTiDBSetForTidbCluster(t *testing.T) { }, }, testSts: func(sts *apps.StatefulSet) { - cmName := FindConfigMapVolume(&sts.Spec.Template.Spec, func(name string) bool { + cmName := mngerutils.FindConfigMapVolume(&sts.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, controller.TiDBMemberName("tc")) }) g := NewGomegaWithT(t) diff --git a/pkg/manager/member/tidb_upgrader.go b/pkg/manager/member/tidb_upgrader.go index 795a646270..1f0758250b 100644 --- a/pkg/manager/member/tidb_upgrader.go +++ b/pkg/manager/member/tidb_upgrader.go @@ -16,9 +16,11 @@ package member import ( "fmt" - "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" + + "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" apps "k8s.io/api/apps/v1" "k8s.io/klog" ) @@ -82,7 +84,7 @@ func (u *tidbUpgrader) Upgrade(tc *v1alpha1.TidbCluster, oldSet *apps.StatefulSe return nil } - setUpgradePartition(newSet, *oldSet.Spec.UpdateStrategy.RollingUpdate.Partition) + mngerutils.SetUpgradePartition(newSet, *oldSet.Spec.UpdateStrategy.RollingUpdate.Partition) podOrdinals := helper.GetPodOrdinals(*oldSet.Spec.Replicas, oldSet).List() for _i := len(podOrdinals) - 1; _i >= 0; _i-- { i := podOrdinals[_i] @@ -109,7 +111,7 @@ func (u *tidbUpgrader) Upgrade(tc *v1alpha1.TidbCluster, oldSet *apps.StatefulSe } func (u *tidbUpgrader) upgradeTiDBPod(tc *v1alpha1.TidbCluster, ordinal int32, newSet *apps.StatefulSet) error { - setUpgradePartition(newSet, ordinal) + mngerutils.SetUpgradePartition(newSet, ordinal) return nil } diff --git a/pkg/manager/member/tidb_upgrader_test.go b/pkg/manager/member/tidb_upgrader_test.go index 8cbaee9b5a..3a9091e71c 100644 --- a/pkg/manager/member/tidb_upgrader_test.go +++ b/pkg/manager/member/tidb_upgrader_test.go @@ -16,10 +16,12 @@ package member import ( "testing" - . "github.com/onsi/gomega" "github.com/pingcap/tidb-operator/pkg/apis/label" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" + + . "github.com/onsi/gomega" apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -61,7 +63,7 @@ func TestTiDBUpgrader_Upgrade(t *testing.T) { if test.getLastAppliedConfigErr { oldSet.SetAnnotations(map[string]string{LastAppliedConfigAnnotation: "fake apply config"}) } else { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) } err := upgrader.Upgrade(tc, oldSet, newSet) if test.errorExpect { diff --git a/pkg/manager/member/tiflash_member_manager.go b/pkg/manager/member/tiflash_member_manager.go index d5849bea87..deebcb6844 100644 --- a/pkg/manager/member/tiflash_member_manager.go +++ b/pkg/manager/member/tiflash_member_manager.go @@ -19,13 +19,15 @@ import ( "regexp" "strings" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/tidb-operator/pkg/apis/label" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" "github.com/pingcap/tidb-operator/pkg/manager" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" "github.com/pingcap/tidb-operator/pkg/pdapi" "github.com/pingcap/tidb-operator/pkg/util" + + "github.com/pingcap/kvproto/pkg/metapb" apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -188,7 +190,7 @@ func (m *tiflashMemberManager) syncStatefulSet(tc *v1alpha1.TidbCluster) error { klog.Infof("TidbCluster: %s/%s, waiting for PD cluster running", ns, tcName) return nil } - err = SetStatefulSetLastAppliedConfigAnnotation(newSet) + err = mngerutils.SetStatefulSetLastAppliedConfigAnnotation(newSet) if err != nil { return err } @@ -227,7 +229,7 @@ func (m *tiflashMemberManager) syncStatefulSet(tc *v1alpha1.TidbCluster) error { } } - return UpdateStatefulSet(m.deps.StatefulSetControl, tc, newSet, oldSet) + return mngerutils.UpdateStatefulSet(m.deps.StatefulSetControl, tc, newSet, oldSet) } func (m *tiflashMemberManager) syncConfigMap(tc *v1alpha1.TidbCluster, set *apps.StatefulSet) (*corev1.ConfigMap, error) { @@ -238,12 +240,12 @@ func (m *tiflashMemberManager) syncConfigMap(tc *v1alpha1.TidbCluster, set *apps var inUseName string if set != nil { - inUseName = FindConfigMapVolume(&set.Spec.Template.Spec, func(name string) bool { + inUseName = mngerutils.FindConfigMapVolume(&set.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, controller.TiFlashMemberName(tc.Name)) }) } - err = updateConfigMapIfNeed(m.deps.ConfigMapLister, tc.BaseTiFlashSpec().ConfigUpdateStrategy(), inUseName, newCm) + err = mngerutils.UpdateConfigMapIfNeed(m.deps.ConfigMapLister, tc.BaseTiFlashSpec().ConfigUpdateStrategy(), inUseName, newCm) if err != nil { return nil, err } @@ -833,7 +835,7 @@ func (m *tiflashMemberManager) storeLabelsEqualNodeLabels(storeLabels []*metapb. } func tiflashStatefulSetIsUpgrading(podLister corelisters.PodLister, pdControl pdapi.PDControlInterface, set *apps.StatefulSet, tc *v1alpha1.TidbCluster) (bool, error) { - if statefulSetIsUpgrading(set) { + if mngerutils.StatefulSetIsUpgrading(set) { return true, nil } instanceName := tc.GetInstanceName() diff --git a/pkg/manager/member/tiflash_upgrader.go b/pkg/manager/member/tiflash_upgrader.go index 320706989b..fdc87fd219 100644 --- a/pkg/manager/member/tiflash_upgrader.go +++ b/pkg/manager/member/tiflash_upgrader.go @@ -16,15 +16,16 @@ package member import ( "fmt" - apps "k8s.io/api/apps/v1" - "k8s.io/klog" - podutil "k8s.io/kubernetes/pkg/api/v1/pod" - - "github.com/Masterminds/semver" - "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" "github.com/pingcap/tidb-operator/pkg/tiflashapi" + + "github.com/Masterminds/semver" + "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" + apps "k8s.io/api/apps/v1" + "k8s.io/klog" + podutil "k8s.io/kubernetes/pkg/api/v1/pod" ) var ( @@ -85,13 +86,13 @@ func (u *tiflashUpgrader) Upgrade(tc *v1alpha1.TidbCluster, oldSet *apps.Statefu return nil } - setUpgradePartition(newSet, *oldSet.Spec.UpdateStrategy.RollingUpdate.Partition) + mngerutils.SetUpgradePartition(newSet, *oldSet.Spec.UpdateStrategy.RollingUpdate.Partition) podOrdinals := helper.GetPodOrdinals(*oldSet.Spec.Replicas, oldSet).List() for _i := len(podOrdinals) - 1; _i >= 0; _i-- { i := podOrdinals[_i] store := getTiFlashStoreByOrdinal(tc.GetName(), tc.Status.TiFlash, i) if store == nil { - setUpgradePartition(newSet, i) + mngerutils.SetUpgradePartition(newSet, i) continue } podName := TiFlashPodName(tcName, i) @@ -133,7 +134,7 @@ func (u *tiflashUpgrader) Upgrade(tc *v1alpha1.TidbCluster, oldSet *apps.Statefu continue } - setUpgradePartition(newSet, i) + mngerutils.SetUpgradePartition(newSet, i) return nil } diff --git a/pkg/manager/member/tiflash_upgrader_test.go b/pkg/manager/member/tiflash_upgrader_test.go index eedcdc3099..1f60946ca4 100644 --- a/pkg/manager/member/tiflash_upgrader_test.go +++ b/pkg/manager/member/tiflash_upgrader_test.go @@ -29,6 +29,7 @@ import ( "github.com/pingcap/tidb-operator/pkg/apis/label" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" "github.com/pingcap/tidb-operator/pkg/pdapi" "github.com/pingcap/tidb-operator/pkg/tiflashapi" ) @@ -91,7 +92,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { name: "modify oldSet update strategy to OnDelete", changeFn: nil, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Spec.UpdateStrategy = apps.StatefulSetUpdateStrategy{ Type: apps.OnDeleteStatefulSetStrategyType, } @@ -110,7 +111,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { name: "set oldSet's RollingUpdate strategy to nil", changeFn: nil, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Spec.UpdateStrategy = apps.StatefulSetUpdateStrategy{ Type: apps.RollingUpdateStatefulSetStrategyType, } @@ -137,7 +138,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { tc.Status.TiFlash.Stores["3"] = store }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) }, changePods: nil, updatePodErr: false, @@ -163,7 +164,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { tc.Status.TiFlash.Stores["2"] = store }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Status.CurrentReplicas = 2 oldSet.Status.UpdatedReplicas = 1 oldSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(2) @@ -186,7 +187,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { }, changeOldSet: func(oldSet *apps.StatefulSet) { oldSet.Spec.Template.Spec.Containers[0].Image = "old-image" - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) }, changePods: nil, updatePodErr: false, @@ -224,7 +225,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { tc.Status.TiFlash.Synced = true }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) }, changePods: nil, updatePodErr: false, @@ -272,7 +273,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { }) }, changeOldSet: func(oldSet *apps.StatefulSet) { // tigger upgrade - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Spec.Template.Spec.Containers[0].Image = "old-image" }, changePods: func(pods []*corev1.Pod, tc *v1alpha1.TidbCluster, old, new *apps.StatefulSet) { @@ -303,7 +304,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { }) }, changeOldSet: func(oldSet *apps.StatefulSet) { // tigger upgrade - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Spec.Template.Spec.Containers[0].Image = "old-image" }, changePods: func(pods []*corev1.Pod, tc *v1alpha1.TidbCluster, old, new *apps.StatefulSet) { @@ -334,7 +335,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { }) }, changeOldSet: func(oldSet *apps.StatefulSet) { // tigger upgrade - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Spec.Template.Spec.Containers[0].Image = "old-image" }, changePods: func(pods []*corev1.Pod, tc *v1alpha1.TidbCluster, old, new *apps.StatefulSet) { @@ -365,7 +366,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { }) }, changeOldSet: func(oldSet *apps.StatefulSet) { // tigger upgrade - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Spec.Template.Spec.Containers[0].Image = "old-image" }, changePods: func(pods []*corev1.Pod, tc *v1alpha1.TidbCluster, old, new *apps.StatefulSet) { @@ -396,7 +397,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { }) }, changeOldSet: func(oldSet *apps.StatefulSet) { // tigger upgrade - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Spec.Template.Spec.Containers[0].Image = "old-image" }, changePods: func(pods []*corev1.Pod, tc *v1alpha1.TidbCluster, old, new *apps.StatefulSet) { @@ -427,7 +428,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { }) }, changeOldSet: func(oldSet *apps.StatefulSet) { // tigger upgrade - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Spec.Template.Spec.Containers[0].Image = "old-image" }, changePods: func(pods []*corev1.Pod, tc *v1alpha1.TidbCluster, old, new *apps.StatefulSet) { @@ -459,7 +460,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { }) }, changeOldSet: func(oldSet *apps.StatefulSet) { // tigger upgrade - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Spec.Template.Spec.Containers[0].Image = "old-image" }, changePods: func(pods []*corev1.Pod, tc *v1alpha1.TidbCluster, old, new *apps.StatefulSet) { @@ -491,7 +492,7 @@ func TestTiFlashUpgraderUpgrade(t *testing.T) { }) }, changeOldSet: func(oldSet *apps.StatefulSet) { // tigger upgrade - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Spec.Template.Spec.Containers[0].Image = "old-image" }, changePods: func(pods []*corev1.Pod, tc *v1alpha1.TidbCluster, old, new *apps.StatefulSet) { diff --git a/pkg/manager/member/tikv_member_manager.go b/pkg/manager/member/tikv_member_manager.go index 75b4a3a207..8ddf46c24a 100644 --- a/pkg/manager/member/tikv_member_manager.go +++ b/pkg/manager/member/tikv_member_manager.go @@ -22,14 +22,16 @@ import ( "strconv" "strings" - "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/tidb-operator/pkg/apis/label" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" "github.com/pingcap/tidb-operator/pkg/manager" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" "github.com/pingcap/tidb-operator/pkg/pdapi" "github.com/pingcap/tidb-operator/pkg/util" + + "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" + "github.com/pingcap/kvproto/pkg/metapb" apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -198,7 +200,7 @@ func (m *tikvMemberManager) syncStatefulSetForTidbCluster(tc *v1alpha1.TidbClust return err } if setNotExist { - err = SetStatefulSetLastAppliedConfigAnnotation(newSet) + err = mngerutils.SetStatefulSetLastAppliedConfigAnnotation(newSet) if err != nil { return err } @@ -240,7 +242,7 @@ func (m *tikvMemberManager) syncStatefulSetForTidbCluster(tc *v1alpha1.TidbClust } } - return UpdateStatefulSet(m.deps.StatefulSetControl, tc, newSet, oldSet) + return mngerutils.UpdateStatefulSet(m.deps.StatefulSetControl, tc, newSet, oldSet) } func (m *tikvMemberManager) syncTiKVConfigMap(tc *v1alpha1.TidbCluster, set *apps.StatefulSet) (*corev1.ConfigMap, error) { @@ -255,12 +257,12 @@ func (m *tikvMemberManager) syncTiKVConfigMap(tc *v1alpha1.TidbCluster, set *app var inUseName string if set != nil { - inUseName = FindConfigMapVolume(&set.Spec.Template.Spec, func(name string) bool { + inUseName = mngerutils.FindConfigMapVolume(&set.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, controller.TiKVMemberName(tc.Name)) }) } - err = updateConfigMapIfNeed(m.deps.ConfigMapLister, tc.BaseTiKVSpec().ConfigUpdateStrategy(), inUseName, newCm) + err = mngerutils.UpdateConfigMapIfNeed(m.deps.ConfigMapLister, tc.BaseTiKVSpec().ConfigUpdateStrategy(), inUseName, newCm) if err != nil { return nil, err } @@ -959,7 +961,7 @@ func (m *tikvMemberManager) storeLabelsEqualNodeLabels(storeLabels []*metapb.Sto } func tikvStatefulSetIsUpgrading(podLister corelisters.PodLister, pdControl pdapi.PDControlInterface, set *apps.StatefulSet, tc *v1alpha1.TidbCluster) (bool, error) { - if statefulSetIsUpgrading(set) { + if mngerutils.StatefulSetIsUpgrading(set) { return true, nil } instanceName := tc.GetInstanceName() diff --git a/pkg/manager/member/tikv_upgrader.go b/pkg/manager/member/tikv_upgrader.go index 74959d8382..795d16df56 100644 --- a/pkg/manager/member/tikv_upgrader.go +++ b/pkg/manager/member/tikv_upgrader.go @@ -21,6 +21,8 @@ import ( "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" + apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -77,7 +79,7 @@ func (u *tikvUpgrader) Upgrade(meta metav1.Object, oldSet *apps.StatefulSet, new if *oldSet.Spec.Replicas < 2 { klog.Infof("TiKV statefulset replicas are less than 2, skip evicting region leader for tc %s/%s", ns, tcName) status.Phase = v1alpha1.UpgradePhase - setUpgradePartition(newSet, 0) + mngerutils.SetUpgradePartition(newSet, 0) return nil } @@ -106,13 +108,13 @@ func (u *tikvUpgrader) Upgrade(meta metav1.Object, oldSet *apps.StatefulSet, new return nil } - setUpgradePartition(newSet, *oldSet.Spec.UpdateStrategy.RollingUpdate.Partition) + mngerutils.SetUpgradePartition(newSet, *oldSet.Spec.UpdateStrategy.RollingUpdate.Partition) podOrdinals := helper.GetPodOrdinals(*oldSet.Spec.Replicas, oldSet).List() for _i := len(podOrdinals) - 1; _i >= 0; _i-- { i := podOrdinals[_i] store := getStoreByOrdinal(meta.GetName(), *status, i) if store == nil { - setUpgradePartition(newSet, i) + mngerutils.SetUpgradePartition(newSet, i) continue } podName := TikvPodName(tcName, i) @@ -149,7 +151,7 @@ func (u *tikvUpgrader) Upgrade(meta metav1.Object, oldSet *apps.StatefulSet, new } if u.deps.CLIConfig.PodWebhookEnabled { - setUpgradePartition(newSet, i) + mngerutils.SetUpgradePartition(newSet, i) return nil } @@ -182,7 +184,7 @@ func (u *tikvUpgrader) upgradeTiKVPod(tc *v1alpha1.TidbCluster, ordinal int32, n } if u.readyToUpgrade(upgradePod, tc) { - setUpgradePartition(newSet, ordinal) + mngerutils.SetUpgradePartition(newSet, ordinal) return nil } diff --git a/pkg/manager/member/tikv_upgrader_test.go b/pkg/manager/member/tikv_upgrader_test.go index 1c44acdb22..b0ddbe1db4 100644 --- a/pkg/manager/member/tikv_upgrader_test.go +++ b/pkg/manager/member/tikv_upgrader_test.go @@ -19,12 +19,14 @@ import ( "testing" "time" - . "github.com/onsi/gomega" "github.com/pingcap/tidb-operator/pkg/apis/label" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/controller" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" "github.com/pingcap/tidb-operator/pkg/pdapi" "github.com/pingcap/tidb-operator/pkg/tikvapi" + + . "github.com/onsi/gomega" apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -135,7 +137,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { name: "modify oldSet update strategy to OnDelete", changeFn: nil, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Spec.UpdateStrategy = apps.StatefulSetUpdateStrategy{ Type: apps.OnDeleteStatefulSetStrategyType, } @@ -156,7 +158,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { name: "set oldSet's RollingUpdate strategy to nil", changeFn: nil, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Spec.UpdateStrategy = apps.StatefulSetUpdateStrategy{ Type: apps.RollingUpdateStatefulSetStrategyType, } @@ -185,7 +187,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { tc.Status.TiKV.Stores["3"] = store }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) }, changePods: func(pods []*corev1.Pod) { for _, pod := range pods { @@ -219,7 +221,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { tc.Status.TiKV.Stores["2"] = store }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Status.CurrentReplicas = 2 oldSet.Status.UpdatedReplicas = 1 oldSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(2) @@ -251,7 +253,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { }, changeOldSet: func(oldSet *apps.StatefulSet) { oldSet.Spec.Template.Spec.Containers[0].Image = "old-image" - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) }, changePods: nil, beginEvictLeaderErr: false, @@ -293,7 +295,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { tc.Status.TiKV.Synced = true }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) }, changePods: nil, beginEvictLeaderErr: false, @@ -315,7 +317,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { tc.Status.TiKV.Synced = true }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) }, changePods: nil, beginEvictLeaderErr: false, @@ -337,7 +339,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { tc.Status.TiKV.Synced = true }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) }, changePods: nil, beginEvictLeaderErr: false, @@ -383,7 +385,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { tc.Status.TiKV.StatefulSet.UpdatedReplicas = 1 }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Status.CurrentReplicas = 2 oldSet.Status.UpdatedReplicas = 1 oldSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(2) @@ -411,7 +413,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { tc.Status.TiKV.StatefulSet.UpdatedReplicas = 1 }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Status.CurrentReplicas = 2 oldSet.Status.UpdatedReplicas = 1 oldSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(2) @@ -447,7 +449,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { tc.Status.TiKV.StatefulSet.UpdatedReplicas = 1 }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Status.CurrentReplicas = 2 oldSet.Status.UpdatedReplicas = 1 oldSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(2) @@ -483,7 +485,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { tc.Status.TiKV.StatefulSet.UpdatedReplicas = 1 }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Status.CurrentReplicas = 2 oldSet.Status.UpdatedReplicas = 1 oldSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(2) @@ -511,7 +513,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { tc.Status.TiKV.StatefulSet.UpdatedReplicas = 1 }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Status.CurrentReplicas = 2 oldSet.Status.UpdatedReplicas = 1 oldSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(2) @@ -546,7 +548,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { tc.Status.TiKV.StatefulSet.UpdatedReplicas = 1 }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Status.CurrentReplicas = 1 oldSet.Status.UpdatedReplicas = 1 oldSet.Spec.Replicas = pointer.Int32Ptr(1) @@ -581,7 +583,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { tc.Status.TiKV.StatefulSet.UpdatedReplicas = 1 }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Status.CurrentReplicas = 2 oldSet.Status.UpdatedReplicas = 1 oldSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(2) @@ -613,7 +615,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { tc.Status.TiKV.StatefulSet.UpdatedReplicas = 1 }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Status.CurrentReplicas = 2 oldSet.Status.UpdatedReplicas = 1 oldSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(2) @@ -639,7 +641,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { tc.Status.TiKV.StatefulSet.UpdatedReplicas = 1 }, changeOldSet: func(oldSet *apps.StatefulSet) { - SetStatefulSetLastAppliedConfigAnnotation(oldSet) + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) oldSet.Status.CurrentReplicas = 2 oldSet.Status.UpdatedReplicas = 1 oldSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(2) diff --git a/pkg/manager/member/utils.go b/pkg/manager/member/utils.go index bd4a513060..14e3397b37 100644 --- a/pkg/manager/member/utils.go +++ b/pkg/manager/member/utils.go @@ -14,7 +14,6 @@ package member import ( - "crypto/sha256" "encoding/json" "fmt" "path" @@ -75,30 +74,6 @@ func annotationsMountVolume() (corev1.VolumeMount, corev1.Volume) { return m, v } -// statefulSetIsUpgrading confirms whether the statefulSet is upgrading phase -func statefulSetIsUpgrading(set *apps.StatefulSet) bool { - if set.Status.CurrentRevision != set.Status.UpdateRevision { - return true - } - if set.Generation > set.Status.ObservedGeneration && *set.Spec.Replicas == set.Status.Replicas { - return true - } - return false -} - -// SetStatefulSetLastAppliedConfigAnnotation set last applied config to Statefulset's annotation -func SetStatefulSetLastAppliedConfigAnnotation(set *apps.StatefulSet) error { - setApply, err := util.Encode(set.Spec) - if err != nil { - return err - } - if set.Annotations == nil { - set.Annotations = map[string]string{} - } - set.Annotations[LastAppliedConfigAnnotation] = setApply - return nil -} - // GetLastAppliedConfig get last applied config info from Statefulset's annotation and the podTemplate's annotation func GetLastAppliedConfig(set *apps.StatefulSet) (*apps.StatefulSetSpec, *corev1.PodSpec, error) { specAppliedConfig, ok := set.Annotations[LastAppliedConfigAnnotation] @@ -129,12 +104,6 @@ func templateEqual(new *apps.StatefulSet, old *apps.StatefulSet) bool { return false } -// setUpgradePartition set statefulSet's rolling update partition -func setUpgradePartition(set *apps.StatefulSet, upgradeOrdinal int32) { - set.Spec.UpdateStrategy.RollingUpdate = &apps.RollingUpdateStatefulSetStrategy{Partition: &upgradeOrdinal} - klog.Infof("set %s/%s partition to %d", set.GetNamespace(), set.GetName(), upgradeOrdinal) -} - func MemberPodName(controllerName, controllerKind string, ordinal int32, memberType v1alpha1.MemberType) (string, error) { switch controllerKind { case v1alpha1.TiDBClusterKind: @@ -187,16 +156,6 @@ func NeedForceUpgrade(ann map[string]string) bool { return false } -// FindConfigMapVolume returns the configmap which's name matches the predicate in a PodSpec, empty indicates not found -func FindConfigMapVolume(podSpec *corev1.PodSpec, pred func(string) bool) string { - for _, vol := range podSpec.Volumes { - if vol.ConfigMap != nil && pred(vol.ConfigMap.LocalObjectReference.Name) { - return vol.ConfigMap.LocalObjectReference.Name - } - } - return "" -} - // MarshalTOML is a template function that try to marshal a go value to toml func MarshalTOML(v interface{}) ([]byte, error) { return toml.Marshal(v) @@ -206,25 +165,6 @@ func UnmarshalTOML(b []byte, obj interface{}) error { return toml.Unmarshal(b, obj) } -func Sha256Sum(v interface{}) (string, error) { - data, err := json.Marshal(v) - if err != nil { - return "", err - } - sum := sha256.Sum256(data) - return fmt.Sprintf("%x", sum), nil -} - -func AddConfigMapDigestSuffix(cm *corev1.ConfigMap) error { - sum, err := Sha256Sum(cm.Data) - if err != nil { - return err - } - suffix := fmt.Sprintf("%x", sum)[0:7] - cm.Name = fmt.Sprintf("%s-%s", cm.Name, suffix) - return nil -} - // getStsAnnotations gets annotations for statefulset of given component. func getStsAnnotations(tcAnns map[string]string, component string) map[string]string { anns := map[string]string{} @@ -266,60 +206,6 @@ func MapContainers(podSpec *corev1.PodSpec) map[string]corev1.Container { return m } -// UpdateStatefulSet is a template function to update the statefulset of components -func UpdateStatefulSet(setCtl controller.StatefulSetControlInterface, object runtime.Object, newSet, oldSet *apps.StatefulSet) error { - isOrphan := metav1.GetControllerOf(oldSet) == nil - if newSet.Annotations == nil { - newSet.Annotations = map[string]string{} - } - if oldSet.Annotations == nil { - oldSet.Annotations = map[string]string{} - } - - // Check if an upgrade is needed. - // If not, early return. - if util.StatefulSetEqual(*newSet, *oldSet) && !isOrphan { - return nil - } - - set := *oldSet - - // update specs for sts - *set.Spec.Replicas = *newSet.Spec.Replicas - set.Spec.UpdateStrategy = newSet.Spec.UpdateStrategy - set.Labels = newSet.Labels - set.Annotations = newSet.Annotations - set.Spec.Template = newSet.Spec.Template - if isOrphan { - set.OwnerReferences = newSet.OwnerReferences - } - - var podConfig string - var hasPodConfig bool - if oldSet.Spec.Template.Annotations != nil { - podConfig, hasPodConfig = oldSet.Spec.Template.Annotations[LastAppliedConfigAnnotation] - } - if hasPodConfig { - if set.Spec.Template.Annotations == nil { - set.Spec.Template.Annotations = map[string]string{} - } - set.Spec.Template.Annotations[LastAppliedConfigAnnotation] = podConfig - } - v, ok := oldSet.Annotations[label.AnnStsLastSyncTimestamp] - if ok { - set.Annotations[label.AnnStsLastSyncTimestamp] = v - } - - err := SetStatefulSetLastAppliedConfigAnnotation(&set) - if err != nil { - return err - } - - // commit to k8s - _, err = setCtl.UpdateStatefulSet(object, &set) - return err -} - // findContainerByName finds targetContainer by containerName, If not find, then return nil func findContainerByName(sts *apps.StatefulSet, containerName string) *corev1.Container { for _, c := range sts.Spec.Template.Spec.Containers { diff --git a/pkg/manager/member/utils_test.go b/pkg/manager/member/utils_test.go index 0127bf10a7..e6793f04f2 100644 --- a/pkg/manager/member/utils_test.go +++ b/pkg/manager/member/utils_test.go @@ -26,7 +26,6 @@ import ( "github.com/pingcap/advanced-statefulset/client/apis/apps/v1/helper" "github.com/pingcap/tidb-operator/pkg/apis/label" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" - apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -34,80 +33,6 @@ import ( kubefake "k8s.io/client-go/kubernetes/fake" ) -func TestStatefulSetIsUpgrading(t *testing.T) { - g := NewGomegaWithT(t) - - type testcase struct { - name string - update func(*apps.StatefulSet) - expectUpgrading bool - } - - testFn := func(test *testcase, t *testing.T) { - t.Log(test.name) - - set := &apps.StatefulSet{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test", - Namespace: metav1.NamespaceDefault, - }, - } - if test.update != nil { - test.update(set) - } - b := statefulSetIsUpgrading(set) - if test.expectUpgrading { - g.Expect(b).To(BeTrue()) - } else { - g.Expect(b).To(BeFalse()) - } - } - tests := []*testcase{ - { - name: "ObservedGeneration is nil", - update: nil, - expectUpgrading: false, - }, - { - name: "CurrentRevision not equal UpdateRevision", - update: func(set *apps.StatefulSet) { - set.Status.ObservedGeneration = 1000 - set.Status.CurrentRevision = "v1" - set.Status.UpdateRevision = "v2" - }, - expectUpgrading: true, - }, - { - name: "set.Generation > *set.Status.ObservedGeneration && *set.Spec.Replicas == set.Status.Replicas", - update: func(set *apps.StatefulSet) { - set.Generation = 1001 - set.Status.ObservedGeneration = 1000 - set.Status.CurrentRevision = "v1" - set.Status.UpdateRevision = "v1" - set.Status.Replicas = 3 - set.Spec.Replicas = func() *int32 { var i int32 = 3; return &i }() - }, - expectUpgrading: true, - }, - { - name: "replicas not equal", - update: func(set *apps.StatefulSet) { - set.Generation = 1001 - set.Status.ObservedGeneration = 1000 - set.Status.CurrentRevision = "v1" - set.Status.UpdateRevision = "v1" - set.Status.Replicas = 3 - set.Spec.Replicas = func() *int32 { var i int32 = 2; return &i }() - }, - expectUpgrading: false, - }, - } - - for _, test := range tests { - testFn(test, t) - } -} - func TestGetStsAnnotations(t *testing.T) { tests := []struct { name string diff --git a/pkg/manager/meta/reclaim_policy_manager.go b/pkg/manager/meta/reclaim_policy_manager.go index dd3c376079..5feefaee15 100644 --- a/pkg/manager/meta/reclaim_policy_manager.go +++ b/pkg/manager/meta/reclaim_policy_manager.go @@ -46,6 +46,10 @@ func (m *reclaimPolicyManager) SyncMonitor(tm *v1alpha1.TidbMonitor) error { return m.sync(v1alpha1.TiDBMonitorKind, tm, false, *tm.Spec.PVReclaimPolicy) } +func (m *reclaimPolicyManager) SyncTiDBNGMonitoring(tngm *v1alpha1.TidbNGMonitoring) error { + return m.sync(v1alpha1.TiDBNGMonitoringKind, tngm, false, *tngm.Spec.PVReclaimPolicy) +} + func (m *reclaimPolicyManager) SyncDM(dc *v1alpha1.DMCluster) error { return m.sync(v1alpha1.DMClusterKind, dc, dc.IsPVReclaimEnabled(), *dc.Spec.PVReclaimPolicy) } @@ -71,6 +75,8 @@ func (m *reclaimPolicyManager) sync(kind string, obj runtime.Object, isPVReclaim selector, err = label.NewMonitor().Instance(instanceName).Monitor().Selector() case v1alpha1.DMClusterKind: selector, err = label.NewDM().Instance(instanceName).Selector() + case v1alpha1.TiDBNGMonitoringKind: + selector, err = label.NewTiDBNGMonitoring().Instance(instanceName).Selector() default: return fmt.Errorf("unsupported kind %s", kind) } diff --git a/pkg/manager/meta/reclaim_policy_manager_test.go b/pkg/manager/meta/reclaim_policy_manager_test.go index 660a6fcde1..596701c7e8 100644 --- a/pkg/manager/meta/reclaim_policy_manager_test.go +++ b/pkg/manager/meta/reclaim_policy_manager_test.go @@ -50,6 +50,8 @@ func TestReclaimPolicyManagerSync(t *testing.T) { obj = newTidbClusterForMeta() case v1alpha1.DMClusterKind: obj = newDMClusterForMeta() + case v1alpha1.TiDBNGMonitoringKind: + obj = newTiDBNGMonitoringForMeta() } pv1 := newPV("1") pvc1 := newPVC(obj, "1") @@ -65,6 +67,10 @@ func TestReclaimPolicyManagerSync(t *testing.T) { obj.(*v1alpha1.TidbCluster).Spec.EnablePVReclaim = &test.enablePVRecalim case v1alpha1.DMClusterKind: obj.(*v1alpha1.DMCluster).Spec.EnablePVReclaim = &test.enablePVRecalim + case v1alpha1.TiDBNGMonitoringKind: + if test.enablePVRecalim { + return // skip because don't support enablePVRecalim + } } if test.hasDeferDeleteAnn { pvc1.Annotations = map[string]string{label.AnnPVCDeferDeleting: time.Now().String()} @@ -85,6 +91,8 @@ func TestReclaimPolicyManagerSync(t *testing.T) { err = rpm.Sync(obj.(*v1alpha1.TidbCluster)) case v1alpha1.DMClusterKind: err = rpm.SyncDM(obj.(*v1alpha1.DMCluster)) + case v1alpha1.TiDBNGMonitoringKind: + err = rpm.SyncTiDBNGMonitoring(obj.(*v1alpha1.TidbNGMonitoring)) } if test.err { g.Expect(err).To(HaveOccurred()) @@ -295,6 +303,25 @@ func newTiDBMonitorForMeta() *v1alpha1.TidbMonitor { } } +func newTiDBNGMonitoringForMeta() *v1alpha1.TidbNGMonitoring { + pvp := corev1.PersistentVolumeReclaimDelete + return &v1alpha1.TidbNGMonitoring{ + TypeMeta: metav1.TypeMeta{ + Kind: "TidbNGMonitoring", + APIVersion: "pingcap.com/v1alpha1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: controller.TestClusterName, + Namespace: corev1.NamespaceDefault, + UID: types.UID("test"), + Labels: label.NewDM().Instance(controller.TestClusterName), + }, + Spec: v1alpha1.TidbNGMonitoringSpec{ + PVReclaimPolicy: &pvp, + }, + } +} + func newPV(index string) *corev1.PersistentVolume { return &corev1.PersistentVolume{ TypeMeta: metav1.TypeMeta{ diff --git a/pkg/manager/tidbngmonitoring/name.go b/pkg/manager/tidbngmonitoring/name.go new file mode 100644 index 0000000000..6a84364e7d --- /dev/null +++ b/pkg/manager/tidbngmonitoring/name.go @@ -0,0 +1,26 @@ +// Copyright 2021 PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +package tidbngmonitoring + +import "fmt" + +// NGMonitoringName return ng monitoring name +func NGMonitoringName(monitorName string) string { + return fmt.Sprintf("%s-ng-monitoring", monitorName) +} + +// NGMonitoringHeadlessServiceName return headless service name +func NGMonitoringHeadlessServiceName(tngm string) string { + return fmt.Sprintf("%s-ng-monitoring", tngm) +} diff --git a/pkg/manager/tidbngmonitoring/ng_monitoring_manager.go b/pkg/manager/tidbngmonitoring/ng_monitoring_manager.go new file mode 100644 index 0000000000..98e6a75df5 --- /dev/null +++ b/pkg/manager/tidbngmonitoring/ng_monitoring_manager.go @@ -0,0 +1,499 @@ +// Copyright 2021 PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +package tidbngmonitoring + +import ( + "fmt" + "strings" + + "github.com/pingcap/tidb-operator/pkg/apis/label" + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" + "github.com/pingcap/tidb-operator/pkg/controller" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" + "github.com/pingcap/tidb-operator/pkg/util" + + apps "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/klog" +) + +const ( + ngmPodDataVolumeMountDir = "/var/lib/ng-monitoring" // the mount path for ng monitoring data volume + ngmPodConfigVolumeMountDir = "/etc/ng-monitoring" // the dir for ng monitoring config + ngmPodConfigFilename = "ng-monitoring.toml" // the filename of config file + + ngmConfigMapConfigKey = "config-file" // the key for config data in config map + + ngmServicePort = 12020 +) + +type ngMonitoringManager struct { + deps *controller.Dependencies +} + +func NewNGMonitorManager(deps *controller.Dependencies) *ngMonitoringManager { + return &ngMonitoringManager{ + deps: deps, + } +} + +func (m *ngMonitoringManager) Sync(tngm *v1alpha1.TidbNGMonitoring) error { + var err error + + err = m.syncService(tngm) + if err != nil { + return err + } + + err = m.syncCore(tngm) + if err != nil { + return err + } + + return nil +} + +func (m *ngMonitoringManager) syncService(tngm *v1alpha1.TidbNGMonitoring) error { + ns := tngm.GetNamespace() + name := tngm.GetName() + + if tngm.Spec.Paused { + klog.V(4).Infof("tidb ng monitoring %s/%s is paused, skip syncing for ng monitoring headless service", ns, name) + return nil + } + + newSvc := GenerateNGMonitoringHeadlessService(tngm) + oldSvc, err := m.deps.ServiceLister.Services(newSvc.Namespace).Get(newSvc.Name) + svcNotFound := errors.IsNotFound(err) + + if err != nil && !svcNotFound { + return fmt.Errorf("syncService: failed to get headless svc %s/%s for ng monitoring %s/%s, error %s", newSvc.Namespace, newSvc.Name, ns, name, err) + } + + // first creation + if svcNotFound { + err := controller.SetServiceLastAppliedConfigAnnotation(newSvc) + if err != nil { + return err + } + return m.deps.ServiceControl.CreateService(tngm, newSvc) + } + + // update existing service if needed + equal, err := controller.ServiceEqual(newSvc, oldSvc) + if err != nil { + return err + } + if !equal { + svc := *oldSvc + svc.Spec = newSvc.Spec + err = controller.SetServiceLastAppliedConfigAnnotation(&svc) + if err != nil { + return err + } + _, err = m.deps.ServiceControl.UpdateService(tngm, &svc) + return err + } + + return nil +} + +func (m *ngMonitoringManager) syncCore(tngm *v1alpha1.TidbNGMonitoring) error { + ns := tngm.GetNamespace() + name := tngm.GetName() + + stsName := NGMonitoringName(name) + oldStsTemp, err := m.deps.StatefulSetLister.StatefulSets(ns).Get(stsName) + if err != nil && !errors.IsNotFound(err) { + return fmt.Errorf("populateStatus: failed to get sts %s for tidb ng monitor %s/%s, error: %s", stsName, ns, name, err) + } + stsNotFound := errors.IsNotFound(err) + oldSts := oldStsTemp.DeepCopy() + + // sync status + err = m.populateStatus(tngm, oldSts) + if err != nil { + klog.Errorf("failed to sync ng monitoring's status of tidb ng monitring %s/%s, error: %v", ns, name, err) + return err + } + + if tngm.Spec.Paused { + klog.V(4).Infof("tidb ng monitring %s/%s is paused, skip syncing for ng monitoring statefulset", ns, name) + return nil + } + + // sync resources + + cm, err := m.syncConfigMap(tngm, oldSts) + if err != nil { + klog.Errorf("failed to sync ng monitoring's configmap of tidb ng monitring %s/%s, error: %v", ns, name, err) + return err + } + + newSts, err := GenerateNGMonitoringStatefulSet(tngm, cm) + if err != nil { + return err + } + + // first creation + if stsNotFound { + err = mngerutils.SetStatefulSetLastAppliedConfigAnnotation(newSts) + if err != nil { + return err + } + return m.deps.StatefulSetControl.CreateStatefulSet(tngm, newSts) + } + + // update existing statefulset if needed + return mngerutils.UpdateStatefulSet(m.deps.StatefulSetControl, tngm, newSts, oldSts) +} + +func (m *ngMonitoringManager) syncConfigMap(tngm *v1alpha1.TidbNGMonitoring, sts *apps.StatefulSet) (*corev1.ConfigMap, error) { + spec := tngm.BaseNGMonitoringSpec() + + newCM, err := GenerateNGMonitoringConfigMap(tngm) + if err != nil { + return nil, err + } + + var inUseName string + if sts != nil { + inUseName = mngerutils.FindConfigMapVolume(&sts.Spec.Template.Spec, func(name string) bool { + return strings.HasPrefix(name, NGMonitoringName(tngm.Name)) + }) + } + + err = mngerutils.UpdateConfigMapIfNeed(m.deps.ConfigMapLister, spec.ConfigUpdateStrategy(), inUseName, newCM) + if err != nil { + return nil, err + } + + return m.deps.TypedControl.CreateOrUpdateConfigMap(tngm, newCM) +} + +func (m *ngMonitoringManager) populateStatus(tngm *v1alpha1.TidbNGMonitoring, sts *apps.StatefulSet) error { + if sts == nil { + return nil // skip if not created yet + } + + tngm.Status.NGMonitoring.StatefulSet = &sts.Status + + upgrading, err := m.confirmStatefulSetIsUpgrading(tngm, sts) + if err != nil { + tngm.Status.NGMonitoring.Synced = false + return err + } + if upgrading { + tngm.Status.NGMonitoring.Phase = v1alpha1.UpgradePhase + } else { + tngm.Status.NGMonitoring.Phase = v1alpha1.NormalPhase + } + + tngm.Status.NGMonitoring.Synced = true + + return nil +} + +func (m *ngMonitoringManager) confirmStatefulSetIsUpgrading(tngm *v1alpha1.TidbNGMonitoring, oldSts *apps.StatefulSet) (bool, error) { + if mngerutils.StatefulSetIsUpgrading(oldSts) { + return true, nil + } + + selector, err := label.NewTiDBNGMonitoring(). + Instance(tngm.GetInstanceName()). + NGMonitoring(). + Selector() + if err != nil { + return false, err + } + + pods, err := m.deps.PodLister.Pods(tngm.GetNamespace()).List(selector) + if err != nil { + return false, fmt.Errorf("confirmStatefulSetIsUpgrading: failed to list pod for tidb ng monitor %s/%s, selector %s, error: %s", tngm.GetNamespace(), tngm.GetName(), selector, err) + } + + for _, pod := range pods { + revisionHash, exist := pod.Labels[apps.ControllerRevisionHashLabelKey] + if !exist { + return false, nil + } + if revisionHash != oldSts.Status.UpdateRevision { + return true, nil + } + } + return false, nil +} + +func GenerateNGMonitoringStatefulSet(tngm *v1alpha1.TidbNGMonitoring, cm *corev1.ConfigMap) (*apps.StatefulSet, error) { + ns := tngm.GetNamespace() + name := tngm.GetName() + + if cm == nil { + return nil, fmt.Errorf("config map is nil for tidb ng monitoring %s/%s", ns, name) + } + + spec := tngm.BaseNGMonitoringSpec() + meta, stsLabels := GenerateNGMonitoringMeta(tngm, NGMonitoringName) + headlessServiceName := NGMonitoringHeadlessServiceName(name) + replicas := int32(1) // only support one replica now + + dataVolumeName := v1alpha1.NGMonitoringMemberType.String() + configVolumeName := "config" + + // base containers, base pod spec and base statefulset + + // base containers + baseContainers := []corev1.Container{} + nmContainerName := v1alpha1.NGMonitoringMemberType.String() + startScript, err := GenerateNGMonitoringStartScript(tngm) + if err != nil { + return nil, fmt.Errorf("cannot render start-script for ng monitoring, tidb ng monitoring %s/%s, error: %v", ns, name, err) + } + nmVolumeMounts := []corev1.VolumeMount{ + {Name: configVolumeName, ReadOnly: true, MountPath: ngmPodConfigVolumeMountDir}, // config + {Name: dataVolumeName, MountPath: ngmPodDataVolumeMountDir}, // data + } + baseContainers = append(baseContainers, corev1.Container{ + Name: nmContainerName, + Image: tngm.NGMonitoringImage(), + ImagePullPolicy: spec.ImagePullPolicy(), + Command: []string{"/bin/sh", "-c", startScript}, + Ports: []corev1.ContainerPort{ + { + + Name: "ng-monitoring", + ContainerPort: ngmServicePort, + }, + }, + VolumeMounts: nmVolumeMounts, + Resources: controller.ContainerResource(tngm.Spec.NGMonitoring.ResourceRequirements), + // LivenessProbe: &corev1.Probe{ + // Handler: corev1.Handler{ + // HTTPGet: &corev1.HTTPGetAction{ + // Path: "/health", + // Port: intstr.FromInt(ngmServicePort), + // }, + // }, + // }, + Env: []corev1.EnvVar{ + { + Name: "HEADLESS_SERVICE_NAME", + Value: headlessServiceName, + }, + { + Name: "POD_NAME", + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + FieldPath: "metadata.name", + }, + }, + }, + }, + }) + baseVolumes := []corev1.Volume{ + { + Name: configVolumeName, + VolumeSource: corev1.VolumeSource{ + ConfigMap: &corev1.ConfigMapVolumeSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: cm.Name, + }, + Items: []corev1.KeyToPath{ + { + Key: ngmConfigMapConfigKey, + Path: ngmPodConfigFilename, + }, + }, + }, + }, + }, + } + // base pod spec + // TODO: place it in builder in order to reuse + podSpec := spec.BuildPodSpec() + podSpec.InitContainers = spec.InitContainers() + podSpec.DNSPolicy = spec.DnsPolicy() + podSpec.SecurityContext = spec.PodSecurityContext() + podSpec.Containers = baseContainers + podSpec.Volumes = baseVolumes + basePodTemplate := corev1.PodTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Labels: stsLabels, + }, + Spec: podSpec, + } + // base statefulset + storageRequest, err := controller.ParseStorageRequest(tngm.Spec.NGMonitoring.Requests) + if err != nil { + return nil, fmt.Errorf("cannot parse storage request for ng monitoring, tidb ng monitoring %s/%s, error: %v", ns, name, err) + } + baseSts := &apps.StatefulSet{ + ObjectMeta: meta, + Spec: apps.StatefulSetSpec{ + Selector: stsLabels.LabelSelector(), + ServiceName: headlessServiceName, + Replicas: &replicas, + + Template: basePodTemplate, + VolumeClaimTemplates: []corev1.PersistentVolumeClaim{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: dataVolumeName, + }, + Spec: corev1.PersistentVolumeClaimSpec{ + AccessModes: []corev1.PersistentVolumeAccessMode{ + corev1.ReadWriteOnce, + }, + StorageClassName: tngm.Spec.NGMonitoring.StorageClassName, + Resources: storageRequest, + }, + }, + }, + UpdateStrategy: apps.StatefulSetUpdateStrategy{ + Type: spec.StatefulSetUpdateStrategy(), + }, + PodManagementPolicy: spec.PodManagementPolicy(), + }, + } + + builder := mngerutils.NewStatefulSetBuilder(baseSts) + + // features + + // hostnework + if spec.HostNetwork() { + builder.PodTemplateSpecBuilder().RunInHostNetwork() + } + // downward + builder.PodTemplateSpecBuilder().ContainerBuilder(nmContainerName).AddEnvs(spec.Env()...) + builder.PodTemplateSpecBuilder().AddLabels(spec.Labels()) + builder.PodTemplateSpecBuilder().AddAnnotations(spec.Annotations()) + // additional storage volumes + storageVolMounts, additionalPVCs := util.BuildStorageVolumeAndVolumeMount(tngm.Spec.NGMonitoring.StorageVolumes, tngm.Spec.NGMonitoring.StorageClassName, v1alpha1.NGMonitoringMemberType) + builder.PodTemplateSpecBuilder().ContainerBuilder(nmContainerName).AddVolumeMounts(storageVolMounts...) + builder.AddVolumeClaims(additionalPVCs...) + // additional volumes and mounts + builder.PodTemplateSpecBuilder().ContainerBuilder(nmContainerName).AddVolumeMounts(spec.AdditionalVolumeMounts()...) + builder.PodTemplateSpecBuilder().AddVolumes(spec.AdditionalVolumes()...) + // additional containers + builder.PodTemplateSpecBuilder().AddContainers(spec.AdditionalContainers()...) + // TODO: TLS + + return builder.Get(), nil +} + +// GenerateNGMonitoringConfigMap generate ConfigMap from tidb ng monitoring +func GenerateNGMonitoringConfigMap(tngm *v1alpha1.TidbNGMonitoring) (*corev1.ConfigMap, error) { + config := tngm.Spec.NGMonitoring.Config + meta, _ := GenerateNGMonitoringMeta(tngm, NGMonitoringName) + + // TODO: TLS + + confText, err := config.MarshalTOML() + if err != nil { + return nil, err + } + + name := NGMonitoringName(tngm.Name) + confTextStr := string(confText) + + data := map[string]string{ + ngmConfigMapConfigKey: confTextStr, + } + + meta.Name = name + + return &corev1.ConfigMap{ + ObjectMeta: meta, + Data: data, + }, nil +} + +// GenerateNGMonitoringMeta build ObjectMeta and Label for ng monitoring +func GenerateNGMonitoringMeta(tngm *v1alpha1.TidbNGMonitoring, nameFunc func(string) string) (metav1.ObjectMeta, label.Label) { + instanceName := tngm.GetInstanceName() + label := label.NewTiDBNGMonitoring().Instance(instanceName).NGMonitoring() + + objMeta := metav1.ObjectMeta{ + Name: nameFunc(tngm.Name), + Namespace: tngm.GetNamespace(), + Labels: label, + OwnerReferences: []metav1.OwnerReference{controller.GetTiDBNGMonitoringOwnerRef(tngm)}, + } + return objMeta, label +} + +// GenerateNGMonitoringHeadlessService build headless service for ng monitoring +func GenerateNGMonitoringHeadlessService(tngm *v1alpha1.TidbNGMonitoring) *corev1.Service { + meta, labels := GenerateNGMonitoringMeta(tngm, NGMonitoringHeadlessServiceName) + + return &corev1.Service{ + ObjectMeta: meta, + Spec: corev1.ServiceSpec{ + ClusterIP: "None", + Ports: []corev1.ServicePort{ + { + Name: "ng-monitoring", + Port: ngmServicePort, + TargetPort: intstr.FromInt(ngmServicePort), + Protocol: corev1.ProtocolTCP, + }, + }, + Selector: labels, + PublishNotReadyAddresses: true, + }, + } +} + +func GenerateNGMonitoringStartScript(tngm *v1alpha1.TidbNGMonitoring) (string, error) { + tcRef := tngm.Spec.Clusters[0] + + model := &NGMonitoringStartScriptModel{ + TCName: tcRef.Name, + TCNamespace: tcRef.Namespace, + TCClusterDomain: tcRef.ClusterDomain, + TNGMName: tngm.Name, + TNGMNamespace: tngm.Namespace, + TNGMClusterDomain: tngm.Spec.ClusterDomain, + } + + script, err := model.RenderStartScript() + if err != nil { + return "", err + } + + return script, nil +} + +type FakeNGMonitoringManager struct { + sync func(tngm *v1alpha1.TidbNGMonitoring) error +} + +func NewFakeNGMonitoringManager() *FakeNGMonitoringManager { + return &FakeNGMonitoringManager{} +} + +func (m *FakeNGMonitoringManager) MockSync(sync func(tngm *v1alpha1.TidbNGMonitoring) error) { + m.sync = sync +} + +func (m *FakeNGMonitoringManager) Sync(tngm *v1alpha1.TidbNGMonitoring) error { + if m.sync == nil { + return nil + } + return m.sync(tngm) +} diff --git a/pkg/manager/tidbngmonitoring/start_script.go b/pkg/manager/tidbngmonitoring/start_script.go new file mode 100644 index 0000000000..b5dc0b60dc --- /dev/null +++ b/pkg/manager/tidbngmonitoring/start_script.go @@ -0,0 +1,76 @@ +// Copyright 2021 PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +package tidbngmonitoring + +import ( + "bytes" + "fmt" + "html/template" + + "github.com/pingcap/tidb-operator/pkg/controller" +) + +type NGMonitoringStartScriptModel struct { + TCName string // name of tidb cluster + TCNamespace string // namespace of tidb cluster's namespace + TCClusterDomain string // cluster domain of tidb cluster + + TNGMName string // name of tidb ng monitoring + TNGMNamespace string // namespace of tidb ng monitoring + TNGMClusterDomain string // cluster domain of tidb ng monitoring +} + +func (m *NGMonitoringStartScriptModel) FormatClusterDomain() string { + if len(m.TCClusterDomain) > 0 { + return "." + m.TCClusterDomain + } + return "" +} + +func (m *NGMonitoringStartScriptModel) PDAddress() string { + // don't need add scheme, ng monitoring will use https if cert is configured + // TODO: support across kubernetes + return fmt.Sprintf("%s.%s:2379", controller.PDMemberName(m.TCName), m.TCNamespace) +} + +func (m *NGMonitoringStartScriptModel) RenderStartScript() (string, error) { + return renderTemplateFunc(ngMonitoringStartScriptTpl, m) +} + +func (m *NGMonitoringStartScriptModel) NGMPeerAddress() string { + headlessSvc := NGMonitoringHeadlessServiceName(m.TNGMName) + ns := m.TNGMNamespace + clusterDomain := m.TNGMClusterDomain + + if clusterDomain == "" { + return fmt.Sprintf("${POD_NAME}.%s.%s:12020", headlessSvc, ns) + } + return fmt.Sprintf("${POD_NAME}.%s.%s.svc.%s:12020", headlessSvc, m.TNGMNamespace, clusterDomain) +} + +var ngMonitoringStartScriptTpl = template.Must(template.New("ng-monitoring-start-script").Parse(`/ng-monitoring-server \ + --pd.endpoints {{ .PDAddress }} \ + --advertise-address {{ .NGMPeerAddress }} \ + --config /etc/ng-monitoring/ng-monitoring.toml \ + --storage.path /var/lib/ng-monitoring +`)) + +func renderTemplateFunc(tpl *template.Template, model interface{}) (string, error) { + buff := new(bytes.Buffer) + err := tpl.Execute(buff, model) + if err != nil { + return "", err + } + return buff.String(), nil +} diff --git a/pkg/manager/member/config.go b/pkg/manager/utils/config.go similarity index 90% rename from pkg/manager/member/config.go rename to pkg/manager/utils/config.go index d666eabbe6..35575395d7 100644 --- a/pkg/manager/member/config.go +++ b/pkg/manager/utils/config.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package member +package utils import ( "fmt" @@ -28,7 +28,12 @@ func updateConfigMap(old, new *corev1.ConfigMap) (bool, error) { dataEqual := true // check config - tomlField := []string{"config-file" /*pd,tikv,tidb */, "pump-config", "config_templ.toml" /*tiflash*/, "proxy_templ.toml" /*tiflash*/} + tomlField := []string{ + "config-file", // pd,tikv,tidb,ng-monitoring + "pump-config", // pump + "config_templ.toml", // tiflash + "proxy_templ.toml", // tiflash + } for _, k := range tomlField { oldData, oldOK := old.Data[k] newData, newOK := new.Data[k] @@ -68,8 +73,8 @@ func updateConfigMap(old, new *corev1.ConfigMap) (bool, error) { return dataEqual, nil } -// updateConfigMap set the toml field as the old one if they are logically equal. -func updateConfigMapIfNeed( +// UpdateConfigMapIfNeed set the toml field as the old one if they are logically equal. +func UpdateConfigMapIfNeed( cmLister corelisters.ConfigMapLister, configUpdateStrategy v1alpha1.ConfigUpdateStrategy, inUseName string, diff --git a/pkg/manager/member/config_test.go b/pkg/manager/utils/config_test.go similarity index 99% rename from pkg/manager/member/config_test.go rename to pkg/manager/utils/config_test.go index 062bfdba01..92469efd84 100644 --- a/pkg/manager/member/config_test.go +++ b/pkg/manager/utils/config_test.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package member +package utils import ( "testing" diff --git a/pkg/manager/utils/configmap.go b/pkg/manager/utils/configmap.go new file mode 100644 index 0000000000..690157c77c --- /dev/null +++ b/pkg/manager/utils/configmap.go @@ -0,0 +1,51 @@ +// Copyright 2020 PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +package utils + +import ( + "crypto/sha256" + "encoding/json" + "fmt" + + corev1 "k8s.io/api/core/v1" +) + +func AddConfigMapDigestSuffix(cm *corev1.ConfigMap) error { + sum, err := Sha256Sum(cm.Data) + if err != nil { + return err + } + suffix := fmt.Sprintf("%x", sum)[0:7] + cm.Name = fmt.Sprintf("%s-%s", cm.Name, suffix) + return nil +} + +func Sha256Sum(v interface{}) (string, error) { + data, err := json.Marshal(v) + if err != nil { + return "", err + } + sum := sha256.Sum256(data) + return fmt.Sprintf("%x", sum), nil +} + +// FindConfigMapVolume returns the configmap which's name matches the predicate in a PodSpec, empty indicates not found +func FindConfigMapVolume(podSpec *corev1.PodSpec, pred func(string) bool) string { + for _, vol := range podSpec.Volumes { + if vol.ConfigMap != nil && pred(vol.ConfigMap.LocalObjectReference.Name) { + return vol.ConfigMap.LocalObjectReference.Name + } + } + return "" +} diff --git a/pkg/manager/utils/statefulset.go b/pkg/manager/utils/statefulset.go new file mode 100644 index 0000000000..cc7571b208 --- /dev/null +++ b/pkg/manager/utils/statefulset.go @@ -0,0 +1,114 @@ +// Copyright 2021 PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +package utils + +import ( + "github.com/pingcap/tidb-operator/pkg/apis/label" + "github.com/pingcap/tidb-operator/pkg/controller" + "github.com/pingcap/tidb-operator/pkg/util" + + apps "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/klog" +) + +const ( + // LastAppliedConfigAnnotation is annotation key of last applied configuration + LastAppliedConfigAnnotation = "pingcap.com/last-applied-configuration" +) + +// StatefulSetIsUpgrading confirms whether the statefulSet is upgrading phase +func StatefulSetIsUpgrading(set *apps.StatefulSet) bool { + if set.Status.CurrentRevision != set.Status.UpdateRevision { + return true + } + if set.Generation > set.Status.ObservedGeneration && *set.Spec.Replicas == set.Status.Replicas { + return true + } + return false +} + +// SetStatefulSetLastAppliedConfigAnnotation set last applied config to Statefulset's annotation +func SetStatefulSetLastAppliedConfigAnnotation(set *apps.StatefulSet) error { + setApply, err := util.Encode(set.Spec) + if err != nil { + return err + } + if set.Annotations == nil { + set.Annotations = map[string]string{} + } + set.Annotations[LastAppliedConfigAnnotation] = setApply + return nil +} + +// UpdateStatefulSet is a template function to update the statefulset of components +func UpdateStatefulSet(setCtl controller.StatefulSetControlInterface, object runtime.Object, newSet, oldSet *apps.StatefulSet) error { + isOrphan := metav1.GetControllerOf(oldSet) == nil + if newSet.Annotations == nil { + newSet.Annotations = map[string]string{} + } + if oldSet.Annotations == nil { + oldSet.Annotations = map[string]string{} + } + + // Check if an upgrade is needed. + // If not, early return. + if util.StatefulSetEqual(*newSet, *oldSet) && !isOrphan { + return nil + } + + set := *oldSet + + // update specs for sts + *set.Spec.Replicas = *newSet.Spec.Replicas + set.Spec.UpdateStrategy = newSet.Spec.UpdateStrategy + set.Labels = newSet.Labels + set.Annotations = newSet.Annotations + set.Spec.Template = newSet.Spec.Template + if isOrphan { + set.OwnerReferences = newSet.OwnerReferences + } + + var podConfig string + var hasPodConfig bool + if oldSet.Spec.Template.Annotations != nil { + podConfig, hasPodConfig = oldSet.Spec.Template.Annotations[LastAppliedConfigAnnotation] + } + if hasPodConfig { + if set.Spec.Template.Annotations == nil { + set.Spec.Template.Annotations = map[string]string{} + } + set.Spec.Template.Annotations[LastAppliedConfigAnnotation] = podConfig + } + v, ok := oldSet.Annotations[label.AnnStsLastSyncTimestamp] + if ok { + set.Annotations[label.AnnStsLastSyncTimestamp] = v + } + + err := SetStatefulSetLastAppliedConfigAnnotation(&set) + if err != nil { + return err + } + + // commit to k8s + _, err = setCtl.UpdateStatefulSet(object, &set) + return err +} + +// SetUpgradePartition set statefulSet's rolling update partition +func SetUpgradePartition(set *apps.StatefulSet, upgradeOrdinal int32) { + set.Spec.UpdateStrategy.RollingUpdate = &apps.RollingUpdateStatefulSetStrategy{Partition: &upgradeOrdinal} + klog.Infof("set %s/%s partition to %d", set.GetNamespace(), set.GetName(), upgradeOrdinal) +} diff --git a/pkg/manager/utils/statefulset_builder.go b/pkg/manager/utils/statefulset_builder.go new file mode 100644 index 0000000000..ddff38f696 --- /dev/null +++ b/pkg/manager/utils/statefulset_builder.go @@ -0,0 +1,127 @@ +// Copyright 2021 PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +package utils + +import ( + "github.com/pingcap/tidb-operator/pkg/util" + + apps "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" +) + +type ContainerBuilder struct { + prototype *corev1.Container +} + +func NewContainerBuilder(container *corev1.Container) *ContainerBuilder { + return &ContainerBuilder{ + prototype: container, + } +} + +func (cb *ContainerBuilder) Get() *corev1.Container { + return cb.prototype +} + +func (cb *ContainerBuilder) Clone() *corev1.Container { + return cb.prototype.DeepCopy() +} + +func (cb *ContainerBuilder) AddVolumeMounts(mounts ...corev1.VolumeMount) { + cb.prototype.VolumeMounts = append(cb.prototype.VolumeMounts, mounts...) +} + +func (cb *ContainerBuilder) AddEnvs(envs ...corev1.EnvVar) { + cb.prototype.Env = util.AppendEnv(cb.prototype.Env, envs) +} + +type PodTemplateSpecBuilder struct { + prototype *corev1.PodTemplateSpec +} + +func NewPodTemplateSpecBuilder(podTemplate *corev1.PodTemplateSpec) *PodTemplateSpecBuilder { + return &PodTemplateSpecBuilder{ + prototype: podTemplate, + } +} + +func (pb *PodTemplateSpecBuilder) Get() *corev1.PodTemplateSpec { + return pb.prototype +} + +func (pb *PodTemplateSpecBuilder) Clone() *corev1.PodTemplateSpec { + return pb.prototype.DeepCopy() +} + +// ContainerBuilder return the specified container builder +// +// NOTE: don't save the builder, it will be outdated if container slice expand +func (pb *PodTemplateSpecBuilder) ContainerBuilder(name string) *ContainerBuilder { + for i := range pb.prototype.Spec.Containers { + if pb.prototype.Spec.Containers[i].Name == name { + return NewContainerBuilder(&pb.prototype.Spec.Containers[i]) + } + } + return nil +} + +// AddContainers add container to pod's spec +// +// NOTE: if container slice expand, old ContainerBuilder reference will be outdated. +func (pb *PodTemplateSpecBuilder) AddContainers(containers ...corev1.Container) { + pb.prototype.Spec.Containers = append(pb.prototype.Spec.Containers, containers...) +} + +func (b *PodTemplateSpecBuilder) AddVolumes(volumes ...corev1.Volume) { + b.prototype.Spec.Volumes = append(b.prototype.Spec.Volumes, volumes...) +} + +func (b *PodTemplateSpecBuilder) AddLabels(labels map[string]string) { + b.prototype.Labels = util.CombineStringMap(b.prototype.Labels, labels) +} + +func (b *PodTemplateSpecBuilder) AddAnnotations(annos map[string]string) { + b.prototype.Annotations = util.CombineStringMap(b.prototype.Annotations, annos) +} + +func (b *PodTemplateSpecBuilder) RunInHostNetwork() { + b.prototype.Spec.HostNetwork = true + b.prototype.Spec.DNSPolicy = corev1.DNSClusterFirstWithHostNet +} + +type StatefulSetBuilder struct { + prototype *apps.StatefulSet +} + +func NewStatefulSetBuilder(sts *apps.StatefulSet) *StatefulSetBuilder { + return &StatefulSetBuilder{ + prototype: sts, + } +} + +func (sb *StatefulSetBuilder) Get() *apps.StatefulSet { + return sb.prototype +} + +func (sb *StatefulSetBuilder) Clone() *apps.StatefulSet { + return sb.prototype.DeepCopy() +} + +func (sb *StatefulSetBuilder) PodTemplateSpecBuilder() *PodTemplateSpecBuilder { + return NewPodTemplateSpecBuilder(&sb.prototype.Spec.Template) +} + +func (sb *StatefulSetBuilder) AddVolumeClaims(pvcs ...corev1.PersistentVolumeClaim) { + sb.prototype.Spec.VolumeClaimTemplates = append(sb.prototype.Spec.VolumeClaimTemplates, pvcs...) +} diff --git a/pkg/manager/utils/statefulset_test.go b/pkg/manager/utils/statefulset_test.go new file mode 100644 index 0000000000..2a5bc61466 --- /dev/null +++ b/pkg/manager/utils/statefulset_test.go @@ -0,0 +1,96 @@ +// Copyright 2018 PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +package utils + +import ( + "testing" + + . "github.com/onsi/gomega" + apps "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func TestStatefulSetIsUpgrading(t *testing.T) { + g := NewGomegaWithT(t) + + type testcase struct { + name string + update func(*apps.StatefulSet) + expectUpgrading bool + } + + testFn := func(test *testcase, t *testing.T) { + t.Log(test.name) + + set := &apps.StatefulSet{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test", + Namespace: metav1.NamespaceDefault, + }, + } + if test.update != nil { + test.update(set) + } + b := StatefulSetIsUpgrading(set) + if test.expectUpgrading { + g.Expect(b).To(BeTrue()) + } else { + g.Expect(b).To(BeFalse()) + } + } + tests := []*testcase{ + { + name: "ObservedGeneration is nil", + update: nil, + expectUpgrading: false, + }, + { + name: "CurrentRevision not equal UpdateRevision", + update: func(set *apps.StatefulSet) { + set.Status.ObservedGeneration = 1000 + set.Status.CurrentRevision = "v1" + set.Status.UpdateRevision = "v2" + }, + expectUpgrading: true, + }, + { + name: "set.Generation > *set.Status.ObservedGeneration && *set.Spec.Replicas == set.Status.Replicas", + update: func(set *apps.StatefulSet) { + set.Generation = 1001 + set.Status.ObservedGeneration = 1000 + set.Status.CurrentRevision = "v1" + set.Status.UpdateRevision = "v1" + set.Status.Replicas = 3 + set.Spec.Replicas = func() *int32 { var i int32 = 3; return &i }() + }, + expectUpgrading: true, + }, + { + name: "replicas not equal", + update: func(set *apps.StatefulSet) { + set.Generation = 1001 + set.Status.ObservedGeneration = 1000 + set.Status.CurrentRevision = "v1" + set.Status.UpdateRevision = "v1" + set.Status.Replicas = 3 + set.Spec.Replicas = func() *int32 { var i int32 = 2; return &i }() + }, + expectUpgrading: false, + }, + } + + for _, test := range tests { + testFn(test, t) + } +} diff --git a/pkg/monitor/monitor/monitor_manager.go b/pkg/monitor/monitor/monitor_manager.go index 672a36306b..7725f83637 100644 --- a/pkg/monitor/monitor/monitor_manager.go +++ b/pkg/monitor/monitor/monitor_manager.go @@ -26,6 +26,7 @@ import ( "github.com/pingcap/tidb-operator/pkg/features" "github.com/pingcap/tidb-operator/pkg/manager/member" "github.com/pingcap/tidb-operator/pkg/manager/meta" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" "github.com/pingcap/tidb-operator/pkg/monitor" "github.com/pingcap/tidb-operator/pkg/pdapi" "github.com/pingcap/tidb-operator/pkg/util" @@ -248,7 +249,7 @@ func (m *MonitorManager) syncTidbMonitorStatefulset(tc *v1alpha1.TidbCluster, dc } setNotExist := errors.IsNotFound(err) if setNotExist { - err = member.SetStatefulSetLastAppliedConfigAnnotation(newMonitorSts) + err = mngerutils.SetStatefulSetLastAppliedConfigAnnotation(newMonitorSts) if err != nil { return err } @@ -258,7 +259,7 @@ func (m *MonitorManager) syncTidbMonitorStatefulset(tc *v1alpha1.TidbCluster, dc isAllCreated = false continue } - err = member.UpdateStatefulSet(m.deps.StatefulSetControl, monitor, newMonitorSts, oldMonitorSetTmp) + err = mngerutils.UpdateStatefulSet(m.deps.StatefulSetControl, monitor, newMonitorSts, oldMonitorSetTmp) if err != nil { klog.Errorf("Fail to update statefulset[%s/%s] for tm [%s/%s], err: %v", ns, stsName, ns, name, err) return err diff --git a/tests/e2e/tidbcluster/tidbcluster.go b/tests/e2e/tidbcluster/tidbcluster.go index 40859fedde..98d18ad466 100644 --- a/tests/e2e/tidbcluster/tidbcluster.go +++ b/tests/e2e/tidbcluster/tidbcluster.go @@ -53,6 +53,7 @@ import ( "github.com/pingcap/tidb-operator/pkg/controller" "github.com/pingcap/tidb-operator/pkg/features" "github.com/pingcap/tidb-operator/pkg/manager/member" + mngerutils "github.com/pingcap/tidb-operator/pkg/manager/utils" "github.com/pingcap/tidb-operator/pkg/monitor/monitor" "github.com/pingcap/tidb-operator/pkg/scheme" "github.com/pingcap/tidb-operator/tests" @@ -639,7 +640,7 @@ var _ = ginkgo.Describe("TiDBCluster", func() { return false, nil } - cmName := member.FindConfigMapVolume(&pumpSet.Spec.Template.Spec, func(name string) bool { + cmName := mngerutils.FindConfigMapVolume(&pumpSet.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, controller.PumpMemberName(tc.Name)) }) if cmName == "" { @@ -768,7 +769,7 @@ var _ = ginkgo.Describe("TiDBCluster", func() { if err != nil { return false, err } - cmName := member.FindConfigMapVolume(&newSet.Spec.Template.Spec, func(name string) bool { + cmName := mngerutils.FindConfigMapVolume(&newSet.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, setName) }) if cmName == "" { @@ -1644,7 +1645,7 @@ var _ = ginkgo.Describe("TiDBCluster", func() { return false, err } - cdcCmName = member.FindConfigMapVolume(&cdcSts.Spec.Template.Spec, func(name string) bool { + cdcCmName = mngerutils.FindConfigMapVolume(&cdcSts.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, controller.TiCDCMemberName(fromTc.Name)) }) @@ -2004,7 +2005,7 @@ var _ = ginkgo.Describe("TiDBCluster", func() { pdMemberName := controller.PDMemberName(tc.Name) pdSts, err := stsGetter.StatefulSets(ns).Get(context.TODO(), pdMemberName, metav1.GetOptions{}) framework.ExpectNoError(err, "failed to get StatefulSet %s/%s", ns, pdMemberName) - pdCmName := member.FindConfigMapVolume(&pdSts.Spec.Template.Spec, func(name string) bool { + pdCmName := mngerutils.FindConfigMapVolume(&pdSts.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, controller.PDMemberName(tc.Name)) }) pdCm, err := c.CoreV1().ConfigMaps(ns).Get(context.TODO(), pdCmName, metav1.GetOptions{}) @@ -2024,7 +2025,7 @@ var _ = ginkgo.Describe("TiDBCluster", func() { tikvMemberName := controller.TiKVMemberName(tc.Name) tikvSts, err := stsGetter.StatefulSets(ns).Get(context.TODO(), tikvMemberName, metav1.GetOptions{}) framework.ExpectNoError(err, "failed to get StatefulSet %s/%s", ns, tikvMemberName) - tikvCmName := member.FindConfigMapVolume(&tikvSts.Spec.Template.Spec, func(name string) bool { + tikvCmName := mngerutils.FindConfigMapVolume(&tikvSts.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, controller.TiKVMemberName(tc.Name)) }) tikvCm, err := c.CoreV1().ConfigMaps(ns).Get(context.TODO(), tikvCmName, metav1.GetOptions{}) @@ -2044,7 +2045,7 @@ var _ = ginkgo.Describe("TiDBCluster", func() { tidbMemberName := controller.TiDBMemberName(tc.Name) tidbSts, err := stsGetter.StatefulSets(ns).Get(context.TODO(), tidbMemberName, metav1.GetOptions{}) framework.ExpectNoError(err, "failed to get StatefulSet %s/%s", ns, tidbMemberName) - tidbCmName := member.FindConfigMapVolume(&tidbSts.Spec.Template.Spec, func(name string) bool { + tidbCmName := mngerutils.FindConfigMapVolume(&tidbSts.Spec.Template.Spec, func(name string) bool { return strings.HasPrefix(name, controller.TiDBMemberName(tc.Name)) }) tidbCm, err := c.CoreV1().ConfigMaps(ns).Get(context.TODO(), tidbCmName, metav1.GetOptions{})