forked from microsoft/hcsshim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
k/k repo using ContainerProperties and NetworkStats struct from hcs internal pkg. Due to this the whole hcsshim pkg is having to be imported in k/k. This commit helps to restructure the pkg and maintain submodule to ensure that only this pkg is imported in k/k Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
- Loading branch information
Showing
28 changed files
with
497 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module github.com/Microsoft/hcsshim/hcs | ||
|
||
go 1.21.5 | ||
|
||
require github.com/Microsoft/go-winio v0.6.2 | ||
|
||
require golang.org/x/sys v0.10.0 // indirect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= | ||
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= | ||
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= | ||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
//go:build windows | ||
|
||
package hcs | ||
|
||
import ( | ||
"github.com/Microsoft/hcsshim/hcs/internal/schema1" | ||
hcsschema "github.com/Microsoft/hcsshim/hcs/internal/schema2" | ||
) | ||
|
||
// ContainerProperties holds the properties for a container and the processes running in that container | ||
type ContainerProperties = schema1.ContainerProperties | ||
|
||
// MemoryStats holds the memory statistics for a container | ||
type MemoryStats = schema1.MemoryStats | ||
|
||
// ProcessorStats holds the processor statistics for a container | ||
type ProcessorStats = schema1.ProcessorStats | ||
|
||
// StorageStats holds the storage statistics for a container | ||
type StorageStats = schema1.StorageStats | ||
|
||
// NetworkStats holds the network statistics for a container | ||
type NetworkStats = schema1.NetworkStats | ||
|
||
// Statistics is the structure returned by a statistics call on a container | ||
type Statistics = schema1.Statistics | ||
|
||
// ProcessList is the structure of an item returned by a ProcessList call on a container | ||
type ProcessListItem = schema1.ProcessListItem | ||
|
||
// MappedVirtualDiskController is the structure of an item returned by a MappedVirtualDiskList call on a container | ||
type MappedVirtualDiskController = schema1.MappedVirtualDiskController | ||
|
||
type Version = hcsschema.Version | ||
|
||
// Type of Request Support in ModifySystem | ||
type RequestType = schema1.RequestType | ||
|
||
// Type of Resource Support in ModifySystem | ||
type ResourceType = schema1.ResourceType | ||
|
||
type GuestDefinedCapabilities = schema1.GuestDefinedCapabilities | ||
|
||
type ResourceModificationRequestResponse = schema1.ResourceModificationRequestResponse | ||
|
||
// RequestType const | ||
const ( | ||
Add RequestType = "Add" | ||
Remove RequestType = "Remove" | ||
Network ResourceType = "Network" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
//go:build windows | ||
|
||
package schema1 | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/Microsoft/go-winio/pkg/guid" | ||
hcsschema "github.com/Microsoft/hcsshim/hcs/internal/schema2" | ||
) | ||
|
||
// ContainerProperties holds the properties for a container and the processes running in that container | ||
type ContainerProperties struct { | ||
ID string `json:"Id"` | ||
State string | ||
Name string | ||
SystemType string | ||
RuntimeOSType string `json:"RuntimeOsType,omitempty"` | ||
Owner string | ||
SiloGUID string `json:"SiloGuid,omitempty"` | ||
RuntimeID guid.GUID `json:"RuntimeId,omitempty"` | ||
IsRuntimeTemplate bool `json:",omitempty"` | ||
RuntimeImagePath string `json:",omitempty"` | ||
Stopped bool `json:",omitempty"` | ||
ExitType string `json:",omitempty"` | ||
AreUpdatesPending bool `json:",omitempty"` | ||
ObRoot string `json:",omitempty"` | ||
Statistics Statistics `json:",omitempty"` | ||
ProcessList []ProcessListItem `json:",omitempty"` | ||
MappedVirtualDiskControllers map[int]MappedVirtualDiskController `json:",omitempty"` | ||
GuestConnectionInfo GuestConnectionInfo `json:",omitempty"` | ||
} | ||
|
||
// MemoryStats holds the memory statistics for a container | ||
type MemoryStats struct { | ||
UsageCommitBytes uint64 `json:"MemoryUsageCommitBytes,omitempty"` | ||
UsageCommitPeakBytes uint64 `json:"MemoryUsageCommitPeakBytes,omitempty"` | ||
UsagePrivateWorkingSetBytes uint64 `json:"MemoryUsagePrivateWorkingSetBytes,omitempty"` | ||
} | ||
|
||
// ProcessorStats holds the processor statistics for a container | ||
type ProcessorStats struct { | ||
TotalRuntime100ns uint64 `json:",omitempty"` | ||
RuntimeUser100ns uint64 `json:",omitempty"` | ||
RuntimeKernel100ns uint64 `json:",omitempty"` | ||
} | ||
|
||
// StorageStats holds the storage statistics for a container | ||
type StorageStats struct { | ||
ReadCountNormalized uint64 `json:",omitempty"` | ||
ReadSizeBytes uint64 `json:",omitempty"` | ||
WriteCountNormalized uint64 `json:",omitempty"` | ||
WriteSizeBytes uint64 `json:",omitempty"` | ||
} | ||
|
||
// NetworkStats holds the network statistics for a container | ||
type NetworkStats struct { | ||
BytesReceived uint64 `json:",omitempty"` | ||
BytesSent uint64 `json:",omitempty"` | ||
PacketsReceived uint64 `json:",omitempty"` | ||
PacketsSent uint64 `json:",omitempty"` | ||
DroppedPacketsIncoming uint64 `json:",omitempty"` | ||
DroppedPacketsOutgoing uint64 `json:",omitempty"` | ||
EndpointId string `json:",omitempty"` | ||
InstanceId string `json:",omitempty"` | ||
} | ||
|
||
// Statistics is the structure returned by a statistics call on a container | ||
type Statistics struct { | ||
Timestamp time.Time `json:",omitempty"` | ||
ContainerStartTime time.Time `json:",omitempty"` | ||
Uptime100ns uint64 `json:",omitempty"` | ||
Memory MemoryStats `json:",omitempty"` | ||
Processor ProcessorStats `json:",omitempty"` | ||
Storage StorageStats `json:",omitempty"` | ||
Network []NetworkStats `json:",omitempty"` | ||
} | ||
|
||
// ProcessList is the structure of an item returned by a ProcessList call on a container | ||
type ProcessListItem struct { | ||
CreateTimestamp time.Time `json:",omitempty"` | ||
ImageName string `json:",omitempty"` | ||
KernelTime100ns uint64 `json:",omitempty"` | ||
MemoryCommitBytes uint64 `json:",omitempty"` | ||
MemoryWorkingSetPrivateBytes uint64 `json:",omitempty"` | ||
MemoryWorkingSetSharedBytes uint64 `json:",omitempty"` | ||
ProcessId uint32 `json:",omitempty"` | ||
UserTime100ns uint64 `json:",omitempty"` | ||
} | ||
|
||
// MappedVirtualDiskController is the structure of an item returned by a MappedVirtualDiskList call on a container | ||
type MappedVirtualDiskController struct { | ||
MappedVirtualDisks map[int]MappedVirtualDisk `json:",omitempty"` | ||
} | ||
|
||
type MappedVirtualDisk struct { | ||
HostPath string `json:",omitempty"` // Path to VHD on the host | ||
ContainerPath string // Platform-specific mount point path in the container | ||
CreateInUtilityVM bool `json:",omitempty"` | ||
ReadOnly bool `json:",omitempty"` | ||
Cache string `json:",omitempty"` // "" (Unspecified); "Disabled"; "Enabled"; "Private"; "PrivateAllowSharing" | ||
AttachOnly bool `json:",omitempty"` | ||
} | ||
|
||
// GuestDefinedCapabilities is part of the GuestConnectionInfo returned by a GuestConnection call on a utility VM | ||
type GuestDefinedCapabilities struct { | ||
NamespaceAddRequestSupported bool `json:",omitempty"` | ||
SignalProcessSupported bool `json:",omitempty"` | ||
DumpStacksSupported bool `json:",omitempty"` | ||
DeleteContainerStateSupported bool `json:",omitempty"` | ||
UpdateContainerSupported bool `json:",omitempty"` | ||
} | ||
|
||
// GuestConnectionInfo is the structure of an iterm return by a GuestConnection call on a utility VM | ||
type GuestConnectionInfo struct { | ||
SupportedSchemaVersions []hcsschema.Version `json:",omitempty"` | ||
ProtocolVersion uint32 `json:",omitempty"` | ||
GuestDefinedCapabilities GuestDefinedCapabilities `json:",omitempty"` | ||
} | ||
|
||
// Type of Request Support in ModifySystem | ||
type RequestType string | ||
|
||
// Type of Resource Support in ModifySystem | ||
type ResourceType string | ||
|
||
// ResourceModificationRequestResponse is the structure used to send request to the container to modify the system | ||
// Supported resource types are Network and Request Types are Add/Remove | ||
type ResourceModificationRequestResponse struct { | ||
Resource ResourceType `json:"ResourceType"` | ||
Data interface{} `json:"Settings"` | ||
Request RequestType `json:"RequestType,omitempty"` | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.