legacy

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

README

INTRODUCTION

This module include the key functions on processing the POD JSON data file

The sample input POD data file is:


{
	"id": "test_|-|_id",
	"containers" : [{
		"name": "web",
		"image": "nginx:latest"
	}],
	"resource": {
		"vcpu": 1,
		"memory": "128"
	},
	"files": [],
	"volumes": []
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PodLogConfig

type PodLogConfig struct {
	Type   string            `json:"type"`
	Config map[string]string `json:"config"`
}

type PortmappingWhiteList

type PortmappingWhiteList struct {
	InternalNetworks []string `json:"internalNetworks,omitempty"`
	ExternalNetworks []string `json:"externalNetworks,omitempty"`
}

type UserContainer

type UserContainer struct {
	Name          string                `json:"name"`
	Image         string                `json:"image"`
	User          UserUser              `json:"user,omitempty"`
	Command       []string              `json:"command"`
	Workdir       string                `json:"workdir"`
	Entrypoint    []string              `json:"entrypoint"`
	Tty           bool                  `json:"tty,omitempty"`
	Sysctl        map[string]string     `json:"sysctl,omitempty"`
	Labels        map[string]string     `json:"labels"`
	Ports         []UserContainerPort   `json:"ports"`
	Envs          []UserEnvironmentVar  `json:"envs"`
	Volumes       []UserVolumeReference `json:"volumes"`
	Files         []UserFileReference   `json:"files"`
	RestartPolicy string                `json:"restartPolicy"`
}

type UserContainerPort

type UserContainerPort struct {
	HostPort      int    `json:"hostPort"`
	ContainerPort int    `json:"containerPort"`
	ServicePort   int    `json:"servicePort"`
	Protocol      string `json:"protocol"`
}

type UserEnvironmentVar

type UserEnvironmentVar struct {
	Env   string `json:"env"`
	Value string `json:"value"`
}

type UserFile

type UserFile struct {
	Name     string `json:"name"`
	Encoding string `json:"encoding"`
	Uri      string `json:"uri"`
	Contents string `json:"content"`
}

type UserFileReference

type UserFileReference struct {
	Path     string `json:"path"`
	Filename string `json:"filename"`
	Perm     string `json:"perm"`
	User     string `json:"user"`
	Group    string `json:"group"`
}

type UserInterface

type UserInterface struct {
	Bridge string `json:"bridge"`
	Ip     string `json:"ip"`
	Ifname string `json:"ifname,omitempty"`
	Mac    string `json:"mac,omitempty"`
	Gw     string `json:"gateway,omitempty"`
}

type UserPod

type UserPod struct {
	Name                  string                `json:"id"`
	Hostname              string                `json:"hostname"`
	Containers            []UserContainer       `json:"containers"`
	Resource              UserResource          `json:"resource"`
	Files                 []UserFile            `json:"files"`
	Volumes               []UserVolume          `json:"volumes"`
	Interfaces            []UserInterface       `json:"interfaces,omitempty"`
	Labels                map[string]string     `json:"labels"`
	Services              []UserService         `json:"services,omitempty"`
	LogConfig             PodLogConfig          `json:"log"`
	Dns                   []string              `json:"dns,omitempty"`
	PortmappingWhiteLists *PortmappingWhiteList `json:"portmappingWhiteLists,omitempty"`
	Tty                   bool                  `json:"tty"`
	Type                  string                `json:"type"`
	RestartPolicy         string
}

func ProcessPodBytes

func ProcessPodBytes(body []byte) (*UserPod, error)

func ProcessPodFile

func ProcessPodFile(jsonFile string) (*UserPod, error)

type UserResource

type UserResource struct {
	Vcpu   int `json:"vcpu"`
	Memory int `json:"memory"`
}

type UserService

type UserService struct {
	ServiceIP   string               `json:"serviceip"`
	ServicePort int                  `json:"serviceport"`
	Protocol    string               `json:"protocol"`
	Hosts       []UserServiceBackend `json:"hosts"`
}

type UserServiceBackend

type UserServiceBackend struct {
	HostIP   string `json:"hostip"`
	HostPort int    `json:"hostport"`
}

type UserUser

type UserUser struct {
	Name             string   `json:"name"`
	Group            string   `json:"group"`
	AdditionalGroups []string `json:"additionalGroups,omitempty"`
}

Pod Data Structure

type UserVolume

type UserVolume struct {
	Name   string           `json:"name"`
	Source string           `json:"source"`
	Driver string           `json:"driver"`
	Option UserVolumeOption `json:"option,omitempty"`
}

type UserVolumeOption

type UserVolumeOption struct {
	Monitors    []string `json:"monitors"`
	User        string   `json:"user"`
	Keyring     string   `json:"keyring"`
	BytesPerSec int      `json:"bytespersec"`
	Iops        int      `json:"iops"`
}

type UserVolumeReference

type UserVolumeReference struct {
	Path     string `json:"path"`
	Volume   string `json:"volume"`
	ReadOnly bool   `json:"readOnly"`
}

Jump to

Keyboard shortcuts

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