mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-12 11:55:42 +00:00
run modernize -fix ./...
Using golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize + some manual cleanup in libpod/lock/shm/shm_lock_test.go as it generated an unused variable + restored one removed comment Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
dc5a791f58
commit
8631032556
144 changed files with 500 additions and 623 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"maps"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
|
@ -337,9 +338,7 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *Buil
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for name, val := range fargs {
|
||||
args[name] = val
|
||||
}
|
||||
maps.Copy(args, fargs)
|
||||
}
|
||||
}
|
||||
if c.Flag("build-arg").Changed {
|
||||
|
|
|
|||
|
|
@ -1365,7 +1365,7 @@ func convertFormatSuggestions(suggestions []formatSuggestion) []string {
|
|||
// This function will only work for pointer to structs other types are not supported.
|
||||
// When "{{." is typed the field and method names of the given struct will be completed.
|
||||
// This also works recursive for nested structs.
|
||||
func AutocompleteFormat(o interface{}) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteFormat(o any) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
// this function provides shell completion for go templates
|
||||
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
// autocomplete json when nothing or json is typed
|
||||
|
|
@ -1454,7 +1454,7 @@ func AutocompleteFormat(o interface{}) func(cmd *cobra.Command, args []string, t
|
|||
}
|
||||
}
|
||||
|
||||
func getEntityType(cmd *cobra.Command, args []string, o interface{}) interface{} {
|
||||
func getEntityType(cmd *cobra.Command, args []string, o any) any {
|
||||
// container logic
|
||||
if containers, _ := getContainers(cmd, args[0], completeDefault); len(containers) > 0 {
|
||||
return &define.InspectContainerData{}
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ func imageSearch(cmd *cobra.Command, args []string) error {
|
|||
return rpt.Execute(searchReport)
|
||||
}
|
||||
|
||||
func printArbitraryJSON(v interface{}) error {
|
||||
func printArbitraryJSON(v any) error {
|
||||
prettyJSON, err := json.MarshalIndent(v, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ func newInspector(options entities.InspectOptions) (*inspector, error) {
|
|||
// inspect inspects the specified container/image names or IDs.
|
||||
func (i *inspector) inspect(namesOrIDs []string) error {
|
||||
// data - dumping place for inspection results.
|
||||
var data []interface{}
|
||||
var data []any
|
||||
var errs []error
|
||||
ctx := context.Background()
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ func (i *inspector) inspect(namesOrIDs []string) error {
|
|||
}
|
||||
// Always print an empty array
|
||||
if data == nil {
|
||||
data = []interface{}{}
|
||||
data = []any{}
|
||||
}
|
||||
|
||||
var err error
|
||||
|
|
@ -191,8 +191,8 @@ func (i *inspector) inspect(namesOrIDs []string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (i *inspector) inspectAll(ctx context.Context, namesOrIDs []string) ([]interface{}, []error, error) {
|
||||
var data []interface{}
|
||||
func (i *inspector) inspectAll(ctx context.Context, namesOrIDs []string) ([]any, []error, error) {
|
||||
var data []any
|
||||
allErrs := []error{}
|
||||
for _, name := range namesOrIDs {
|
||||
ctrData, errs, err := i.containerEngine.ContainerInspect(ctx, []string{name}, i.options)
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ func client9p(portNum uint32, mountPath string) error {
|
|||
conn *vsock.Conn
|
||||
retries = 20
|
||||
)
|
||||
for i := 0; i < retries; i++ {
|
||||
for range retries {
|
||||
// Host connects to non-hypervisor processes on the host running the VM.
|
||||
conn, err = vsock.Dial(vsock.Host, portNum, nil)
|
||||
// If errors.Is worked on this error, we could detect non-timeout errors.
|
||||
|
|
|
|||
|
|
@ -89,11 +89,11 @@ func GetDistribution() Distribution {
|
|||
|
||||
l := bufio.NewScanner(f)
|
||||
for l.Scan() {
|
||||
if strings.HasPrefix(l.Text(), "ID=") {
|
||||
dist.Name = strings.TrimPrefix(l.Text(), "ID=")
|
||||
if after, ok := strings.CutPrefix(l.Text(), "ID="); ok {
|
||||
dist.Name = after
|
||||
}
|
||||
if strings.HasPrefix(l.Text(), "VARIANT_ID=") {
|
||||
dist.Variant = strings.Trim(strings.TrimPrefix(l.Text(), "VARIANT_ID="), "\"")
|
||||
if after, ok := strings.CutPrefix(l.Text(), "VARIANT_ID="); ok {
|
||||
dist.Variant = strings.Trim(after, "\"")
|
||||
}
|
||||
}
|
||||
return dist
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ import (
|
|||
|
||||
type logrusLogger struct{}
|
||||
|
||||
func (l logrusLogger) Errorf(format string, args ...interface{}) {
|
||||
func (l logrusLogger) Errorf(format string, args ...any) {
|
||||
logrus.Errorf(format, args...)
|
||||
}
|
||||
func (l logrusLogger) Debugf(format string, args ...interface{}) {
|
||||
func (l logrusLogger) Debugf(format string, args ...any) {
|
||||
logrus.Debugf(format, args...)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ import (
|
|||
// logrusLogger implements the logiface.Logger interface using logrus
|
||||
type logrusLogger struct{}
|
||||
|
||||
func (l logrusLogger) Errorf(format string, args ...interface{}) {
|
||||
func (l logrusLogger) Errorf(format string, args ...any) {
|
||||
logrus.Errorf(format, args...)
|
||||
}
|
||||
|
||||
func (l logrusLogger) Debugf(format string, args ...interface{}) {
|
||||
func (l logrusLogger) Debugf(format string, args ...any) {
|
||||
logrus.Debugf(format, args...)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
"path/filepath"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
|
|
@ -452,11 +453,8 @@ func loggingHook() {
|
|||
}
|
||||
logLevel = "debug"
|
||||
}
|
||||
for _, l := range common.LogLevels {
|
||||
if l == strings.ToLower(logLevel) {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
if slices.Contains(common.LogLevels, strings.ToLower(logLevel)) {
|
||||
found = true
|
||||
}
|
||||
if !found {
|
||||
fmt.Fprintf(os.Stderr, "Log Level %q is not supported, choose from: %s\n", logLevel, strings.Join(common.LogLevels, ", "))
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ func printVerbose(cmd *cobra.Command, reports *entities.SystemDfReport) error {
|
|||
return writeTemplate(rpt, hdrs, dfVolumes)
|
||||
}
|
||||
|
||||
func writeTemplate(rpt *report.Formatter, hdrs []map[string]string, output interface{}) error {
|
||||
func writeTemplate(rpt *report.Formatter, hdrs []map[string]string, output any) error {
|
||||
if rpt.RenderHeaders {
|
||||
if err := rpt.Execute(hdrs); err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ func RemoveSlash(input []string) []string {
|
|||
return output
|
||||
}
|
||||
|
||||
func PrintGenericJSON(data interface{}) error {
|
||||
func PrintGenericJSON(data any) error {
|
||||
enc := json.NewEncoder(os.Stdout)
|
||||
// by default, json marshallers will force utf=8 from
|
||||
// a string.
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package validate
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
|
@ -29,11 +30,9 @@ func (c *ChoiceValue) String() string {
|
|||
}
|
||||
|
||||
func (c *ChoiceValue) Set(value string) error {
|
||||
for _, v := range c.choices {
|
||||
if v == value {
|
||||
*c.value = value
|
||||
return nil
|
||||
}
|
||||
if slices.Contains(c.choices, value) {
|
||||
*c.value = value
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("%q is not a valid value. Choose from: %q", value, c.Choices())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ func logToKmsg(s string) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func Logf(format string, a ...interface{}) {
|
||||
func Logf(format string, a ...any) {
|
||||
s := fmt.Sprintf(format, a...)
|
||||
line := fmt.Sprintf("quadlet-generator[%d]: %s", os.Getpid(), s)
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ func enableDebug() {
|
|||
debugEnabled = true
|
||||
}
|
||||
|
||||
func Debugf(format string, a ...interface{}) {
|
||||
func Debugf(format string, a ...any) {
|
||||
if debugEnabled {
|
||||
Logf(format, a...)
|
||||
}
|
||||
|
|
@ -421,11 +421,11 @@ func generateUnitsInfoMap(units []*parser.UnitFile) map[string]*quadlet.UnitInfo
|
|||
// quadletLogger implements the logiface.Logger interface using quadlet's custom logging
|
||||
type quadletLogger struct{}
|
||||
|
||||
func (l quadletLogger) Errorf(format string, args ...interface{}) {
|
||||
func (l quadletLogger) Errorf(format string, args ...any) {
|
||||
Logf(format, args...)
|
||||
}
|
||||
|
||||
func (l quadletLogger) Debugf(format string, args ...interface{}) {
|
||||
func (l quadletLogger) Debugf(format string, args ...any) {
|
||||
Debugf(format, args...)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ func TestStartAndStopMultipleRegistries(t *testing.T) {
|
|||
|
||||
// Start registries.
|
||||
var errors *multierror.Error
|
||||
for i := 0; i < 3; i++ {
|
||||
for range 3 {
|
||||
reg, err := StartWithOptions(registryOptions)
|
||||
if err != nil {
|
||||
errors = multierror.Append(errors, err)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"maps"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
|
|
@ -145,9 +146,9 @@ type ContainerState struct {
|
|||
// by containers/storage.
|
||||
Mountpoint string `json:"mountPoint,omitempty"`
|
||||
// StartedTime is the time the container was started
|
||||
StartedTime time.Time `json:"startedTime,omitempty"`
|
||||
StartedTime time.Time `json:"startedTime"`
|
||||
// FinishedTime is the time the container finished executing
|
||||
FinishedTime time.Time `json:"finishedTime,omitempty"`
|
||||
FinishedTime time.Time `json:"finishedTime"`
|
||||
// ExitCode is the exit code returned when the container stopped
|
||||
ExitCode int32 `json:"exitCode,omitempty"`
|
||||
// Exited is whether the container has exited
|
||||
|
|
@ -229,8 +230,8 @@ type ContainerState struct {
|
|||
|
||||
// Following checkpoint/restore related information is displayed
|
||||
// if the container has been checkpointed or restored.
|
||||
CheckpointedTime time.Time `json:"checkpointedTime,omitempty"`
|
||||
RestoredTime time.Time `json:"restoredTime,omitempty"`
|
||||
CheckpointedTime time.Time `json:"checkpointedTime"`
|
||||
RestoredTime time.Time `json:"restoredTime"`
|
||||
CheckpointLog string `json:"checkpointLog,omitempty"`
|
||||
CheckpointPath string `json:"checkpointPath,omitempty"`
|
||||
RestoreLog string `json:"restoreLog,omitempty"`
|
||||
|
|
@ -627,9 +628,7 @@ func (c *Container) Stdin() bool {
|
|||
// Labels returns the container's labels
|
||||
func (c *Container) Labels() map[string]string {
|
||||
labels := make(map[string]string)
|
||||
for key, value := range c.config.Labels {
|
||||
labels[key] = value
|
||||
}
|
||||
maps.Copy(labels, c.config.Labels)
|
||||
return labels
|
||||
}
|
||||
|
||||
|
|
@ -1040,9 +1039,7 @@ func (c *Container) BindMounts() (map[string]string, error) {
|
|||
|
||||
newMap := make(map[string]string, len(c.state.BindMounts))
|
||||
|
||||
for key, val := range c.state.BindMounts {
|
||||
newMap[key] = val
|
||||
}
|
||||
maps.Copy(newMap, c.state.BindMounts)
|
||||
|
||||
return newMap, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/containers/buildah"
|
||||
|
|
@ -130,13 +131,7 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai
|
|||
// Only include anonymous named volumes added by the user by
|
||||
// default.
|
||||
for _, v := range c.config.NamedVolumes {
|
||||
include := false
|
||||
for _, userVol := range c.config.UserVolumes {
|
||||
if userVol == v.Dest {
|
||||
include = true
|
||||
break
|
||||
}
|
||||
}
|
||||
include := slices.Contains(c.config.UserVolumes, v.Dest)
|
||||
if include {
|
||||
vol, err := c.runtime.GetVolume(v.Name)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ type ContainerConfig struct {
|
|||
// namespace. They are used by the OCI runtime when creating the
|
||||
// container, and by c/storage to ensure that the container's files have
|
||||
// the appropriate owner.
|
||||
IDMappings storage.IDMappingOptions `json:"idMappingsOptions,omitempty"`
|
||||
IDMappings storage.IDMappingOptions `json:"idMappingsOptions"`
|
||||
|
||||
// Dependencies are the IDs of dependency containers.
|
||||
// These containers must be started before this container is started.
|
||||
|
|
|
|||
|
|
@ -991,7 +991,7 @@ func (c *Container) exec(config *ExecConfig, streams *define.AttachStreams, resi
|
|||
// errors.
|
||||
func (c *Container) cleanupExecBundle(sessionID string) (err error) {
|
||||
path := c.execBundlePath(sessionID)
|
||||
for attempts := 0; attempts < 50; attempts++ {
|
||||
for range 50 {
|
||||
err = os.RemoveAll(path)
|
||||
if err == nil || os.IsNotExist(err) {
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ package libpod
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"strings"
|
||||
|
||||
"github.com/containers/podman/v5/libpod/define"
|
||||
|
|
@ -416,16 +417,12 @@ func (c *Container) generateInspectContainerConfig(spec *spec.Spec) *define.Insp
|
|||
|
||||
if len(c.config.Labels) != 0 {
|
||||
ctrConfig.Labels = make(map[string]string)
|
||||
for k, v := range c.config.Labels {
|
||||
ctrConfig.Labels[k] = v
|
||||
}
|
||||
maps.Copy(ctrConfig.Labels, c.config.Labels)
|
||||
}
|
||||
|
||||
if len(spec.Annotations) != 0 {
|
||||
ctrConfig.Annotations = make(map[string]string)
|
||||
for k, v := range spec.Annotations {
|
||||
ctrConfig.Annotations[k] = v
|
||||
}
|
||||
maps.Copy(ctrConfig.Annotations, spec.Annotations)
|
||||
}
|
||||
ctrConfig.StopSignal = signal.ToDockerFormat(c.config.StopSignal)
|
||||
// TODO: should JSON deep copy this to ensure internal pointers don't
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"maps"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
|
|
@ -350,12 +351,7 @@ func (c *Container) handleRestartPolicy(ctx context.Context) (_ bool, retErr err
|
|||
// Returns true if the container is in one of the given states,
|
||||
// or false otherwise.
|
||||
func (c *Container) ensureState(states ...define.ContainerStatus) bool {
|
||||
for _, state := range states {
|
||||
if state == c.state.State {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains(states, c.state.State)
|
||||
}
|
||||
|
||||
// Sync this container with on-disk state and runtime status
|
||||
|
|
@ -412,8 +408,8 @@ func (c *Container) setupStorageMapping(dest, from *storage.IDMappingOptions) {
|
|||
dest.AutoUserNsOpts.GroupFile = overrides.ContainerEtcGroupPath
|
||||
if c.config.User != "" {
|
||||
initialSize := uint32(0)
|
||||
parts := strings.Split(c.config.User, ":")
|
||||
for _, p := range parts {
|
||||
parts := strings.SplitSeq(c.config.User, ":")
|
||||
for p := range parts {
|
||||
s, err := strconv.ParseUint(p, 10, 32)
|
||||
if err == nil && uint32(s) > initialSize {
|
||||
initialSize = uint32(s)
|
||||
|
|
@ -476,19 +472,14 @@ func (c *Container) setupStorage(ctx context.Context) error {
|
|||
// privileged containers or '--ipc host' only ProcessLabel will
|
||||
// be set and so we will skip it for cases like that.
|
||||
if options.Flags == nil {
|
||||
options.Flags = make(map[string]interface{})
|
||||
options.Flags = make(map[string]any)
|
||||
}
|
||||
options.Flags["ProcessLabel"] = c.config.ProcessLabel
|
||||
options.Flags["MountLabel"] = c.config.MountLabel
|
||||
}
|
||||
if c.config.Privileged {
|
||||
privOpt := func(opt string) bool {
|
||||
for _, privopt := range []string{"nodev", "nosuid", "noexec"} {
|
||||
if opt == privopt {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains([]string{"nodev", "nosuid", "noexec"}, opt)
|
||||
}
|
||||
|
||||
defOptions, err := storage.GetMountOptions(c.runtime.store.GraphDriverName(), c.runtime.store.GraphOptions())
|
||||
|
|
@ -2479,9 +2470,7 @@ func (c *Container) setupOCIHooks(ctx context.Context, config *spec.Spec) (map[s
|
|||
if len(ociHooks) > 0 || config.Hooks != nil {
|
||||
logrus.Warnf("Implicit hook directories are deprecated; set --ociHooks-dir=%q explicitly to continue to load ociHooks from this directory", hDir)
|
||||
}
|
||||
for i, hook := range ociHooks {
|
||||
allHooks[i] = hook
|
||||
}
|
||||
maps.Copy(allHooks, ociHooks)
|
||||
}
|
||||
} else {
|
||||
manager, err := hooks.New(ctx, c.runtime.config.Engine.HooksDir.Get(), []string{"precreate", "poststop"})
|
||||
|
|
|
|||
|
|
@ -109,8 +109,8 @@ func parseIDMapMountOption(idMappings stypes.IDMappingOptions, option string) ([
|
|||
gidMap := idMappings.GIDMap
|
||||
if strings.HasPrefix(option, "idmap=") {
|
||||
var err error
|
||||
options := strings.Split(strings.SplitN(option, "=", 2)[1], ";")
|
||||
for _, i := range options {
|
||||
options := strings.SplitSeq(strings.SplitN(option, "=", 2)[1], ";")
|
||||
for i := range options {
|
||||
switch {
|
||||
case strings.HasPrefix(i, "uids="):
|
||||
uidMap, err = parseOptionIDs(idMappings.UIDMap, strings.Replace(i, "uids=", "", 1))
|
||||
|
|
@ -2732,11 +2732,8 @@ func (c *Container) userPasswdEntry(u *user.User) (string, error) {
|
|||
hDir = filepath.Dir(hDir)
|
||||
}
|
||||
if homeDir != u.HomeDir {
|
||||
for _, hDir := range c.UserVolumes() {
|
||||
if hDir == u.HomeDir {
|
||||
homeDir = u.HomeDir
|
||||
break
|
||||
}
|
||||
if slices.Contains(c.UserVolumes(), u.HomeDir) {
|
||||
homeDir = u.HomeDir
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ const (
|
|||
// InfoData holds the info type, i.e store, host etc and the data for each type
|
||||
type InfoData struct {
|
||||
Type string
|
||||
Data map[string]interface{}
|
||||
Data map[string]any
|
||||
}
|
||||
|
||||
// VolumeDriverLocal is the "local" volume driver. It is managed by libpod
|
||||
|
|
|
|||
|
|
@ -111,8 +111,8 @@ type InspectContainerConfig struct {
|
|||
func (insp *InspectContainerConfig) UnmarshalJSON(data []byte) error {
|
||||
type Alias InspectContainerConfig
|
||||
aux := &struct {
|
||||
Entrypoint interface{} `json:"Entrypoint"`
|
||||
StopSignal interface{} `json:"StopSignal"`
|
||||
Entrypoint any `json:"Entrypoint"`
|
||||
StopSignal any `json:"StopSignal"`
|
||||
*Alias
|
||||
}{
|
||||
Alias: (*Alias)(insp),
|
||||
|
|
@ -126,7 +126,7 @@ func (insp *InspectContainerConfig) UnmarshalJSON(data []byte) error {
|
|||
insp.Entrypoint = strings.Split(entrypoint, " ")
|
||||
case []string:
|
||||
insp.Entrypoint = entrypoint
|
||||
case []interface{}:
|
||||
case []any:
|
||||
insp.Entrypoint = []string{}
|
||||
for _, entry := range entrypoint {
|
||||
if str, ok := entry.(string); ok {
|
||||
|
|
@ -312,8 +312,8 @@ type InspectContainerState struct {
|
|||
Health *HealthCheckResults `json:"Health,omitempty"`
|
||||
Checkpointed bool `json:"Checkpointed,omitempty"`
|
||||
CgroupPath string `json:"CgroupPath,omitempty"`
|
||||
CheckpointedAt time.Time `json:"CheckpointedAt,omitempty"`
|
||||
RestoredAt time.Time `json:"RestoredAt,omitempty"`
|
||||
CheckpointedAt time.Time `json:"CheckpointedAt"`
|
||||
RestoredAt time.Time `json:"RestoredAt"`
|
||||
CheckpointLog string `json:"CheckpointLog,omitempty"`
|
||||
CheckpointPath string `json:"CheckpointPath,omitempty"`
|
||||
RestoreLog string `json:"RestoreLog,omitempty"`
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ import (
|
|||
// running libpod/podman
|
||||
// swagger:model LibpodInfo
|
||||
type Info struct {
|
||||
Host *HostInfo `json:"host"`
|
||||
Store *StoreInfo `json:"store"`
|
||||
Registries map[string]interface{} `json:"registries"`
|
||||
Plugins Plugins `json:"plugins"`
|
||||
Version Version `json:"version"`
|
||||
Host *HostInfo `json:"host"`
|
||||
Store *StoreInfo `json:"store"`
|
||||
Registries map[string]any `json:"registries"`
|
||||
Plugins Plugins `json:"plugins"`
|
||||
Version Version `json:"version"`
|
||||
}
|
||||
|
||||
// SecurityInfo describes the libpod host
|
||||
|
|
@ -41,7 +41,7 @@ type HostInfo struct {
|
|||
EventLogger string `json:"eventLogger"`
|
||||
FreeLocks *uint32 `json:"freeLocks,omitempty"`
|
||||
Hostname string `json:"hostname"`
|
||||
IDMappings IDMappings `json:"idMappings,omitempty"`
|
||||
IDMappings IDMappings `json:"idMappings"`
|
||||
Kernel string `json:"kernel"`
|
||||
LogDriver string `json:"logDriver"`
|
||||
MemFree int64 `json:"memFree"`
|
||||
|
|
@ -53,13 +53,13 @@ type HostInfo struct {
|
|||
// RemoteSocket returns the UNIX domain socket the Podman service is listening on
|
||||
RemoteSocket *RemoteSocket `json:"remoteSocket,omitempty"`
|
||||
// RootlessNetworkCmd returns the default rootless network command (slirp4netns or pasta)
|
||||
RootlessNetworkCmd string `json:"rootlessNetworkCmd"`
|
||||
RuntimeInfo map[string]interface{} `json:"runtimeInfo,omitempty"`
|
||||
RootlessNetworkCmd string `json:"rootlessNetworkCmd"`
|
||||
RuntimeInfo map[string]any `json:"runtimeInfo,omitempty"`
|
||||
// ServiceIsRemote is true when the podman/libpod service is remote to the client
|
||||
ServiceIsRemote bool `json:"serviceIsRemote"`
|
||||
Security SecurityInfo `json:"security"`
|
||||
Slirp4NetNS SlirpInfo `json:"slirp4netns,omitempty"`
|
||||
Pasta PastaInfo `json:"pasta,omitempty"`
|
||||
Slirp4NetNS SlirpInfo `json:"slirp4netns"`
|
||||
Pasta PastaInfo `json:"pasta"`
|
||||
|
||||
SwapFree int64 `json:"swapFree"`
|
||||
SwapTotal int64 `json:"swapTotal"`
|
||||
|
|
@ -123,11 +123,11 @@ type OCIRuntimeInfo struct {
|
|||
// StoreInfo describes the container storage and its
|
||||
// attributes
|
||||
type StoreInfo struct {
|
||||
ConfigFile string `json:"configFile"`
|
||||
ContainerStore ContainerStore `json:"containerStore"`
|
||||
GraphDriverName string `json:"graphDriverName"`
|
||||
GraphOptions map[string]interface{} `json:"graphOptions"`
|
||||
GraphRoot string `json:"graphRoot"`
|
||||
ConfigFile string `json:"configFile"`
|
||||
ContainerStore ContainerStore `json:"containerStore"`
|
||||
GraphDriverName string `json:"graphDriverName"`
|
||||
GraphOptions map[string]any `json:"graphOptions"`
|
||||
GraphRoot string `json:"graphRoot"`
|
||||
// GraphRootAllocated is how much space the graphroot has in bytes
|
||||
GraphRootAllocated uint64 `json:"graphRootAllocated"`
|
||||
// GraphRootUsed is how much of graphroot is used in bytes
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@ type InspectVolumeData struct {
|
|||
Mountpoint string `json:"Mountpoint"`
|
||||
// CreatedAt is the date and time the volume was created at. This is not
|
||||
// stored for older Libpod volumes; if so, it will be omitted.
|
||||
CreatedAt time.Time `json:"CreatedAt,omitempty"`
|
||||
CreatedAt time.Time `json:"CreatedAt"`
|
||||
// Status is used to return information on the volume's current state,
|
||||
// if the volume was created using a volume plugin (uses a Driver that
|
||||
// is not the local driver).
|
||||
// Status is provided to us by an external program, so no guarantees are
|
||||
// made about its format or contents. Further, it is an optional field,
|
||||
// so it may not be set even in cases where a volume plugin is in use.
|
||||
Status map[string]interface{} `json:"Status,omitempty"`
|
||||
Status map[string]any `json:"Status,omitempty"`
|
||||
// Labels includes the volume's configured labels, key:value pairs that
|
||||
// can be passed during volume creation to provide information for third
|
||||
// party tools.
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ func (r *Runtime) info() (*define.Info, error) {
|
|||
return nil, fmt.Errorf("getting store info: %w", err)
|
||||
}
|
||||
info.Store = storeInfo
|
||||
registries := make(map[string]interface{})
|
||||
registries := make(map[string]any)
|
||||
|
||||
sys := r.SystemContext()
|
||||
data, err := sysregistriesv2.GetRegistries(sys)
|
||||
|
|
@ -248,7 +248,7 @@ func (r *Runtime) storeInfo() (*define.StoreInfo, error) {
|
|||
TransientStore: r.store.TransientStore(),
|
||||
}
|
||||
|
||||
graphOptions := map[string]interface{}{}
|
||||
graphOptions := map[string]any{}
|
||||
for _, o := range r.store.GraphOptions() {
|
||||
split := strings.SplitN(o, "=", 2)
|
||||
switch {
|
||||
|
|
@ -257,7 +257,7 @@ func (r *Runtime) storeInfo() (*define.StoreInfo, error) {
|
|||
if err != nil {
|
||||
logrus.Warnf("Failed to retrieve program version for %s: %v", split[1], err)
|
||||
}
|
||||
program := map[string]interface{}{}
|
||||
program := map[string]any{}
|
||||
program["Executable"] = split[1]
|
||||
program["Version"] = ver
|
||||
program["Package"] = version.Package(split[1])
|
||||
|
|
@ -306,17 +306,17 @@ func (r *Runtime) GetHostDistributionInfo() define.DistributionInfo {
|
|||
|
||||
l := bufio.NewScanner(f)
|
||||
for l.Scan() {
|
||||
if strings.HasPrefix(l.Text(), "ID=") {
|
||||
dist.Distribution = strings.Trim(strings.TrimPrefix(l.Text(), "ID="), "\"")
|
||||
if after, ok := strings.CutPrefix(l.Text(), "ID="); ok {
|
||||
dist.Distribution = strings.Trim(after, "\"")
|
||||
}
|
||||
if strings.HasPrefix(l.Text(), "VARIANT_ID=") {
|
||||
dist.Variant = strings.Trim(strings.TrimPrefix(l.Text(), "VARIANT_ID="), "\"")
|
||||
if after, ok := strings.CutPrefix(l.Text(), "VARIANT_ID="); ok {
|
||||
dist.Variant = strings.Trim(after, "\"")
|
||||
}
|
||||
if strings.HasPrefix(l.Text(), "VERSION_ID=") {
|
||||
dist.Version = strings.Trim(strings.TrimPrefix(l.Text(), "VERSION_ID="), "\"")
|
||||
if after, ok := strings.CutPrefix(l.Text(), "VERSION_ID="); ok {
|
||||
dist.Version = strings.Trim(after, "\"")
|
||||
}
|
||||
if strings.HasPrefix(l.Text(), "VERSION_CODENAME=") {
|
||||
dist.Codename = strings.Trim(strings.TrimPrefix(l.Text(), "VERSION_CODENAME="), "\"")
|
||||
if after, ok := strings.CutPrefix(l.Text(), "VERSION_CODENAME="); ok {
|
||||
dist.Codename = strings.Trim(after, "\"")
|
||||
}
|
||||
}
|
||||
return dist
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"math/rand"
|
||||
"os"
|
||||
"reflect"
|
||||
|
|
@ -620,9 +621,7 @@ func (p *Pod) podWithContainers(ctx context.Context, containers []*Container, po
|
|||
podAnnotations[fmt.Sprintf("%s/%s", k, removeUnderscores(ctr.Name()))] = v
|
||||
}
|
||||
// Convert auto-update labels into kube annotations
|
||||
for k, v := range getAutoUpdateAnnotations(ctr.Name(), ctr.Labels()) {
|
||||
podAnnotations[k] = v
|
||||
}
|
||||
maps.Copy(podAnnotations, getAutoUpdateAnnotations(ctr.Name(), ctr.Labels()))
|
||||
isInit := ctr.IsInitCtr()
|
||||
// Since hostname is only set at pod level, set the hostname to the hostname of the first container we encounter
|
||||
if hostname == "" {
|
||||
|
|
@ -769,9 +768,7 @@ func simplePodWithV1Containers(ctx context.Context, ctrs []*Container, getServic
|
|||
}
|
||||
|
||||
// Convert auto-update labels into kube annotations
|
||||
for k, v := range getAutoUpdateAnnotations(ctr.Name(), ctr.Labels()) {
|
||||
kubeAnnotations[k] = v
|
||||
}
|
||||
maps.Copy(kubeAnnotations, getAutoUpdateAnnotations(ctr.Name(), ctr.Labels()))
|
||||
|
||||
isInit := ctr.IsInitCtr()
|
||||
// Since hostname is only set at pod level, set the hostname to the hostname of the first container we encounter
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ func NewInMemoryManager(numLocks uint32) (Manager, error) {
|
|||
manager.locks = make([]*Mutex, numLocks)
|
||||
|
||||
var i uint32
|
||||
for i = 0; i < numLocks; i++ {
|
||||
for i = range numLocks {
|
||||
lock := new(Mutex)
|
||||
lock.id = i
|
||||
manager.locks[i] = lock
|
||||
|
|
|
|||
|
|
@ -166,8 +166,7 @@ func TestAllocateTwoLocksGetsDifferentLocks(t *testing.T) {
|
|||
func TestAllocateAllLocksSucceeds(t *testing.T) {
|
||||
runLockTest(t, func(t *testing.T, locks *SHMLocks) {
|
||||
sems := make(map[uint32]bool)
|
||||
var i uint32
|
||||
for i = 0; i < numLocks; i++ {
|
||||
for range numLocks {
|
||||
sem, err := locks.AllocateSemaphore()
|
||||
assert.NoError(t, err)
|
||||
|
||||
|
|
@ -184,8 +183,7 @@ func TestAllocateAllLocksSucceeds(t *testing.T) {
|
|||
func TestAllocateTooManyLocksFails(t *testing.T) {
|
||||
runLockTest(t, func(t *testing.T, locks *SHMLocks) {
|
||||
// Allocate all locks
|
||||
var i uint32
|
||||
for i = 0; i < numLocks; i++ {
|
||||
for range numLocks {
|
||||
_, err := locks.AllocateSemaphore()
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
|
@ -200,8 +198,7 @@ func TestAllocateTooManyLocksFails(t *testing.T) {
|
|||
func TestAllocateDeallocateCycle(t *testing.T) {
|
||||
runLockTest(t, func(t *testing.T, locks *SHMLocks) {
|
||||
// Allocate all locks
|
||||
var i uint32
|
||||
for i = 0; i < numLocks; i++ {
|
||||
for range numLocks {
|
||||
_, err := locks.AllocateSemaphore()
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
|
@ -209,8 +206,7 @@ func TestAllocateDeallocateCycle(t *testing.T) {
|
|||
// Now loop through again, deallocating and reallocating.
|
||||
// Each time we free 1 semaphore, allocate again, and make sure
|
||||
// we get the same semaphore back.
|
||||
var j uint32
|
||||
for j = 0; j < numLocks; j++ {
|
||||
for j := range numLocks {
|
||||
err := locks.DeallocateSemaphore(j)
|
||||
assert.NoError(t, err)
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ func TestGetTailLogBigFiles(t *testing.T) {
|
|||
f, err := os.Create(file)
|
||||
assert.NoError(t, err, "create log file")
|
||||
want := make([]*LogLine, 0, 2000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
for range 1000 {
|
||||
_, err = f.WriteString(`2023-08-07T19:56:34.223758260-06:00 stdout P lin
|
||||
2023-08-07T19:56:34.223758260-06:00 stdout F e2
|
||||
`)
|
||||
|
|
|
|||
|
|
@ -33,10 +33,7 @@ func NewReverseReader(reader *os.File) (*ReverseReader, error) {
|
|||
}
|
||||
// set offset (starting position) to the last page boundary or
|
||||
// zero if fits in one page
|
||||
startOffset := end - remainder
|
||||
if startOffset < 0 {
|
||||
startOffset = 0
|
||||
}
|
||||
startOffset := max(end-remainder, 0)
|
||||
rr := ReverseReader{
|
||||
reader: reader,
|
||||
offset: startOffset,
|
||||
|
|
|
|||
|
|
@ -642,7 +642,7 @@ func getFreeInterfaceName(networks map[string]types.PerNetworkOptions) string {
|
|||
for _, opts := range networks {
|
||||
ifNames = append(ifNames, opts.InterfaceName)
|
||||
}
|
||||
for i := 0; i < 100000; i++ {
|
||||
for i := range 100000 {
|
||||
ifName := fmt.Sprintf("eth%d", i)
|
||||
if !slices.Contains(ifNames, ifName) {
|
||||
return ifName
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ func Test_resultToBasicNetworkConfig(t *testing.T) {
|
|||
}
|
||||
|
||||
func benchmarkOCICNIPortsToNetTypesPorts(b *testing.B, ports []types.OCICNIPortMapping) {
|
||||
for n := 0; n < b.N; n++ {
|
||||
for b.Loop() {
|
||||
ocicniPortsToNetTypesPorts(ports)
|
||||
}
|
||||
}
|
||||
|
|
@ -515,7 +515,7 @@ func Benchmark_ocicniPortsToNetTypesPorts10k(b *testing.B) {
|
|||
|
||||
func Benchmark_ocicniPortsToNetTypesPorts1m(b *testing.B) {
|
||||
ports := make([]types.OCICNIPortMapping, 0, 1000000)
|
||||
for j := 0; j < 20; j++ {
|
||||
for j := range 20 {
|
||||
for i := int32(1); i <= 50000; i++ {
|
||||
ports = append(ports, types.OCICNIPortMapping{
|
||||
HostPort: i,
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ func requestMachinePorts(expose bool, ports []types.PortMapping) error {
|
|||
}
|
||||
buf := new(bytes.Buffer)
|
||||
for num, port := range ports {
|
||||
protocols := strings.Split(port.Protocol, ",")
|
||||
for _, protocol := range protocols {
|
||||
protocols := strings.SplitSeq(port.Protocol, ",")
|
||||
for protocol := range protocols {
|
||||
for i := uint16(0); i < port.Range; i++ {
|
||||
machinePort := machineExpose{
|
||||
Local: net.JoinHostPort(port.HostIP, strconv.FormatInt(int64(port.HostPort+i), 10)),
|
||||
|
|
|
|||
|
|
@ -690,7 +690,7 @@ func isRetryable(err error) bool {
|
|||
// openControlFile opens the terminal control file.
|
||||
func openControlFile(ctr *Container, parentDir string) (*os.File, error) {
|
||||
controlPath := filepath.Join(parentDir, "ctl")
|
||||
for i := 0; i < 600; i++ {
|
||||
for range 600 {
|
||||
controlFile, err := os.OpenFile(controlPath, unix.O_WRONLY|unix.O_NONBLOCK, 0)
|
||||
if err == nil {
|
||||
return controlFile, nil
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ func bindPorts(ports []types.PortMapping) ([]*os.File, error) {
|
|||
if port.HostIP == "" {
|
||||
isV6 = false
|
||||
}
|
||||
protocols := strings.Split(port.Protocol, ",")
|
||||
for _, protocol := range protocols {
|
||||
protocols := strings.SplitSeq(port.Protocol, ",")
|
||||
for protocol := range protocols {
|
||||
for i := uint16(0); i < port.Range; i++ {
|
||||
f, err := bindPort(protocol, port.HostIP, port.HostPort+i, isV6, &sctpWarning)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -5,9 +5,11 @@ package libpod
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
|
@ -86,9 +88,7 @@ func WithStorageConfig(config storage.StoreOptions) RuntimeOption {
|
|||
|
||||
if config.PullOptions != nil {
|
||||
rt.storageConfig.PullOptions = make(map[string]string)
|
||||
for k, v := range config.PullOptions {
|
||||
rt.storageConfig.PullOptions[k] = v
|
||||
}
|
||||
maps.Copy(rt.storageConfig.PullOptions, config.PullOptions)
|
||||
}
|
||||
|
||||
// If any one of runroot, graphroot, graphdrivername,
|
||||
|
|
@ -278,10 +278,8 @@ func WithHooksDir(hooksDirs ...string) RuntimeOption {
|
|||
return define.ErrRuntimeFinalized
|
||||
}
|
||||
|
||||
for _, hooksDir := range hooksDirs {
|
||||
if hooksDir == "" {
|
||||
return fmt.Errorf("empty-string hook directories are not supported: %w", define.ErrInvalidArg)
|
||||
}
|
||||
if slices.Contains(hooksDirs, "") {
|
||||
return fmt.Errorf("empty-string hook directories are not supported: %w", define.ErrInvalidArg)
|
||||
}
|
||||
|
||||
rt.config.Engine.HooksDir.Set(hooksDirs)
|
||||
|
|
@ -706,9 +704,7 @@ func WithLabels(labels map[string]string) CtrCreateOption {
|
|||
}
|
||||
|
||||
ctr.config.Labels = make(map[string]string)
|
||||
for key, value := range labels {
|
||||
ctr.config.Labels[key] = value
|
||||
}
|
||||
maps.Copy(ctr.config.Labels, labels)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -1624,9 +1620,7 @@ func WithVolumeLabels(labels map[string]string) VolumeCreateOption {
|
|||
}
|
||||
|
||||
volume.config.Labels = make(map[string]string)
|
||||
for key, value := range labels {
|
||||
volume.config.Labels[key] = value
|
||||
}
|
||||
maps.Copy(volume.config.Labels, labels)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -1652,9 +1646,7 @@ func WithVolumeOptions(options map[string]string) VolumeCreateOption {
|
|||
}
|
||||
|
||||
volume.config.Options = make(map[string]string)
|
||||
for key, value := range options {
|
||||
volume.config.Options[key] = value
|
||||
}
|
||||
maps.Copy(volume.config.Options, options)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -2023,9 +2015,7 @@ func WithPodLabels(labels map[string]string) PodCreateOption {
|
|||
}
|
||||
|
||||
pod.config.Labels = make(map[string]string)
|
||||
for key, value := range labels {
|
||||
pod.config.Labels[key] = value
|
||||
}
|
||||
maps.Copy(pod.config.Labels, labels)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
|
@ -106,13 +107,7 @@ func validatePlugin(newPlugin *VolumePlugin) error {
|
|||
return fmt.Errorf("unmarshalling plugin %s activation response: %w", newPlugin.Name, err)
|
||||
}
|
||||
|
||||
foundVolume := false
|
||||
for _, pluginType := range respStruct.Implements {
|
||||
if pluginType == volumePluginType {
|
||||
foundVolume = true
|
||||
break
|
||||
}
|
||||
}
|
||||
foundVolume := slices.Contains(respStruct.Implements, volumePluginType)
|
||||
|
||||
if !foundVolume {
|
||||
return fmt.Errorf("plugin %s does not implement volume plugin, instead provides %s: %w", newPlugin.Name, strings.Join(respStruct.Implements, ", "), ErrNotVolumePlugin)
|
||||
|
|
@ -204,7 +199,7 @@ func (p *VolumePlugin) verifyReachable() error {
|
|||
|
||||
// Send a request to the volume plugin for handling.
|
||||
// Callers *MUST* close the response when they are done.
|
||||
func (p *VolumePlugin) sendRequest(toJSON interface{}, endpoint string) (*http.Response, error) {
|
||||
func (p *VolumePlugin) sendRequest(toJSON any, endpoint string) (*http.Response, error) {
|
||||
var (
|
||||
reqJSON []byte
|
||||
err error
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ package libpod
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
|
@ -286,9 +287,7 @@ func (p *Pod) VolumesFrom() []string {
|
|||
// Labels returns the pod's labels
|
||||
func (p *Pod) Labels() map[string]string {
|
||||
labels := make(map[string]string)
|
||||
for key, value := range p.config.Labels {
|
||||
labels[key] = value
|
||||
}
|
||||
maps.Copy(labels, p.config.Labels)
|
||||
|
||||
return labels
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ func (p *Pod) GetPodPidInformation(descriptors []string) ([]string, error) {
|
|||
// Also support comma-separated input.
|
||||
psgoDescriptors := []string{}
|
||||
for _, d := range descriptors {
|
||||
for _, s := range strings.Split(d, ",") {
|
||||
for s := range strings.SplitSeq(d, ",") {
|
||||
if s != "" {
|
||||
psgoDescriptors = append(psgoDescriptors, s)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"maps"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
|
@ -824,9 +825,7 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, opts ctrRmO
|
|||
}
|
||||
logrus.Infof("Removing pod %s as container %s is its service container", depPod.ID(), c.ID())
|
||||
podRemovedCtrs, err := r.RemovePod(ctx, depPod, true, opts.Force, opts.Timeout)
|
||||
for ctr, err := range podRemovedCtrs {
|
||||
removedCtrs[ctr] = err
|
||||
}
|
||||
maps.Copy(removedCtrs, podRemovedCtrs)
|
||||
if err != nil && !errors.Is(err, define.ErrNoSuchPod) && !errors.Is(err, define.ErrPodRemoved) {
|
||||
removedPods[depPod.ID()] = err
|
||||
retErr = fmt.Errorf("error removing container %s dependency pods: %w", c.ID(), err)
|
||||
|
|
@ -846,9 +845,7 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, opts ctrRmO
|
|||
|
||||
logrus.Infof("Removing pod %s (dependency of container %s)", pod.ID(), c.ID())
|
||||
podRemovedCtrs, err := r.removePod(ctx, pod, true, opts.Force, opts.Timeout)
|
||||
for ctr, err := range podRemovedCtrs {
|
||||
removedCtrs[ctr] = err
|
||||
}
|
||||
maps.Copy(removedCtrs, podRemovedCtrs)
|
||||
if err != nil && !errors.Is(err, define.ErrNoSuchPod) && !errors.Is(err, define.ErrPodRemoved) {
|
||||
removedPods[pod.ID()] = err
|
||||
retErr = fmt.Errorf("error removing container %s pod: %w", c.ID(), err)
|
||||
|
|
@ -929,9 +926,7 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, opts ctrRmO
|
|||
removedCtrs[rmCtr] = err
|
||||
}
|
||||
}
|
||||
for rmPod, err := range pods {
|
||||
removedPods[rmPod] = err
|
||||
}
|
||||
maps.Copy(removedPods, pods)
|
||||
if err != nil && !errors.Is(err, define.ErrNoSuchCtr) && !errors.Is(err, define.ErrCtrRemoved) {
|
||||
retErr = err
|
||||
return
|
||||
|
|
|
|||
|
|
@ -166,12 +166,7 @@ func (r *Runtime) PrunePods(ctx context.Context) (map[string]error, error) {
|
|||
states := []string{define.PodStateStopped, define.PodStateExited}
|
||||
filterFunc := func(p *Pod) bool {
|
||||
state, _ := p.GetPodStatus()
|
||||
for _, status := range states {
|
||||
if state == status {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains(states, state)
|
||||
}
|
||||
pods, err := r.Pods(filterFunc)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ func sortMounts(m []spec.Mount) []spec.Mount {
|
|||
|
||||
// JSONDeepCopy performs a deep copy by performing a JSON encode/decode of the
|
||||
// given structures. From and To should be identically typed structs.
|
||||
func JSONDeepCopy(from, to interface{}) error {
|
||||
func JSONDeepCopy(from, to any) error {
|
||||
tmp, err := json.Marshal(from)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -128,7 +128,7 @@ func checkDependencyContainer(depCtr, ctr *Container) error {
|
|||
// hijackWriteError writes an error to a hijacked HTTP session.
|
||||
func hijackWriteError(toWrite error, cid string, terminal bool, httpBuf *bufio.ReadWriter) {
|
||||
if toWrite != nil && !errors.Is(toWrite, define.ErrDetach) {
|
||||
errString := []byte(fmt.Sprintf("Error: %v\n", toWrite))
|
||||
errString := fmt.Appendf(nil, "Error: %v\n", toWrite)
|
||||
if !terminal {
|
||||
// We need a header.
|
||||
header := makeHTTPAttachHeader(2, uint32(len(errString)))
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ package libpod
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"maps"
|
||||
"time"
|
||||
|
||||
"github.com/containers/podman/v5/libpod/define"
|
||||
|
|
@ -45,7 +46,7 @@ type VolumeConfig struct {
|
|||
// The location the volume is mounted at.
|
||||
MountPoint string `json:"mountPoint"`
|
||||
// Time the volume was created.
|
||||
CreatedTime time.Time `json:"createdAt,omitempty"`
|
||||
CreatedTime time.Time `json:"createdAt"`
|
||||
// Options to pass to the volume driver. For the local driver, this is
|
||||
// a list of mount options. For other drivers, they are passed to the
|
||||
// volume driver handling the volume.
|
||||
|
|
@ -139,9 +140,7 @@ func (v *Volume) Scope() string {
|
|||
// Labels returns the volume's labels
|
||||
func (v *Volume) Labels() map[string]string {
|
||||
labels := make(map[string]string)
|
||||
for key, value := range v.config.Labels {
|
||||
labels[key] = value
|
||||
}
|
||||
maps.Copy(labels, v.config.Labels)
|
||||
return labels
|
||||
}
|
||||
|
||||
|
|
@ -183,9 +182,7 @@ func (v *Volume) mountPoint() string {
|
|||
// Options return the volume's options
|
||||
func (v *Volume) Options() map[string]string {
|
||||
options := make(map[string]string)
|
||||
for k, v := range v.config.Options {
|
||||
options[k] = v
|
||||
}
|
||||
maps.Copy(options, v.config.Options)
|
||||
return options
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package libpod
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"maps"
|
||||
|
||||
"github.com/containers/podman/v5/libpod/define"
|
||||
pluginapi "github.com/docker/go-plugins-helpers/volume"
|
||||
|
|
@ -52,14 +53,10 @@ func (v *Volume) Inspect() (*define.InspectVolumeData, error) {
|
|||
data.Driver = v.config.Driver
|
||||
data.CreatedAt = v.config.CreatedTime
|
||||
data.Labels = make(map[string]string)
|
||||
for k, v := range v.config.Labels {
|
||||
data.Labels[k] = v
|
||||
}
|
||||
maps.Copy(data.Labels, v.config.Labels)
|
||||
data.Scope = v.Scope()
|
||||
data.Options = make(map[string]string)
|
||||
for k, v := range v.config.Options {
|
||||
data.Options[k] = v
|
||||
}
|
||||
maps.Copy(data.Options, v.config.Options)
|
||||
data.UID = v.uid()
|
||||
data.GID = v.gid()
|
||||
data.Anonymous = v.config.IsAnon
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ streamLabel: // A label to flatten the scope
|
|||
}
|
||||
s.Stats.PreRead = preRead
|
||||
|
||||
var jsonOut interface{}
|
||||
var jsonOut any
|
||||
if utils.IsLibpodRequest(r) {
|
||||
jsonOut = s
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -803,7 +803,7 @@ func executeBuild(runtime *libpod.Runtime, w http.ResponseWriter, r *http.Reques
|
|||
case <-runCtx.Done():
|
||||
if success {
|
||||
if !utils.IsLibpodRequest(r) && !query.Quiet {
|
||||
sender.SendBuildAux([]byte(fmt.Sprintf(`{"ID":"sha256:%s"}`, imageID)))
|
||||
sender.SendBuildAux(fmt.Appendf(nil, `{"ID":"sha256:%s"}`, imageID))
|
||||
sender.SendBuildStream(fmt.Sprintf("Successfully built %12.12s\n", imageID))
|
||||
for _, tag := range query.Tags {
|
||||
sender.SendBuildStream(fmt.Sprintf("Successfully tagged %s\n", tag))
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ type CPUStats struct {
|
|||
CPU float64 `json:"cpu"`
|
||||
|
||||
// Throttling Data. Linux only.
|
||||
ThrottlingData container.ThrottlingData `json:"throttling_data,omitempty"`
|
||||
ThrottlingData container.ThrottlingData `json:"throttling_data"`
|
||||
}
|
||||
|
||||
// Stats is Ultimate struct aggregating all types of stats of one container
|
||||
|
|
@ -33,17 +33,17 @@ type Stats struct {
|
|||
PreRead time.Time `json:"preread"`
|
||||
|
||||
// Linux specific stats, not populated on Windows.
|
||||
PidsStats container.PidsStats `json:"pids_stats,omitempty"`
|
||||
BlkioStats container.BlkioStats `json:"blkio_stats,omitempty"`
|
||||
PidsStats container.PidsStats `json:"pids_stats"`
|
||||
BlkioStats container.BlkioStats `json:"blkio_stats"`
|
||||
|
||||
// Windows specific stats, not populated on Linux.
|
||||
NumProcs uint32 `json:"num_procs"`
|
||||
StorageStats container.StorageStats `json:"storage_stats,omitempty"`
|
||||
StorageStats container.StorageStats `json:"storage_stats"`
|
||||
|
||||
// Shared stats
|
||||
CPUStats CPUStats `json:"cpu_stats,omitempty"`
|
||||
PreCPUStats CPUStats `json:"precpu_stats,omitempty"` // "Pre"="Previous"
|
||||
MemoryStats container.MemoryStats `json:"memory_stats,omitempty"`
|
||||
CPUStats CPUStats `json:"cpu_stats"`
|
||||
PreCPUStats CPUStats `json:"precpu_stats"` // "Pre"="Previous"
|
||||
MemoryStats container.MemoryStats `json:"memory_stats"`
|
||||
}
|
||||
|
||||
type StatsJSON struct {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
|
|
@ -53,12 +54,8 @@ func CreateVolume(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
// Label provided for compatibility.
|
||||
labels := make(map[string]string, len(input.Label)+len(input.Labels))
|
||||
for k, v := range input.Label {
|
||||
labels[k] = v
|
||||
}
|
||||
for k, v := range input.Labels {
|
||||
labels[k] = v
|
||||
}
|
||||
maps.Copy(labels, input.Label)
|
||||
maps.Copy(labels, input.Labels)
|
||||
if len(labels) > 0 {
|
||||
volumeOptions = append(volumeOptions, libpod.WithVolumeLabels(labels))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ func containerExists(ctx context.Context, name string) (bool, error) {
|
|||
func PSTitles(output string) []string {
|
||||
var titles []string
|
||||
|
||||
for _, title := range strings.Fields(output) {
|
||||
for title := range strings.FieldsSeq(output) {
|
||||
switch title {
|
||||
case "AMBIENT", "INHERITED", "PERMITTED", "EFFECTIVE", "BOUNDING":
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ func SupportedVersion(r *http.Request, condition string) (semver.Version, error)
|
|||
}
|
||||
|
||||
// WriteResponse encodes the given value as JSON or string and renders it for http client
|
||||
func WriteResponse(w http.ResponseWriter, code int, value interface{}) {
|
||||
func WriteResponse(w http.ResponseWriter, code int, value any) {
|
||||
// RFC2616 explicitly states that the following status codes "MUST NOT
|
||||
// include a message-body":
|
||||
switch code {
|
||||
|
|
@ -118,7 +118,7 @@ func MarshalErrorSliceJSONIsEmpty(ptr unsafe.Pointer) bool {
|
|||
}
|
||||
|
||||
// WriteJSON writes an interface value encoded as JSON to w
|
||||
func WriteJSON(w http.ResponseWriter, code int, value interface{}) {
|
||||
func WriteJSON(w http.ResponseWriter, code int, value any) {
|
||||
// FIXME: we don't need to write the header in all/some circumstances.
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(code)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ func TestErrorEncoderFuncOmit(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
dataAsMap := make(map[string]interface{})
|
||||
dataAsMap := make(map[string]any)
|
||||
err = json.Unmarshal(data, &dataAsMap)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
@ -38,7 +38,7 @@ func TestErrorEncoderFuncOmit(t *testing.T) {
|
|||
t.Errorf("the `errs` field should have been omitted")
|
||||
}
|
||||
|
||||
dataAsMap = make(map[string]interface{})
|
||||
dataAsMap = make(map[string]any)
|
||||
data, err = json.Marshal(struct {
|
||||
Err error `json:"err"`
|
||||
Errs []error `json:"errs"`
|
||||
|
|
@ -264,7 +264,7 @@ func TestResponseSender_Send(t *testing.T) {
|
|||
w := httptest.NewRecorder()
|
||||
sender := NewBuildResponseSender(w)
|
||||
|
||||
testResponse := map[string]interface{}{
|
||||
testResponse := map[string]any{
|
||||
"stream": "test message",
|
||||
"id": "12345",
|
||||
}
|
||||
|
|
@ -275,7 +275,7 @@ func TestResponseSender_Send(t *testing.T) {
|
|||
assert.NotEmpty(t, w.Body.String())
|
||||
|
||||
// Verify the JSON was properly encoded
|
||||
var decoded map[string]interface{}
|
||||
var decoded map[string]any
|
||||
err := json.Unmarshal(w.Body.Bytes(), &decoded)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "test message", decoded["stream"])
|
||||
|
|
@ -290,7 +290,7 @@ func TestResponseSender_SendBuildStream(t *testing.T) {
|
|||
sender.SendBuildStream(message)
|
||||
|
||||
// Verify the response structure
|
||||
var response map[string]interface{}
|
||||
var response map[string]any
|
||||
err := json.Unmarshal(w.Body.Bytes(), &response)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, message, response["stream"])
|
||||
|
|
@ -304,7 +304,7 @@ func TestResponseSender_SendBuildError(t *testing.T) {
|
|||
sender.SendBuildError(errorMessage)
|
||||
|
||||
// Verify the response structure
|
||||
var response map[string]interface{}
|
||||
var response map[string]any
|
||||
err := json.Unmarshal(w.Body.Bytes(), &response)
|
||||
assert.NoError(t, err)
|
||||
|
||||
|
|
@ -313,7 +313,7 @@ func TestResponseSender_SendBuildError(t *testing.T) {
|
|||
assert.NotNil(t, response["errorDetail"])
|
||||
|
||||
// Check the nested error structure (errorDetail)
|
||||
errorObj := response["errorDetail"].(map[string]interface{})
|
||||
errorObj := response["errorDetail"].(map[string]any)
|
||||
assert.Equal(t, errorMessage, errorObj["message"])
|
||||
}
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ func TestResponseSender_SendBuildAux(t *testing.T) {
|
|||
sender.SendBuildAux(auxData)
|
||||
|
||||
// Verify the response structure
|
||||
var response map[string]interface{}
|
||||
var response map[string]any
|
||||
err := json.Unmarshal(w.Body.Bytes(), &response)
|
||||
assert.NoError(t, err)
|
||||
|
||||
|
|
@ -342,7 +342,7 @@ func TestResponseSender_SendInvalidJSON(t *testing.T) {
|
|||
sender := NewBuildResponseSender(w)
|
||||
|
||||
// Create a value that can't be JSON encoded (contains channels)
|
||||
invalidValue := map[string]interface{}{
|
||||
invalidValue := map[string]any{
|
||||
"channel": make(chan string),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -220,8 +220,8 @@ func TestMakeXRegistryConfigHeader(t *testing.T) {
|
|||
decodedHeader, err := base64.URLEncoding.DecodeString(header[0])
|
||||
require.NoError(t, err, tc.name)
|
||||
// Don't test for a specific JSON representation, just for the expected contents.
|
||||
expected := map[string]interface{}{}
|
||||
actual := map[string]interface{}{}
|
||||
expected := map[string]any{}
|
||||
actual := map[string]any{}
|
||||
err = json.Unmarshal([]byte(tc.expectedContents), &expected)
|
||||
require.NoError(t, err, tc.name)
|
||||
err = json.Unmarshal(decodedHeader, &actual)
|
||||
|
|
@ -282,8 +282,8 @@ func TestMakeXRegistryAuthHeader(t *testing.T) {
|
|||
decodedHeader, err := base64.URLEncoding.DecodeString(header[0])
|
||||
require.NoError(t, err, tc.name)
|
||||
// Don't test for a specific JSON representation, just for the expected contents.
|
||||
expected := map[string]interface{}{}
|
||||
actual := map[string]interface{}{}
|
||||
expected := map[string]any{}
|
||||
actual := map[string]any{}
|
||||
err = json.Unmarshal([]byte(tc.expectedContents), &expected)
|
||||
require.NoError(t, err, tc.name)
|
||||
err = json.Unmarshal(decodedHeader, &actual)
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ func (c *Connection) DoRequest(ctx context.Context, httpBody io.Reader, httpMeth
|
|||
response *http.Response
|
||||
)
|
||||
|
||||
params := make([]interface{}, len(pathValues)+1)
|
||||
params := make([]any, len(pathValues)+1)
|
||||
|
||||
if v := headers.Values("API-Version"); len(v) > 0 {
|
||||
params[0] = v[0]
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ var (
|
|||
ErrNotImplemented = errors.New("function not implemented")
|
||||
)
|
||||
|
||||
func handleError(data []byte, unmarshalErrorInto interface{}) error {
|
||||
func handleError(data []byte, unmarshalErrorInto any) error {
|
||||
if err := json.Unmarshal(data, unmarshalErrorInto); err != nil {
|
||||
return fmt.Errorf("unmarshalling error into %#v, data %q: %w", unmarshalErrorInto, string(data), err)
|
||||
}
|
||||
|
|
@ -23,13 +23,13 @@ func handleError(data []byte, unmarshalErrorInto interface{}) error {
|
|||
|
||||
// Process drains the response body, and processes the HTTP status code
|
||||
// Note: Closing the response.Body is left to the caller
|
||||
func (h *APIResponse) Process(unmarshalInto interface{}) error {
|
||||
func (h *APIResponse) Process(unmarshalInto any) error {
|
||||
return h.ProcessWithError(unmarshalInto, &errorhandling.ErrorModel{})
|
||||
}
|
||||
|
||||
// ProcessWithError drains the response body, and processes the HTTP status code
|
||||
// Note: Closing the response.Body is left to the caller
|
||||
func (h *APIResponse) ProcessWithError(unmarshalInto interface{}, unmarshalErrorInto interface{}) error {
|
||||
func (h *APIResponse) ProcessWithError(unmarshalInto any, unmarshalErrorInto any) error {
|
||||
data, err := io.ReadAll(h.Response.Body)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to process API response: %w", err)
|
||||
|
|
|
|||
|
|
@ -581,8 +581,8 @@ func prepareContainerFiles(containerFiles []string, contextDir string, options *
|
|||
|
||||
// Check if Containerfile is in the context directory, if so truncate the context directory off path
|
||||
// Do NOT add to tarfile
|
||||
if strings.HasPrefix(containerfile, contextDir+string(filepath.Separator)) {
|
||||
containerfile = strings.TrimPrefix(containerfile, contextDir+string(filepath.Separator))
|
||||
if after, ok := strings.CutPrefix(containerfile, contextDir+string(filepath.Separator)); ok {
|
||||
containerfile = after
|
||||
out.dontexcludes = append(out.dontexcludes, "!"+containerfile)
|
||||
out.dontexcludes = append(out.dontexcludes, "!"+containerfile+".dockerignore")
|
||||
out.dontexcludes = append(out.dontexcludes, "!"+containerfile+".containerignore")
|
||||
|
|
|
|||
|
|
@ -45,13 +45,13 @@ func SimpleTypeToParam(f reflect.Value) string {
|
|||
panic("the input parameter is not a simple type")
|
||||
}
|
||||
|
||||
func Changed(o interface{}, fieldName string) bool {
|
||||
func Changed(o any, fieldName string) bool {
|
||||
r := reflect.ValueOf(o)
|
||||
value := reflect.Indirect(r).FieldByName(fieldName)
|
||||
return !value.IsNil()
|
||||
}
|
||||
|
||||
func ToParams(o interface{}) (url.Values, error) {
|
||||
func ToParams(o any) (url.Values, error) {
|
||||
params := url.Values{}
|
||||
if o == nil || reflect.ValueOf(o).IsNil() {
|
||||
return params, nil
|
||||
|
|
@ -92,7 +92,7 @@ func ToParams(o interface{}) (url.Values, error) {
|
|||
}
|
||||
}
|
||||
case f.Kind() == reflect.Map:
|
||||
lowerCaseKeys := make(map[string]interface{})
|
||||
lowerCaseKeys := make(map[string]any)
|
||||
iter := f.MapRange()
|
||||
for iter.Next() {
|
||||
lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface()
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ func (b *bindingTest) startAPIService() *Session {
|
|||
session := b.runPodman(cmd)
|
||||
|
||||
sock := strings.TrimPrefix(b.sock, "unix://")
|
||||
for i := 0; i < 10; i++ {
|
||||
for range 10 {
|
||||
if _, err := os.Stat(sock); err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
break
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ var _ = Describe("Podman networks", func() {
|
|||
It("list networks", func() {
|
||||
// create a bunch of named networks and make verify with list
|
||||
netNames := []string{"homer", "bart", "lisa", "maggie", "marge"}
|
||||
for i := 0; i < 5; i++ {
|
||||
for i := range 5 {
|
||||
net := types.Network{
|
||||
Name: netNames[i],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ var _ = Describe("Podman volumes", func() {
|
|||
|
||||
// create a bunch of named volumes and make verify with list
|
||||
volNames := []string{"homer", "bart", "lisa", "maggie", "marge"}
|
||||
for i := 0; i < 5; i++ {
|
||||
for i := range 5 {
|
||||
_, err = volumes.Create(connText, entities.VolumeCreateOptions{Name: volNames[i]}, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ type NetOptions struct {
|
|||
DNSSearch []string `json:"dns_search,omitempty"`
|
||||
DNSServers []net.IP `json:"dns_server,omitempty"`
|
||||
HostsFile string `json:"hosts_file,omitempty"`
|
||||
Network specgen.Namespace `json:"netns,omitempty"`
|
||||
Network specgen.Namespace `json:"netns"`
|
||||
NoHostname bool `json:"no_manage_hostname,omitempty"`
|
||||
NoHosts bool `json:"no_manage_hosts,omitempty"`
|
||||
PublishPorts []types.PortMapping `json:"portmappings,omitempty"`
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ type ImageRemoveReport struct {
|
|||
|
||||
type ImageHistoryLayer struct {
|
||||
ID string `json:"id"`
|
||||
Created time.Time `json:"created,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
CreatedBy string `json:",omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
Size int64 `json:"size"`
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ type ComponentVersion struct {
|
|||
// Version contains response of Engine API:
|
||||
// GET "/version"
|
||||
type Version struct {
|
||||
Platform struct{ Name string } `json:",omitempty"`
|
||||
Components []ComponentVersion `json:",omitempty"`
|
||||
Platform struct{ Name string }
|
||||
Components []ComponentVersion `json:",omitempty"`
|
||||
|
||||
// The following fields are deprecated, they relate to the Engine component and are kept for backwards compatibility
|
||||
|
||||
|
|
|
|||
|
|
@ -55,10 +55,8 @@ func GenerateContainerFilterFuncs(filter string, filterValues []string, r *libpo
|
|||
return func(c *libpod.Container) bool {
|
||||
ec, exited, err := c.ExitCode()
|
||||
if err == nil && exited {
|
||||
for _, exitCode := range exitCodes {
|
||||
if ec == exitCode {
|
||||
return true
|
||||
}
|
||||
if slices.Contains(exitCodes, ec) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
|
@ -179,12 +177,7 @@ func GenerateContainerFilterFuncs(filter string, filterValues []string, r *libpo
|
|||
if err != nil {
|
||||
return false
|
||||
}
|
||||
for _, filterValue := range filterValues {
|
||||
if hcStatus == filterValue {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains(filterValues, hcStatus)
|
||||
}, nil
|
||||
case "until":
|
||||
return prepareUntilFilterFunc(filterValues)
|
||||
|
|
@ -470,10 +463,8 @@ func GenerateExternalContainerFilterFuncs(filter string, filterValues []string,
|
|||
ec := listContainer.ExitCode
|
||||
exited := listContainer.Exited
|
||||
if exited {
|
||||
for _, exitCode := range exitCodes {
|
||||
if ec == exitCode {
|
||||
return true
|
||||
}
|
||||
if slices.Contains(exitCodes, ec) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -111,12 +111,7 @@ func GeneratePodFilterFunc(filter string, filterValues []string, r *libpod.Runti
|
|||
if err != nil {
|
||||
return false
|
||||
}
|
||||
for _, filterValue := range filterValues {
|
||||
if strings.ToLower(status) == filterValue {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains(filterValues, strings.ToLower(status))
|
||||
}, nil
|
||||
case "label":
|
||||
return func(p *libpod.Pod) bool {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package filters
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -22,21 +23,11 @@ func GenerateVolumeFilters(filter string, filterValues []string, runtime *libpod
|
|||
}, nil
|
||||
case "driver":
|
||||
return func(v *libpod.Volume) bool {
|
||||
for _, val := range filterValues {
|
||||
if v.Driver() == val {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains(filterValues, v.Driver())
|
||||
}, nil
|
||||
case "scope":
|
||||
return func(v *libpod.Volume) bool {
|
||||
for _, val := range filterValues {
|
||||
if v.Scope() == val {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains(filterValues, v.Scope())
|
||||
}, nil
|
||||
case "label":
|
||||
return func(v *libpod.Volume) bool {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"os"
|
||||
"reflect"
|
||||
"strconv"
|
||||
|
|
@ -522,9 +523,7 @@ func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string,
|
|||
|
||||
mapMutex.Lock()
|
||||
defer mapMutex.Unlock()
|
||||
for ctr, err := range ctrs {
|
||||
ctrsMap[ctr] = err
|
||||
}
|
||||
maps.Copy(ctrsMap, ctrs)
|
||||
|
||||
return err
|
||||
})
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ func getKubePVCs(volumes []*libpod.Volume) ([][]byte, error) {
|
|||
}
|
||||
|
||||
// generateKubeYAML marshalls a kube kind into a YAML file.
|
||||
func generateKubeYAML(kubeKind interface{}) ([]byte, error) {
|
||||
func generateKubeYAML(kubeKind any) ([]byte, error) {
|
||||
b, err := yaml.Marshal(kubeKind)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -402,7 +402,7 @@ func generateKubeOutput(content [][]byte) ([]byte, error) {
|
|||
}
|
||||
|
||||
// Add header to kube YAML file.
|
||||
output = append(output, []byte(fmt.Sprintf(header, podmanVersion.Version))...)
|
||||
output = append(output, fmt.Appendf(nil, header, podmanVersion.Version)...)
|
||||
|
||||
// kube generate order is based on helm install order (secret, persistentVolume, service, pod...).
|
||||
// Add kube kinds.
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"maps"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
|
@ -956,9 +957,8 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
for k, v := range podSpec.PodSpecGen.Labels { // add podYAML labels
|
||||
labels[k] = v
|
||||
}
|
||||
// add podYAML labels
|
||||
maps.Copy(labels, podSpec.PodSpecGen.Labels)
|
||||
initCtrType := annotations[define.InitContainerType]
|
||||
if initCtrType == "" {
|
||||
initCtrType = define.OneShotInitContainer
|
||||
|
|
@ -1050,9 +1050,8 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
for k, v := range podSpec.PodSpecGen.Labels { // add podYAML labels
|
||||
labels[k] = v
|
||||
}
|
||||
// add podYAML labels
|
||||
maps.Copy(labels, podSpec.PodSpecGen.Labels)
|
||||
|
||||
automountImages, err := ic.prepareAutomountImages(ctx, container.Name, annotations)
|
||||
if err != nil {
|
||||
|
|
@ -1548,7 +1547,7 @@ func splitMultiDocYAML(yamlContent []byte) ([][]byte, error) {
|
|||
|
||||
d := yamlv3.NewDecoder(bytes.NewReader(yamlContent))
|
||||
for {
|
||||
var o interface{}
|
||||
var o any
|
||||
// read individual document
|
||||
err := d.Decode(&o)
|
||||
if err == io.EOF {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
|||
|
||||
// DeepCopy does a deep copy of a structure
|
||||
// Error checking of parameters delegated to json engine
|
||||
var DeepCopy = func(dst interface{}, src interface{}) error {
|
||||
var DeepCopy = func(dst any, src any) error {
|
||||
payload, err := json.Marshal(src)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
4
pkg/env/env.go
vendored
4
pkg/env/env.go
vendored
|
|
@ -54,9 +54,7 @@ func Join(base map[string]string, override map[string]string) map[string]string
|
|||
return maps.Clone(override)
|
||||
}
|
||||
base = maps.Clone(base)
|
||||
for k, v := range override {
|
||||
base[k] = v
|
||||
}
|
||||
maps.Copy(base, override)
|
||||
return base
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,16 +48,16 @@ type StatefulSet struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Spec defines the desired identities of pods in this set.
|
||||
// +optional
|
||||
Spec StatefulSetSpec `json:"spec,omitempty"`
|
||||
Spec StatefulSetSpec `json:"spec"`
|
||||
|
||||
// Status is the current status of Pods in this StatefulSet. This data
|
||||
// may be out of date by some window of time.
|
||||
// +optional
|
||||
Status StatefulSetStatus `json:"status,omitempty"`
|
||||
Status StatefulSetStatus `json:"status"`
|
||||
}
|
||||
|
||||
// PodManagementPolicyType defines the policy for creating pods under a stateful set.
|
||||
|
|
@ -168,7 +168,7 @@ type StatefulSetSpec struct {
|
|||
// updateStrategy indicates the StatefulSetUpdateStrategy that will be
|
||||
// employed to update Pods in the StatefulSet when a revision is made to
|
||||
// Template.
|
||||
UpdateStrategy StatefulSetUpdateStrategy `json:"updateStrategy,omitempty"`
|
||||
UpdateStrategy StatefulSetUpdateStrategy `json:"updateStrategy"`
|
||||
|
||||
// revisionHistoryLimit is the maximum number of revisions that will
|
||||
// be maintained in the StatefulSet's revision history. The revision history
|
||||
|
|
@ -242,7 +242,7 @@ type StatefulSetCondition struct {
|
|||
Status v1.ConditionStatus `json:"status"`
|
||||
// Last time the condition transitioned from one status to another.
|
||||
// +optional
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime"`
|
||||
// The reason for the condition's last transition.
|
||||
// +optional
|
||||
Reason string `json:"reason,omitempty"`
|
||||
|
|
@ -259,7 +259,7 @@ type StatefulSetList struct {
|
|||
// Standard list's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// Items is the list of stateful sets.
|
||||
Items []StatefulSet `json:"items"`
|
||||
|
|
@ -277,15 +277,15 @@ type Deployment struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Specification of the desired behavior of the Deployment.
|
||||
// +optional
|
||||
Spec DeploymentSpec `json:"spec,omitempty"`
|
||||
Spec DeploymentSpec `json:"spec"`
|
||||
|
||||
// Most recently observed status of the Deployment.
|
||||
// +optional
|
||||
Status DeploymentStatus `json:"status,omitempty"`
|
||||
Status DeploymentStatus `json:"status"`
|
||||
}
|
||||
|
||||
// DeploymentSpec is the specification of the desired behavior of the Deployment.
|
||||
|
|
@ -306,7 +306,7 @@ type DeploymentSpec struct {
|
|||
// The deployment strategy to use to replace existing pods with new ones.
|
||||
// +optional
|
||||
// +patchStrategy=retainKeys
|
||||
Strategy DeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys"`
|
||||
Strategy DeploymentStrategy `json:"strategy" patchStrategy:"retainKeys"`
|
||||
|
||||
// Minimum number of seconds for which a newly created pod should be ready
|
||||
// without any of its container crashing, for it to be considered available.
|
||||
|
|
@ -458,9 +458,9 @@ type DeploymentCondition struct {
|
|||
// Status of the condition, one of True, False, Unknown.
|
||||
Status v1.ConditionStatus `json:"status"`
|
||||
// The last time this condition was updated.
|
||||
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
|
||||
LastUpdateTime metav1.Time `json:"lastUpdateTime"`
|
||||
// Last time the condition transitioned from one status to another.
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime"`
|
||||
// The reason for the condition's last transition.
|
||||
Reason string `json:"reason,omitempty"`
|
||||
// A human readable message indicating details about the transition.
|
||||
|
|
@ -474,7 +474,7 @@ type DeploymentList struct {
|
|||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// Items is the list of Deployments.
|
||||
Items []Deployment `json:"items"`
|
||||
|
|
@ -564,7 +564,7 @@ type DaemonSetSpec struct {
|
|||
|
||||
// An update strategy to replace existing DaemonSet pods with new pods.
|
||||
// +optional
|
||||
UpdateStrategy DaemonSetUpdateStrategy `json:"updateStrategy,omitempty"`
|
||||
UpdateStrategy DaemonSetUpdateStrategy `json:"updateStrategy"`
|
||||
|
||||
// The minimum number of seconds for which a newly created DaemonSet pod should
|
||||
// be ready without any of its container crashing, for it to be considered
|
||||
|
|
@ -646,7 +646,7 @@ type DaemonSetCondition struct {
|
|||
Status v1.ConditionStatus `json:"status"`
|
||||
// Last time the condition transitioned from one status to another.
|
||||
// +optional
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime"`
|
||||
// The reason for the condition's last transition.
|
||||
// +optional
|
||||
Reason string `json:"reason,omitempty"`
|
||||
|
|
@ -664,12 +664,12 @@ type DaemonSet struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// The desired behavior of this daemon set.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec DaemonSetSpec `json:"spec,omitempty"`
|
||||
Spec DaemonSetSpec `json:"spec"`
|
||||
|
||||
// The current status of this daemon set. This data may be
|
||||
// out of date by some window of time.
|
||||
|
|
@ -677,7 +677,7 @@ type DaemonSet struct {
|
|||
// Read-only.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Status DaemonSetStatus `json:"status,omitempty"`
|
||||
Status DaemonSetStatus `json:"status"`
|
||||
}
|
||||
|
||||
const (
|
||||
|
|
@ -695,7 +695,7 @@ type DaemonSetList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// A list of daemon sets.
|
||||
Items []DaemonSet `json:"items"`
|
||||
|
|
@ -716,12 +716,12 @@ type ReplicaSet struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Spec defines the specification of the desired behavior of the ReplicaSet.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec ReplicaSetSpec `json:"spec,omitempty"`
|
||||
Spec ReplicaSetSpec `json:"spec"`
|
||||
|
||||
// Status is the most recently observed status of the ReplicaSet.
|
||||
// This data may be out of date by some window of time.
|
||||
|
|
@ -729,7 +729,7 @@ type ReplicaSet struct {
|
|||
// Read-only.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Status ReplicaSetStatus `json:"status,omitempty"`
|
||||
Status ReplicaSetStatus `json:"status"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
|
@ -740,7 +740,7 @@ type ReplicaSetList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// List of ReplicaSets.
|
||||
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller
|
||||
|
|
@ -772,7 +772,7 @@ type ReplicaSetSpec struct {
|
|||
// insufficient replicas are detected.
|
||||
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template
|
||||
// +optional
|
||||
Template v1.PodTemplateSpec `json:"template,omitempty"`
|
||||
Template v1.PodTemplateSpec `json:"template"`
|
||||
}
|
||||
|
||||
// ReplicaSetStatus represents the current status of a ReplicaSet.
|
||||
|
|
@ -822,7 +822,7 @@ type ReplicaSetCondition struct {
|
|||
Status v1.ConditionStatus `json:"status"`
|
||||
// The last time the condition transitioned from one status to another.
|
||||
// +optional
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime"`
|
||||
// The reason for the condition's last transition.
|
||||
// +optional
|
||||
Reason string `json:"reason,omitempty"`
|
||||
|
|
|
|||
|
|
@ -117,20 +117,20 @@ type PersistentVolume struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Spec defines a specification of a persistent volume owned by the cluster.
|
||||
// Provisioned by an administrator.
|
||||
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes
|
||||
// +optional
|
||||
Spec PersistentVolumeSpec `json:"spec,omitempty"`
|
||||
Spec PersistentVolumeSpec `json:"spec"`
|
||||
|
||||
// Status represents the current information/status for the persistent volume.
|
||||
// Populated by the system.
|
||||
// Read-only.
|
||||
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes
|
||||
// +optional
|
||||
Status PersistentVolumeStatus `json:"status,omitempty"`
|
||||
Status PersistentVolumeStatus `json:"status"`
|
||||
}
|
||||
|
||||
// PersistentVolumeSpec is the specification of a persistent volume.
|
||||
|
|
@ -231,7 +231,7 @@ type PersistentVolumeList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
// List of persistent volumes.
|
||||
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes
|
||||
Items []PersistentVolume `json:"items"`
|
||||
|
|
@ -246,18 +246,18 @@ type PersistentVolumeClaim struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Spec defines the desired characteristics of a volume requested by a pod author.
|
||||
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims
|
||||
// +optional
|
||||
Spec PersistentVolumeClaimSpec `json:"spec,omitempty"`
|
||||
Spec PersistentVolumeClaimSpec `json:"spec"`
|
||||
|
||||
// Status represents the current information/status of a persistent volume claim.
|
||||
// Read-only.
|
||||
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims
|
||||
// +optional
|
||||
Status PersistentVolumeClaimStatus `json:"status,omitempty"`
|
||||
Status PersistentVolumeClaimStatus `json:"status"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
|
@ -268,7 +268,7 @@ type PersistentVolumeClaimList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
// A list of persistent volume claims.
|
||||
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims
|
||||
Items []PersistentVolumeClaim `json:"items"`
|
||||
|
|
@ -287,7 +287,7 @@ type PersistentVolumeClaimSpec struct {
|
|||
// Resources represents the minimum resources the volume should have.
|
||||
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
|
||||
// +optional
|
||||
Resources ResourceRequirements `json:"resources,omitempty"`
|
||||
Resources ResourceRequirements `json:"resources"`
|
||||
// VolumeName is the binding reference to the PersistentVolume backing this claim.
|
||||
// +optional
|
||||
VolumeName string `json:"volumeName,omitempty"`
|
||||
|
|
@ -345,10 +345,10 @@ type PersistentVolumeClaimCondition struct {
|
|||
Status ConditionStatus `json:"status"`
|
||||
// Last time we probed the condition.
|
||||
// +optional
|
||||
LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"`
|
||||
LastProbeTime metav1.Time `json:"lastProbeTime"`
|
||||
// Last time the condition transitioned from one status to another.
|
||||
// +optional
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime"`
|
||||
// Unique, this should be a short, machine understandable string that gives the reason
|
||||
// for condition's last transition. If it reports "ResizeStarted" that means the underlying
|
||||
// persistent volume is being resized.
|
||||
|
|
@ -738,7 +738,7 @@ type PersistentVolumeClaimTemplate struct {
|
|||
// validation.
|
||||
//
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// The specification for the PersistentVolumeClaim. The entire content is
|
||||
// copied unchanged into the PVC that gets created from this
|
||||
|
|
@ -896,7 +896,7 @@ type ResourceFieldSelector struct {
|
|||
Resource string `json:"resource"`
|
||||
// Specifies the output format of the exposed resources, defaults to "1"
|
||||
// +optional
|
||||
Divisor resource.Quantity `json:"divisor,omitempty"`
|
||||
Divisor resource.Quantity `json:"divisor"`
|
||||
}
|
||||
|
||||
// Selects a key from a ConfigMap.
|
||||
|
|
@ -1201,7 +1201,7 @@ type Container struct {
|
|||
// Cannot be updated.
|
||||
// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
|
||||
// +optional
|
||||
Resources ResourceRequirements `json:"resources,omitempty"`
|
||||
Resources ResourceRequirements `json:"resources"`
|
||||
// Pod volumes to mount into the container's filesystem.
|
||||
// Cannot be updated.
|
||||
// +optional
|
||||
|
|
@ -1366,7 +1366,7 @@ type ContainerStateWaiting struct {
|
|||
type ContainerStateRunning struct {
|
||||
// Time at which the container was last (re-)started
|
||||
// +optional
|
||||
StartedAt metav1.Time `json:"startedAt,omitempty"`
|
||||
StartedAt metav1.Time `json:"startedAt"`
|
||||
}
|
||||
|
||||
// ContainerStateTerminated is a terminated state of a container.
|
||||
|
|
@ -1384,10 +1384,10 @@ type ContainerStateTerminated struct {
|
|||
Message string `json:"message,omitempty"`
|
||||
// Time at which previous execution of the container started
|
||||
// +optional
|
||||
StartedAt metav1.Time `json:"startedAt,omitempty"`
|
||||
StartedAt metav1.Time `json:"startedAt"`
|
||||
// Time at which the container last terminated
|
||||
// +optional
|
||||
FinishedAt metav1.Time `json:"finishedAt,omitempty"`
|
||||
FinishedAt metav1.Time `json:"finishedAt"`
|
||||
// Container's ID in the format 'docker://<container_id>'
|
||||
// +optional
|
||||
ContainerID string `json:"containerID,omitempty"`
|
||||
|
|
@ -1415,10 +1415,10 @@ type ContainerStatus struct {
|
|||
Name string `json:"name"`
|
||||
// Details about the container's current condition.
|
||||
// +optional
|
||||
State ContainerState `json:"state,omitempty"`
|
||||
State ContainerState `json:"state"`
|
||||
// Details about the container's last termination condition.
|
||||
// +optional
|
||||
LastTerminationState ContainerState `json:"lastState,omitempty"`
|
||||
LastTerminationState ContainerState `json:"lastState"`
|
||||
// Specifies whether the container has passed its readiness probe.
|
||||
Ready bool `json:"ready"`
|
||||
// The number of times the container has been restarted, currently based on
|
||||
|
|
@ -1501,10 +1501,10 @@ type PodCondition struct {
|
|||
Status ConditionStatus `json:"status"`
|
||||
// Last time we probed the condition.
|
||||
// +optional
|
||||
LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"`
|
||||
LastProbeTime metav1.Time `json:"lastProbeTime"`
|
||||
// Last time the condition transitioned from one status to another.
|
||||
// +optional
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime"`
|
||||
// Unique, one-word, CamelCase reason for the condition's last transition.
|
||||
// +optional
|
||||
Reason string `json:"reason,omitempty"`
|
||||
|
|
@ -2340,7 +2340,7 @@ type EphemeralContainerCommon struct {
|
|||
// Resources are not allowed for ephemeral containers. Ephemeral containers use spare resources
|
||||
// already allocated to the pod.
|
||||
// +optional
|
||||
Resources ResourceRequirements `json:"resources,omitempty"`
|
||||
Resources ResourceRequirements `json:"resources"`
|
||||
// Pod volumes to mount into the container's filesystem.
|
||||
// Cannot be updated.
|
||||
// +optional
|
||||
|
|
@ -2543,14 +2543,14 @@ type PodStatusResult struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
// Most recently observed status of the pod.
|
||||
// This data may not be up to date.
|
||||
// Populated by the system.
|
||||
// Read-only.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Status PodStatus `json:"status,omitempty"`
|
||||
Status PodStatus `json:"status"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
|
|
@ -2564,12 +2564,12 @@ type Pod struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Specification of the desired behavior of the pod.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec PodSpec `json:"spec,omitempty"`
|
||||
Spec PodSpec `json:"spec"`
|
||||
|
||||
// Most recently observed status of the pod.
|
||||
// This data may not be up to date.
|
||||
|
|
@ -2577,7 +2577,7 @@ type Pod struct {
|
|||
// Read-only.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Status PodStatus `json:"status,omitempty"`
|
||||
Status PodStatus `json:"status"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
|
@ -2588,7 +2588,7 @@ type PodList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// List of pods.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md
|
||||
|
|
@ -2600,12 +2600,12 @@ type PodTemplateSpec struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Specification of the desired behavior of the pod.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec PodSpec `json:"spec,omitempty"`
|
||||
Spec PodSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
|
|
@ -2617,12 +2617,12 @@ type PodTemplate struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Template defines the pods that will be created from this pod template.
|
||||
// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Template PodTemplateSpec `json:"template,omitempty"`
|
||||
Template PodTemplateSpec `json:"template"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
|
@ -2633,7 +2633,7 @@ type PodTemplateList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// List of pod templates
|
||||
Items []PodTemplate `json:"items"`
|
||||
|
|
@ -2724,7 +2724,7 @@ type ReplicationControllerCondition struct {
|
|||
Status ConditionStatus `json:"status"`
|
||||
// The last time the condition transitioned from one status to another.
|
||||
// +optional
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime"`
|
||||
// The reason for the condition's last transition.
|
||||
// +optional
|
||||
Reason string `json:"reason,omitempty"`
|
||||
|
|
@ -2746,12 +2746,12 @@ type ReplicationController struct {
|
|||
// be the same as the Pod(s) that the replication controller manages.
|
||||
// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Spec defines the specification of the desired behavior of the replication controller.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec ReplicationControllerSpec `json:"spec,omitempty"`
|
||||
Spec ReplicationControllerSpec `json:"spec"`
|
||||
|
||||
// Status is the most recently observed status of the replication controller.
|
||||
// This data may be out of date by some window of time.
|
||||
|
|
@ -2759,7 +2759,7 @@ type ReplicationController struct {
|
|||
// Read-only.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Status ReplicationControllerStatus `json:"status,omitempty"`
|
||||
Status ReplicationControllerStatus `json:"status"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
|
@ -2770,7 +2770,7 @@ type ReplicationControllerList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// List of replication controllers.
|
||||
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller
|
||||
|
|
@ -2864,7 +2864,7 @@ type ServiceStatus struct {
|
|||
// LoadBalancer contains the current status of the load-balancer,
|
||||
// if one is present.
|
||||
// +optional
|
||||
LoadBalancer LoadBalancerStatus `json:"loadBalancer,omitempty"`
|
||||
LoadBalancer LoadBalancerStatus `json:"loadBalancer"`
|
||||
// Current service state
|
||||
// +optional
|
||||
// +patchMergeKey=type
|
||||
|
|
@ -3211,7 +3211,7 @@ type ServicePort struct {
|
|||
// omitted or set equal to the 'port' field.
|
||||
// More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service
|
||||
// +optional
|
||||
TargetPort intstr.IntOrString `json:"targetPort,omitempty"`
|
||||
TargetPort intstr.IntOrString `json:"targetPort"`
|
||||
|
||||
// The port on each node on which this service is exposed when type is
|
||||
// NodePort or LoadBalancer. Usually assigned by the system. If a value is
|
||||
|
|
@ -3238,19 +3238,19 @@ type Service struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Spec defines the behavior of a service.
|
||||
// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec ServiceSpec `json:"spec,omitempty"`
|
||||
Spec ServiceSpec `json:"spec"`
|
||||
|
||||
// Most recently observed status of the service.
|
||||
// Populated by the system.
|
||||
// Read-only.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Status ServiceStatus `json:"status,omitempty"`
|
||||
Status ServiceStatus `json:"status"`
|
||||
}
|
||||
|
||||
const (
|
||||
|
|
@ -3267,7 +3267,7 @@ type ServiceList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// List of services
|
||||
Items []Service `json:"items"`
|
||||
|
|
@ -3286,7 +3286,7 @@ type ServiceAccount struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount.
|
||||
// More info: https://kubernetes.io/docs/concepts/configuration/secret
|
||||
|
|
@ -3316,7 +3316,7 @@ type ServiceAccountList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// List of ServiceAccounts.
|
||||
// More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
|
||||
|
|
@ -3344,7 +3344,7 @@ type Endpoints struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// The set of all endpoints is the union of all subsets. Addresses are placed into
|
||||
// subsets according to the IPs they share. A single address with multiple ports,
|
||||
|
|
@ -3776,7 +3776,7 @@ type SerializedReference struct {
|
|||
metav1.TypeMeta `json:",inline"`
|
||||
// The reference to an object in the system.
|
||||
// +optional
|
||||
Reference ObjectReference `json:"reference,omitempty"`
|
||||
Reference ObjectReference `json:"reference"`
|
||||
}
|
||||
|
||||
// EventSource contains information for an event.
|
||||
|
|
@ -3828,15 +3828,15 @@ type Event struct {
|
|||
|
||||
// The component reporting this event. Should be a short machine understandable string.
|
||||
// +optional
|
||||
Source EventSource `json:"source,omitempty"`
|
||||
Source EventSource `json:"source"`
|
||||
|
||||
// The time at which the event was first recorded. (Time of server receipt is in TypeMeta.)
|
||||
// +optional
|
||||
FirstTimestamp metav1.Time `json:"firstTimestamp,omitempty"`
|
||||
FirstTimestamp metav1.Time `json:"firstTimestamp"`
|
||||
|
||||
// The time at which the most recent occurrence of this event was recorded.
|
||||
// +optional
|
||||
LastTimestamp metav1.Time `json:"lastTimestamp,omitempty"`
|
||||
LastTimestamp metav1.Time `json:"lastTimestamp"`
|
||||
|
||||
// The number of times this event has occurred.
|
||||
// +optional
|
||||
|
|
@ -3848,7 +3848,7 @@ type Event struct {
|
|||
|
||||
// Time when this Event was first observed.
|
||||
// +optional
|
||||
EventTime metav1.MicroTime `json:"eventTime,omitempty"`
|
||||
EventTime metav1.MicroTime `json:"eventTime"`
|
||||
|
||||
// Data about the Event series this event represents or nil if it's a singleton Event.
|
||||
// +optional
|
||||
|
|
@ -3877,7 +3877,7 @@ type EventSeries struct {
|
|||
// Number of occurrences in this series up to the last heartbeat time
|
||||
Count int32 `json:"count,omitempty"`
|
||||
// Time of the last occurrence observed
|
||||
LastObservedTime metav1.MicroTime `json:"lastObservedTime,omitempty"`
|
||||
LastObservedTime metav1.MicroTime `json:"lastObservedTime"`
|
||||
|
||||
// +k8s:deprecated=state,protobuf=3
|
||||
}
|
||||
|
|
@ -3890,7 +3890,7 @@ type EventList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// List of events
|
||||
Items []Event `json:"items"`
|
||||
|
|
@ -3946,12 +3946,12 @@ type LimitRange struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Spec defines the limits enforced.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec LimitRangeSpec `json:"spec,omitempty"`
|
||||
Spec LimitRangeSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
|
@ -3962,7 +3962,7 @@ type LimitRangeList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// Items is a list of LimitRange objects.
|
||||
// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
|
||||
|
|
@ -4106,17 +4106,17 @@ type ResourceQuota struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Spec defines the desired quota.
|
||||
// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec ResourceQuotaSpec `json:"spec,omitempty"`
|
||||
Spec ResourceQuotaSpec `json:"spec"`
|
||||
|
||||
// Status defines the actual enforced quota and its current usage.
|
||||
// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Status ResourceQuotaStatus `json:"status,omitempty"`
|
||||
Status ResourceQuotaStatus `json:"status"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
|
@ -4127,7 +4127,7 @@ type ResourceQuotaList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// Items is a list of ResourceQuota objects.
|
||||
// More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/
|
||||
|
|
@ -4144,7 +4144,7 @@ type Secret struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Immutable, if set to true, ensures that data stored in the Secret cannot
|
||||
// be updated (only object metadata can be modified).
|
||||
|
|
@ -4183,7 +4183,7 @@ type SecretList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// Items is a list of secret objects.
|
||||
// More info: https://kubernetes.io/docs/concepts/configuration/secret
|
||||
|
|
@ -4199,7 +4199,7 @@ type ConfigMap struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Immutable, if set to true, ensures that data stored in the ConfigMap cannot
|
||||
// be updated (only object metadata can be modified).
|
||||
|
|
@ -4235,7 +4235,7 @@ type ConfigMapList struct {
|
|||
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// Items is the list of ConfigMaps.
|
||||
Items []ConfigMap `json:"items"`
|
||||
|
|
@ -4278,7 +4278,7 @@ type ComponentStatus struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// List of component conditions observed
|
||||
// +optional
|
||||
|
|
@ -4296,7 +4296,7 @@ type ComponentStatusList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
// List of ComponentStatus objects.
|
||||
Items []ComponentStatus `json:"items"`
|
||||
|
|
@ -4697,7 +4697,7 @@ type NamedExtension struct {
|
|||
// Name is the nickname for this Extension
|
||||
Name string `json:"name"`
|
||||
// Extension holds the extension information
|
||||
Extension interface{} `json:"extension"`
|
||||
Extension any `json:"extension"`
|
||||
}
|
||||
|
||||
// AuthProviderConfig holds the configuration for a specified auth provider.
|
||||
|
|
@ -4791,15 +4791,15 @@ type Deployment struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Specification of the desired behavior of the Deployment.
|
||||
// +optional
|
||||
Spec DeploymentSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
|
||||
Spec DeploymentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
||||
|
||||
// Most recently observed status of the Deployment.
|
||||
// +optional
|
||||
Status DeploymentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
||||
Status DeploymentStatus `json:"status" protobuf:"bytes,3,opt,name=status"`
|
||||
}
|
||||
|
||||
// DeploymentSpec is the specification of the desired behavior of the Deployment.
|
||||
|
|
@ -4821,7 +4821,7 @@ type DeploymentSpec struct {
|
|||
// The deployment strategy to use to replace existing pods with new ones.
|
||||
// +optional
|
||||
// +patchStrategy=retainKeys
|
||||
Strategy DeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" protobuf:"bytes,4,opt,name=strategy"`
|
||||
Strategy DeploymentStrategy `json:"strategy" patchStrategy:"retainKeys" protobuf:"bytes,4,opt,name=strategy"`
|
||||
|
||||
// Minimum number of seconds for which a newly created pod should be ready
|
||||
// without any of its container crashing, for it to be considered available.
|
||||
|
|
@ -4974,9 +4974,9 @@ type DeploymentCondition struct {
|
|||
// Status of the condition, one of True, False, Unknown.
|
||||
Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
|
||||
// The last time this condition was updated.
|
||||
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty" protobuf:"bytes,6,opt,name=lastUpdateTime"`
|
||||
LastUpdateTime metav1.Time `json:"lastUpdateTime" protobuf:"bytes,6,opt,name=lastUpdateTime"`
|
||||
// Last time the condition transitioned from one status to another.
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,7,opt,name=lastTransitionTime"`
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime" protobuf:"bytes,7,opt,name=lastTransitionTime"`
|
||||
// The reason for the condition's last transition.
|
||||
Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
|
||||
// A human readable message indicating details about the transition.
|
||||
|
|
@ -4990,7 +4990,7 @@ type DeploymentList struct {
|
|||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
metav1.ListMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Items is the list of Deployments.
|
||||
Items []Deployment `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
|
|
@ -5080,7 +5080,7 @@ type DaemonSetSpec struct {
|
|||
|
||||
// An update strategy to replace existing DaemonSet pods with new pods.
|
||||
// +optional
|
||||
UpdateStrategy DaemonSetUpdateStrategy `json:"updateStrategy,omitempty" protobuf:"bytes,3,opt,name=updateStrategy"`
|
||||
UpdateStrategy DaemonSetUpdateStrategy `json:"updateStrategy" protobuf:"bytes,3,opt,name=updateStrategy"`
|
||||
|
||||
// The minimum number of seconds for which a newly created DaemonSet pod should
|
||||
// be ready without any of its container crashing, for it to be considered
|
||||
|
|
@ -5162,7 +5162,7 @@ type DaemonSetCondition struct {
|
|||
Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
|
||||
// Last time the condition transitioned from one status to another.
|
||||
// +optional
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime" protobuf:"bytes,3,opt,name=lastTransitionTime"`
|
||||
// The reason for the condition's last transition.
|
||||
// +optional
|
||||
Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
|
||||
|
|
@ -5180,12 +5180,12 @@ type DaemonSet struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// The desired behavior of this daemon set.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec DaemonSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
|
||||
Spec DaemonSetSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
||||
|
||||
// The current status of this daemon set. This data may be
|
||||
// out of date by some window of time.
|
||||
|
|
@ -5193,7 +5193,7 @@ type DaemonSet struct {
|
|||
// Read-only.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Status DaemonSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
||||
Status DaemonSetStatus `json:"status" protobuf:"bytes,3,opt,name=status"`
|
||||
}
|
||||
|
||||
const (
|
||||
|
|
@ -5211,7 +5211,7 @@ type DaemonSetList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
metav1.ListMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// A list of daemon sets.
|
||||
Items []DaemonSet `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
|
|
@ -5225,17 +5225,17 @@ type Job struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Specification of the desired behavior of a job.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec JobSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
|
||||
Spec JobSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
||||
|
||||
// Current status of a job.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Status JobStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
||||
Status JobStatus `json:"status" protobuf:"bytes,3,opt,name=status"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
|
@ -5246,7 +5246,7 @@ type JobList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
metav1.ListMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// items is the list of Jobs.
|
||||
Items []Job `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
|
|
@ -5818,10 +5818,10 @@ type JobCondition struct {
|
|||
Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
|
||||
// Last time the condition was checked.
|
||||
// +optional
|
||||
LastProbeTime metav1.Time `json:"lastProbeTime,omitempty" protobuf:"bytes,3,opt,name=lastProbeTime"`
|
||||
LastProbeTime metav1.Time `json:"lastProbeTime" protobuf:"bytes,3,opt,name=lastProbeTime"`
|
||||
// Last time the condition transit from one status to another.
|
||||
// +optional
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"`
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime" protobuf:"bytes,4,opt,name=lastTransitionTime"`
|
||||
// (brief) reason for the condition's last transition.
|
||||
// +optional
|
||||
Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"`
|
||||
|
|
@ -5835,10 +5835,10 @@ type JobTemplateSpec struct {
|
|||
// Standard object's metadata of the jobs created from this template.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Specification of the desired behavior of the job.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec JobSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
|
||||
Spec JobSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ func positiveScaleInt64(base int64, scale Scale) (int64, bool) {
|
|||
default:
|
||||
value := base
|
||||
var ok bool
|
||||
for i := Scale(0); i < scale; i++ {
|
||||
for range scale {
|
||||
if value, ok = int64MultiplyScale(value, 10); !ok {
|
||||
return 0, false
|
||||
}
|
||||
|
|
@ -167,7 +167,7 @@ func negativeScaleInt64(base int64, scale Scale) (result int64, exact bool) {
|
|||
|
||||
value := base
|
||||
var fraction bool
|
||||
for i := Scale(0); i < scale; i++ {
|
||||
for range scale {
|
||||
if !fraction && value%10 != 0 {
|
||||
fraction = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -595,7 +595,7 @@ func (q Quantity) MarshalJSON() ([]byte, error) {
|
|||
}
|
||||
|
||||
// ToUnstructured implements the value.UnstructuredConverter interface.
|
||||
func (q Quantity) ToUnstructured() interface{} {
|
||||
func (q Quantity) ToUnstructured() any {
|
||||
return q.String()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ var (
|
|||
)
|
||||
|
||||
func init() {
|
||||
intPool.New = func() interface{} {
|
||||
intPool.New = func() any {
|
||||
return &big.Int{}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,6 @@ func (d Duration) MarshalJSON() ([]byte, error) {
|
|||
}
|
||||
|
||||
// ToUnstructured implements the value.UnstructuredConverter interface.
|
||||
func (d Duration) ToUnstructured() interface{} {
|
||||
func (d Duration) ToUnstructured() any {
|
||||
return d.Duration.String()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ func (t Time) MarshalJSON() ([]byte, error) {
|
|||
}
|
||||
|
||||
// ToUnstructured implements the value.UnstructuredConverter interface.
|
||||
func (t Time) ToUnstructured() interface{} {
|
||||
func (t Time) ToUnstructured() any {
|
||||
if t.IsZero() {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ type ObjectMeta struct {
|
|||
// Null for lists.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
CreationTimestamp Time `json:"creationTimestamp,omitempty"`
|
||||
CreationTimestamp Time `json:"creationTimestamp"`
|
||||
|
||||
// DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This
|
||||
// field is set by the server when a graceful deletion is requested by the user, and is not
|
||||
|
|
@ -652,7 +652,7 @@ type Status struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
ListMeta `json:"metadata,omitempty"`
|
||||
ListMeta `json:"metadata"`
|
||||
|
||||
// Status of the operation.
|
||||
// One of: "Success" or "Failure".
|
||||
|
|
@ -935,10 +935,10 @@ type List struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
ListMeta `json:"metadata,omitempty"`
|
||||
ListMeta `json:"metadata"`
|
||||
|
||||
// List of objects
|
||||
Items []interface{} `json:"items"`
|
||||
Items []any `json:"items"`
|
||||
}
|
||||
|
||||
// APIVersions lists the versions that are available, to allow clients to
|
||||
|
|
@ -983,7 +983,7 @@ type APIGroup struct {
|
|||
// preferredVersion is the version preferred by the API server, which
|
||||
// probably is the storage version.
|
||||
// +optional
|
||||
PreferredVersion GroupVersionForDiscovery `json:"preferredVersion,omitempty"`
|
||||
PreferredVersion GroupVersionForDiscovery `json:"preferredVersion"`
|
||||
// a map of client CIDR to server address that is serving this group.
|
||||
// This is to help clients reach servers in the most network-efficient way possible.
|
||||
// Clients can use the appropriate server address as per the CIDR that they match.
|
||||
|
|
@ -1266,7 +1266,7 @@ type PartialObjectMetadata struct {
|
|||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
ObjectMeta `json:"metadata"`
|
||||
}
|
||||
|
||||
// PartialObjectMetadataList contains a list of objects containing only their metadata
|
||||
|
|
@ -1276,7 +1276,7 @@ type PartialObjectMetadataList struct {
|
|||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
// +optional
|
||||
ListMeta `json:"metadata,omitempty"`
|
||||
ListMeta `json:"metadata"`
|
||||
|
||||
// items contains each of the included items.
|
||||
Items []PartialObjectMetadata `json:"items"`
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package logiface
|
||||
|
||||
type Logger interface {
|
||||
Errorf(format string, args ...interface{})
|
||||
Debugf(format string, args ...interface{})
|
||||
Errorf(format string, args ...any)
|
||||
Debugf(format string, args ...any)
|
||||
}
|
||||
|
||||
var logger Logger
|
||||
|
|
@ -11,13 +11,13 @@ func SetLogger(l Logger) {
|
|||
logger = l
|
||||
}
|
||||
|
||||
func Errorf(format string, args ...interface{}) {
|
||||
func Errorf(format string, args ...any) {
|
||||
if logger != nil {
|
||||
logger.Errorf(format, args...)
|
||||
}
|
||||
}
|
||||
|
||||
func Debugf(format string, args ...interface{}) {
|
||||
func Debugf(format string, args ...any) {
|
||||
if logger != nil {
|
||||
logger.Debugf(format, args...)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,10 +63,7 @@ func testInputWithWriteLen(t *testing.T, input []byte, minSparse int64, chunkSiz
|
|||
sparseWriter := NewSparseWriter(m)
|
||||
|
||||
for i := 0; i < len(input); i += chunkSize {
|
||||
end := i + chunkSize
|
||||
if end > len(input) {
|
||||
end = len(input)
|
||||
}
|
||||
end := min(i+chunkSize, len(input))
|
||||
_, err := sparseWriter.Write(input[i:end])
|
||||
if err != nil {
|
||||
t.Fatalf("Expected no error, got %v", err)
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ func testHTTPServer(port string, shouldErr bool, expectedResponse string) {
|
|||
interval := 250 * time.Millisecond
|
||||
var err error
|
||||
var resp *http.Response
|
||||
for i := 0; i < 6; i++ {
|
||||
for range 6 {
|
||||
resp, err = http.Get(address.String() + "/testimage-id")
|
||||
if err != nil && shouldErr {
|
||||
Expect(err.Error()).To(ContainSubstring(expectedResponse))
|
||||
|
|
|
|||
|
|
@ -214,24 +214,24 @@ func BeValidJSON() *ValidJSONMatcher {
|
|||
return &ValidJSONMatcher{}
|
||||
}
|
||||
|
||||
func (matcher *ValidJSONMatcher) Match(actual interface{}) (success bool, err error) {
|
||||
func (matcher *ValidJSONMatcher) Match(actual any) (success bool, err error) {
|
||||
s, ok := actual.(string)
|
||||
if !ok {
|
||||
return false, fmt.Errorf("ValidJSONMatcher expects a string, not %q", actual)
|
||||
}
|
||||
|
||||
var i interface{}
|
||||
var i any
|
||||
if err := json.Unmarshal([]byte(s), &i); err != nil {
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (matcher *ValidJSONMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
func (matcher *ValidJSONMatcher) FailureMessage(actual any) (message string) {
|
||||
return format.Message(actual, "to be valid JSON")
|
||||
}
|
||||
|
||||
func (matcher *ValidJSONMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
func (matcher *ValidJSONMatcher) NegatedFailureMessage(actual any) (message string) {
|
||||
return format.Message(actual, "to _not_ be valid JSON")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ var _ = Describe("podman inspect stop", func() {
|
|||
|
||||
It("inspect shows a unique socket name per machine", func() {
|
||||
var socks []string
|
||||
for c := 0; c < 2; c++ {
|
||||
for range 2 {
|
||||
name := randomString()
|
||||
i := new(initMachine)
|
||||
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ var _ = Describe("podman machine list", func() {
|
|||
Expect(err).ToNot(HaveOccurred())
|
||||
wait := 3
|
||||
retries := (int)(mb.timeout/time.Second) / wait
|
||||
for i := 0; i < retries; i++ {
|
||||
for range retries {
|
||||
listSession, err := mb.setCmd(l).run()
|
||||
Expect(listSession).To(Exit(0))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ const (
|
|||
// an error is returned
|
||||
func backoffForProcess(p *psutil.Process) error {
|
||||
sleepInterval := sleepTime
|
||||
for i := 0; i < loops; i++ {
|
||||
for range loops {
|
||||
running, err := p.IsRunning()
|
||||
if err != nil {
|
||||
// It is possible that while in our loop, the PID vaporize triggering
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ type Clevis struct {
|
|||
|
||||
type Config struct {
|
||||
Ignition Ignition `json:"ignition"`
|
||||
Passwd Passwd `json:"passwd,omitempty"`
|
||||
Storage Storage `json:"storage,omitempty"`
|
||||
Systemd Systemd `json:"systemd,omitempty"`
|
||||
Passwd Passwd `json:"passwd"`
|
||||
Storage Storage `json:"storage"`
|
||||
Systemd Systemd `json:"systemd"`
|
||||
}
|
||||
|
||||
type Custom struct {
|
||||
|
|
@ -58,7 +58,7 @@ type File struct {
|
|||
|
||||
type FileEmbedded1 struct {
|
||||
Append []Resource `json:"append,omitempty"`
|
||||
Contents Resource `json:"contents,omitempty"`
|
||||
Contents Resource `json:"contents"`
|
||||
Mode *int `json:"mode,omitempty"`
|
||||
}
|
||||
|
||||
|
|
@ -85,16 +85,16 @@ type HTTPHeader struct {
|
|||
type HTTPHeaders []HTTPHeader
|
||||
|
||||
type Ignition struct {
|
||||
Config IgnitionConfig `json:"config,omitempty"`
|
||||
Proxy Proxy `json:"proxy,omitempty"`
|
||||
Security Security `json:"security,omitempty"`
|
||||
Timeouts Timeouts `json:"timeouts,omitempty"`
|
||||
Config IgnitionConfig `json:"config"`
|
||||
Proxy Proxy `json:"proxy"`
|
||||
Security Security `json:"security"`
|
||||
Timeouts Timeouts `json:"timeouts"`
|
||||
Version string `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
type IgnitionConfig struct {
|
||||
Merge []Resource `json:"merge,omitempty"`
|
||||
Replace Resource `json:"replace,omitempty"`
|
||||
Replace Resource `json:"replace"`
|
||||
}
|
||||
|
||||
type Link struct {
|
||||
|
|
@ -110,7 +110,7 @@ type LinkEmbedded1 struct {
|
|||
type Luks struct {
|
||||
Clevis *Clevis `json:"clevis,omitempty"`
|
||||
Device *string `json:"device,omitempty"`
|
||||
KeyFile Resource `json:"keyFile,omitempty"`
|
||||
KeyFile Resource `json:"keyFile"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Options []LuksOption `json:"options,omitempty"`
|
||||
|
|
@ -125,10 +125,10 @@ type MountOption string
|
|||
type NoProxyItem string
|
||||
|
||||
type Node struct {
|
||||
Group NodeGroup `json:"group,omitempty"`
|
||||
Group NodeGroup `json:"group"`
|
||||
Overwrite *bool `json:"overwrite,omitempty"`
|
||||
Path string `json:"path"`
|
||||
User NodeUser `json:"user,omitempty"`
|
||||
User NodeUser `json:"user"`
|
||||
}
|
||||
|
||||
type NodeGroup struct {
|
||||
|
|
@ -203,13 +203,13 @@ type Resource struct {
|
|||
Compression *string `json:"compression,omitempty"`
|
||||
HTTPHeaders HTTPHeaders `json:"httpHeaders,omitempty"`
|
||||
Source *string `json:"source,omitempty"`
|
||||
Verification Verification `json:"verification,omitempty"`
|
||||
Verification Verification `json:"verification"`
|
||||
}
|
||||
|
||||
type SSHAuthorizedKey string
|
||||
|
||||
type Security struct {
|
||||
TLS TLS `json:"tls,omitempty"`
|
||||
TLS TLS `json:"tls"`
|
||||
}
|
||||
|
||||
type Storage struct {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ func (q *QEMUStubber) checkStatus(monitor *qmp.SocketMonitor) (define.Status, er
|
|||
func (q *QEMUStubber) waitForMachineToStop(mc *vmconfigs.MachineConfig) error {
|
||||
fmt.Println("Waiting for VM to stop running...")
|
||||
waitInternal := 250 * time.Millisecond
|
||||
for i := 0; i < 5; i++ {
|
||||
for range 5 {
|
||||
state, err := q.State(mc, false)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ func startNetworking(mc *vmconfigs.MachineConfig, provider vmconfigs.VMProvider)
|
|||
// conductVMReadinessCheck checks to make sure the machine is in the proper state
|
||||
// and that SSH is up and running
|
||||
func conductVMReadinessCheck(mc *vmconfigs.MachineConfig, maxBackoffs int, backoff time.Duration, stateF func() (define.Status, error)) (connected bool, sshError error, err error) {
|
||||
for i := 0; i < maxBackoffs; i++ {
|
||||
for i := range maxBackoffs {
|
||||
if i > 0 {
|
||||
time.Sleep(backoff)
|
||||
backoff *= 2
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ func ListenAndWaitOnSocket(errChan chan<- error, listener net.Listener) {
|
|||
|
||||
// DialSocketWithBackoffs attempts to connect to the socket in maxBackoffs attempts
|
||||
func DialSocketWithBackoffs(maxBackoffs int, backoff time.Duration, socketPath string) (conn net.Conn, err error) {
|
||||
for i := 0; i < maxBackoffs; i++ {
|
||||
for i := range maxBackoffs {
|
||||
if i > 0 {
|
||||
time.Sleep(backoff)
|
||||
backoff *= 2
|
||||
|
|
@ -62,7 +62,7 @@ func DialSocketWithBackoffsAndProcCheck(
|
|||
procPid int,
|
||||
errBuf *bytes.Buffer,
|
||||
) (conn net.Conn, err error) {
|
||||
for i := 0; i < maxBackoffs; i++ {
|
||||
for i := range maxBackoffs {
|
||||
if i > 0 {
|
||||
time.Sleep(backoff)
|
||||
backoff *= 2
|
||||
|
|
@ -85,7 +85,7 @@ func DialSocketWithBackoffsAndProcCheck(
|
|||
func WaitForSocketWithBackoffs(maxBackoffs int, backoff time.Duration, socketPath string, name string) error {
|
||||
backoffWait := backoff
|
||||
logrus.Debugf("checking that %q socket is ready", name)
|
||||
for i := 0; i < maxBackoffs; i++ {
|
||||
for range maxBackoffs {
|
||||
err := fileutils.Exists(socketPath)
|
||||
if err == nil {
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ func extractMountOptions(paths []string) (bool, string) {
|
|||
securityModel := "none"
|
||||
if len(paths) > 2 {
|
||||
options := paths[2]
|
||||
volopts := strings.Split(options, ",")
|
||||
for _, o := range volopts {
|
||||
volopts := strings.SplitSeq(options, ",")
|
||||
for o := range volopts {
|
||||
switch {
|
||||
case o == "rw":
|
||||
readonly = false
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ func shouldMask(mask string, unmask []string) bool {
|
|||
if strings.ToLower(m) == "all" {
|
||||
return false
|
||||
}
|
||||
for _, m1 := range strings.Split(m, ":") {
|
||||
for m1 := range strings.SplitSeq(m, ":") {
|
||||
match, err := filepath.Match(m1, mask)
|
||||
if err != nil {
|
||||
logrus.Error(err.Error())
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -294,9 +295,7 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat
|
|||
annotations[k] = v
|
||||
}
|
||||
// now pass in the values from client
|
||||
for k, v := range s.Annotations {
|
||||
annotations[k] = v
|
||||
}
|
||||
maps.Copy(annotations, s.Annotations)
|
||||
s.Annotations = annotations
|
||||
|
||||
if len(s.SeccompProfilePath) < 1 {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"math"
|
||||
"net"
|
||||
"os"
|
||||
|
|
@ -328,9 +329,7 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
|
|||
return nil, err
|
||||
}
|
||||
|
||||
for k, v := range s.Expose {
|
||||
exposed[k] = v
|
||||
}
|
||||
maps.Copy(exposed, s.Expose)
|
||||
s.Expose = exposed
|
||||
// Pull entrypoint and cmd from image
|
||||
s.Entrypoint = imageData.Config.Entrypoint
|
||||
|
|
@ -489,9 +488,7 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
|
|||
return nil, err
|
||||
}
|
||||
|
||||
for k, v := range cmEnvs {
|
||||
envs[k] = v
|
||||
}
|
||||
maps.Copy(envs, cmEnvs)
|
||||
}
|
||||
s.Env = envs
|
||||
|
||||
|
|
@ -634,9 +631,7 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
|
|||
} else {
|
||||
// If there are already labels in the map, append the ones
|
||||
// obtained from kube
|
||||
for k, v := range opts.Labels {
|
||||
s.Labels[k] = v
|
||||
}
|
||||
maps.Copy(s.Labels, opts.Labels)
|
||||
}
|
||||
|
||||
if ro := opts.ReadOnly; ro != itypes.OptionalBoolUndefined {
|
||||
|
|
@ -1054,9 +1049,7 @@ func k8sSecretFromSecretManager(name string, secretsManager *secrets.SecretsMana
|
|||
return nil, fmt.Errorf("secret %v is not valid JSON/YAML: %v", name, err)
|
||||
}
|
||||
|
||||
for key, val := range secret.Data {
|
||||
secrets[key] = val
|
||||
}
|
||||
maps.Copy(secrets, secret.Data)
|
||||
|
||||
for key, val := range secret.StringData {
|
||||
secrets[key] = []byte(val)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"maps"
|
||||
"os"
|
||||
|
||||
"github.com/containers/podman/v5/libpod"
|
||||
|
|
@ -182,9 +183,7 @@ func VolumeFromSecret(secretSource *v1.SecretVolumeSource, secretsManager *secre
|
|||
}
|
||||
} else {
|
||||
// add key: value pairs to the items array
|
||||
for key, entry := range secret.Data {
|
||||
kv.Items[key] = entry
|
||||
}
|
||||
maps.Copy(kv.Items, secret.Data)
|
||||
|
||||
for key, entry := range secret.StringData {
|
||||
kv.Items[key] = []byte(entry)
|
||||
|
|
@ -257,9 +256,7 @@ func VolumeFromConfigMap(configMapVolumeSource *v1.ConfigMapVolumeSource, config
|
|||
for k, v := range configMap.Data {
|
||||
kv.Items[k] = []byte(v)
|
||||
}
|
||||
for k, v := range configMap.BinaryData {
|
||||
kv.Items[k] = v
|
||||
}
|
||||
maps.Copy(kv.Items, configMap.BinaryData)
|
||||
}
|
||||
return kv, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ func addPortToUsedPorts(ports *[]types.PortMapping, allHostPorts, allContainerPo
|
|||
// the caller has to supply an array with the already used ports
|
||||
func getRandomHostPort(hostPorts *[65536]bool, port types.PortMapping) (types.PortMapping, error) {
|
||||
outer:
|
||||
for i := 0; i < 15; i++ {
|
||||
for range 15 {
|
||||
ranPort, err := utils.GetRandomPort()
|
||||
if err != nil {
|
||||
return port, err
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
)
|
||||
|
||||
func benchmarkParsePortMapping(b *testing.B, ports []types.PortMapping) {
|
||||
for n := 0; n < b.N; n++ {
|
||||
for b.Loop() {
|
||||
_, _ = ParsePortMapping(ports, nil)
|
||||
}
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ func BenchmarkParsePortMapping10k(b *testing.B) {
|
|||
|
||||
func BenchmarkParsePortMapping1m(b *testing.B) {
|
||||
ports := make([]types.PortMapping, 0, 1000000)
|
||||
for j := 0; j < 20; j++ {
|
||||
for j := range 20 {
|
||||
for i := uint16(1); i <= 50000; i++ {
|
||||
ports = append(ports, types.PortMapping{
|
||||
HostPort: i,
|
||||
|
|
@ -125,7 +125,7 @@ func BenchmarkParsePortMappingReverse10k(b *testing.B) {
|
|||
|
||||
func BenchmarkParsePortMappingReverse1m(b *testing.B) {
|
||||
ports := make([]types.PortMapping, 0, 1000000)
|
||||
for j := 0; j < 20; j++ {
|
||||
for j := range 20 {
|
||||
for i := uint16(50000); i > 0; i-- {
|
||||
ports = append(ports, types.PortMapping{
|
||||
HostPort: i,
|
||||
|
|
@ -185,7 +185,7 @@ func BenchmarkParsePortMappingRange10k(b *testing.B) {
|
|||
|
||||
func BenchmarkParsePortMappingRange1m(b *testing.B) {
|
||||
ports := make([]types.PortMapping, 0, 1000000)
|
||||
for j := 0; j < 20; j++ {
|
||||
for j := range 20 {
|
||||
ports = append(ports, types.PortMapping{
|
||||
HostPort: 1,
|
||||
ContainerPort: 1,
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ func securityConfigureGenerator(s *specgen.SpecGenerator, g *generate.Generator,
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
boundingCaps := make(map[string]interface{})
|
||||
boundingCaps := make(map[string]any)
|
||||
for _, b := range boundingSet {
|
||||
boundingCaps[b] = b
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ func securityConfigureGenerator(s *specgen.SpecGenerator, g *generate.Generator,
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
boundingCaps := make(map[string]interface{})
|
||||
boundingCaps := make(map[string]any)
|
||||
for _, b := range boundingSet {
|
||||
boundingCaps[b] = b
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"maps"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
|
@ -165,12 +166,8 @@ func finalizeMounts(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Ru
|
|||
|
||||
// Supersede volumes-from/image volumes with unified volumes from above.
|
||||
// This is an unconditional replacement.
|
||||
for dest, mount := range unifiedMounts {
|
||||
baseMounts[dest] = mount
|
||||
}
|
||||
for dest, volume := range unifiedVolumes {
|
||||
baseVolumes[dest] = volume
|
||||
}
|
||||
maps.Copy(baseMounts, unifiedMounts)
|
||||
maps.Copy(baseVolumes, unifiedVolumes)
|
||||
|
||||
// TODO: Investigate moving readonlyTmpfs into here. Would be more
|
||||
// correct.
|
||||
|
|
|
|||
|
|
@ -408,8 +408,8 @@ func ParseNetworkFlag(networks []string) (Namespace, map[string]types.PerNetwork
|
|||
podmanNetworks[name] = netOpts
|
||||
} else {
|
||||
// Assume we have been given a comma separated list of networks for backwards compat.
|
||||
networkList := strings.Split(ns, ",")
|
||||
for _, net := range networkList {
|
||||
networkList := strings.SplitSeq(ns, ",")
|
||||
for net := range networkList {
|
||||
podmanNetworks[net] = types.PerNetworkOptions{}
|
||||
}
|
||||
}
|
||||
|
|
@ -452,8 +452,8 @@ func parseBridgeNetworkOptions(opts string) (types.PerNetworkOptions, error) {
|
|||
if len(opts) == 0 {
|
||||
return netOpts, nil
|
||||
}
|
||||
allopts := strings.Split(opts, ",")
|
||||
for _, opt := range allopts {
|
||||
allopts := strings.SplitSeq(opts, ",")
|
||||
for opt := range allopts {
|
||||
name, value, _ := strings.Cut(opt, "=")
|
||||
switch name {
|
||||
case "ip", "ip6":
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue