mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Revert "try old patch after new patch fails"
This reverts commit f32696e734.
This commit is contained in:
@@ -164,8 +164,8 @@ func (o *ImageOptions) Validate() error {
|
||||
|
||||
func (o *ImageOptions) Run() error {
|
||||
allErrs := []error{}
|
||||
// Defauting to SMPatchVersion_1_5, since the func passed in doesn't update any lists of primitive
|
||||
patches := CalculatePatches(o.f, o.Infos, o.Encoder, strategicpatch.SMPatchVersion_1_5, func(info *resource.Info) (bool, error) {
|
||||
|
||||
patches := CalculatePatches(o.f, o.Infos, o.Encoder, o.Local, func(info *resource.Info) (bool, error) {
|
||||
transformed := false
|
||||
_, err := o.UpdatePodSpecForObject(info.Object, func(spec *api.PodSpec) error {
|
||||
for name, image := range o.ContainerImages {
|
||||
@@ -189,6 +189,14 @@ func (o *ImageOptions) Run() error {
|
||||
return transformed, err
|
||||
})
|
||||
|
||||
smPatchVersion := strategicpatch.SMPatchVersionLatest
|
||||
var err error
|
||||
if !o.Local {
|
||||
smPatchVersion, err = cmdutil.GetServerSupportedSMPatchVersionFromFactory(o.f)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
for _, patch := range patches {
|
||||
info := patch.Info
|
||||
if patch.Err != nil {
|
||||
@@ -215,7 +223,7 @@ func (o *ImageOptions) Run() error {
|
||||
|
||||
// record this change (for rollout history)
|
||||
if o.Record || cmdutil.ContainsChangeCause(info) {
|
||||
if patch, err := cmdutil.ChangeResourcePatch(info, o.ChangeCause); err == nil {
|
||||
if patch, err := cmdutil.ChangeResourcePatch(info, o.ChangeCause, smPatchVersion); err == nil {
|
||||
if obj, err = resource.NewHelper(info.Client, info.Mapping).Patch(info.Namespace, info.Name, api.StrategicMergePatchType, patch); err != nil {
|
||||
fmt.Fprintf(o.Err, "WARNING: changes to %s/%s can't be recorded: %v\n", info.Mapping.Resource, info.Name, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user