mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 02:38:12 +00:00
Merge pull request #47824 from mbohlool/revert2
Automatic merge from submit-queue (batch tested with PRs 47851, 47824, 47858, 46099) Revert 44714 manually #44714 broke backward compatibility for old swagger spec that kubectl still uses. The decision on #47448 was to revert this change but the change was not automatically revertible. Here I semi-manually remove all references to UnixUserID and UnixGroupID and updated generated files accordingly. Please wait for tests to pass then review that as there may still be tests that are failing. Fixes #47448 Adding release note just because the original PR has a release note. If possible, we should remove both release notes as they cancel each other. **Release note**: (removed by caesarxuchao) UnixUserID and UnixGroupID is reverted back as int64 to keep backward compatibility.
This commit is contained in:
@@ -24,7 +24,6 @@ import (
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
@@ -3627,10 +3626,10 @@ func TestValidatePodSpec(t *testing.T) {
|
||||
activeDeadlineSeconds := int64(30)
|
||||
activeDeadlineSecondsMax := int64(math.MaxInt32)
|
||||
|
||||
minUserID := types.UnixUserID(0)
|
||||
maxUserID := types.UnixUserID(2147483647)
|
||||
minGroupID := types.UnixGroupID(0)
|
||||
maxGroupID := types.UnixGroupID(2147483647)
|
||||
minUserID := int64(0)
|
||||
maxUserID := int64(2147483647)
|
||||
minGroupID := int64(0)
|
||||
maxGroupID := int64(2147483647)
|
||||
|
||||
successCases := []api.PodSpec{
|
||||
{ // Populate basic fields, leave defaults for most.
|
||||
@@ -3685,7 +3684,7 @@ func TestValidatePodSpec(t *testing.T) {
|
||||
{ // Populate RunAsUser SupplementalGroups FSGroup with minID 0
|
||||
Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent", TerminationMessagePolicy: "File"}},
|
||||
SecurityContext: &api.PodSecurityContext{
|
||||
SupplementalGroups: []types.UnixGroupID{minGroupID},
|
||||
SupplementalGroups: []int64{minGroupID},
|
||||
RunAsUser: &minUserID,
|
||||
FSGroup: &minGroupID,
|
||||
},
|
||||
@@ -3695,7 +3694,7 @@ func TestValidatePodSpec(t *testing.T) {
|
||||
{ // Populate RunAsUser SupplementalGroups FSGroup with maxID 2147483647
|
||||
Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent", TerminationMessagePolicy: "File"}},
|
||||
SecurityContext: &api.PodSecurityContext{
|
||||
SupplementalGroups: []types.UnixGroupID{maxGroupID},
|
||||
SupplementalGroups: []int64{maxGroupID},
|
||||
RunAsUser: &maxUserID,
|
||||
FSGroup: &maxGroupID,
|
||||
},
|
||||
@@ -3750,10 +3749,10 @@ func TestValidatePodSpec(t *testing.T) {
|
||||
activeDeadlineSeconds = int64(0)
|
||||
activeDeadlineSecondsTooLarge := int64(math.MaxInt32 + 1)
|
||||
|
||||
minUserID = types.UnixUserID(-1)
|
||||
maxUserID = types.UnixUserID(2147483648)
|
||||
minGroupID = types.UnixGroupID(-1)
|
||||
maxGroupID = types.UnixGroupID(2147483648)
|
||||
minUserID = int64(-1)
|
||||
maxUserID = int64(2147483648)
|
||||
minGroupID = int64(-1)
|
||||
maxGroupID = int64(2147483648)
|
||||
|
||||
failureCases := map[string]api.PodSpec{
|
||||
"bad volume": {
|
||||
@@ -3827,7 +3826,7 @@ func TestValidatePodSpec(t *testing.T) {
|
||||
Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent", TerminationMessagePolicy: "File"}},
|
||||
SecurityContext: &api.PodSecurityContext{
|
||||
HostNetwork: false,
|
||||
SupplementalGroups: []types.UnixGroupID{maxGroupID, 1234},
|
||||
SupplementalGroups: []int64{maxGroupID, 1234},
|
||||
},
|
||||
RestartPolicy: api.RestartPolicyAlways,
|
||||
DNSPolicy: api.DNSClusterFirst,
|
||||
@@ -3836,7 +3835,7 @@ func TestValidatePodSpec(t *testing.T) {
|
||||
Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent", TerminationMessagePolicy: "File"}},
|
||||
SecurityContext: &api.PodSecurityContext{
|
||||
HostNetwork: false,
|
||||
SupplementalGroups: []types.UnixGroupID{minGroupID, 1234},
|
||||
SupplementalGroups: []int64{minGroupID, 1234},
|
||||
},
|
||||
RestartPolicy: api.RestartPolicyAlways,
|
||||
DNSPolicy: api.DNSClusterFirst,
|
||||
@@ -9597,7 +9596,7 @@ func TestValidateTLSSecret(t *testing.T) {
|
||||
|
||||
func TestValidateSecurityContext(t *testing.T) {
|
||||
priv := false
|
||||
runAsUser := types.UnixUserID(1)
|
||||
runAsUser := int64(1)
|
||||
fullValidSC := func() *api.SecurityContext {
|
||||
return &api.SecurityContext{
|
||||
Privileged: &priv,
|
||||
@@ -9649,7 +9648,7 @@ func TestValidateSecurityContext(t *testing.T) {
|
||||
privRequestWithGlobalDeny.Privileged = &requestPrivileged
|
||||
|
||||
negativeRunAsUser := fullValidSC()
|
||||
negativeUser := types.UnixUserID(-1)
|
||||
negativeUser := int64(-1)
|
||||
negativeRunAsUser.RunAsUser = &negativeUser
|
||||
|
||||
errorCases := map[string]struct {
|
||||
|
||||
Reference in New Issue
Block a user