constant

package
v0.0.0-...-96b04c8 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Valid           = "VALID"
	DisConnect      = "DISCONNECT"
	VerifyFailed    = "VERIFYFAILED"
	Azure           = "AZURE"
	S3              = "S3"
	OSS             = "OSS"
	Sftp            = "SFTP"
	MinIo           = "MINIO"
	DefaultFireName = "./ko-backup-test.json"
	MinIoFileName   = "ko-backup-test"
)
View Source
const (
	IngressReleaseName = "nginx-ingress"
	EFKReleaseName     = "efk"
	KoNamespaceName    = "kube-operator"
)
View Source
const (
	OpenStack                = "OpenStack"
	OpenStackImageName       = "kubeoperator_centos_7.6.1810"
	OpenStackImageDiskFormat = "qcow2"
	OpenStackImagePath       = "http://%s:%d/repository/oss-proxy/terraform/images/openstack/kubeoperator_centos_7.6.1810-1.qcow2"
	VSphere                  = "vSphere"
	VSphereImageName         = "kubeoperator_centos_7.6.1810"
	VSphereImageVMDkPath     = "http://%s:%d/repository/oss-proxy/terraform/images/vsphere/kubeoperator_centos_7.6.1810/kubeoperator_centos_7.6.1810-1.vmdk"
	VSphereImageOvfPath      = "http://%s:%d/repository/oss-proxy/terraform/images/vsphere/kubeoperator_centos_7.6.1810/kubeoperator_centos_7.6.1810.ovf"
	VSphereFolder            = "kubeoperator"
	ImageCredentialName      = "kubeoperator"
	OpenStackImageLocalPath  = "/opt/kubeoperator_centos_7.6.1810-1.qcow2"
	FusionCompute            = "FusionCompute"
	FusionComputeImageName   = "kubeoperator_centos_7.6.1810"
	FusionComputeOvfPath     = "" /* 126-byte string literal not displayed */
	FusionComputeVhdPath     = "" /* 130-byte string literal not displayed */
	FusionComputeOvfName     = "kubeoperator_centos_7.6.1810.ovf"
	FusionComputeVhdName     = "kubeoperator_centos_7.6.1810-vda.vhd"
	FusionComputeOvfLocal    = "./kubeoperator_centos_7.6.1810.ovf"
	FusionComputeVhdLocal    = "./kubeoperator_centos_7.6.1810-vda.vhd"
)
View Source
const (
	ClusterNotConnected = "NotConnected"
	ClusterTerminated   = "Terminated"

	NodeNameRuleDefault  = "default"
	NodeNameRuleHostName = "hostname"
	NodeNameRuleIP       = "ip"

	ClusterSourceLocal      = "local"
	ClusterNotReady         = "NotReady"
	ClusterSourceInternal   = "internal"
	ClusterSourceExternal   = "external"
	ClusterSourceKoExternal = "ko-external"

	NodeRoleNameMaster = "master"
	NodeRoleNameWorker = "worker"
	LbModeInternal     = "internal"

	ClusterProviderBareMetal = "bareMetal"
	ClusterProviderPlan      = "plan"

	AuthenticationModeBearer      = "bearer"
	AuthenticationModeCertificate = "certificate"
	AuthenticationModeConfigFile  = "configFile"

	DefaultNamespace     = "kube-operator"
	F5Namespace          = "kube-system"
	DefaultApiServerPort = 8443

	DefaultIngress            = "apps.ko.com"
	DefaultPrometheusIngress  = "prometheus." + DefaultIngress
	DefaultLoggingIngress     = "logging." + DefaultIngress
	DefaultLokiIngress        = "loki." + DefaultIngress
	DefaultGrafanaIngress     = "grafana." + DefaultIngress
	DefaultChartmuseumIngress = "chartmuseum." + DefaultIngress
	DefaultRegistryIngress    = "registry." + DefaultIngress
	DefaultDashboardIngress   = "dashboard." + DefaultIngress
	DefaultGatekeeperIngress  = "gatekeeper." + DefaultIngress
	DefaultKubeappsIngress    = "kubeapps." + DefaultIngress

	ChartmuseumChartName    = "nexus/chartmuseum"
	DockerRegistryChartName = "nexus/docker-registry"
	PrometheusChartName     = "nexus/prometheus"
	LoggingChartName        = "nexus/logging"
	LokiChartName           = "nexus/loki-stack"
	GrafanaChartName        = "nexus/grafana"
	DashboardChartName      = "nexus/kubernetes-dashboard"
	GatekeeperChartName     = "nexus/gatekeeper"
	KubeappsChartName       = "nexus/kubeapps"

	DefaultRegistryServiceName    = "registry-docker-registry"
	DefaultChartmuseumServiceName = "chartmuseum-chartmuseum"
	DefaultDashboardServiceName   = "dashboard-kubernetes-dashboard"
	DefaultGatekeeperServiceName  = "gatekeeper-webhook-service"
	DefaultLoggingServiceName     = "elasticsearch-master"
	DefaultLokiServiceName        = "loki"
	DefaultGrafanaServiceName     = "grafana"
	DefaultPrometheusServiceName  = "prometheus-server"
	DefaultKubeappsServiceName    = "kubeapps"

	DefaultRegistryIngressName    = "docker-registry-ingress"
	DefaultChartmuseumIngressName = "chartmuseum-ingress"
	DefaultDashboardIngressName   = "dashboard-ingress"
	DefaultGatekeeperIngressName  = "gatekeeper-ingress"
	DefaultLoggingIngressName     = "logging-ingress"
	DefaultLokiIngressName        = "loki-ingress"
	DefaultGrafanaIngressName     = "grafana-ingress"
	DefaultPrometheusIngressName  = "prometheus-ingress"
	DefaultKubeappsIngressName    = "kubeapps-ingress"

	DefaultRegistryDeploymentName    = "registry-docker-registry"
	DefaultChartmuseumDeploymentName = "chartmuseum-chartmuseum"
	DefaultDashboardDeploymentName   = "dashboard-kubernetes-dashboard"
	DefaultGatekeeperDeploymentName  = "gatekeeper-controller-manager"
	DefaultKubeappsDeploymentName    = "kubeapps"
	DefaultLoggingStateSetsfulName   = "elasticsearch-master"
	DefaultLokiStateSetsfulName      = "loki"
	DefaultGrafanaDeploymentName     = "grafana"
	DefaultPrometheusDeploymentName  = "prometheus-server"

	ClusterHealthLevelError   = "error"
	ClusterHealthLevelWarning = "warning"
	ClusterHealthLevelSuccess = "success"
)
View Source
const (
	BackupFileDefaultName    = "etcd-snapshot.db"
	BackupTarFileDefaultName = "etcd-snapshot.tar.gz"
)
View Source
const (
	PageNumQueryKey  = "pageNum"
	PageSizeQueryKey = "pageSize"

	BatchOperationUpdate = "update"
	BatchOperationCreate = "create"
	BatchOperationDelete = "delete"

	LocalRepositoryDomainName = "registry.kubeoperator.io"

	DefaultResourceName = "kubeoperator"

	TaskCancel = "task cancel"

	DefaultPassword = "kubeoperator@admin123"
)
View Source
const (
	Password   = "password"
	PrivateKey = "privateKey"
)
View Source
const (
	IpUsed      = "IP_USED"
	IpAvailable = "IP_AVAILABLE"
	IpLock      = "IP_LOCK"
	IpReachable = "IP_REACHABLE"
)
View Source
const (
	IstioNamespace         = "istio-system"
	IstioOperatorNamespace = "istio-operator-help"

	BaseChartName     = "nexus/istio-base"
	CniChartName      = "nexus/istio-cni"
	PilotChartName    = "nexus/istio-discovery"
	IngressChartName  = "nexus/istio-ingress"
	EgressChartName   = "nexus/istio-egress"
	OperatorChartName = "nexus/istio-operator"
	RemoteChartName   = "nexus/istiod-remote"
	CorednsChartName  = "nexus/istiocoredns"
)
View Source
const (
	Email          = "EMAIL"
	DingTalk       = "DING_TALK"
	WorkWeiXin     = "WORK_WEIXIN"
	LocalMail      = "LOCAL"
	Enable         = "ENABLE"
	Disable        = "DISABLE"
	Cluster        = "CLUSTER"
	System         = "SYSTEM"
	Read           = "READ"
	UnRead         = "UNREAD"
	SendSuccess    = "SUCCESS"
	SendFailed     = "FAILED"
	OperateSuccess = "SUCCESS"
	OperateFailed  = "FAILED"
)
View Source
const (
	ClusterInstall            = "CLUSTER_INSTALL"
	ClusterImport             = "CLUSTER_IMPORT"
	ClusterUpgrade            = "CLUSTER_UPGRADE"
	ClusterDelete             = "CLUSTER_DELETE"
	ClusterScale              = "CLUSTER_SCALE"
	ClusterAddWorker          = "CLUSTER_ADD_WORKER"
	ClusterRemoveWorker       = "CLUSTER_REMOVE_WORKER"
	ClusterRestore            = "CLUSTER_RESTORE"
	ClusterBackup             = "CLUSTER_BACKUP"
	ClusterEnableProvisioner  = "CLUSTER_ENABLE_PROVISIONER"
	ClusterDisableProvisioner = "CLUSTER_DISABLE_PROVISIONER"
	ClusterEnableComponent    = "CLUSTER_ENABLE_COMPONENT"
	ClusterDisableComponent   = "CLUSTER_DISABLE_COMPONENT"
	ClusterEventWarning       = "CLUSTER_EVENT_WARNING"
	MsgTest                   = "MSG_TEST"
	LicenseExpires            = "LICENSE_EXPIRE"
	ClusterOperator           = "CLUSTER_OPERATOR"
)

