mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 23:15:14 +00:00
Fix go-lint issues in package pkg/kubelet/checkpointmanager/testing/example_checkpoint_formats/v1
This commit is contained in:
parent
8cd8784289
commit
12a5bdec00
@ -104,7 +104,6 @@ pkg/kubeapiserver/options
|
||||
pkg/kubectl/cmd/convert
|
||||
pkg/kubelet/apis/config
|
||||
pkg/kubelet/apis/config/v1beta1
|
||||
pkg/kubelet/checkpointmanager/testing/example_checkpoint_formats/v1
|
||||
pkg/kubelet/cm
|
||||
pkg/kubelet/config
|
||||
pkg/kubelet/container
|
||||
|
@ -24,7 +24,7 @@ import (
|
||||
|
||||
type protocol string
|
||||
|
||||
// portMapping is the port mapping configurations of a sandbox.
|
||||
// PortMapping is the port mapping configurations of a sandbox.
|
||||
type PortMapping struct {
|
||||
// protocol of the port mapping.
|
||||
Protocol *protocol
|
||||
@ -34,7 +34,7 @@ type PortMapping struct {
|
||||
HostPort *int32
|
||||
}
|
||||
|
||||
// CheckpointData contains all types of data that can be stored in the checkpoint.
|
||||
// Data contains all types of data that can be stored in the checkpoint.
|
||||
type Data struct {
|
||||
PortMappings []*PortMapping `json:"port_mappings,omitempty"`
|
||||
HostNetwork bool `json:"host_network,omitempty"`
|
||||
@ -48,15 +48,18 @@ type CheckpointData struct {
|
||||
Checksum checksum.Checksum
|
||||
}
|
||||
|
||||
// MarshalCheckpoint tries to marshal the CheckpointData into JSON data.
|
||||
func (cp *CheckpointData) MarshalCheckpoint() ([]byte, error) {
|
||||
cp.Checksum = checksum.New(*cp.Data)
|
||||
return json.Marshal(*cp)
|
||||
}
|
||||
|
||||
// UnmarshalCheckpoint tries to unmarshal the passed JSON data into CheckpointData.
|
||||
func (cp *CheckpointData) UnmarshalCheckpoint(blob []byte) error {
|
||||
return json.Unmarshal(blob, cp)
|
||||
}
|
||||
|
||||
// VerifyChecksum verifies that CheckpointData's checksum is same as the checksum calculated by its data.
|
||||
func (cp *CheckpointData) VerifyChecksum() error {
|
||||
return cp.Checksum.Verify(*cp.Data)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user