github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/pkg/controller/component/type.go (about) 1 /* 2 Copyright (C) 2022-2023 ApeCloud Co., Ltd 3 4 This file is part of KubeBlocks project 5 6 This program is free software: you can redistribute it and/or modify 7 it under the terms of the GNU Affero General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU Affero General Public License for more details. 15 16 You should have received a copy of the GNU Affero General Public License 17 along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 package component 21 22 import ( 23 corev1 "k8s.io/api/core/v1" 24 "k8s.io/apimachinery/pkg/util/intstr" 25 26 "github.com/1aal/kubeblocks/apis/apps/v1alpha1" 27 ) 28 29 type MonitorConfig struct { 30 Enable bool `json:"enable"` 31 BuiltIn bool `json:"builtIn"` 32 ScrapePort int32 `json:"scrapePort,omitempty"` 33 ScrapePath string `json:"scrapePath,omitempty"` 34 } 35 36 type SynthesizedComponent struct { 37 ClusterDefName string `json:"clusterDefName,omitempty"` 38 ClusterName string `json:"clusterName,omitempty"` 39 ClusterUID string `json:"clusterUID,omitempty"` 40 Name string `json:"name,omitempty"` 41 CompDefName string `json:"compDefName,omitempty"` 42 CharacterType string `json:"characterType,omitempty"` 43 MinAvailable *intstr.IntOrString `json:"minAvailable,omitempty"` 44 Replicas int32 `json:"replicas"` 45 WorkloadType v1alpha1.WorkloadType `json:"workloadType,omitempty"` 46 StatelessSpec *v1alpha1.StatelessSetSpec `json:"statelessSpec,omitempty"` 47 StatefulSpec *v1alpha1.StatefulSetSpec `json:"statefulSpec,omitempty"` 48 ConsensusSpec *v1alpha1.ConsensusSetSpec `json:"consensusSpec,omitempty"` 49 ReplicationSpec *v1alpha1.ReplicationSetSpec `json:"replicationSpec,omitempty"` 50 RSMSpec *v1alpha1.RSMSpec `json:"rsmSpec,omitempty"` 51 PodSpec *corev1.PodSpec `json:"podSpec,omitempty"` 52 Services []corev1.Service `json:"services,omitempty"` 53 Probes *v1alpha1.ClusterDefinitionProbes `json:"probes,omitempty"` 54 VolumeClaimTemplates []corev1.PersistentVolumeClaimTemplate `json:"volumeClaimTemplates,omitempty"` 55 Monitor *MonitorConfig `json:"monitor,omitempty"` 56 EnabledLogs []string `json:"enabledLogs,omitempty"` 57 LogConfigs []v1alpha1.LogConfig `json:"logConfigs,omitempty"` 58 ConfigTemplates []v1alpha1.ComponentConfigSpec `json:"configTemplates,omitempty"` 59 ScriptTemplates []v1alpha1.ComponentTemplateSpec `json:"scriptTemplates,omitempty"` 60 HorizontalScalePolicy *v1alpha1.HorizontalScalePolicy `json:"horizontalScalePolicy,omitempty"` 61 TLS bool `json:"tls"` 62 Issuer *v1alpha1.Issuer `json:"issuer,omitempty"` 63 VolumeTypes []v1alpha1.VolumeTypeSpec `json:"volumeTypes,omitempty"` 64 VolumeProtection *v1alpha1.VolumeProtectionSpec `json:"volumeProtection,omitempty"` 65 CustomLabelSpecs []v1alpha1.CustomLabelSpec `json:"customLabelSpecs,omitempty"` 66 SwitchoverSpec *v1alpha1.SwitchoverSpec `json:"switchoverSpec,omitempty"` 67 ComponentDef string `json:"componentDef,omitempty"` 68 ServiceAccountName string `json:"serviceAccountName,omitempty"` 69 StatefulSetWorkload v1alpha1.StatefulSetWorkload `json:"statefulSetWorkload,omitempty"` 70 ComponentRefEnvs []*corev1.EnvVar `json:"componentRefEnvs,omitempty"` 71 ServiceReferences map[string]*v1alpha1.ServiceDescriptor `json:"serviceReferences,omitempty"` 72 } 73 74 type CloudProvider string 75 76 const ( 77 CloudProviderAWS CloudProvider = "aws" 78 CloudProviderGCP CloudProvider = "gcp" 79 CloudProviderAliyun CloudProvider = "aliyun" 80 CloudProviderAzure CloudProvider = "azure" 81 CloudProviderTencent CloudProvider = "tencent" 82 CloudProviderUnknown CloudProvider = "unknown" 83 )