Files
virtual-kubelet/providers/openstack/types.go
Kevin Zhao 5afb24809d Add OpenStack Zun provider(#22) (#239)
* Add Virtual Kubelet provider for OpenStack Zun

Initial virtual kubelet provider for OpenStack Zun. This provider
currently handles creating, starting and deleting a pod via OpenStack
Zun. Currently the configmap and secret is not support in Zun. Currently
the Volume is supported in Zun and will implementation the support in
virtual kubelet in next several patches.

Will add document to elaborate this development status.

Change-Id: Id80f18d89b22c535214aef95254f5c3c7ae23139
Signed-off-by: Kevin Zhao <kevin.zhao@arm.com>

* trying to fix dependencies

Change-Id: I8e6f2e0234a11591ff2be74e22dca1fb91bf8f47
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

* Add dummy ExecInContainer method

Change-Id: Idece5695bd81b0911538660526484895cdd8832c
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

* better use of fmt.Errorf

Change-Id: Ic402c80bd2302ac4f26b0025f110cbf9977ca862
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

* fix gofmt error

Signed-off-by: Kevin Zhao <kevinzs2048@gmail.com>

* add gophercloud vendor

Signed-off-by: Kevin Zhao <kevinzs2048@gmail.com>

* add provider register for openstack

Signed-off-by: Kevin Zhao <kevinzs2048@gmail.com>

* fix build error

Signed-off-by: Kevin Zhao <kevinzs2048@gmail.com>

* excluded aci test case

Signed-off-by: Kevin Zhao <kevinzs2048@gmail.com>

* Zun: several fixes on openstack provider

* Remove 'zunCapStatusToPodPhase' since it is not used anymore.
* Remove the handling of first container in capsule.
* Remove 'ApiVersion' from CapsuleTemplate

Signed-off-by: Hongbin Lu <hongbin034@gmail.com>

* Update gophercloud to latest

* Zun: use Zun API micro version 1.32

Signed-off-by: Hongbin Lu <hongbin034@gmail.com>

* Zun: wait for capsule to be deleted

Resource deletion in OpenStack Zun is asynchronous which means
the resource is not deleted immediately right after the delete request.
This commit make the provider wait for resource deletion to complete
on DeletePod.

Signed-off-by: Hongbin Lu <hongbin034@gmail.com>

* Change the build tag to openstack_provider

Signed-off-by: Hongbin Lu <hongbin034@gmail.com>
2019-03-28 18:27:57 -07:00

72 lines
3.1 KiB
Go

package openstack
// CapsuleSpec
type CapsuleSpec struct {
Volumes []Volume `json:"volumes,omitempty"`
Containers []Container `json:"containers,omitempty"`
RestartPolicy string `json:"restartPolicy,omitempty"`
}
type CapsuleTemplate struct {
Spec CapsuleSpec `json:"spec,omitempty"`
Kind string `json:"kind,omitempty"`
Metadata Metadata `json:"metadata,omitempty"`
}
type Metadata struct {
Labels map[string]string `json:"labels,omitempty"`
Name string `json:"name,omitempty"`
}
type Volume struct {
Name string `json:"name,omitempty"`
}
type Container struct {
// Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
Image string `json:"image,omitempty" protobuf:"bytes,2,opt,name=image"`
Command []string `json:"command,omitempty" protobuf:"bytes,3,rep,name=command"`
Args []string `json:"args,omitempty" protobuf:"bytes,4,rep,name=args"`
WorkingDir string `json:"workDir,omitempty" protobuf:"bytes,5,opt,name=workingDir"`
// Ports []ContainerPort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"containerPort" protobuf:"bytes,6,rep,name=ports"`
Env map[string]string `json:"env,omitempty"`
//ENV is different with Kubernetes
// Env []EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,6,rep,name=env"`
Resources ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,7,opt,name=resources"`
// VolumeMounts []VolumeMount `json:"volumeMounts,omitempty" patchStrategy:"merge" patchMergeKey:"mountPath" protobuf:"bytes,8,rep,name=volumeMounts"`
ImagePullPolicy string `json:"imagePullPolicy,omitempty" protobuf:"bytes,8,opt,name=imagePullPolicy"`
// Stdin bool `json:"stdin,omitempty" protobuf:"varint,16,opt,name=stdin"`
// StdinOnce bool `json:"stdinOnce,omitempty" protobuf:"varint,17,opt,name=stdinOnce"`
// TTY bool `json:"tty,omitempty" protobuf:"varint,18,opt,name=tty"`
}
//type EnvVar struct {
// Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// Value string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"`
//}
// ContainerPort represents a network port in a single container.
//type ContainerPort struct {
// Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
// HostPort int32 `json:"hostPort,omitempty" protobuf:"varint,2,opt,name=hostPort"`
// ContainerPort int32 `json:"containerPort" protobuf:"varint,3,opt,name=containerPort"`
// Protocol Protocol `json:"protocol,omitempty" protobuf:"bytes,4,opt,name=protocol,casttype=Protocol"`
// HostIP string `json:"hostIP,omitempty" protobuf:"bytes,5,opt,name=hostIP"`
//}
type ResourceName string
type ResourceList map[ResourceName]float64
// ResourceRequirements describes the compute resource requirements.
type ResourceRequirements struct {
//Zun define the Limit is opposite.
//Limits ResourceList `json:"limits,omitempty" protobuf:"bytes,1,rep,name=limits,casttype=ResourceList,castkey=ResourceName"`
//Requests ResourceList `json:"requests,omitempty" protobuf:"bytes,2,rep,name=requests,casttype=ResourceList,castkey=ResourceName"`
Limits ResourceList `json:"requests,omitempty" protobuf:"bytes,1,rep,name=limits"`
}