mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Temporary commit to swap branches
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
This commit is contained in:
@ -269,9 +269,13 @@ type ContainerConfig struct {
|
|||||||
// Network Config
|
// Network Config
|
||||||
|
|
||||||
// CreateNetNS indicates that libpod should create and configure a new
|
// CreateNetNS indicates that libpod should create and configure a new
|
||||||
// network namespace for the container
|
// network namespace for the container.
|
||||||
// This cannot be set if NetNsCtr is also set
|
// This cannot be set if NetNsCtr is also set.
|
||||||
CreateNetNS bool `json:"createNetNS"`
|
CreateNetNS bool `json:"createNetNS"`
|
||||||
|
// StaticIP is a static IP to request for the container.
|
||||||
|
// This cannot be set unless CreateNetNS is set.
|
||||||
|
// If not set, the container will be dynamically assigned an IP by CNI.
|
||||||
|
StaticIP net.IP `json:"staticIP"`
|
||||||
// PortMappings are the ports forwarded to the container's network
|
// PortMappings are the ports forwarded to the container's network
|
||||||
// namespace
|
// namespace
|
||||||
// These are not used unless CreateNetNS is true
|
// These are not used unless CreateNetNS is true
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@ package libpod
|
|||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -25,8 +26,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Get an OCICNI network config
|
// Get an OCICNI network config
|
||||||
func getPodNetwork(id, name, nsPath string, networks []string, ports []ocicni.PortMapping) ocicni.PodNetwork {
|
func (r *Runtime) getPodNetwork(id, name, nsPath string, networks []string, ports []ocicni.PortMapping, staticIP net.IP) ocicni.PodNetwork {
|
||||||
return ocicni.PodNetwork{
|
network := ocicni.PodNetwork{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: name, // TODO is there something else we should put here? We don't know about Kube namespaces
|
Namespace: name, // TODO is there something else we should put here? We don't know about Kube namespaces
|
||||||
ID: id,
|
ID: id,
|
||||||
@ -34,11 +35,21 @@ func getPodNetwork(id, name, nsPath string, networks []string, ports []ocicni.Po
|
|||||||
PortMappings: ports,
|
PortMappings: ports,
|
||||||
Networks: networks,
|
Networks: networks,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if staticIP != nil {
|
||||||
|
defaultNetwork := r.netPlugin.GetDefaultNetworkName()
|
||||||
|
|
||||||
|
network.Networks = []string{defaultNetwork}
|
||||||
|
network.NetworkConfig = make(map[string]ocicni.NetworkConfig)
|
||||||
|
network.NetworkConfig[defaultNetwork] = ocicni.NetworkConfig{IP: staticIP.String()}
|
||||||
|
}
|
||||||
|
|
||||||
|
return network
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create and configure a new network namespace for a container
|
// Create and configure a new network namespace for a container
|
||||||
func (r *Runtime) configureNetNS(ctr *Container, ctrNS ns.NetNS) (err error) {
|
func (r *Runtime) configureNetNS(ctr *Container, ctrNS ns.NetNS) (err error) {
|
||||||
podNetwork := getPodNetwork(ctr.ID(), ctr.Name(), ctrNS.Path(), ctr.config.Networks, ctr.config.PortMappings)
|
podNetwork := r.getPodNetwork(ctr.ID(), ctr.Name(), ctrNS.Path(), ctr.config.Networks, ctr.config.PortMappings, ctr.config.StaticIP)
|
||||||
|
|
||||||
results, err := r.netPlugin.SetUpPod(podNetwork)
|
results, err := r.netPlugin.SetUpPod(podNetwork)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -216,7 +227,7 @@ func (r *Runtime) teardownNetNS(ctr *Container) error {
|
|||||||
|
|
||||||
logrus.Debugf("Tearing down network namespace at %s for container %s", ctr.state.NetNS.Path(), ctr.ID())
|
logrus.Debugf("Tearing down network namespace at %s for container %s", ctr.state.NetNS.Path(), ctr.ID())
|
||||||
|
|
||||||
podNetwork := getPodNetwork(ctr.ID(), ctr.Name(), ctr.state.NetNS.Path(), ctr.config.Networks, ctr.config.PortMappings)
|
podNetwork := r.getPodNetwork(ctr.ID(), ctr.Name(), ctr.state.NetNS.Path(), ctr.config.Networks, ctr.config.PortMappings, ctr.config.StaticIP)
|
||||||
|
|
||||||
// The network may have already been torn down, so don't fail here, just log
|
// The network may have already been torn down, so don't fail here, just log
|
||||||
if err := r.netPlugin.TearDownPod(podNetwork); err != nil {
|
if err := r.netPlugin.TearDownPod(podNetwork); err != nil {
|
||||||
|
@ -828,6 +828,31 @@ func WithNetNS(portMappings []ocicni.PortMapping, postConfigureNetNS bool, netwo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithStaticIP indicates that the container should request a static IP from
|
||||||
|
// the CNI plugins.
|
||||||
|
// It cannot be set unless WithNetNS has already been passed.
|
||||||
|
// Further, it cannot be set if additional CNI networks to join have been
|
||||||
|
// specified.
|
||||||
|
func WithStaticIP(ip net.IP) CtrCreateOption {
|
||||||
|
return func(ctr *Container) error {
|
||||||
|
if ctr.valid {
|
||||||
|
return ErrCtrFinalized
|
||||||
|
}
|
||||||
|
|
||||||
|
if !ctr.config.CreateNetNS {
|
||||||
|
return errors.Wrapf(ErrInvalidArg, "cannot set a static IP if the container is not creating a network namespace")
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(ctr.config.Networks) != 0 {
|
||||||
|
return errors.Wrapf(ErrInvalidArg, "cannot set a static IP if joining additional CNI networks")
|
||||||
|
}
|
||||||
|
|
||||||
|
ctr.config.StaticIP = ip
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// WithLogPath sets the path to the log file.
|
// WithLogPath sets the path to the log file.
|
||||||
func WithLogPath(path string) CtrCreateOption {
|
func WithLogPath(path string) CtrCreateOption {
|
||||||
return func(ctr *Container) error {
|
return func(ctr *Container) error {
|
||||||
|
@ -1,747 +0,0 @@
|
|||||||
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
|
|
||||||
|
|
||||||
package libpod
|
|
||||||
|
|
||||||
import (
|
|
||||||
json "encoding/json"
|
|
||||||
easyjson "github.com/mailru/easyjson"
|
|
||||||
jlexer "github.com/mailru/easyjson/jlexer"
|
|
||||||
jwriter "github.com/mailru/easyjson/jwriter"
|
|
||||||
)
|
|
||||||
|
|
||||||
// suppress unused package warning
|
|
||||||
var (
|
|
||||||
_ *json.RawMessage
|
|
||||||
_ *jlexer.Lexer
|
|
||||||
_ *jwriter.Writer
|
|
||||||
_ easyjson.Marshaler
|
|
||||||
)
|
|
||||||
|
|
||||||
func easyjsonBe091417DecodeGithubComContainersLibpodLibpod(in *jlexer.Lexer, out *podState) {
|
|
||||||
isTopLevel := in.IsStart()
|
|
||||||
if in.IsNull() {
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
in.Skip()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
in.Delim('{')
|
|
||||||
for !in.IsDelim('}') {
|
|
||||||
key := in.UnsafeString()
|
|
||||||
in.WantColon()
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
in.WantComma()
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
switch key {
|
|
||||||
case "cgroupPath":
|
|
||||||
out.CgroupPath = string(in.String())
|
|
||||||
case "InfraContainerID":
|
|
||||||
out.InfraContainerID = string(in.String())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonBe091417EncodeGithubComContainersLibpodLibpod(out *jwriter.Writer, in podState) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
{
|
|
||||||
const prefix string = ",\"cgroupPath\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.String(string(in.CgroupPath))
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const prefix string = ",\"InfraContainerID\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.String(string(in.InfraContainerID))
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v podState) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonBe091417EncodeGithubComContainersLibpodLibpod(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v podState) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonBe091417EncodeGithubComContainersLibpodLibpod(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *podState) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonBe091417DecodeGithubComContainersLibpodLibpod(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *podState) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonBe091417DecodeGithubComContainersLibpodLibpod(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonBe091417DecodeGithubComContainersLibpodLibpod1(in *jlexer.Lexer, out *PodInspectState) {
|
|
||||||
isTopLevel := in.IsStart()
|
|
||||||
if in.IsNull() {
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
in.Skip()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
in.Delim('{')
|
|
||||||
for !in.IsDelim('}') {
|
|
||||||
key := in.UnsafeString()
|
|
||||||
in.WantColon()
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
in.WantComma()
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
switch key {
|
|
||||||
case "cgroupPath":
|
|
||||||
out.CgroupPath = string(in.String())
|
|
||||||
case "infraContainerID":
|
|
||||||
out.InfraContainerID = string(in.String())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonBe091417EncodeGithubComContainersLibpodLibpod1(out *jwriter.Writer, in PodInspectState) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
{
|
|
||||||
const prefix string = ",\"cgroupPath\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.String(string(in.CgroupPath))
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const prefix string = ",\"infraContainerID\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.String(string(in.InfraContainerID))
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v PodInspectState) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonBe091417EncodeGithubComContainersLibpodLibpod1(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v PodInspectState) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonBe091417EncodeGithubComContainersLibpodLibpod1(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *PodInspectState) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonBe091417DecodeGithubComContainersLibpodLibpod1(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *PodInspectState) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonBe091417DecodeGithubComContainersLibpodLibpod1(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonBe091417DecodeGithubComContainersLibpodLibpod2(in *jlexer.Lexer, out *PodInspect) {
|
|
||||||
isTopLevel := in.IsStart()
|
|
||||||
if in.IsNull() {
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
in.Skip()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
in.Delim('{')
|
|
||||||
for !in.IsDelim('}') {
|
|
||||||
key := in.UnsafeString()
|
|
||||||
in.WantColon()
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
in.WantComma()
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
switch key {
|
|
||||||
case "Config":
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
out.Config = nil
|
|
||||||
} else {
|
|
||||||
if out.Config == nil {
|
|
||||||
out.Config = new(PodConfig)
|
|
||||||
}
|
|
||||||
if data := in.Raw(); in.Ok() {
|
|
||||||
in.AddError((*out.Config).UnmarshalJSON(data))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "State":
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
out.State = nil
|
|
||||||
} else {
|
|
||||||
if out.State == nil {
|
|
||||||
out.State = new(PodInspectState)
|
|
||||||
}
|
|
||||||
if data := in.Raw(); in.Ok() {
|
|
||||||
in.AddError((*out.State).UnmarshalJSON(data))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "Containers":
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
out.Containers = nil
|
|
||||||
} else {
|
|
||||||
in.Delim('[')
|
|
||||||
if out.Containers == nil {
|
|
||||||
if !in.IsDelim(']') {
|
|
||||||
out.Containers = make([]PodContainerInfo, 0, 2)
|
|
||||||
} else {
|
|
||||||
out.Containers = []PodContainerInfo{}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
out.Containers = (out.Containers)[:0]
|
|
||||||
}
|
|
||||||
for !in.IsDelim(']') {
|
|
||||||
var v1 PodContainerInfo
|
|
||||||
if data := in.Raw(); in.Ok() {
|
|
||||||
in.AddError((v1).UnmarshalJSON(data))
|
|
||||||
}
|
|
||||||
out.Containers = append(out.Containers, v1)
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim(']')
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonBe091417EncodeGithubComContainersLibpodLibpod2(out *jwriter.Writer, in PodInspect) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
{
|
|
||||||
const prefix string = ",\"Config\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
if in.Config == nil {
|
|
||||||
out.RawString("null")
|
|
||||||
} else {
|
|
||||||
out.Raw((*in.Config).MarshalJSON())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const prefix string = ",\"State\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
if in.State == nil {
|
|
||||||
out.RawString("null")
|
|
||||||
} else {
|
|
||||||
out.Raw((*in.State).MarshalJSON())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const prefix string = ",\"Containers\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
if in.Containers == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
|
||||||
out.RawString("null")
|
|
||||||
} else {
|
|
||||||
out.RawByte('[')
|
|
||||||
for v2, v3 := range in.Containers {
|
|
||||||
if v2 > 0 {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
out.Raw((v3).MarshalJSON())
|
|
||||||
}
|
|
||||||
out.RawByte(']')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v PodInspect) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonBe091417EncodeGithubComContainersLibpodLibpod2(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v PodInspect) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonBe091417EncodeGithubComContainersLibpodLibpod2(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *PodInspect) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonBe091417DecodeGithubComContainersLibpodLibpod2(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *PodInspect) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonBe091417DecodeGithubComContainersLibpodLibpod2(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonBe091417DecodeGithubComContainersLibpodLibpod3(in *jlexer.Lexer, out *PodContainerInfo) {
|
|
||||||
isTopLevel := in.IsStart()
|
|
||||||
if in.IsNull() {
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
in.Skip()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
in.Delim('{')
|
|
||||||
for !in.IsDelim('}') {
|
|
||||||
key := in.UnsafeString()
|
|
||||||
in.WantColon()
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
in.WantComma()
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
switch key {
|
|
||||||
case "id":
|
|
||||||
out.ID = string(in.String())
|
|
||||||
case "state":
|
|
||||||
out.State = string(in.String())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonBe091417EncodeGithubComContainersLibpodLibpod3(out *jwriter.Writer, in PodContainerInfo) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
{
|
|
||||||
const prefix string = ",\"id\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.String(string(in.ID))
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const prefix string = ",\"state\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.String(string(in.State))
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v PodContainerInfo) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonBe091417EncodeGithubComContainersLibpodLibpod3(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v PodContainerInfo) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonBe091417EncodeGithubComContainersLibpodLibpod3(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *PodContainerInfo) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonBe091417DecodeGithubComContainersLibpodLibpod3(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *PodContainerInfo) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonBe091417DecodeGithubComContainersLibpodLibpod3(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonBe091417DecodeGithubComContainersLibpodLibpod4(in *jlexer.Lexer, out *PodConfig) {
|
|
||||||
isTopLevel := in.IsStart()
|
|
||||||
if in.IsNull() {
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
in.Skip()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
in.Delim('{')
|
|
||||||
for !in.IsDelim('}') {
|
|
||||||
key := in.UnsafeString()
|
|
||||||
in.WantColon()
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
in.WantComma()
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
switch key {
|
|
||||||
case "id":
|
|
||||||
out.ID = string(in.String())
|
|
||||||
case "name":
|
|
||||||
out.Name = string(in.String())
|
|
||||||
case "namespace":
|
|
||||||
out.Namespace = string(in.String())
|
|
||||||
case "labels":
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
} else {
|
|
||||||
in.Delim('{')
|
|
||||||
if !in.IsDelim('}') {
|
|
||||||
out.Labels = make(map[string]string)
|
|
||||||
} else {
|
|
||||||
out.Labels = nil
|
|
||||||
}
|
|
||||||
for !in.IsDelim('}') {
|
|
||||||
key := string(in.String())
|
|
||||||
in.WantColon()
|
|
||||||
var v4 string
|
|
||||||
v4 = string(in.String())
|
|
||||||
(out.Labels)[key] = v4
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
}
|
|
||||||
case "cgroupParent":
|
|
||||||
out.CgroupParent = string(in.String())
|
|
||||||
case "sharesCgroup":
|
|
||||||
out.UsePodCgroup = bool(in.Bool())
|
|
||||||
case "sharesPid":
|
|
||||||
out.UsePodPID = bool(in.Bool())
|
|
||||||
case "sharesIpc":
|
|
||||||
out.UsePodIPC = bool(in.Bool())
|
|
||||||
case "sharesNet":
|
|
||||||
out.UsePodNet = bool(in.Bool())
|
|
||||||
case "sharesMnt":
|
|
||||||
out.UsePodMount = bool(in.Bool())
|
|
||||||
case "sharesUser":
|
|
||||||
out.UsePodUser = bool(in.Bool())
|
|
||||||
case "sharesUts":
|
|
||||||
out.UsePodUTS = bool(in.Bool())
|
|
||||||
case "infraConfig":
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
out.InfraContainer = nil
|
|
||||||
} else {
|
|
||||||
if out.InfraContainer == nil {
|
|
||||||
out.InfraContainer = new(InfraContainerConfig)
|
|
||||||
}
|
|
||||||
easyjsonBe091417DecodeGithubComContainersLibpodLibpod5(in, &*out.InfraContainer)
|
|
||||||
}
|
|
||||||
case "created":
|
|
||||||
if data := in.Raw(); in.Ok() {
|
|
||||||
in.AddError((out.CreatedTime).UnmarshalJSON(data))
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonBe091417EncodeGithubComContainersLibpodLibpod4(out *jwriter.Writer, in PodConfig) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
{
|
|
||||||
const prefix string = ",\"id\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.String(string(in.ID))
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const prefix string = ",\"name\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.String(string(in.Name))
|
|
||||||
}
|
|
||||||
if in.Namespace != "" {
|
|
||||||
const prefix string = ",\"namespace\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.String(string(in.Namespace))
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const prefix string = ",\"labels\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
if in.Labels == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
|
|
||||||
out.RawString(`null`)
|
|
||||||
} else {
|
|
||||||
out.RawByte('{')
|
|
||||||
v5First := true
|
|
||||||
for v5Name, v5Value := range in.Labels {
|
|
||||||
if v5First {
|
|
||||||
v5First = false
|
|
||||||
} else {
|
|
||||||
out.RawByte(',')
|
|
||||||
}
|
|
||||||
out.String(string(v5Name))
|
|
||||||
out.RawByte(':')
|
|
||||||
out.String(string(v5Value))
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const prefix string = ",\"cgroupParent\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.String(string(in.CgroupParent))
|
|
||||||
}
|
|
||||||
if in.UsePodCgroup {
|
|
||||||
const prefix string = ",\"sharesCgroup\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.Bool(bool(in.UsePodCgroup))
|
|
||||||
}
|
|
||||||
if in.UsePodPID {
|
|
||||||
const prefix string = ",\"sharesPid\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.Bool(bool(in.UsePodPID))
|
|
||||||
}
|
|
||||||
if in.UsePodIPC {
|
|
||||||
const prefix string = ",\"sharesIpc\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.Bool(bool(in.UsePodIPC))
|
|
||||||
}
|
|
||||||
if in.UsePodNet {
|
|
||||||
const prefix string = ",\"sharesNet\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.Bool(bool(in.UsePodNet))
|
|
||||||
}
|
|
||||||
if in.UsePodMount {
|
|
||||||
const prefix string = ",\"sharesMnt\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.Bool(bool(in.UsePodMount))
|
|
||||||
}
|
|
||||||
if in.UsePodUser {
|
|
||||||
const prefix string = ",\"sharesUser\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.Bool(bool(in.UsePodUser))
|
|
||||||
}
|
|
||||||
if in.UsePodUTS {
|
|
||||||
const prefix string = ",\"sharesUts\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.Bool(bool(in.UsePodUTS))
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const prefix string = ",\"infraConfig\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
if in.InfraContainer == nil {
|
|
||||||
out.RawString("null")
|
|
||||||
} else {
|
|
||||||
easyjsonBe091417EncodeGithubComContainersLibpodLibpod5(out, *in.InfraContainer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const prefix string = ",\"created\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.Raw((in.CreatedTime).MarshalJSON())
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON supports json.Marshaler interface
|
|
||||||
func (v PodConfig) MarshalJSON() ([]byte, error) {
|
|
||||||
w := jwriter.Writer{}
|
|
||||||
easyjsonBe091417EncodeGithubComContainersLibpodLibpod4(&w, v)
|
|
||||||
return w.Buffer.BuildBytes(), w.Error
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
||||||
func (v PodConfig) MarshalEasyJSON(w *jwriter.Writer) {
|
|
||||||
easyjsonBe091417EncodeGithubComContainersLibpodLibpod4(w, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON supports json.Unmarshaler interface
|
|
||||||
func (v *PodConfig) UnmarshalJSON(data []byte) error {
|
|
||||||
r := jlexer.Lexer{Data: data}
|
|
||||||
easyjsonBe091417DecodeGithubComContainersLibpodLibpod4(&r, v)
|
|
||||||
return r.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
||||||
func (v *PodConfig) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
||||||
easyjsonBe091417DecodeGithubComContainersLibpodLibpod4(l, v)
|
|
||||||
}
|
|
||||||
func easyjsonBe091417DecodeGithubComContainersLibpodLibpod5(in *jlexer.Lexer, out *InfraContainerConfig) {
|
|
||||||
isTopLevel := in.IsStart()
|
|
||||||
if in.IsNull() {
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
in.Skip()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
in.Delim('{')
|
|
||||||
for !in.IsDelim('}') {
|
|
||||||
key := in.UnsafeString()
|
|
||||||
in.WantColon()
|
|
||||||
if in.IsNull() {
|
|
||||||
in.Skip()
|
|
||||||
in.WantComma()
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
switch key {
|
|
||||||
case "makeInfraContainer":
|
|
||||||
out.HasInfraContainer = bool(in.Bool())
|
|
||||||
default:
|
|
||||||
in.SkipRecursive()
|
|
||||||
}
|
|
||||||
in.WantComma()
|
|
||||||
}
|
|
||||||
in.Delim('}')
|
|
||||||
if isTopLevel {
|
|
||||||
in.Consumed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func easyjsonBe091417EncodeGithubComContainersLibpodLibpod5(out *jwriter.Writer, in InfraContainerConfig) {
|
|
||||||
out.RawByte('{')
|
|
||||||
first := true
|
|
||||||
_ = first
|
|
||||||
{
|
|
||||||
const prefix string = ",\"makeInfraContainer\":"
|
|
||||||
if first {
|
|
||||||
first = false
|
|
||||||
out.RawString(prefix[1:])
|
|
||||||
} else {
|
|
||||||
out.RawString(prefix)
|
|
||||||
}
|
|
||||||
out.Bool(bool(in.HasInfraContainer))
|
|
||||||
}
|
|
||||||
out.RawByte('}')
|
|
||||||
}
|
|
Reference in New Issue
Block a user