Skip to content

Commit e59d3d2

Browse files
ritikaguptamskiashok
authored andcommitted
Adding state attribute to the HNSEndpoint struct to support hyperv containers for k8s
Signed-off-by: ritikaguptams <[email protected]> Adding stringer for usage and CI/CD Signed-off-by: ritikaguptams <[email protected]> Fixing build errors Signed-off-by: ritikaguptams <[email protected]> Ignore linting for files generated by Stringer Signed-off-by: ritikaguptams <[email protected]> Trying to fix CI go gen Signed-off-by: ritikaguptams <[email protected]> Removing extra step to fix CI go gen Signed-off-by: ritikaguptams <[email protected]> go gen CI fix try 2 Signed-off-by: ritikaguptams <[email protected]> Skip autogenerated file from linting Signed-off-by: ritikaguptams <[email protected]> Fixing linting Signed-off-by: ritikaguptams <[email protected]> Fixing linting Signed-off-by: ritikaguptams <[email protected]> Removing stringer to avoid increasing package bloat for hcsshim Signed-off-by: ritikaguptams <[email protected]> cleanup Signed-off-by: ritikaguptams <[email protected]> Adding comment for future HNS v2 change Signed-off-by: ritikaguptams <[email protected]> Fix linting Signed-off-by: ritikaguptams <[email protected]> (cherry picked from commit e96bfcd) Signed-off-by: ritikaguptams <[email protected]>
1 parent 1495e9f commit e59d3d2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

internal/hns/hnsendpoint.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@ import (
1010
"github.com/sirupsen/logrus"
1111
)
1212

13+
// EndpointState represents the states of an HNS Endpoint lifecycle.
14+
type EndpointState uint16
15+
16+
// EndpointState const
17+
// The lifecycle of an Endpoint goes through created, attached, AttachedSharing - endpoint is being shared with other containers,
18+
// detached, after being attached, degraded and finally destroyed.
19+
// Note: This attribute is used by calico to define stale containers and is dependent on HNS v1 api, if we move to HNS v2 api we will need
20+
// to update the current calico code and cordinate the change with calico. Reach out to Microsoft to facilate the change via HNS.
21+
const (
22+
Uninitialized EndpointState = iota
23+
Created EndpointState = 1
24+
Attached EndpointState = 2
25+
AttachedSharing EndpointState = 3
26+
Detached EndpointState = 4
27+
Degraded EndpointState = 5
28+
Destroyed EndpointState = 6
29+
)
30+
31+
func (es EndpointState) String() string {
32+
return [...]string{"Uninitialized", "Attached", "AttachedSharing", "Detached", "Degraded", "Destroyed"}[es]
33+
}
34+
1335
// HNSEndpoint represents a network endpoint in HNS
1436
type HNSEndpoint struct {
1537
Id string `json:"ID,omitempty"`
@@ -34,6 +56,7 @@ type HNSEndpoint struct {
3456
Namespace *Namespace `json:",omitempty"`
3557
EncapOverhead uint16 `json:",omitempty"`
3658
SharedContainers []string `json:",omitempty"`
59+
State EndpointState `json:",omitempty"`
3760
}
3861

3962
// SystemType represents the type of the system on which actions are done

0 commit comments

Comments
 (0)