Skip to content

Commit

Permalink
Fix typos and formatting (#3036)
Browse files Browse the repository at this point in the history
Signed-off-by: Jianjun Shen <shenj@vmware.com>
  • Loading branch information
jianjuns committed Nov 20, 2021
1 parent 1df8e4a commit c040593
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pkg/agent/cniserver/ipam/antrea_ipam.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (d *AntreaIPAM) Check(args *invoke.Args, k8sArgs *argtypes.K8sArgs, network
}

if !found {
return true, fmt.Errorf("No IP Address association found for container %s", string(k8sArgs.K8S_POD_NAME))
return true, fmt.Errorf("no IP Address association found for container %s", string(k8sArgs.K8S_POD_NAME))
}

return true, nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/agent/cniserver/ipam/antrea_ipam_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const (
controllerName = "AntreaIPAMController"
)

// Antrea IPAM Controller maintains map of namespace annotations using
// namespace informer. In future, which Antrea IPAM support expands,
// Antrea IPAM Controller maintains map of Namespace annotations using
// Namespace informer. In future, which Antrea IPAM support expands,
// this controller can be used to store annotations for other objects,
// such as Statefulsets.
type AntreaIPAMController struct {
Expand Down
8 changes: 4 additions & 4 deletions pkg/agent/cniserver/ipam/antrea_ipam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func TestAntreaIPAMDriver(t *testing.T) {
cniArgsMap := make(map[string]*invoke.Args)
k8sArgsMap := make(map[string]*argtypes.K8sArgs)
for _, test := range []string{"apple1", "apple2", "orange1", "orange2", testNoAnnotation, testJunkAnnotation} {
// extract namespace by removing numerals
// extract Namespace by removing numerals
re := regexp.MustCompile("[0-9]$")
namespace := re.ReplaceAllString(test, "")
args := argtypes.K8sArgs{}
Expand Down Expand Up @@ -176,7 +176,7 @@ func TestAntreaIPAMDriver(t *testing.T) {
}
}

// Run several adds from two namespaces that have pool annotations
// Run several adds from two Namespaces that have pool annotations
ipv6Mask := "ffffffffffffffff0000000000000000"
testAdd("apple1", "10.2.2.100", "10.2.2.1", "ffffff00")
testAdd("orange1", "20::2", "20::1", ipv6Mask)
Expand All @@ -193,7 +193,7 @@ func TestAntreaIPAMDriver(t *testing.T) {
require.NotNil(t, err, "expected error in Add call due to non-existent pool")
assert.True(t, owns)

// Del two of the pods
// Del two of the Pods
testDel("apple1")
testDel("orange2")

Expand All @@ -212,7 +212,7 @@ func TestAntreaIPAMDriver(t *testing.T) {
assert.True(t, owns)
require.NoError(t, err, "expected no error in Del call")

// Make sure repeated Add works for pod that was previously released
// Make sure repeated Add works for Pod that was previously released
testAdd("apple1", "10.2.2.100", "10.2.2.1", "ffffff00")

// Make sure repeated call without previous container results in error
Expand Down
10 changes: 5 additions & 5 deletions pkg/ipam/poolallocator/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (a *IPPoolAllocator) initIPAllocators(ipPool *v1alpha2.IPPool) (ipallocator
err := allocators.AllocateIP(net.ParseIP(ip.IPAddress))
if err != nil {
// TODO - fix state if possible
return allocators, fmt.Errorf("Inconsistent state for IP Pool %s with IP %s", ipPool.Name, ip.IPAddress)
return allocators, fmt.Errorf("inconsistent state for IP Pool %s with IP %s", ipPool.Name, ip.IPAddress)
}
}

Expand Down Expand Up @@ -214,7 +214,7 @@ func (a *IPPoolAllocator) AllocateIP(ip net.IP, state v1alpha2.IPAddressPhase, o

// AllocateNext allocates the next available IP. It returns error if pool is exausted,
// or in case CRD failed to update its state.
// In case of success, IP pool CRD status is updated with allocated IP/state/resourcei/container.
// In case of success, IP pool CRD status is updated with allocated IP/state/resource/container.
// AllocateIP returns subnet details for the requested IP, as defined in IP pool spec.
func (a *IPPoolAllocator) AllocateNext(state v1alpha2.IPAddressPhase, owner v1alpha2.IPAddressOwner) (net.IP, v1alpha2.SubnetInfo, error) {
var subnetSpec v1alpha2.SubnetInfo
Expand All @@ -227,7 +227,7 @@ func (a *IPPoolAllocator) AllocateNext(state v1alpha2.IPAddressPhase, owner v1al
}

if exists {
return ip, subnetSpec, fmt.Errorf("Container %s was already allocated an address from IP Pool %s", owner.Pod.ContainerID, a.ipPoolName)
return ip, subnetSpec, fmt.Errorf("container %s was already allocated an address from IP Pool %s", owner.Pod.ContainerID, a.ipPoolName)
}

// Retry on CRD update conflict which is caused by multiple agents updating a pool at same time.
Expand All @@ -249,7 +249,7 @@ func (a *IPPoolAllocator) AllocateNext(state v1alpha2.IPAddressPhase, owner v1al

if index == len(allocators) {
// Failed to find matching range
return fmt.Errorf("Failed to allocate IP: Pool %s is exausted", a.ipPoolName)
return fmt.Errorf("failed to allocate IP: Pool %s is exausted", a.ipPoolName)
}

subnetSpec = ipPool.Spec.IPRanges[index].SubnetInfo
Expand Down Expand Up @@ -311,7 +311,7 @@ func (a *IPPoolAllocator) ReleasePod(namespace, podName string) error {
}

klog.V(4).InfoS("IP Pool state:", "name", a.ipPoolName, "allocation", ipPool.Status.IPAddresses)
return fmt.Errorf("Failed to find record of IP allocated to Pod:%s/%s in pool %s", namespace, podName, a.ipPoolName)
return fmt.Errorf("failed to find record of IP allocated to Pod:%s/%s in pool %s", namespace, podName, a.ipPoolName)
})

if err != nil {
Expand Down

0 comments on commit c040593

Please sign in to comment.