target

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SailMetaVarProduct  = "_sail_product"
	SailMetaVarHelmMode = "_sail_helm_mode"

	SailHelmModeComponent = "component"
	SailHelmModeProduct   = "product"

	SailPlaybookFile = ".sail.yaml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Common

type Common struct {
	SSHPort string
	SSHUser string
	SSHPass string

	SudoNopass bool

	InstallDir string
	DataDir    string
}

type RunningZone

type RunningZone struct {
	// contains filtered or unexported fields
}

func NewRunningZone

func NewRunningZone(zone *Zone, playbookName string) *RunningZone

func (*RunningZone) Run

func (rz *RunningZone) Run(args []string) error

func (*RunningZone) RunAnsiblePlaybook

func (rz *RunningZone) RunAnsiblePlaybook(args []string) error

func (*RunningZone) RunHelm

func (rz *RunningZone) RunHelm(args []string) error

func (*RunningZone) WithAnsiblePlaybookTags

func (rz *RunningZone) WithAnsiblePlaybookTags(ansiblePlaybookTags []string)

func (*RunningZone) WithPodComponents

func (rz *RunningZone) WithPodComponents(podComponents map[string]string)

func (*RunningZone) WithServerComponents

func (rz *RunningZone) WithServerComponents(serverComponents map[string]string)

func (*RunningZone) WithStartAtPlay

func (rz *RunningZone) WithStartAtPlay(startAtPlay string)

type Target

type Target struct {
	Name string
	// contains filtered or unexported fields
}

func NewTarget

func NewTarget(sailOption *models.SailOption, name string) *Target

func (*Target) AllZones added in v0.1.5

func (t *Target) AllZones() ([]string, error)

AllZones return zone names list of the target.

func (*Target) LoadAllZones

func (t *Target) LoadAllZones() error

func (*Target) LoadZone

func (t *Target) LoadZone(zoneName string) error

type TargetVars

type TargetVars struct {
	Zones map[string]interface{}
}

func NewTargetVars

func NewTargetVars() *TargetVars

type Zone

type Zone struct {
	*ZoneMeta

	TargetName    string
	ZoneName      string
	TargetDir     string
	ZoneDir       string
	VarsFile      string
	HostsFile     string
	PlatformsFile string
	ComputedFile  string

	ResourcesDir string

	HelmDir string

	Product    *product.Product
	CMDB       *cmdb.CMDB
	TargetVars *TargetVars
	// contains filtered or unexported fields
}

func NewZone

func NewZone(sailOption *models.SailOption, targetName string, zoneName string) *Zone

func (*Zone) BuildInventory

func (zone *Zone) BuildInventory(hostsMap map[string][]string) error

func (*Zone) Compute

func (zone *Zone) Compute() error

func (*Zone) Dump

func (zone *Zone) Dump() error

func (*Zone) GetK8SForComponent

func (zone *Zone) GetK8SForComponent(componentName string) *cmdb.K8S

func (*Zone) GetK8SForProduct

func (zone *Zone) GetK8SForProduct() *cmdb.K8S

func (*Zone) HandleCompatibity

func (zone *Zone) HandleCompatibity()

func (*Zone) HelmDirOfComponent

func (zone *Zone) HelmDirOfComponent(componentName string) string

HelmDirOfComponent returns the helm chart directory for specified component. It is used when the '_sail_helm_mode' is 'component'.

func (*Zone) HelmDirOfProduct

func (zone *Zone) HelmDirOfProduct() string

HelmDirOfProduct returns the helm chart directory for the product of the zone. It is used when the '_sail_helm_mode' is 'product'.

func (*Zone) Load

func (zone *Zone) Load() error

Load initialize the zone. The zone is supposed to be already exists. It will try to determine the product name from zone vars file.

func (*Zone) LoadHosts

func (zone *Zone) LoadHosts() error

func (*Zone) LoadNew

func (zone *Zone) LoadNew() error

LoadNew fill vars to zone. The zone is treated as a newly created zone. So it will ONLY load default varibles from product. This method is ONLY called when `conf-create`.

func (*Zone) LoadPlatforms

func (zone *Zone) LoadPlatforms() error

func (*Zone) LoadTarget

func (zone *Zone) LoadTarget() error

func (*Zone) ParseZoneMeta

func (zone *Zone) ParseZoneMeta() (*ZoneMeta, error)

func (*Zone) PatchActionHosts

func (zone *Zone) PatchActionHosts(groupName string, hostsPatch *ansible.ActionHosts)

func (*Zone) PatchActionHostsMap

func (zone *Zone) PatchActionHostsMap(m map[string][]ansible.ActionHosts) error

func (*Zone) PlaybookFile

func (zone *Zone) PlaybookFile(playbookName string) string

func (*Zone) PrepareHelm

func (zone *Zone) PrepareHelm() error

PrepareHelm prepares helm chart(s) for zone.

func (*Zone) PrepareHelmChart

func (zone *Zone) PrepareHelmChart() error

PrepareHelmChart prepares helm chart for the product. There will be only one chart for the product. <target>/<zone>/helm/<productName>/{Chart.yaml,templates,values.yaml,...}

func (*Zone) PrepareHelmCharts

func (zone *Zone) PrepareHelmCharts() error

PrepareHelmCharts prepares helm charts for each component of the product. Each component has its own helm chart. <target>/<zone>/helm/<componetName>/{Chart.yaml,templates,values.yaml,...}

func (*Zone) RenderComputed

func (zone *Zone) RenderComputed() error

func (*Zone) RenderHosts

func (zone *Zone) RenderHosts() error

func (*Zone) RenderPlatforms

func (zone *Zone) RenderPlatforms() error

func (*Zone) RenderSailPlaybook added in v0.1.4

func (zone *Zone) RenderSailPlaybook() error

RenderSailPlaybook renders the default temporary ansible playbook file for the product of the zone.

func (*Zone) RenderVars

func (zone *Zone) RenderVars() error

func (*Zone) SetComponentVersion

func (zone *Zone) SetComponentVersion(componentName string, componentVersion string) error

type ZoneMeta

type ZoneMeta struct {
	// tag value must equal to SailMetaVarProduct
	SailProduct string `json:"_sail_product" yaml:"_sail_product"`

	// tag value must equal to SailMetaVarHelmMode
	SailHelmMode string `json:"_sail_helm_mode" yaml:"_sail_helm_mode"`
}

Jump to

Keyboard shortcuts

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