message type

View Source
const (
	MsgWarning = "Warning"
	MsgInfo    = "Info"
)

message level

View Source
const (
	StatusDisable = "DISABLE"
	StatusEnable  = "ENABLE"
)
View Source
const (
	ResourcePlan          = "PLAN"
	ResourceHost          = "HOST"
	ResourceCluster       = "CLUSTER"
	ResourceBackupAccount = "BACKUP_ACCOUNT"
	ResourceProject       = "PROJECT"
)
View Source
const (
	RoleAdmin          = "ADMIN"
	RoleProjectManager = "PROJECT_MANAGER"
	RoleClusterManager = "CLUSTER_MANAGER"
)
View Source
const (
	SystemRoleSuperAdmin = "super_admin"
	SystemRoleAdmin      = "admin"
	SystemRoleUser       = "user"
)
View Source
const (
	ProjectRoleProjectManager = "PROJECT_MANAGER"
	ProjectRoleClusterManager = "CLUSTER_MANAGER"
)
View Source
const (
	Admin          = "admin"
	ProjectManager = "projectManager"
	ClusterManager = "clusterManager"
)
View Source
const (
	SessionUserKey         = "user"
	CookieNameForSessionID = "ksession"

	AuthMethodSession = "session"
	AuthMethodJWT     = "jwt"
)
View Source
const (
	LOGIN  = "登录|Login"
	LOGOUT = "退出|Logout"

	// 项目
	CREATE_PROJECT      = "创建项目|Create project"
	UPDATE_PROJECT_INFO = "更新项目信息|Update project information"
	DELETE_PROJECT      = "删除项目|Delete project"

	BIND_CLUSTER_MEMBER            = "绑定集群成员|Binding cluster members"
	UNBIND_CLUSTER_MEMBER          = "解绑集群成员|Unbind cluster members"
	UPDATE_CLUSTER_MEMBER_ROLE     = "更新集群成员权限|Update cluster member permissions"
	BIND_CLUSTER_RESOURCE_PLAN     = "绑定集群资源(部署计划)|Binding cluster resources(plan)"
	BIND_CLUSTER_RESOURCE_BACKUP   = "绑定集群资源(备份账号)|Binding cluster resources(backup_account)"
	BIND_CLUSTER_RESOURCE_HOST     = "绑定集群资源(主机)|Binding cluster resources(host)"
	UNBIND_CLUSTER_RESOURCE_PLAN   = "解绑集群资源(部署计划)|Unbind cluster resources(plan)"
	UNBIND_CLUSTER_RESOURCE_BACKUP = "解绑集群资源(备份账号)|Unbind cluster resources(backup_account)"
	UNBIND_CLUSTER_RESOURCE_HOST   = "解绑集群资源(主机)|Unbind cluster resources(host)"

	BIND_PROJECT_MEMBER            = "绑定项目成员|Binding project members"
	UNBIND_PROJECT_MEMBER          = "解绑项目成员|Unbind project members"
	UPDATE_PROJECT_MEMBER_ROLE     = "更新项目成员权限|Update project member permissions"
	BIND_PROJECT_RESOURCE_PLAN     = "绑定项目资源(部署计划)|Binding project resources(plan)"
	BIND_PROJECT_RESOURCE_BACKUP   = "绑定项目资源(备份账号)|Binding project resources(backup_account)"
	BIND_PROJECT_RESOURCE_HOST     = "绑定项目资源(主机)|Binding project resources(host)"
	UNBIND_PROJECT_RESOURCE_PLAN   = "解绑项目资源(部署计划)|Unbind project resources(plan)"
	UNBIND_PROJECT_RESOURCE_BACKUP = "解绑项目资源(备份账号)|Unbind project resources(backup_account)"
	UNBIND_PROJECT_RESOURCE_HOST   = "解绑项目资源(主机)|Unbind project resources(host)"

	// 集群
	CREATE_CLUSTER  = "添加集群|Create cluster"
	IMPORT_CLUSTER  = "导入集群|Import cluster"
	INIT_CLUSTER    = "初始化集群|Init cluster"
	DELETE_CLUSTER  = "删除集群|Delete cluster"
	UPGRADE_CLUSTER = "集群升级|Upgrade cluster"
	HEALTH_CHECK    = "集群健康检查|Health check"
	HEALTH_RECOVER  = "集群健康恢复|Health recover"

	CREATE_COMPONENT = "添加集群组件|Create cluster component"
	DELETE_COMPONENT = "删除集群组件|Delete cluster component"
	SYNC_COMPONENT   = "同步集群组件|Sync cluster component"

	CREATE_CLUSTER_NODE = "添加集群节点|Create cluster node"
	DELETE_CLUSTER_NODE = "删除集群节点|Delete cluster node"

	CREATE_CLUSTER_STORAGE_SUPPLIER = "添加集群存储供应商|Create cluster storage vendor"
	DELETE_CLUSTER_STORAGE_SUPPLIER = "删除集群存储供应商|Delete cluster storage vendor"
	SYNC_CLUSTER_STORAGE_SUPPLIER   = "同步集群存储供应商|Sync cluster storage vendor"
	CREATE_CLUSTER_PVC              = "添加集群持久卷|Create cluster pvc"
	DELETE_CLUSTER_PVC              = "删除集群持久卷|Delete cluster pvc"

	ENABLE_CLUSTER_NPD  = "启用NPD|Enable cluster NPD"
	DISABLE_CLUSTER_NPD = "关闭NPD|Disable cluster NPD"

	ENABLE_CLUSTER_TOOL   = "启用集群工具|Enable cluster tools"
	ENABLE_CLUSTER_FLEX   = "启用弹性 ip|Enable cluster flex ip"
	DISABLE_CLUSTER_FLEX  = "禁用弹性 ip|Disable cluster flex ip"
	UPGRADE_CLUSTER_TOOL  = "升级集群工具|Upgrade cluster tools"
	DISABLE_CLUSTER_TOOL  = "禁用集群工具|Disable cluster tools"
	ENABLE_CLUSTER_ISTIO  = "启用/修改集群 Istio|Enable/Update cluster Istio"
	DISABLE_CLUSTER_ISTIO = "禁用集群 Istio|Disable cluster Istio"

	CREATE_CLUSTER_STORAGE_CLASS   = "添加存储类|Create storage class"
	DELETE_CLUSTER_STORAGE_CLASS   = "删除存储类|Delete storage class"
	CREATE_CLUSTER_NAMESPACE       = "添加命名空间|Create cluster namespace"
	DELETE_CLUSTER_NAMESPACE       = "删除命名空间|Delete cluster namespace"
	CREATE_CLUSTER_BACKUP_STRATEGY = "添加集群备份策略|Create cluster backup strategy"
	START_CLUSTER_BACKUP           = "开始备份|Start cluster backup"
	UPLOAD_LOCAL_RECOVERY_FILE     = "上传本地恢复文件|Upload local recovery file"
	DELETE_RECOVERY_LIST           = "删除备份文件|Delete backup files"
	RECOVER_FROM_RECOVERY          = "从备份列表恢复|Restore from backup list"
	START_CLUSTER_CIS_SCAN         = "开始集群CIS扫描|Start cluster CIS scan"
	DELETE_CLUSTER_CIS_SCAN_RESULT = "删除集群CIS扫描结果|Delete cluster CIS scan results"

	// 主机
	CREATE_HOST    = "添加主机|Create host"
	EDIT_HOST      = "编辑主机|Edit host"
	SYNC_HOST_LIST = "主机同步|Sync host"
	DELETE_HOST    = "删除主机|Delete host"

	// 自动模式
	CREATE_REGION        = "添加区域|Create region"
	DELETE_REGION        = "删除区域|Delete region"
	CREATE_ZONE          = "添加可用区|Create zone"
	UPDATE_ZONE          = "修改可用区信息|Update zone information"
	DELETE_ZONE          = "删除可用区|Delete zone"
	CREATE_PLAN          = "添加部署计划|Create plan"
	DELETE_PLAN          = "删除部署计划|Delete plan"
	UPDATE_PLAN          = "更新部署计划|Update plan"
	CREATE_VM_CONFIG     = "添加虚拟机配置|Create virtual machine configuration"
	UPDATE_VM_CONFIG     = "修改虚拟机配置信息|Update virtual machine configuration information"
	DELETE_VM_CONFIG     = "删除虚拟机配置|Delete virtual machine configuration"
	CREATE_IP_POOL       = "添加IP池|Create Ip pool"
	BACTH_DELETE_IP_POOL = "批量删除IP池|Batch delete IP pool"
	DELETE_IP_POOL       = "删除IP池|Delete IP Pool"
	CREATE_IP            = "添加IP"
	DELETE_IP            = "删除Ip"
	CREATE_TEMPLATE      = "创建模版"
	DELETE_TEMPLATE      = "删除模版"
	UPRATE_TEMPLATE      = "更新模版"

	// 用户
	CREATE_USER          = "添加用户|Create user"
	UPDATE_USER          = "修改用户信息|Update user information"
	UPDATE_USER_PASSWORD = "修改用户密码|Update user password"
	DELETE_USER          = "删除用户|Delete user"
	FORGOT_USER_PASSWORD = "忘记密码|forgot password"

	// 版本
	ENABLE_VERSION  = "启用ko版本|Enable ko version"
	DISABLE_VERSION = "停用ko版本|Disable ko version"

	// 系统设置
	CREATE_CREDENTIALS    = "添加凭据|Create credentials"
	UPDATE_CREDENTIALS    = "修改凭据信息|Update credential information"
	DELETE_CREDENTIALS    = "删除凭据|Delete credentials"
	CREATE_REGISTRY       = "添加仓库信息|Create registry"
	UPDATE_REGISTRY       = "更新仓库信息|Delete registry"
	UPDATE_NEXUS_PASSWORD = "更新 Nexus 仓库密码|Update nexus password"
	DELETE_REGISTRY       = "删除仓库信息|Delete registry"
	CREATE_BACKUP_ACCOUNT = "添加备份账号|Create backup account"
	UPDATE_BACKUP_ACCOUNT = "修改备份账号信息|Update backup account information"
	DELETE_BACKUP_ACCOUNT = "删除备份账号|Delete backup account"
	CREATE_EMAIL          = "设置系统配置|Set system config"
	IMPORT_LICENCE        = "导入许可证书|import licence"

	CREATE_NTP = "添加 NTP|Create NTP server"
	UPDATE_NTP = "修改 NTP|Update NTP server"
	DELETE_NTP = "删除 NTP|DElete NTP server"
)
View Source
const (
	ArchAMD64           = "amd64"
	ArchARM64           = "arm64"
	ArchitectureOfAMD64 = "x86_64"
	ArchitectureOfARM64 = "aarch64"
)
View Source
const (
	TaskLogTypeClusterCreate     = "CLUSTER_CREATE"
	TaskLogTypeClusterImport     = "CLUSTER_IMPORT"
	TaskLogTypeClusterUpgrade    = "CLUSTER_UPGRADE"
	TaskLogTypeClusterDelete     = "CLUSTER_DELEDE"
	TaskLogTypeClusterNodeExtend = "CLUSTER_NODE_EXTEND"
	TaskLogTypeClusterNodeShrink = "CLUSTER_NODE_SHRINK"
	TaskLogTypeBackup            = "CLUSTER_BACKUP"
	TaskLogTypeRestore           = "CLUSTER_RESTORE"
	TaskLogTypeVeleroBackup      = "CLUSTER_VELERO_BACKUP"
	TaskLogTypeVeleroRestore     = "CLUSTER_VELERO_RESTORE"
	TaskLogTypeUpgrade           = "CLUSTER_UPGRADE"

	TaskLogStatusSuccess = "SUCCESS"
	TaskLogStatusFailed  = "FAILED"
	TaskLogStatusRunning = "RUNNING"
	TaskLogStatusWaiting = "WAITING"
	TaskLogStatusRedo    = "REDO"

	StatusPending       = "Pending"
	StatusRunning       = "Running"
	StatusNotReady      = "NotReady"
	StatusUpgrading     = "Upgrading"
	StatusSuccess       = "Success"
	StatusFailed        = "Failed"
	StatusLost          = "Lost"
	StatusCreating      = "Creating"
	StatusInitializing  = "Initializing"
	StatusTerminating   = "Terminating"
	StatusSynchronizing = "Synchronizing"
	StatusWaiting       = "Waiting"
	StatusDisabled      = "disable"
	StatusEnabled       = "enable"
)
View Source
const (
	Local = "LOCAL"
	Ldap  = "LDAP"
)
View Source
const (
	UserStatusActive  = "active"
	UserStatusPassive = "passive"
)
View Source
const (
	Initializing     = "INITIALIZING"
	Ready            = "READY"
	UploadImageError = "UPLOADIMAGERROR"
	Value            = "value"
	Usage            = "usage"
)
View Source
const AbrtAdaptor = "" /* 1365-byte string literal not displayed */
View Source
const DefaultDashboardTemplate = "" /* 76833-byte string literal not displayed */
View Source
const DockerMonitor = "" /* 647-byte string literal not displayed */
View Source
const KernelMonitor = "" /* 2591-byte string literal not displayed */
View Source
const (
	SINGLE = "SINGLE"
)
View Source
const SystemdMonitor = "" /* 952-byte string literal not displayed */
View Source
const (
	TestMessage = "KubeOperator消息测试"
)

