Documentation ¶
Index ¶
- Constants
- Variables
- func BranchPass(mars *mars.Config, name string) bool
- func CreateDockerSecrets(client kubernetes.Interface, namespace string, auths config.DockerAuths) (*v1.Secret, error)
- func DownloadFiles(pid any, commit string, files []string) (string, func(), error)
- func DownloadFilesToDir(pid any, commit string, files []string, dir string) (string, func(), error)
- func FileExists(path string) bool
- func Filter[T any](items []T, fn func(item T, index int) bool) []T
- func GetCpuAndMemory(list []v1beta1.PodMetrics) (string, string)
- func GetCpuAndMemoryInNamespace(namespace string) (string, string)
- func GetCpuAndMemoryQuantity(pod v1beta1.PodMetrics) (cpu *resource.Quantity, memory *resource.Quantity)
- func GetMarsNamespace(ns string) string
- func GetPreOccupiedLenByValuesYaml(values string) int
- func GetProjectMarsConfig(projectId any, branch string) (*mars.Config, error)
- func GetProjectName[T ~int | ~int64 | ~string](projectID T, marsC *mars.Config) string
- func GetSlugName[T int64 | int](namespaceId T, name string) string
- func IsPodRunning(namespace, podName string) (running bool, notRunningReason string)
- func IsRemoteChart(mars *mars.Config) bool
- func IsRemoteConfigFile(mars *mars.Config) bool
- func MD5(data string) string
- func NewCloser(fn func() error) io.Closer
- func NewCustomErrorContext() (context.Context, func(error))
- func NewDefaultArchiver() contracts.Archiver
- func NewFileCopier(executor contracts.RemoteExecutor, archiver contracts.Archiver) contracts.PodFileCopier
- func PackageChart(path string, destDir string) (string, error)
- func ParseInputConfig(mars *mars.Config, input string) (string, error)
- func RandomString(length int) string
- func ReleaseStatus(releaseName, namespace string) types.Deploy
- func Rollback(releaseName, namespace string, wait bool, log contracts.LogFn, dryRun bool) error
- func SplitManifests(manifest string) []string
- func UninstallRelease(releaseName, namespace string, log contracts.LogFn) error
- func UpgradeOrInstall(ctx context.Context, releaseName, namespace string, ch *chart.Chart, ...) (*release.Release, error)
- func WriteConfigYamlToTmpFile(data []byte) (string, io.Closer, error)
- func YamlDeepSetKey(field string, data any) ([]byte, error)
- type Closeable
- type ClusterStatus
- type CustomErrorContext
- type DockerConfig
- type DockerConfigEntry
- type DockerConfigJSON
- type Endpoint
- type EndpointMapping
- type InfoResponse
- type ListReleaseItem
- type ReleaseList
- type RuntimeObjectList
Constants ¶
View Source
const ( StatusUnknown string = "unknown" StatusPending string = "pending" StatusDeployed string = "deployed" StatusFailed string = "failed" )
Variables ¶
View Source
var (
ErrorInvalidSeparator = errors.New("error invalid separator")
)
Functions ¶
func CreateDockerSecrets ¶
func CreateDockerSecrets(client kubernetes.Interface, namespace string, auths config.DockerAuths) (*v1.Secret, error)
func DownloadFiles ¶
func DownloadFilesToDir ¶
func FileExists ¶
func GetCpuAndMemory ¶
func GetCpuAndMemory(list []v1beta1.PodMetrics) (string, string)
func GetCpuAndMemoryQuantity ¶
func GetMarsNamespace ¶
GetMarsNamespace prefix `devops-` namespace output dev devops-dev devops-dev devops-dev
func GetProjectMarsConfig ¶
func GetProjectName ¶
func IsPodRunning ¶
func IsRemoteChart ¶
func IsRemoteConfigFile ¶
IsRemoteConfigFile 如果是这个格式意味着是远程项目, "pid|branch|filename"
func NewCustomErrorContext ¶
func NewDefaultArchiver ¶
func NewFileCopier ¶
func NewFileCopier(executor contracts.RemoteExecutor, archiver contracts.Archiver) contracts.PodFileCopier
func ParseInputConfig ¶
values.yaml: ``` command: command: - sleep 3600 ``` config_field: command input: ``` command: - app ``` wants: ``` command: command: - app ```
------------------------------------
values.yaml: command: - sleep 3600 config_field: command input: ``` command: - app ``` wants: ``` command: - app ```
func ReleaseStatus ¶
func SplitManifests ¶
SplitManifests 因为有些 secret 自带 --- 的值,导致 spilt "---" 解析异常
func UninstallRelease ¶
func UpgradeOrInstall ¶
func UpgradeOrInstall(ctx context.Context, releaseName, namespace string, ch *chart.Chart, valueOpts *values.Options, fn contracts.WrapLogFn, wait bool, timeoutSeconds int64, dryRun bool, podSelectors []string, desc string) (*release.Release, error)
UpgradeOrInstall 不会自动回滚
Types ¶
type ClusterStatus ¶
type ClusterStatus = string
const ( StatusBad ClusterStatus = "bad" StatusNotGood ClusterStatus = "not good" StatusHealth ClusterStatus = "health" )
type CustomErrorContext ¶
func (*CustomErrorContext) Deadline ¶
func (m *CustomErrorContext) Deadline() (deadline time.Time, ok bool)
func (*CustomErrorContext) Done ¶
func (m *CustomErrorContext) Done() <-chan struct{}
func (*CustomErrorContext) Err ¶
func (m *CustomErrorContext) Err() error
func (*CustomErrorContext) Value ¶
func (m *CustomErrorContext) Value(key any) any
type DockerConfig ¶
type DockerConfig map[string]DockerConfigEntry
type DockerConfigEntry ¶
type DockerConfigJSON ¶
type DockerConfigJSON struct { Auths DockerConfig `json:"auths"` HttpHeaders map[string]string `json:"HttpHeaders,omitempty"` }
func DecodeDockerConfigJSON ¶
func DecodeDockerConfigJSON(data []byte) (res DockerConfigJSON, err error)
type Endpoint ¶
type Endpoint = types.ServiceEndpoint
type EndpointMapping ¶
func GetIngressMappingByProjects ¶
func GetIngressMappingByProjects(namespace string, projects ...models.Project) EndpointMapping
func GetLoadBalancerMappingByProjects ¶
func GetLoadBalancerMappingByProjects(namespace string, projects ...models.Project) EndpointMapping
func GetNodePortMappingByProjects ¶
func GetNodePortMappingByProjects(namespace string, projects ...models.Project) EndpointMapping
func (EndpointMapping) AllEndpoints ¶
func (e EndpointMapping) AllEndpoints() []*Endpoint
func (EndpointMapping) Get ¶
func (e EndpointMapping) Get(projName string) []*Endpoint
func (EndpointMapping) Sort ¶
func (e EndpointMapping) Sort()
type InfoResponse ¶
type InfoResponse struct { // 健康状况 Status ClusterStatus `json:"status"` // 可用内存 FreeMemory string `json:"free_memory"` // 可用 cpu FreeCpu string `json:"free_cpu"` // 可分配内存 FreeRequestMemory string `json:"free_request_memory"` // 可分配 cpu FreeRequestCpu string `json:"free_request_cpu"` // 总共的可调度的内存 TotalMemory string `json:"total_memory"` // 总共的可调度的 cpu TotalCpu string `json:"total_cpu"` // 内存使用率 UsageMemoryRate string `json:"usage_memory_rate"` // cpu 使用率 UsageCpuRate string `json:"usage_cpu_rate"` // 内存分配率 RequestMemoryRate string `json:"request_memory_rate"` // cpu 分配率 RequestCpuRate string `json:"request_cpu_rate"` }
func ClusterInfo ¶
func ClusterInfo() *InfoResponse
type ListReleaseItem ¶
type ReleaseList ¶
type ReleaseList map[string]ListReleaseItem
func (ReleaseList) Add ¶
func (l ReleaseList) Add(r *release.Release)
func (ReleaseList) GetStatus ¶
func (l ReleaseList) GetStatus(namespace, name string) string
type RuntimeObjectList ¶
func FilterRuntimeObjectFromManifests ¶
func FilterRuntimeObjectFromManifests[T runtime.Object](manifests []string) RuntimeObjectList
Source Files ¶
Click to show internal directories.
Click to hide internal directories.