mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Merge pull request #56984 from dungeonmaster18/kubectl-cleanup
Automatic merge from submit-queue (batch tested with PRs 56997, 57008, 56984, 56975, 56955). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. remove internal version api from apply Signed-off-by: dungeonmaster18 <umesh4257@gmail.com> **What this PR does / why we need it**: Remove internal api version from apply.go. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: it helps fixing [kubernetes/kubectl#83](https://github.com/kubernetes/kubectl/issues/83). **Special notes for your reviewer**: **Release note**: ```release-note None ```
This commit is contained in:
commit
ea8ec206fc
@ -17,9 +17,9 @@ limitations under the License.
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/kubectl/resource"
|
||||
)
|
||||
|
||||
@ -35,7 +35,7 @@ func GetOriginalConfiguration(mapping *meta.RESTMapping, obj runtime.Object) ([]
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
original, ok := annots[api.LastAppliedConfigAnnotation]
|
||||
original, ok := annots[v1.LastAppliedConfigAnnotation]
|
||||
if !ok {
|
||||
return nil, nil
|
||||
}
|
||||
@ -60,7 +60,7 @@ func SetOriginalConfiguration(info *resource.Info, original []byte) error {
|
||||
annots = map[string]string{}
|
||||
}
|
||||
|
||||
annots[api.LastAppliedConfigAnnotation] = string(original)
|
||||
annots[v1.LastAppliedConfigAnnotation] = string(original)
|
||||
return info.Mapping.MetadataAccessor.SetAnnotations(info.Object, annots)
|
||||
}
|
||||
|
||||
@ -85,8 +85,8 @@ func GetModifiedConfiguration(info *resource.Info, annotate bool, codec runtime.
|
||||
annots = map[string]string{}
|
||||
}
|
||||
|
||||
original := annots[api.LastAppliedConfigAnnotation]
|
||||
delete(annots, api.LastAppliedConfigAnnotation)
|
||||
original := annots[v1.LastAppliedConfigAnnotation]
|
||||
delete(annots, v1.LastAppliedConfigAnnotation)
|
||||
if err := accessor.SetAnnotations(info.Object, annots); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -97,7 +97,7 @@ func GetModifiedConfiguration(info *resource.Info, annotate bool, codec runtime.
|
||||
}
|
||||
|
||||
if annotate {
|
||||
annots[api.LastAppliedConfigAnnotation] = string(modified)
|
||||
annots[v1.LastAppliedConfigAnnotation] = string(modified)
|
||||
if err := info.Mapping.MetadataAccessor.SetAnnotations(info.Object, annots); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -109,7 +109,7 @@ func GetModifiedConfiguration(info *resource.Info, annotate bool, codec runtime.
|
||||
}
|
||||
|
||||
// Restore the object to its original condition.
|
||||
annots[api.LastAppliedConfigAnnotation] = original
|
||||
annots[v1.LastAppliedConfigAnnotation] = original
|
||||
if err := info.Mapping.MetadataAccessor.SetAnnotations(info.Object, annots); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user