resource

package
v0.0.0-...-9c8d8c7 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Code    *int    `json:"code,omitempty"`
	Data    *Data   `json:"data,omitempty"`
	Message *string `json:"msg,omitempty"`
}

type Basic

type Basic struct {
	CommonLabels       map[string]string
	DefaultAccessModes []v1.PersistentVolumeAccessMode
	StorageClass       string

	DockerRegistry []DockerRegistry
	Prefix         string
	// 默认为空
	ImageRepository string
	ChartRepository string
	DatasourceTpl   string
	ThinMode        bool

	SkipInput bool
	Timeout   int
	Slaver    c7nslaver.Slaver
}

type Client

type Client struct {
	BaseURL *url.URL

	UserAgent string

	Business bool
	Username string
	Password string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client, bUrl string) *Client

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) error

func (*Client) GetResource

func (c *Client) GetResource(version, url string) (string, error)

func (*Client) Init

func (c *Client) Init()

func (*Client) Login

func (c *Client) Login(user, pass string, biz bool) (*Auth, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

type Data

type Data struct {
	Token *string `json:"token,omitempty"`
}

type DockerRegistry

type DockerRegistry struct {
	Server         string
	Username       string
	Password       string
	SecretName     string
	ServiceAccount string
}

type InstallDefinition

type InstallDefinition struct {
	// api 版本
	Version string
	// Choerodon 平台版本
	PaaSVersion string
	Metadata    Metadata
	Spec        Spec
}

func (*InstallDefinition) CheckReleaseDomain

func (i *InstallDefinition) CheckReleaseDomain(values []c7nclient.ChartValue) error

func (*InstallDefinition) CreatePersistence

func (i *InstallDefinition) CreatePersistence(r *Release, client *c7nclient.K8sClient, namespace string)

func (*InstallDefinition) EncryptGitlabAccessToken

func (i *InstallDefinition) EncryptGitlabAccessToken() string

func (*InstallDefinition) GetDatabaseUrl

func (i *InstallDefinition) GetDatabaseUrl(rls string) string

func (*InstallDefinition) GetEurekaUrl

func (i *InstallDefinition) GetEurekaUrl() string

func (*InstallDefinition) GetImageRepository

func (i *InstallDefinition) GetImageRepository() string

func (*InstallDefinition) GetPersistence

func (i *InstallDefinition) GetPersistence(rls string, index int) *Persistence

func (*InstallDefinition) GetReleaseName

func (i *InstallDefinition) GetReleaseName(rlsName string) string

func (*InstallDefinition) GetReleaseValue

func (i *InstallDefinition) GetReleaseValue(rls, value string) string

func (*InstallDefinition) GetResource

func (i *InstallDefinition) GetResource(rls string) *c7ncfg.Resource

func (*InstallDefinition) GetResourceDomainUrl

func (i *InstallDefinition) GetResourceDomainUrl(rls string) string

func (*InstallDefinition) GetRunnerPersistence

func (i *InstallDefinition) GetRunnerPersistence(index int) *Persistence

func (*InstallDefinition) GetRunnerValues

func (i *InstallDefinition) GetRunnerValues(values string) string

func (*InstallDefinition) GetStorageClass

func (i *InstallDefinition) GetStorageClass() string

TODO add storageClassName()

func (*InstallDefinition) IsApplication

func (i *InstallDefinition) IsApplication(name string) bool

func (*InstallDefinition) IsName

func (i *InstallDefinition) IsName(name string) bool

func (*InstallDefinition) IsReleases

func (i *InstallDefinition) IsReleases(name string) bool

func (*InstallDefinition) IsThinMode

func (i *InstallDefinition) IsThinMode() bool

func (*InstallDefinition) MergerConfig

func (i *InstallDefinition) MergerConfig(uc *c7ncfg.C7nConfig)

将 config.yml 中的值合并到 Release.Resource

func (*InstallDefinition) PrintRelease

func (i *InstallDefinition) PrintRelease(name string)

func (*InstallDefinition) RenderHelmValues

func (i *InstallDefinition) RenderHelmValues(r *Release, fileVals string) (map[string]interface{}, error)

必须基于 InstallDefinition 渲染 value.yaml 文件

func (*InstallDefinition) RenderReleases

func (i *InstallDefinition) RenderReleases(name string, client *c7nclient.K8sClient, namespace string) error

func (*InstallDefinition) SetChartRepository

func (i *InstallDefinition) SetChartRepository(chartRepo string)

func (*InstallDefinition) SetDatasourceTpl

func (i *InstallDefinition) SetDatasourceTpl(dsTpl string)

func (*InstallDefinition) SetImageRepository

func (i *InstallDefinition) SetImageRepository(imageRepo string)

func (*InstallDefinition) SetPrefix

func (i *InstallDefinition) SetPrefix(prefix string)

func (*InstallDefinition) SetStorageClass

func (i *InstallDefinition) SetStorageClass(sc string)

func (*InstallDefinition) SetThinMode

func (i *InstallDefinition) SetThinMode(thinMode bool)

func (*InstallDefinition) WithPrefix

func (i *InstallDefinition) WithPrefix() string

template 内嵌函数

type Metadata

type Metadata struct {
	Name      string
	Namespace string
}

type Persistence

type Persistence struct {
	Client       *c7nclient.K8sClient
	CommonLabels map[string]string
	AccessModes  []v1.PersistentVolumeAccessMode
	Capacity     v1.ResourceList
	Name         string
	PvcEnabled   bool
	Path         string
	RootPath     string
	Size         string
	Namespace    string
	RefPvName    string
	RefPvcName   string
	Mode         string
	Own          string
	MountOptions []string
	StorageClass string
}

func (*Persistence) CheckOrCreatePv

func (p *Persistence) CheckOrCreatePv(pvs v1.PersistentVolumeSource) error

check and create pv with defined pv schema

func (*Persistence) CheckOrCreatePvc

func (p *Persistence) CheckOrCreatePvc(sc string) error

type Release

type Release struct {
	Name         string
	Chart        string
	Version      string
	Namespace    string
	RepoURL      string
	Values       []c7nclient.ChartValue
	Persistence  []*Persistence
	PreInstall   []ReleaseJob
	AfterInstall []ReleaseJob
	Requirements []string
	Resource     *config.Resource
	// TODO Remove
	Timeout     int
	Prefix      string
	SkipInput   bool
	PaaSVersion string
}

func (*Release) ExecuteAfterTasks

func (r *Release) ExecuteAfterTasks(s *slaver.Slaver) error

执行 after Task,完成后更新任务状态,并执行 wg.done

func (*Release) ExecutePreCommands

func (r *Release) ExecutePreCommands(s *slaver.Slaver) error

func (*Release) HelmValues

func (r *Release) HelmValues() []string

convert yml values to values list as xxx=yyy

func (*Release) InstallComponent

func (r *Release) InstallComponent() error

TODO 移动到 action 包

func (*Release) String

func (r *Release) String() string

type ReleaseJob

type ReleaseJob struct {
	Name     string
	InfraRef string `yaml:"infraRef"`
	Database string `yaml:"database"`
	Commands []string
	Mysql    []string
	Psql     []string `yaml:"psql"`
	Opens    []string
	Request  *Request
}

type Request

type Request struct {
	Header     []c7nclient.ChartValue
	Url        string
	Parameters []c7nclient.ChartValue
	Body       string
	Method     string
}

type Spec

type Spec struct {
	Basic       Basic
	Resources   v1.ResourceRequirements
	Application map[string][]string
	Release     map[string][]*Release
}

Jump to

Keyboard shortcuts

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