Documentation ¶
Overview ¶
Package innerdomain , interconversion between k8s & marathon internal domain
旧版本的内部地址格式
<servicename>.<servicegroup-name>.<servicegroup-namespace>.<suffix1>.<suffix2>.marathon.l4lb.thisdcos.directory
e.g. (marathon) prototype.prod-6056.services.v1.runtimes.marathon.l4lb.thisdcos.directory (k8s) 不存在旧版本k8s地址 (marathon) consul.consul-afdb5eb0327848e19f3d414eb345dfdd.addons-2126.v1.runtimes.marathon.l4lb.thisdcos.directory (k8s) 不存在旧版本k8s地址
新版本的内部地址格式
marathon:
<servicename>.<namespace>.marathon.l4lb.thisdcos.directory
k8s:
<servicename>.<namespace>.svc.cluster.local
_LIMIT_: <namespace> 最长63位, <namespace> 必须保持唯一
e.g. (marathon) blog-service.<namespace>.marathon.l4lb.thisdcos.directory (k8s) blog-service.<namespace>.svc.cluster.local
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidAddr 输入地址不规范 ErrInvalidAddr = errors.New("invalid input address") // ErrMarathonLegacyAddr marathon _旧版_ 内部域名不满足规则 ErrMarathonLegacyAddr = fmt.Errorf("invalid legacy marathon addr, not satisfy regexp: %v", marathonLegacyRegex) // ErrMarathonAddr marathon 内部域名不满足规则 ErrMarathonAddr = fmt.Errorf("invalid marathon addr, not satisfy regexp: %v", marathonRegex) // ErrK8SAddr k8s 内部域名不满足规则 ErrK8SAddr = fmt.Errorf("invalid k8s addr: not satisfy regexp: %v", k8sRegex) // ErrTooLongNamespace 内部域名的 namespace 部分过长 ErrTooLongNamespace = errors.New("internal addr's namespace length > 63") // ErrNoLegacyK8SAddr 不存在 k8s _旧版_ 内部域名 ErrNoLegacyK8SAddr = errors.New("can't generate legacy k8s internal addr") )
Functions ¶
func MustParseWithEnv ¶
Types ¶
type InnerDomain ¶
type InnerDomain struct {
// contains filtered or unexported fields
}
InnerDomain 代表内部地址
func New ¶
func New(servicename, namespace string) (InnerDomain, error)
New 根据 servicename, namespace 构建 InnerDomain
func (*InnerDomain) Marathon ¶
func (i *InnerDomain) Marathon() (string, error)
Marathon 生成 marathon 版本的内部地址
func (*InnerDomain) MustMarathon ¶
func (i *InnerDomain) MustMarathon() string
MustMarathon 类似 Marathon,如果出错则 panic