Merge pull request #42083 from fraenkel/validate_name
Automatic merge from submit-queue (batch tested with PRs 42038, 42083) Validate ConfigMapRef and SecretRef name fixes #42037 **Release note**: ```release-note When creating a container using envFrom, 1. validate the name of the ConfigMap in a ConfigMapRef 2. validate the name of the Secret in a SecretRef ```
This commit is contained in:
@@ -2415,6 +2415,16 @@ func TestValidateEnvFrom(t *testing.T) {
|
||||
},
|
||||
expectedError: "field[0].configMapRef.name: Required value",
|
||||
},
|
||||
{
|
||||
name: "invalid name",
|
||||
envs: []api.EnvFromSource{
|
||||
{
|
||||
ConfigMapRef: &api.ConfigMapEnvSource{
|
||||
LocalObjectReference: api.LocalObjectReference{Name: "$"}},
|
||||
},
|
||||
},
|
||||
expectedError: "field[0].configMapRef.name: Invalid value",
|
||||
},
|
||||
{
|
||||
name: "invalid prefix",
|
||||
envs: []api.EnvFromSource{
|
||||
@@ -2436,6 +2446,16 @@ func TestValidateEnvFrom(t *testing.T) {
|
||||
},
|
||||
expectedError: "field[0].secretRef.name: Required value",
|
||||
},
|
||||
{
|
||||
name: "invalid name",
|
||||
envs: []api.EnvFromSource{
|
||||
{
|
||||
SecretRef: &api.SecretEnvSource{
|
||||
LocalObjectReference: api.LocalObjectReference{Name: "&"}},
|
||||
},
|
||||
},
|
||||
expectedError: "field[0].secretRef.name: Invalid value",
|
||||
},
|
||||
{
|
||||
name: "invalid prefix",
|
||||
envs: []api.EnvFromSource{
|
||||
|
Reference in New Issue
Block a user