Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ BUILDTAGS += ${EXTRA_BUILDTAGS}
# N/B: This value is managed by Renovate, manual changes are
# possible, as long as they don't disturb the formatting
# (i.e. DO NOT ADD A 'v' prefix!)
GOLANGCI_LINT_VERSION := 2.5.0
GOLANGCI_LINT_VERSION := 2.6.0
PYTHON ?= $(shell command -v python3 python|head -n1)
PKG_MANAGER ?= $(shell command -v dnf yum|head -n1)
# ~/.local/bin is not in PATH on all systems
Expand Down
11 changes: 1 addition & 10 deletions libpod/container_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,6 @@ type ContainerNetworkConfig struct {
// network namespace for the container.
// This cannot be set if NetNsCtr is also set.
CreateNetNS bool `json:"createNetNS"`
// StaticIP is a static IP to request for the container.
// This cannot be set unless CreateNetNS is set.
// If not set, the container will be dynamically assigned an IP by CNI.
// Deprecated: Do no use this anymore, this is only for DB backwards compat.
StaticIP net.IP `json:"staticIP,omitempty"`
// StaticMAC is a static MAC to request for the container.
// This cannot be set unless CreateNetNS is set.
// If not set, the container will be dynamically assigned a MAC by CNI.
// Deprecated: Do no use this anymore, this is only for DB backwards compat.
StaticMAC types.HardwareAddr `json:"staticMAC,omitempty"`
// PortMappings are the ports forwarded to the container's network
// namespace
// These are not used unless CreateNetNS is true
Expand Down Expand Up @@ -314,6 +304,7 @@ type ContainerNetworkConfig struct {
// Please note that these can be altered at runtime. The actual list is
// stored in the DB and should be retrieved from there; this is only the
// set of networks the container was *created* with.
//
// Deprecated: Do no use this anymore, this is only for DB backwards compat.
// Also note that we need to keep the old json tag to decode from DB correctly
NetworksDeprecated []string `json:"networks,omitempty"`
Expand Down
5 changes: 3 additions & 2 deletions libpod/container_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import (
cutil "go.podman.io/common/pkg/util"
"go.podman.io/storage"
"go.podman.io/storage/pkg/chrootarchive"
"go.podman.io/storage/pkg/directory"
"go.podman.io/storage/pkg/fileutils"
"go.podman.io/storage/pkg/idmap"
"go.podman.io/storage/pkg/idtools"
Expand Down Expand Up @@ -100,8 +101,8 @@ func (c *Container) rootFsSize() (int64, error) {
// for a given container.
func (c *Container) rwSize() (int64, error) {
if c.config.Rootfs != "" {
size, err := util.SizeOfPath(c.config.Rootfs)
return int64(size), err
size, err := directory.Size(c.config.Rootfs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn’t this the last user? The function can be removed, then.

return size, err
}

layerSize, err := c.runtime.store.ContainerSize(c.ID())
Expand Down
10 changes: 0 additions & 10 deletions libpod/container_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,6 @@ func (c *Container) validate() error {
}
}

// Can only set static IP or MAC is creating a network namespace.
if !c.config.CreateNetNS && (c.config.StaticIP != nil || c.config.StaticMAC != nil) {
return fmt.Errorf("cannot set static IP or MAC address if not creating a network namespace: %w", define.ErrInvalidArg)
}

// Cannot set static IP or MAC if joining >1 network.
if len(c.config.Networks) > 1 && (c.config.StaticIP != nil || c.config.StaticMAC != nil) {
return fmt.Errorf("cannot set static IP or MAC address if joining more than one network: %w", define.ErrInvalidArg)
}

// Using image resolv.conf conflicts with various DNS settings.
if c.config.UseImageResolvConf &&
(len(c.config.DNSSearch) > 0 || len(c.config.DNSServer) > 0 ||
Expand Down
1 change: 0 additions & 1 deletion libpod/pod_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,6 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) {
}
infraConfig = new(define.InspectPodInfraConfig)
infraConfig.HostNetwork = p.NetworkMode() == "host"
infraConfig.StaticIP = infra.config.ContainerNetworkConfig.StaticIP
infraConfig.NoManageResolvConf = infra.config.UseImageResolvConf
infraConfig.NoManageHostname = infra.config.UseImageHostname
infraConfig.NoManageHosts = infra.config.UseImageHosts
Expand Down
5 changes: 0 additions & 5 deletions libpod/runtime_ctr.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,6 @@ func (r *Runtime) initContainerVariables(rSpec *spec.Spec, config *ContainerConf
}
// Reset the log path to point to the default
ctr.config.LogPath = ""
// Later in validate() the check is for nil. JSONDeepCopy sets it to an empty
// object. Resetting it to nil if it was nil before.
if config.StaticMAC == nil {
ctr.config.StaticMAC = nil
}
}

ctr.config.Spec = rSpec
Expand Down
1 change: 1 addition & 0 deletions pkg/bindings/containers/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ type WaitOptions struct {
// Time interval to wait before polling for completion.
Interval *string
// Container status to wait on.
//
// Deprecated: use Conditions instead.
Condition []define.ContainerStatus
}
Expand Down
2 changes: 0 additions & 2 deletions pkg/checkpoint/checkpoint_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ func CRImportCheckpoint(ctx context.Context, runtime *libpod.Runtime, restoreOpt
opts.StaticMAC = nil
ctrConfig.Networks[net] = opts
}
ctrConfig.StaticIP = nil
ctrConfig.StaticMAC = nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are old fields, I don't think they have been in use since sqlite so they also should be removed from the struct

}

if ctrConfig.PIDNsCtr != "" {
Expand Down
4 changes: 4 additions & 0 deletions pkg/k8s.io/api/core/v1/annotation_key_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,18 @@ const (

// SeccompPodAnnotationKey represents the key of a seccomp profile applied
// to all containers of a pod.
//
// Deprecated: set a pod security context `seccompProfile` field.
SeccompPodAnnotationKey string = "seccomp.security.alpha.kubernetes.io/pod"

// SeccompContainerAnnotationKeyPrefix represents the key of a seccomp profile applied
// to one container of a pod.
//
// Deprecated: set a container security context `seccompProfile` field.
SeccompContainerAnnotationKeyPrefix string = "container.seccomp.security.alpha.kubernetes.io/"

// SeccompProfileRuntimeDefault represents the default seccomp profile used by container runtime.
//
// Deprecated: set a pod or container security context `seccompProfile` of type "RuntimeDefault" instead.
SeccompProfileRuntimeDefault string = "runtime/default"

Expand All @@ -71,6 +74,7 @@ const (
AppArmorBetaProfileNameUnconfined = "unconfined"

// DeprecatedSeccompProfileDockerDefault represents the default seccomp profile used by docker.
//
// Deprecated: set a pod or container security context `seccompProfile` of type "RuntimeDefault" instead.
DeprecatedSeccompProfileDockerDefault string = "docker/default"

Expand Down
4 changes: 4 additions & 0 deletions pkg/k8s.io/api/core/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1463,6 +1463,7 @@ const (
PodFailed PodPhase = "Failed"
// PodUnknown means that for some reason the state of the pod could not be obtained, typically due
// to an error in communicating with the host of the pod.
//
// Deprecated: It isn't being set since 2015 (74da3b14b0c0f658b3bb8d2def5094686d0e9095)
PodUnknown PodPhase = "Unknown"
)
Expand Down Expand Up @@ -1882,6 +1883,7 @@ type PodSpec struct {
// +optional
ServiceAccountName string `json:"serviceAccountName,omitempty"`
// DeprecatedServiceAccount is a depreciated alias for ServiceAccountName.
//
// Deprecated: Use serviceAccountName instead.
// +k8s:conversion-gen=false
// +optional
Expand Down Expand Up @@ -4272,6 +4274,7 @@ type ComponentCondition struct {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
//
// Deprecated: This API is deprecated in v1.19+
type ComponentStatus struct {
metav1.TypeMeta `json:",inline"`
Expand All @@ -4290,6 +4293,7 @@ type ComponentStatus struct {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// Status of all the conditions for the component as a list of ComponentStatus objects.
//
// Deprecated: This API is deprecated in v1.19+
type ComponentStatusList struct {
metav1.TypeMeta `json:",inline"`
Expand Down
13 changes: 8 additions & 5 deletions pkg/specgen/generate/kube/seccomp.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ func InitializeSeccompPaths(annotations map[string]string, profileRoot string) (
for annKeyValue, seccomp := range annotations {
// check if it is prefaced with container.seccomp.security.alpha.kubernetes.io/
prefixAndCtr := strings.Split(annKeyValue, "/")
if prefixAndCtr[0]+"/" != v1.SeccompContainerAnnotationKeyPrefix {
// FIXME: Rework for deprecation removal https://github.com/containers/podman/issues/27501
if prefixAndCtr[0]+"/" != v1.SeccompContainerAnnotationKeyPrefix { //nolint:staticcheck
continue
} else if len(prefixAndCtr) != 2 {
// this could be caused by a user inputting either of
Expand All @@ -52,8 +53,8 @@ func InitializeSeccompPaths(annotations map[string]string, profileRoot string) (
}
seccompPaths.containerPaths[prefixAndCtr[1]] = path
}

podSeccomp, ok := annotations[v1.SeccompPodAnnotationKey]
// FIXME: Rework for deprecation removal https://github.com/containers/podman/issues/27501
podSeccomp, ok := annotations[v1.SeccompPodAnnotationKey] //nolint:staticcheck
if ok {
seccompPaths.podPath, err = verifySeccompPath(podSeccomp, profileRoot)
} else {
Expand All @@ -70,9 +71,11 @@ func InitializeSeccompPaths(annotations map[string]string, profileRoot string) (
// the available options are parsed as defined in https://kubernetes.io/docs/concepts/policy/pod-security-policy/#seccomp
func verifySeccompPath(path string, profileRoot string) (string, error) {
switch path {
case v1.DeprecatedSeccompProfileDockerDefault:
// FIXME: Rework for deprecation removal https://github.com/containers/podman/issues/27501
case v1.DeprecatedSeccompProfileDockerDefault: //nolint:staticcheck
fallthrough
case v1.SeccompProfileRuntimeDefault:
// FIXME: Rework for deprecation removal https://github.com/containers/podman/issues/27501
case v1.SeccompProfileRuntimeDefault: //nolint:staticcheck
return libpod.DefaultSeccompPath()
case "unconfined":
return path, nil
Expand Down
16 changes: 3 additions & 13 deletions pkg/specgen/generate/namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,19 +338,9 @@ func namespaceOptions(s *specgen.SpecGenerator, rt *libpod.Runtime, pod *libpod.
}
// if no network was specified use add the default
if len(s.Networks) == 0 {
// backwards config still allow the old cni networks list and convert to new format
if len(s.CNINetworks) > 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic wise it would be nice to do this and the other cni removal in the same commit instead of splitting the commits per file which doesn't seem to gain us anything here.

This seems safe since we drop cni support but if we do this then also directly remove the CNINetworks field from the struct definition. IF we own the code no point in having unused fields.

logrus.Warn(`specgen "cni_networks" option is deprecated use the "networks" map instead`)
networks := make(map[string]types.PerNetworkOptions, len(s.CNINetworks))
for _, net := range s.CNINetworks {
networks[net] = types.PerNetworkOptions{}
}
s.Networks = networks
} else {
// no networks given but bridge is set so use default network
s.Networks = map[string]types.PerNetworkOptions{
rtConfig.Network.DefaultNetwork: {},
}
// no networks given but bridge is set so use default network
s.Networks = map[string]types.PerNetworkOptions{
rtConfig.Network.DefaultNetwork: {},
}
}
// rename the "default" network to the correct default name
Expand Down
4 changes: 0 additions & 4 deletions pkg/specgen/generate/pod_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,6 @@ func MapSpec(p *specgen.PodSpecGenerator) (*specgen.SpecGenerator, error) {
if len(p.Networks) > 0 {
spec.Networks = p.Networks
}
// deprecated cni networks for api users
if len(p.CNINetworks) > 0 {
spec.CNINetworks = p.CNINetworks
}
if p.NoManageHosts {
spec.UseImageHosts = &p.NoManageHosts
}
Expand Down
8 changes: 0 additions & 8 deletions pkg/specgen/podspecgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,6 @@ type PodNetworkConfig struct {
// If the map is empty and the bridge network mode is set the container
// will be joined to the default network.
Networks map[string]types.PerNetworkOptions
// CNINetworks is a list of CNI networks to join the container to.
// If this list is empty, the default CNI network will be joined
// instead. If at least one entry is present, we will not join the
// default network (unless it is part of this list).
// Only available if NetNS is set to bridge.
// Optional.
// Deprecated: as of podman 4.0 use "Networks" instead.
CNINetworks []string `json:"cni_networks,omitempty"`
// NoManageResolvConf indicates that /etc/resolv.conf should not be
// managed by the pod. Instead, each container will create and manage a
// separate resolv.conf as if they had not joined a pod.
Expand Down
8 changes: 0 additions & 8 deletions pkg/specgen/specgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,14 +505,6 @@ type ContainerNetworkConfig struct {
// will be joined to the default network.
// Optional.
Networks map[string]nettypes.PerNetworkOptions
// CNINetworks is a list of CNI networks to join the container to.
// If this list is empty, the default CNI network will be joined
// instead. If at least one entry is present, we will not join the
// default network (unless it is part of this list).
// Only available if NetNS is set to bridge.
// Optional.
// Deprecated: as of podman 4.0 use "Networks" instead.
CNINetworks []string `json:"cni_networks,omitempty"`
// UseImageResolvConf indicates that resolv.conf should not be managed
// by Podman, but instead sourced from the image.
// Conflicts with DNSServer, DNSSearch, DNSOption.
Expand Down
9 changes: 0 additions & 9 deletions pkg/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
"go.podman.io/image/v5/types"
"go.podman.io/storage/pkg/directory"
"go.podman.io/storage/pkg/fileutils"
"go.podman.io/storage/pkg/idtools"
"go.podman.io/storage/pkg/unshare"
Expand Down Expand Up @@ -1198,14 +1197,6 @@ func LookupUser(name string) (*user.User, error) {
return user.Lookup(name)
}

// SizeOfPath determines the file usage of a given path. it was called volumeSize in v1
// and now is made to be generic and take a path instead of a libpod volume
// Deprecated: use github.com/containers/storage/pkg/directory.Size() instead.
func SizeOfPath(path string) (uint64, error) {
size, err := directory.Size(path)
return uint64(size), err
}

// ParseRestartPolicy parses the value given to the --restart flag and returns the policy
// and restart retries value
func ParseRestartPolicy(policy string) (string, uint, error) {
Expand Down