dev_dir

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultKey = "DefaultKey"
)
View Source
var (
	NO_DEFAULT_PACK = errors.New("Current Svc pack not found ")
)

Functions

func ClearAllData

func ClearAllData()

for test only! it is dangeruas

func FlushCache

func FlushCache()

func Get

func Get(fun func(dirMapping *DevDirMapping, pathToPack map[DevPath][]*SvcPack) error) error

func Initial

func Initial()

func Update

func Update(fun func(dirMapping *DevDirMapping,

	pathToPack map[DevPath][]*SvcPack) error) error

Types

type AllSvcPackAssociateByPath

type AllSvcPackAssociateByPath struct {
	Packs             map[SvcPackKey]*SvcPack
	Kubeconfigs       map[SvcPackKey]string
	ServerMapping     map[SvcPackKey]string
	DefaultSvcPackKey SvcPackKey
}

type DevDirMapping

type DevDirMapping struct {
	PathToDefaultPackKey   map[DevPath]SvcPackKey `yaml:"path_to_default_pack_key"`
	PackToPath             map[SvcPackKey]DevPath `yaml:"pack_to_path"`
	PackToKubeConfigBytes  map[SvcPackKey]string  `yaml:"pack_to_kube_config_bytes"`
	PackToKubeConfigServer map[SvcPackKey]string  `yaml:"pack_to_kube_config_server"`
}

type DevPath

type DevPath string

func (DevPath) AlreadyAssociate

func (d DevPath) AlreadyAssociate(specifyPack *SvcPack) bool

func (DevPath) Associate

func (d DevPath) Associate(specifyPack *SvcPack, kubeconfig string, setAsDefaultSvc bool) error

Associate setAsDefaultSvc: if this dev path has been associate by svc && [setAsDefaultSvc==true] replace the default svc to the path

setAsDefaultSvc==false when data migration

func (DevPath) GetAllPacks

func (d DevPath) GetAllPacks() *AllSvcPackAssociateByPath

func (DevPath) GetDefaultPack

func (d DevPath) GetDefaultPack() (*SvcPack, error)

return error if not found

func (DevPath) RemovePack

func (d DevPath) RemovePack(specifyPack *SvcPack) error

func (DevPath) ToString

func (d DevPath) ToString() string

type SvcPack

type SvcPack struct {
	Ns        string       `yaml:"ns" json:"ns"`
	Nid       string       `yaml:"nid" json:"nid"`
	App       string       `yaml:"app" json:"app"`
	SvcType   base.SvcType `yaml:"svc_type" json:"svc_type"`
	Svc       string       `yaml:"svc" json:"svc"`
	Container string       `yaml:"container" json:"container"`
}

func NewSvcPack

func NewSvcPack(ns string,
	nid string,
	app string,
	svcType base.SvcType,
	svc string,
	container string) *SvcPack

func (*SvcPack) GetAssociatePath

func (svcPack *SvcPack) GetAssociatePath() DevPath

get associate path of svcPack if no path match, try with svc with none container

func (*SvcPack) GetAssociatePathCache

func (svcPack *SvcPack) GetAssociatePathCache() DevPath

func (*SvcPack) GetKubeConfigBytesAndServer

func (svcPack *SvcPack) GetKubeConfigBytesAndServer() (string, string)

return "" if error occur

func (SvcPack) Key

func (svcPack SvcPack) Key() SvcPackKey

func (SvcPack) KeyWithoutContainer

func (svcPack SvcPack) KeyWithoutContainer() SvcPackKey

func (*SvcPack) UnAssociatePath

func (svcPack *SvcPack) UnAssociatePath()

type SvcPackKey

type SvcPackKey string

func (SvcPackKey) WithoutNid

func (svcPackKey SvcPackKey) WithoutNid() SvcPackKey

Jump to

Keyboard shortcuts

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