Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
7cdbb6ae
Commit
7cdbb6ae
authored
Aug 24, 2017
by
Di Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bump cni vendor to v0.6.0
parent
fcde4c9b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
78 additions
and
53 deletions
+78
-53
Godeps.json
Godeps/Godeps.json
+12
-12
args.go
vendor/github.com/containernetworking/cni/pkg/invoke/args.go
+10
-7
raw_exec.go
...github.com/containernetworking/cni/pkg/invoke/raw_exec.go
+2
-6
types.go
...github.com/containernetworking/cni/pkg/types/020/types.go
+9
-7
args.go
vendor/github.com/containernetworking/cni/pkg/types/args.go
+13
-2
types.go
...ub.com/containernetworking/cni/pkg/types/current/types.go
+27
-18
types.go
vendor/github.com/containernetworking/cni/pkg/types/types.go
+5
-1
No files found.
Godeps/Godeps.json
View file @
7cdbb6ae
...
@@ -439,33 +439,33 @@
...
@@ -439,33 +439,33 @@
},
},
{
{
"ImportPath"
:
"github.com/containernetworking/cni/libcni"
,
"ImportPath"
:
"github.com/containernetworking/cni/libcni"
,
"Comment"
:
"v0.
5.2
"
,
"Comment"
:
"v0.
6.0
"
,
"Rev"
:
"
137b4975ecab6e1f0c24c1e3c228a50a3cfba75e
"
"Rev"
:
"
a7885cb6f8ab03fba07852ded351e4f5e7a112bf
"
},
},
{
{
"ImportPath"
:
"github.com/containernetworking/cni/pkg/invoke"
,
"ImportPath"
:
"github.com/containernetworking/cni/pkg/invoke"
,
"Comment"
:
"v0.
5.2
"
,
"Comment"
:
"v0.
6.0
"
,
"Rev"
:
"
137b4975ecab6e1f0c24c1e3c228a50a3cfba75e
"
"Rev"
:
"
a7885cb6f8ab03fba07852ded351e4f5e7a112bf
"
},
},
{
{
"ImportPath"
:
"github.com/containernetworking/cni/pkg/types"
,
"ImportPath"
:
"github.com/containernetworking/cni/pkg/types"
,
"Comment"
:
"v0.
5.2
"
,
"Comment"
:
"v0.
6.0
"
,
"Rev"
:
"
137b4975ecab6e1f0c24c1e3c228a50a3cfba75e
"
"Rev"
:
"
a7885cb6f8ab03fba07852ded351e4f5e7a112bf
"
},
},
{
{
"ImportPath"
:
"github.com/containernetworking/cni/pkg/types/020"
,
"ImportPath"
:
"github.com/containernetworking/cni/pkg/types/020"
,
"Comment"
:
"v0.
5.2
"
,
"Comment"
:
"v0.
6.0
"
,
"Rev"
:
"
137b4975ecab6e1f0c24c1e3c228a50a3cfba75e
"
"Rev"
:
"
a7885cb6f8ab03fba07852ded351e4f5e7a112bf
"
},
},
{
{
"ImportPath"
:
"github.com/containernetworking/cni/pkg/types/current"
,
"ImportPath"
:
"github.com/containernetworking/cni/pkg/types/current"
,
"Comment"
:
"v0.
5.2
"
,
"Comment"
:
"v0.
6.0
"
,
"Rev"
:
"
137b4975ecab6e1f0c24c1e3c228a50a3cfba75e
"
"Rev"
:
"
a7885cb6f8ab03fba07852ded351e4f5e7a112bf
"
},
},
{
{
"ImportPath"
:
"github.com/containernetworking/cni/pkg/version"
,
"ImportPath"
:
"github.com/containernetworking/cni/pkg/version"
,
"Comment"
:
"v0.
5.2
"
,
"Comment"
:
"v0.
6.0
"
,
"Rev"
:
"
137b4975ecab6e1f0c24c1e3c228a50a3cfba75e
"
"Rev"
:
"
a7885cb6f8ab03fba07852ded351e4f5e7a112bf
"
},
},
{
{
"ImportPath"
:
"github.com/coreos/etcd/alarm"
,
"ImportPath"
:
"github.com/coreos/etcd/alarm"
,
...
...
vendor/github.com/containernetworking/cni/pkg/invoke/args.go
View file @
7cdbb6ae
...
@@ -57,13 +57,16 @@ func (args *Args) AsEnv() []string {
...
@@ -57,13 +57,16 @@ func (args *Args) AsEnv() []string {
pluginArgsStr
=
stringify
(
args
.
PluginArgs
)
pluginArgsStr
=
stringify
(
args
.
PluginArgs
)
}
}
env
=
append
(
env
,
// Ensure that the custom values are first, so any value present in
"CNI_COMMAND="
+
args
.
Command
,
// the process environment won't override them.
"CNI_CONTAINERID="
+
args
.
ContainerID
,
env
=
append
([]
string
{
"CNI_NETNS="
+
args
.
NetNS
,
"CNI_COMMAND="
+
args
.
Command
,
"CNI_ARGS="
+
pluginArgsStr
,
"CNI_CONTAINERID="
+
args
.
ContainerID
,
"CNI_IFNAME="
+
args
.
IfName
,
"CNI_NETNS="
+
args
.
NetNS
,
"CNI_PATH="
+
args
.
Path
)
"CNI_ARGS="
+
pluginArgsStr
,
"CNI_IFNAME="
+
args
.
IfName
,
"CNI_PATH="
+
args
.
Path
,
},
env
...
)
return
env
return
env
}
}
...
...
vendor/github.com/containernetworking/cni/pkg/invoke/raw_exec.go
View file @
7cdbb6ae
...
@@ -50,13 +50,9 @@ func pluginErr(err error, output []byte) error {
...
@@ -50,13 +50,9 @@ func pluginErr(err error, output []byte) error {
if
_
,
ok
:=
err
.
(
*
exec
.
ExitError
);
ok
{
if
_
,
ok
:=
err
.
(
*
exec
.
ExitError
);
ok
{
emsg
:=
types
.
Error
{}
emsg
:=
types
.
Error
{}
if
perr
:=
json
.
Unmarshal
(
output
,
&
emsg
);
perr
!=
nil
{
if
perr
:=
json
.
Unmarshal
(
output
,
&
emsg
);
perr
!=
nil
{
return
fmt
.
Error
f
(
"netplugin failed but error parsing its diagnostic message %q: %v"
,
string
(
output
),
perr
)
emsg
.
Msg
=
fmt
.
Sprint
f
(
"netplugin failed but error parsing its diagnostic message %q: %v"
,
string
(
output
),
perr
)
}
}
details
:=
""
return
&
emsg
if
emsg
.
Details
!=
""
{
details
=
fmt
.
Sprintf
(
"; %v"
,
emsg
.
Details
)
}
return
fmt
.
Errorf
(
"%v%v"
,
emsg
.
Msg
,
details
)
}
}
return
err
return
err
...
...
vendor/github.com/containernetworking/cni/pkg/types/020/types.go
View file @
7cdbb6ae
...
@@ -23,9 +23,9 @@ import (
...
@@ -23,9 +23,9 @@ import (
"github.com/containernetworking/cni/pkg/types"
"github.com/containernetworking/cni/pkg/types"
)
)
const
i
mplementedSpecVersion
string
=
"0.2.0"
const
I
mplementedSpecVersion
string
=
"0.2.0"
var
SupportedVersions
=
[]
string
{
""
,
"0.1.0"
,
i
mplementedSpecVersion
}
var
SupportedVersions
=
[]
string
{
""
,
"0.1.0"
,
I
mplementedSpecVersion
}
// Compatibility types for CNI version 0.1.0 and 0.2.0
// Compatibility types for CNI version 0.1.0 and 0.2.0
...
@@ -39,7 +39,7 @@ func NewResult(data []byte) (types.Result, error) {
...
@@ -39,7 +39,7 @@ func NewResult(data []byte) (types.Result, error) {
func
GetResult
(
r
types
.
Result
)
(
*
Result
,
error
)
{
func
GetResult
(
r
types
.
Result
)
(
*
Result
,
error
)
{
// We expect version 0.1.0/0.2.0 results
// We expect version 0.1.0/0.2.0 results
result020
,
err
:=
r
.
GetAsVersion
(
i
mplementedSpecVersion
)
result020
,
err
:=
r
.
GetAsVersion
(
I
mplementedSpecVersion
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -52,18 +52,20 @@ func GetResult(r types.Result) (*Result, error) {
...
@@ -52,18 +52,20 @@ func GetResult(r types.Result) (*Result, error) {
// Result is what gets returned from the plugin (via stdout) to the caller
// Result is what gets returned from the plugin (via stdout) to the caller
type
Result
struct
{
type
Result
struct
{
IP4
*
IPConfig
`json:"ip4,omitempty"`
CNIVersion
string
`json:"cniVersion,omitempty"`
IP6
*
IPConfig
`json:"ip6,omitempty"`
IP4
*
IPConfig
`json:"ip4,omitempty"`
DNS
types
.
DNS
`json:"dns,omitempty"`
IP6
*
IPConfig
`json:"ip6,omitempty"`
DNS
types
.
DNS
`json:"dns,omitempty"`
}
}
func
(
r
*
Result
)
Version
()
string
{
func
(
r
*
Result
)
Version
()
string
{
return
i
mplementedSpecVersion
return
I
mplementedSpecVersion
}
}
func
(
r
*
Result
)
GetAsVersion
(
version
string
)
(
types
.
Result
,
error
)
{
func
(
r
*
Result
)
GetAsVersion
(
version
string
)
(
types
.
Result
,
error
)
{
for
_
,
supportedVersion
:=
range
SupportedVersions
{
for
_
,
supportedVersion
:=
range
SupportedVersions
{
if
version
==
supportedVersion
{
if
version
==
supportedVersion
{
r
.
CNIVersion
=
version
return
r
,
nil
return
r
,
nil
}
}
}
}
...
...
vendor/github.com/containernetworking/cni/pkg/types/args.go
View file @
7cdbb6ae
...
@@ -63,6 +63,12 @@ func GetKeyField(keyString string, v reflect.Value) reflect.Value {
...
@@ -63,6 +63,12 @@ func GetKeyField(keyString string, v reflect.Value) reflect.Value {
return
v
.
Elem
()
.
FieldByName
(
keyString
)
return
v
.
Elem
()
.
FieldByName
(
keyString
)
}
}
// UnmarshalableArgsError is used to indicate error unmarshalling args
// from the args-string in the form "K=V;K2=V2;..."
type
UnmarshalableArgsError
struct
{
error
}
// LoadArgs parses args from a string in the form "K=V;K2=V2;..."
// LoadArgs parses args from a string in the form "K=V;K2=V2;..."
func
LoadArgs
(
args
string
,
container
interface
{})
error
{
func
LoadArgs
(
args
string
,
container
interface
{})
error
{
if
args
==
""
{
if
args
==
""
{
...
@@ -85,8 +91,13 @@ func LoadArgs(args string, container interface{}) error {
...
@@ -85,8 +91,13 @@ func LoadArgs(args string, container interface{}) error {
unknownArgs
=
append
(
unknownArgs
,
pair
)
unknownArgs
=
append
(
unknownArgs
,
pair
)
continue
continue
}
}
keyFieldIface
:=
keyField
.
Addr
()
.
Interface
()
u
:=
keyField
.
Addr
()
.
Interface
()
.
(
encoding
.
TextUnmarshaler
)
u
,
ok
:=
keyFieldIface
.
(
encoding
.
TextUnmarshaler
)
if
!
ok
{
return
UnmarshalableArgsError
{
fmt
.
Errorf
(
"ARGS: cannot unmarshal into field '%s' - type '%s' does not implement encoding.TextUnmarshaler"
,
keyString
,
reflect
.
TypeOf
(
keyFieldIface
))}
}
err
:=
u
.
UnmarshalText
([]
byte
(
valueString
))
err
:=
u
.
UnmarshalText
([]
byte
(
valueString
))
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"ARGS: error parsing value of pair %q: %v)"
,
pair
,
err
)
return
fmt
.
Errorf
(
"ARGS: error parsing value of pair %q: %v)"
,
pair
,
err
)
...
...
vendor/github.com/containernetworking/cni/pkg/types/current/types.go
View file @
7cdbb6ae
...
@@ -24,9 +24,9 @@ import (
...
@@ -24,9 +24,9 @@ import (
"github.com/containernetworking/cni/pkg/types/020"
"github.com/containernetworking/cni/pkg/types/020"
)
)
const
i
mplementedSpecVersion
string
=
"0.3.1"
const
I
mplementedSpecVersion
string
=
"0.3.1"
var
SupportedVersions
=
[]
string
{
"0.3.0"
,
i
mplementedSpecVersion
}
var
SupportedVersions
=
[]
string
{
"0.3.0"
,
I
mplementedSpecVersion
}
func
NewResult
(
data
[]
byte
)
(
types
.
Result
,
error
)
{
func
NewResult
(
data
[]
byte
)
(
types
.
Result
,
error
)
{
result
:=
&
Result
{}
result
:=
&
Result
{}
...
@@ -37,7 +37,7 @@ func NewResult(data []byte) (types.Result, error) {
...
@@ -37,7 +37,7 @@ func NewResult(data []byte) (types.Result, error) {
}
}
func
GetResult
(
r
types
.
Result
)
(
*
Result
,
error
)
{
func
GetResult
(
r
types
.
Result
)
(
*
Result
,
error
)
{
resultCurrent
,
err
:=
r
.
GetAsVersion
(
i
mplementedSpecVersion
)
resultCurrent
,
err
:=
r
.
GetAsVersion
(
I
mplementedSpecVersion
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -63,16 +63,16 @@ func convertFrom020(result types.Result) (*Result, error) {
...
@@ -63,16 +63,16 @@ func convertFrom020(result types.Result) (*Result, error) {
}
}
newResult
:=
&
Result
{
newResult
:=
&
Result
{
DNS
:
oldResult
.
DNS
,
CNIVersion
:
ImplementedSpecVersion
,
Routes
:
[]
*
types
.
Route
{},
DNS
:
oldResult
.
DNS
,
Routes
:
[]
*
types
.
Route
{},
}
}
if
oldResult
.
IP4
!=
nil
{
if
oldResult
.
IP4
!=
nil
{
newResult
.
IPs
=
append
(
newResult
.
IPs
,
&
IPConfig
{
newResult
.
IPs
=
append
(
newResult
.
IPs
,
&
IPConfig
{
Version
:
"4"
,
Version
:
"4"
,
Interface
:
-
1
,
Address
:
oldResult
.
IP4
.
IP
,
Address
:
oldResult
.
IP4
.
IP
,
Gateway
:
oldResult
.
IP4
.
Gateway
,
Gateway
:
oldResult
.
IP4
.
Gateway
,
})
})
for
_
,
route
:=
range
oldResult
.
IP4
.
Routes
{
for
_
,
route
:=
range
oldResult
.
IP4
.
Routes
{
gw
:=
route
.
GW
gw
:=
route
.
GW
...
@@ -88,10 +88,9 @@ func convertFrom020(result types.Result) (*Result, error) {
...
@@ -88,10 +88,9 @@ func convertFrom020(result types.Result) (*Result, error) {
if
oldResult
.
IP6
!=
nil
{
if
oldResult
.
IP6
!=
nil
{
newResult
.
IPs
=
append
(
newResult
.
IPs
,
&
IPConfig
{
newResult
.
IPs
=
append
(
newResult
.
IPs
,
&
IPConfig
{
Version
:
"6"
,
Version
:
"6"
,
Interface
:
-
1
,
Address
:
oldResult
.
IP6
.
IP
,
Address
:
oldResult
.
IP6
.
IP
,
Gateway
:
oldResult
.
IP6
.
Gateway
,
Gateway
:
oldResult
.
IP6
.
Gateway
,
})
})
for
_
,
route
:=
range
oldResult
.
IP6
.
Routes
{
for
_
,
route
:=
range
oldResult
.
IP6
.
Routes
{
gw
:=
route
.
GW
gw
:=
route
.
GW
...
@@ -117,6 +116,7 @@ func convertFrom030(result types.Result) (*Result, error) {
...
@@ -117,6 +116,7 @@ func convertFrom030(result types.Result) (*Result, error) {
if
!
ok
{
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"failed to convert result"
)
return
nil
,
fmt
.
Errorf
(
"failed to convert result"
)
}
}
newResult
.
CNIVersion
=
ImplementedSpecVersion
return
newResult
,
nil
return
newResult
,
nil
}
}
...
@@ -134,6 +134,7 @@ func NewResultFromResult(result types.Result) (*Result, error) {
...
@@ -134,6 +134,7 @@ func NewResultFromResult(result types.Result) (*Result, error) {
// Result is what gets returned from the plugin (via stdout) to the caller
// Result is what gets returned from the plugin (via stdout) to the caller
type
Result
struct
{
type
Result
struct
{
CNIVersion
string
`json:"cniVersion,omitempty"`
Interfaces
[]
*
Interface
`json:"interfaces,omitempty"`
Interfaces
[]
*
Interface
`json:"interfaces,omitempty"`
IPs
[]
*
IPConfig
`json:"ips,omitempty"`
IPs
[]
*
IPConfig
`json:"ips,omitempty"`
Routes
[]
*
types
.
Route
`json:"routes,omitempty"`
Routes
[]
*
types
.
Route
`json:"routes,omitempty"`
...
@@ -143,7 +144,8 @@ type Result struct {
...
@@ -143,7 +144,8 @@ type Result struct {
// Convert to the older 0.2.0 CNI spec Result type
// Convert to the older 0.2.0 CNI spec Result type
func
(
r
*
Result
)
convertTo020
()
(
*
types020
.
Result
,
error
)
{
func
(
r
*
Result
)
convertTo020
()
(
*
types020
.
Result
,
error
)
{
oldResult
:=
&
types020
.
Result
{
oldResult
:=
&
types020
.
Result
{
DNS
:
r
.
DNS
,
CNIVersion
:
types020
.
ImplementedSpecVersion
,
DNS
:
r
.
DNS
,
}
}
for
_
,
ip
:=
range
r
.
IPs
{
for
_
,
ip
:=
range
r
.
IPs
{
...
@@ -189,12 +191,13 @@ func (r *Result) convertTo020() (*types020.Result, error) {
...
@@ -189,12 +191,13 @@ func (r *Result) convertTo020() (*types020.Result, error) {
}
}
func
(
r
*
Result
)
Version
()
string
{
func
(
r
*
Result
)
Version
()
string
{
return
i
mplementedSpecVersion
return
I
mplementedSpecVersion
}
}
func
(
r
*
Result
)
GetAsVersion
(
version
string
)
(
types
.
Result
,
error
)
{
func
(
r
*
Result
)
GetAsVersion
(
version
string
)
(
types
.
Result
,
error
)
{
switch
version
{
switch
version
{
case
"0.3.0"
,
implementedSpecVersion
:
case
"0.3.0"
,
ImplementedSpecVersion
:
r
.
CNIVersion
=
version
return
r
,
nil
return
r
,
nil
case
types020
.
SupportedVersions
[
0
],
types020
.
SupportedVersions
[
1
],
types020
.
SupportedVersions
[
2
]
:
case
types020
.
SupportedVersions
[
0
],
types020
.
SupportedVersions
[
1
],
types020
.
SupportedVersions
[
2
]
:
return
r
.
convertTo020
()
return
r
.
convertTo020
()
...
@@ -244,12 +247,18 @@ func (i *Interface) String() string {
...
@@ -244,12 +247,18 @@ func (i *Interface) String() string {
return
fmt
.
Sprintf
(
"%+v"
,
*
i
)
return
fmt
.
Sprintf
(
"%+v"
,
*
i
)
}
}
// Int returns a pointer to the int value passed in. Used to
// set the IPConfig.Interface field.
func
Int
(
v
int
)
*
int
{
return
&
v
}
// IPConfig contains values necessary to configure an IP address on an interface
// IPConfig contains values necessary to configure an IP address on an interface
type
IPConfig
struct
{
type
IPConfig
struct
{
// IP version, either "4" or "6"
// IP version, either "4" or "6"
Version
string
Version
string
// Index into Result structs Interfaces list
// Index into Result structs Interfaces list
Interface
int
Interface
*
int
Address
net
.
IPNet
Address
net
.
IPNet
Gateway
net
.
IP
Gateway
net
.
IP
}
}
...
@@ -261,7 +270,7 @@ func (i *IPConfig) String() string {
...
@@ -261,7 +270,7 @@ func (i *IPConfig) String() string {
// JSON (un)marshallable types
// JSON (un)marshallable types
type
ipConfig
struct
{
type
ipConfig
struct
{
Version
string
`json:"version"`
Version
string
`json:"version"`
Interface
int
`json:"interface,omitempty"`
Interface
*
int
`json:"interface,omitempty"`
Address
types
.
IPNet
`json:"address"`
Address
types
.
IPNet
`json:"address"`
Gateway
net
.
IP
`json:"gateway,omitempty"`
Gateway
net
.
IP
`json:"gateway,omitempty"`
}
}
...
...
vendor/github.com/containernetworking/cni/pkg/types/types.go
View file @
7cdbb6ae
...
@@ -136,7 +136,11 @@ type Error struct {
...
@@ -136,7 +136,11 @@ type Error struct {
}
}
func
(
e
*
Error
)
Error
()
string
{
func
(
e
*
Error
)
Error
()
string
{
return
e
.
Msg
details
:=
""
if
e
.
Details
!=
""
{
details
=
fmt
.
Sprintf
(
"; %v"
,
e
.
Details
)
}
return
fmt
.
Sprintf
(
"%v%v"
,
e
.
Msg
,
details
)
}
}
func
(
e
*
Error
)
Print
()
error
{
func
(
e
*
Error
)
Print
()
error
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment