object

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Copyright (c) 2022 Zhang Zhanpeng <zhangregister@outlook.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2022 Zhang Zhanpeng <zhangregister@outlook.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2022 Zhang Zhanpeng <zhangregister@outlook.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2022 Zhang Zhanpeng <zhangregister@outlook.com>, Cai Dongliang <18307130121@fudan.edu.cn>, Zhong Chongpeng <1940064747@qq.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deploy

func Deploy(ctx context.Context, ketherObject *KetherObject, ketherObjectState *KetherObjectState) error

func ParseYaml

func ParseYaml(yamlPath string) (*KetherObject, *KetherObjectState, error)

func Register

func Register(ctx context.Context, yamlPath string) (*KetherObject, *KetherObjectState, error)

Types

type KetherObject

type KetherObject struct {
	Name                string
	Predicate, Priority *ResourceDescription
	Requirement         *RunDescription
}

KetherObject 是 Kether 对象

func (*KetherObject) GetContainerAndHostConfig added in v0.2.0

func (ketherObject *KetherObject) GetContainerAndHostConfig() (*container.Config, *container.HostConfig)

func (*KetherObject) GetContainerName added in v0.2.0

func (ketherObject *KetherObject) GetContainerName() string

func (*KetherObject) GetImageName

func (ketherObject *KetherObject) GetImageName() string

func (*KetherObject) GetNetworkingConfig added in v0.2.0

func (ketherObject *KetherObject) GetNetworkingConfig() *network.NetworkingConfig

type KetherObjectEntity

type KetherObjectEntity struct {
	Name        string                    `yaml:"name"`
	Kind        string                    `yaml:"kind"`
	Predicate   ResourceDescriptionEntity `yaml:"predicate"`
	Priority    ResourceDescriptionEntity `yaml:"priority"`
	Requirement RunDescriptionEntity      `yaml:"requirement"`
}

func (*KetherObjectEntity) GetKetherObject

func (ketherObjectEntity *KetherObjectEntity) GetKetherObject() *KetherObject

func (*KetherObjectEntity) GetKetherObjectState

func (ketherObjectEntity *KetherObjectEntity) GetKetherObjectState() *KetherObjectState

type KetherObjectState

type KetherObjectState struct {
	Name  string
	State KetherObjectStateType
}

KetherObjectState 是 Kether 对象状态

func (*KetherObjectState) SetState

func (ketherObjectState *KetherObjectState) SetState(ctx context.Context, state KetherObjectStateType) error

type KetherObjectStateType

type KetherObjectStateType int8

KetherObjectStateType Kether 对象状态类型

const (
	FAIL_TO_DEPLOY KetherObjectStateType = -2
	UNREGISTERED   KetherObjectStateType = 0
	REGISTERED     KetherObjectStateType = 1
	DEPLOYED       KetherObjectStateType = 2
)

type ResourceDescription

type ResourceDescription ResourceDescriptionEntity

ResourceDescription 描述 Kether 对象的资源需求

type ResourceDescriptionEntity

type ResourceDescriptionEntity struct {
	DockerImageRepository string `yaml:"repository"`
	DockerImageTag        string `yaml:"tag"`
}

type RunDescription

type RunDescription RunDescriptionEntity

RunDescription 描述运行 Kether 对象的需求,对应 `docker run` 的选项

type RunDescriptionEntity

type RunDescriptionEntity struct {
	LocalImage  bool     `yaml:"local_image"`
	Detach      bool     `yaml:"detach"`
	NetworkList []string `yaml:"network_list"`
	PublishList []string `yaml:"publish_list"`
	VolumeList  []string `yaml:"volume_list"`
}

Jump to

Keyboard shortcuts

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