Skip to content

Commit f11392c

Browse files
committed
Remove deprecated fields ctrConfig.[StaticIP,StaticMAC]
Signed-off-by: Lokesh Mandvekar <[email protected]>
1 parent 3842f4d commit f11392c

File tree

5 files changed

+0
-30
lines changed

5 files changed

+0
-30
lines changed

libpod/container_config.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -250,18 +250,6 @@ type ContainerNetworkConfig struct {
250250
// network namespace for the container.
251251
// This cannot be set if NetNsCtr is also set.
252252
CreateNetNS bool `json:"createNetNS"`
253-
// StaticIP is a static IP to request for the container.
254-
// This cannot be set unless CreateNetNS is set.
255-
// If not set, the container will be dynamically assigned an IP by CNI.
256-
//
257-
// Deprecated: Do no use this anymore, this is only for DB backwards compat.
258-
StaticIP net.IP `json:"staticIP,omitempty"`
259-
// StaticMAC is a static MAC to request for the container.
260-
// This cannot be set unless CreateNetNS is set.
261-
// If not set, the container will be dynamically assigned a MAC by CNI.
262-
//
263-
// Deprecated: Do no use this anymore, this is only for DB backwards compat.
264-
StaticMAC types.HardwareAddr `json:"staticMAC,omitempty"`
265253
// PortMappings are the ports forwarded to the container's network
266254
// namespace
267255
// These are not used unless CreateNetNS is true

libpod/container_validate.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,6 @@ func (c *Container) validate() error {
8080
}
8181
}
8282

83-
// Can only set static IP or MAC is creating a network namespace.
84-
if !c.config.CreateNetNS && (c.config.StaticIP != nil || c.config.StaticMAC != nil) {
85-
return fmt.Errorf("cannot set static IP or MAC address if not creating a network namespace: %w", define.ErrInvalidArg)
86-
}
87-
88-
// Cannot set static IP or MAC if joining >1 network.
89-
if len(c.config.Networks) > 1 && (c.config.StaticIP != nil || c.config.StaticMAC != nil) {
90-
return fmt.Errorf("cannot set static IP or MAC address if joining more than one network: %w", define.ErrInvalidArg)
91-
}
92-
9383
// Using image resolv.conf conflicts with various DNS settings.
9484
if c.config.UseImageResolvConf &&
9585
(len(c.config.DNSSearch) > 0 || len(c.config.DNSServer) > 0 ||

libpod/pod_api.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,6 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) {
667667
}
668668
infraConfig = new(define.InspectPodInfraConfig)
669669
infraConfig.HostNetwork = p.NetworkMode() == "host"
670-
infraConfig.StaticIP = infra.config.ContainerNetworkConfig.StaticIP
671670
infraConfig.NoManageResolvConf = infra.config.UseImageResolvConf
672671
infraConfig.NoManageHostname = infra.config.UseImageHostname
673672
infraConfig.NoManageHosts = infra.config.UseImageHosts

libpod/runtime_ctr.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,6 @@ func (r *Runtime) initContainerVariables(rSpec *spec.Spec, config *ContainerConf
205205
}
206206
// Reset the log path to point to the default
207207
ctr.config.LogPath = ""
208-
// Later in validate() the check is for nil. JSONDeepCopy sets it to an empty
209-
// object. Resetting it to nil if it was nil before.
210-
if config.StaticMAC == nil {
211-
ctr.config.StaticMAC = nil
212-
}
213208
}
214209

215210
ctr.config.Spec = rSpec

pkg/checkpoint/checkpoint_restore.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ func CRImportCheckpoint(ctx context.Context, runtime *libpod.Runtime, restoreOpt
139139
opts.StaticMAC = nil
140140
ctrConfig.Networks[net] = opts
141141
}
142-
ctrConfig.StaticIP = nil
143-
ctrConfig.StaticMAC = nil
144142
}
145143

146144
if ctrConfig.PIDNsCtr != "" {

0 commit comments

Comments
 (0)