Variables

View Source
var (
	IngressChartPath = path.Join(ChartsDir, "nginx-ingress-0.5.0.tgz")
	EFKChartPath     = path.Join(ChartsDir, "nginx-ingress-0.5.0.tgz")
)
View Source
var (
	ResourceDir          = "resource"
	ChartsDir            = path.Join(ResourceDir, "charts")
	DefaultDataDir       = "/var/ko/data"
	DefaultAnsibleLogDir = path.Join(DefaultDataDir, "ansible")
	BackupDir            = path.Join(DefaultDataDir, "backup")
	DefaultRepositoryDir = path.Join(DefaultDataDir, "git")
)
View Source
var (
	PlaybookBase                   = "01-base.yml"
	PlaybookContainerd             = "02-containerd.yml"
	PlaybookDocker                 = "02-runtime.yml"
	PlaybookKubernetesComponent    = "03-kubernetes-component.yml"
	PlaybookLoadBalancer           = "04-load-balancer.yml"
	PlaybookETCD                   = "05-etcd.yml"
	PlaybookKubernetesCertificates = "06-kubernetes-certificates.yml"
	PlaybookKubernetesMaster       = "07-kubernetes-master.yml"
	PlaybookKubernetesWorker       = "08-kubernetes-worker.yml"
	PlaybookPost                   = "09-post.yml"
	PlaybookNetworkPlugin          = "10-network-plugin.yml"
	PlaybookInitCluster            = "90-initial-cluster.yml"
	PlaybookAddWorker              = "91-add-worker.yml"
	PlaybookUpgradeCluster         = "92-upgrade-cluster.yml"
	PlaybookCertificatesRenew      = "93-certificates-renew.yml"
	PlaybookBackupCluster          = "94-backup-cluster.yml"
	PlaybookRestoreCluster         = "95-restore-cluster.yml"
	PlaybookResetCluster           = "99-reset-cluster.yml"
)
View Source
var MsgTitle = map[string]string{
	ClusterInstall:            "集群安装",
	ClusterImport:             "集群导入",
	ClusterDelete:             "集群删除",
	ClusterUpgrade:            "集群升级",
	ClusterScale:              "集群伸缩",
	ClusterAddWorker:          "集群扩容",
	ClusterRemoveWorker:       "集群缩容",
	ClusterRestore:            "集群恢复",
	ClusterBackup:             "集群备份",
	ClusterEnableProvisioner:  "启用存储提供商",
	ClusterDisableProvisioner: "禁用存储提供商",
	ClusterEnableComponent:    "启用集群组件",
	ClusterDisableComponent:   "禁用集群组件",
	ClusterEventWarning:       "集群事件告警",
	MsgTest:                   "KubeOperator测试",
	LicenseExpires:            "License到期提醒",
}
View Source
var (
	NotSupportedBatchOperation = errors.New("not supported operation")
)
View Source
var Roles = loader.AdvancedRules{
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/license",
			"/api/v1/projects",
		},
		Method: []string{"GET"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin, RoleProjectManager, RoleClusterManager},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/users/{**}",
		},
		Method: []string{"PATCH"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin, RoleProjectManager, RoleClusterManager},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/users/change/password",
		},
		Method: []string{"POST"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin, RoleProjectManager, RoleClusterManager},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/clusters",
			"/api/v1/clusters/{**}",
			"/api/v1/clusters/{**}/{**}",
			"/api/v1/clusters/{**}/{**}/{**}",
			"/api/v1/clusters/{**}/{**}/{**}/{**}",
			"/api/v1/clusters/{**}/{**}/{**}/{**}/{**}",
			"/api/v1/clusters/{**}/{**}/{**}/{**}/{**}/{**}",
			"/api/v1/kubernetes/search",
			"/api/v1/kubernetes/search/metric/{**}",
			"/api/v1/kubernetes/{**}",
			"/api/v1/kubernetes/{**}/{**}",
			"/api/v1/users/change/password",
			"/api/v1/logs",
			"/api/v1/tasks",
			"/api/v1/tasks/{**}/{**}",
			"/api/v1/tasks/{**}/{**}/{**}",
			"/api/v1/components",
			"/api/v1/components/{**}",
			"/api/v1/components/{**}/{**}",
			"/api/v1/message/{**}",
			"/api/v1/message/{**}/check/{**}",
			"/api/v1/message/{**}/{**}",
			"/api/v1/user/settings/{**}",
			"/api/v1/user/settings",
			"/api/v1/user/messages",
			"/api/v1/user/messages/read/*",
		},
		Method: []string{"GET", "POST", "DELETE", "PUT", "PATCH"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin, RoleProjectManager, RoleClusterManager},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/dashboard/{**}",
			"/api/v1/dashboard/{**}/{**}",
			"/api/v1/dashboard/{**}/{**}/{**}",
			"/api/v1/projects/{**}",
			"/api/v1/projects/{**}/{resources,members}/{**}",
			"/api/v1/multicluster/repositories",
			"/api/v1/multicluster/repositories/{**}",
			"/api/v1/multicluster/repositories/{**}/{**}",
			"/api/v1/multicluster/repositories/{**}/{**}/{**}",
			"/api/v1/multicluster/repositories/{**}/{**}/{**}/{**}",
		},
		Method: []string{"GET", "POST", "DELETE", "PUT", "PATCH"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin, RoleProjectManager, RoleClusterManager},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/projects/{**}/clusters/{**}/{**}",
			"/api/v1/projects/{**}/clusters/{**}/{**}/{**}",
			"/api/v1/projects/{**}/clusters/{**}/{**}/{**}/{**}",
		},
		Method: []string{"POST", "DELETE", "PUT", "PATCH"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin, RoleProjectManager},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/projects/{**}/clusters/{**}/{**}",
			"/api/v1/projects/{**}/clusters/{**}/{**}/{**}",
		},
		Method: []string{"GET"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin, RoleProjectManager, RoleClusterManager},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/plans",
			"/api/v1/plans/{**}",
			"/api/v1/plans/{**}/{**}",
			"/api/v1/vmconfigs",
			"/api/v1/vmconfigs/{**}",
			"/api/v1/hosts",
			"/api/v1/hosts/{**}",
			"/api/v1/backupaccounts",
			"/api/v1/backupaccounts/{**}",
			"/api/v1/projects/{**}/{resources,members}",
			"/api/v1/templates",
			"/api/v1/templates/{**}",
		},
		Method: []string{"GET"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin, RoleProjectManager},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/manifests",
			"/api/v1/manifests/{active,group}",
		},
		Method: []string{"GET"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin, RoleProjectManager, RoleClusterManager},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/plans/search",
			"/api/v1/vmconfigs/search",
			"/api/v1/hosts/search",
			"/api/v1/hosts/batch",
			"/api/v1/backupaccounts/search",
			"/api/v1/templates/search",
		},
		Method: []string{"POST"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin, RoleProjectManager},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/regions",
			"/api/v1/regions/{**}",
			"/api/v1/regions/{**}/{**}",
			"/api/v1/zones",
			"/api/v1/zones/{**}",
			"/api/v1/zones/{**}/{**}",
			"/api/v1/ippools",
			"/api/v1/ippools/{**}",
			"/api/v1/ippools/{**}/{**}",
			"/api/v1/ippools/{**}/{**}/{**}",
			"/api/v1/credentials",
			"/api/v1/credentials/{**}",
			"/api/v1/templates/{**}",
			"/api/v1/msg/subscribes",
			"/api/v1/msg/subscribes/*",
			"/api/v1/msg/subscribes/*/*",
		},
		Method: []string{"GET", "POST", "DELETE", "PUT", "PATCH"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin, RoleProjectManager},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/ntp",
			"/api/v1/ntp/{**}",
			"/api/v1/settings",
			"/api/v1/settings/{**}",
			"/api/v1/settings/{**}/{**}",
			"/api/v1/settings/registry/change/password",
			"/api/v1/settings/registry/check/conn",
		},
		Method: []string{"POST", "DELETE", "PUT", "PATCH"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin, RoleProjectManager},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/ntp",
			"/api/v1/ntp/{**}",
			"/api/v1/settings",
			"/api/v1/settings/{**}",
			"/api/v1/settings/{**}/{**}",
		},
		Method: []string{"GET"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin, RoleProjectManager, RoleClusterManager},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/users",
			"/api/v1/users/{**}",
			"/api/v1/ldap/{**}",
			"/api/v1/msg/accounts/*",
		},
		Method: []string{"GET"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/projects",
			"/api/v1/users",
			"/api/v1/users/{**}",
			"/api/v1/license",
			"/api/v1/hosts",
			"/api/v1/hosts/load",
			"/api/v1/hosts/{sync,upload}",
			"/api/v1/plans",
			"/api/v1/vmconfigs",
			"/api/v1/backupaccounts",
			"/api/v1/backupaccounts/buckets",
			"/api/v1/projects/{**}/{resources,members}",
			"/api/v1/ldap",
			"/api/v1/ldap/*/*",
			"/api/v1/msg/accounts/*",
			"/api/v1/msg/accounts",
		},
		Method: []string{"POST"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/users/{**}",
			"/api/v1/hosts/{**}",
			"/api/v1/plans/{**}",
			"/api/v1/vmconfigs/{**}",
			"/api/v1/backupaccounts/{**}",
			"/api/v1/projects/{**}/{resources,members}/{**}",
			"/api/v1/msg/accounts/*",
		},
		Method: []string{"DELETE"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin},
			AllowAnyone:     false,
		},
	},
	{
		Host: []string{"*"},
		Path: []string{
			"/api/v1/vmconfigs/{**}",
			"/api/v1/manifests/{**}",
			"/api/v1/backupaccounts/{**}",
			"/api/v1/plans/{**}",
			"/api/v1/hosts",
			"/api/v1/ldap",
			"/api/v1/msg/accounts/*",
		},
		Method: []string{"PATCH"},
		Permission: &grbac.Permission{
			AuthorizedRoles: []string{RoleAdmin},
			AllowAnyone:     false,
		},
	},
}
View Source
var Sess = sessions.New(sessions.Config{Cookie: CookieNameForSessionID, Expires: 12 * time.Hour})
View Source
var Templates = map[string]map[string]string{
	MsgTest: {
		Email:      "pkg/templates/test.html",
		DingTalk:   "pkg/templates/test.html",
		WorkWeiXin: "pkg/templates/test.html",
	},
	LicenseExpires: {
		Email:      "pkg/templates/license_expire.html",
		DingTalk:   "pkg/templates/license_expire.md",
		WorkWeiXin: "pkg/templates/license_expire.md",
	},
	ClusterInstall: {
		Email:      "pkg/templates/cluster_op.html",
		DingTalk:   "pkg/templates/cluster_op.md",
		WorkWeiXin: "pkg/templates/cluster_op.md",
	},
	ClusterDelete: {
		Email:      "pkg/templates/cluster_op.html",
		DingTalk:   "pkg/templates/cluster_op.md",
		WorkWeiXin: "pkg/templates/cluster_op.md",
	},
	ClusterUpgrade: {
		Email:      "pkg/templates/cluster_op.html",
		DingTalk:   "pkg/templates/cluster_op.md",
		WorkWeiXin: "pkg/templates/cluster_op.md",
	},
	ClusterScale: {
		Email:      "pkg/templates/cluster_op.html",
		DingTalk:   "pkg/templates/cluster_op.md",
		WorkWeiXin: "pkg/templates/cluster_op.md",
	},
	ClusterAddWorker: {
		Email:      "pkg/templates/cluster_op.html",
		DingTalk:   "pkg/templates/cluster_op.md",
		WorkWeiXin: "pkg/templates/cluster_op.md",
	},
	ClusterRestore: {
		Email:      "pkg/templates/cluster_op.html",
		DingTalk:   "pkg/templates/cluster_op.md",
		WorkWeiXin: "pkg/templates/cluster_op.md",
	},
	ClusterBackup: {
		Email:      "pkg/templates/cluster_op.html",
		DingTalk:   "pkg/templates/cluster_op.md",
		WorkWeiXin: "pkg/templates/cluster_op.md",
	},
	ClusterEnableProvisioner: {
		Email:      "pkg/templates/cluster_op.html",
		DingTalk:   "pkg/templates/cluster_op.md",
		WorkWeiXin: "pkg/templates/cluster_op.md",
	},
	ClusterDisableProvisioner: {
		Email:      "pkg/templates/cluster_op.html",
		DingTalk:   "pkg/templates/cluster_op.md",
		WorkWeiXin: "pkg/templates/cluster_op.md",
	},
	ClusterEnableComponent: {
		Email:      "pkg/templates/cluster_op.html",
		DingTalk:   "pkg/templates/cluster_op.md",
		WorkWeiXin: "pkg/templates/cluster_op.md",
	},
	ClusterDisableComponent: {
		Email:      "pkg/templates/cluster_op.html",
		DingTalk:   "pkg/templates/cluster_op.md",
		WorkWeiXin: "pkg/templates/cluster_op.md",
	},
	ClusterEventWarning: {
		Email:      "pkg/templates/cluster_op.html",
		DingTalk:   "pkg/templates/cluster_op.md",
		WorkWeiXin: "pkg/templates/cluster_op.md",
	},
}

Functions

This section is empty.

Types

type VmConfig

type VmConfig struct {
	ID     int `json:"id"`
	Cpu    int `json:"cpu"`
	Memory int `json:"memory"`
	Disk   int `json:"disk"`
}

Jump to

Keyboard shortcuts

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