Skip to content

Commit 88415e0

Browse files
Backport of CNI: fix deprecation warnings into release/1.5.x (#19955)
Co-authored-by: Tim Gross <tgross@hashicorp.com>
1 parent f81c526 commit 88415e0

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

client/allocrunner/networking_cni.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (c *cniNetworkConfigurator) Setup(ctx context.Context, alloc *structs.Alloc
9999
// in one of them to fail. This rety attempts to overcome those erroneous failures.
100100
const retry = 3
101101
var firstError error
102-
var res *cni.CNIResult
102+
var res *cni.Result
103103
for attempt := 1; ; attempt++ {
104104
var err error
105105
if res, err = c.cni.Setup(ctx, alloc.ID, spec.Path, cni.WithCapabilityPortMap(getPortMapping(alloc, c.ignorePortMappingHostIP))); err != nil {
@@ -127,10 +127,10 @@ func (c *cniNetworkConfigurator) Setup(ctx context.Context, alloc *structs.Alloc
127127

128128
}
129129

130-
// cniToAllocNet converts a CNIResult to an AllocNetworkStatus or returns an
130+
// cniToAllocNet converts a cni.Result to an AllocNetworkStatus or returns an
131131
// error. The first interface and IP with a sandbox and address set are
132132
// preferred. Failing that the first interface with an IP is selected.
133-
func (c *cniNetworkConfigurator) cniToAllocNet(res *cni.CNIResult) (*structs.AllocNetworkStatus, error) {
133+
func (c *cniNetworkConfigurator) cniToAllocNet(res *cni.Result) (*structs.AllocNetworkStatus, error) {
134134
if len(res.Interfaces) == 0 {
135135
return nil, fmt.Errorf("failed to configure network: no interfaces found")
136136
}

client/allocrunner/networking_cni_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ func TestCNI_forceCleanup(t *testing.T) {
127127
})
128128
}
129129

130-
// TestCNI_cniToAllocNet_NoInterfaces asserts an error is returned if CNIResult
130+
// TestCNI_cniToAllocNet_NoInterfaces asserts an error is returned if cni.Result
131131
// contains no interfaces.
132132
func TestCNI_cniToAllocNet_NoInterfaces(t *testing.T) {
133133
ci.Parallel(t)
134134

135-
cniResult := &cni.CNIResult{}
135+
cniResult := &cni.Result{}
136136

137137
// Only need a logger
138138
c := &cniNetworkConfigurator{
@@ -150,7 +150,7 @@ func TestCNI_cniToAllocNet_Fallback(t *testing.T) {
150150

151151
// Calico's CNI plugin v3.12.3 has been observed to return the
152152
// following:
153-
cniResult := &cni.CNIResult{
153+
cniResult := &cni.Result{
154154
Interfaces: map[string]*cni.Config{
155155
"cali39179aa3-74": {},
156156
"eth0": {
@@ -181,7 +181,7 @@ func TestCNI_cniToAllocNet_Fallback(t *testing.T) {
181181
func TestCNI_cniToAllocNet_Invalid(t *testing.T) {
182182
ci.Parallel(t)
183183

184-
cniResult := &cni.CNIResult{
184+
cniResult := &cni.Result{
185185
Interfaces: map[string]*cni.Config{
186186
"eth0": {},
187187
"veth1": {

0 commit comments

Comments
 (0)