mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 18:58:18 +00:00
Merge pull request #17278 from ZJU-SEL/fix-nil-tag
Auto commit by PR queue bot
This commit is contained in:
@@ -17,11 +17,10 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
"k8s.io/kubernetes/pkg/util/intstr"
|
||||
"k8s.io/kubernetes/pkg/util/parsers"
|
||||
)
|
||||
|
||||
func addDefaultingFuncs() {
|
||||
@@ -67,10 +66,10 @@ func addDefaultingFuncs() {
|
||||
},
|
||||
func(obj *Container) {
|
||||
if obj.ImagePullPolicy == "" {
|
||||
// TODO(dchen1107): Move ParseImageName code to pkg/util
|
||||
parts := strings.Split(obj.Image, ":")
|
||||
_, tag := parsers.ParseImageName(obj.Image)
|
||||
// Check image tag
|
||||
if parts[len(parts)-1] == "latest" {
|
||||
|
||||
if tag == "latest" {
|
||||
obj.ImagePullPolicy = PullAlways
|
||||
} else {
|
||||
obj.ImagePullPolicy = PullIfNotPresent
|
||||
|
||||
Reference in New Issue
Block a user