Merge pull request #48125 from xiangpengzhao/downwardapi-poduid

Automatic merge from submit-queue (batch tested with PRs 48264, 48324, 48125, 47944, 47489)

Add Pod UID (metadata.uid) to downward API env var

**What this PR does / why we need it**:
Exposing Pod UID by downward API.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #28918 

**Special notes for your reviewer**:
Generated files aren't committed. I'd like CI to tell me what scripts should I run to generate these files.

/cc @smarterclayton @vishh @dubstack

**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue
2017-06-30 20:58:31 -07:00
committed by GitHub
5 changed files with 30 additions and 8 deletions

View File

@@ -808,7 +808,8 @@ var validDownwardAPIFieldPathExpressions = sets.NewString(
"metadata.name",
"metadata.namespace",
"metadata.labels",
"metadata.annotations")
"metadata.annotations",
"metadata.uid")
func validateDownwardAPIVolumeFile(file *api.DownwardAPIVolumeFile, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
@@ -1556,7 +1557,7 @@ func ValidateEnv(vars []api.EnvVar, fldPath *field.Path) field.ErrorList {
return allErrs
}
var validFieldPathExpressionsEnv = sets.NewString("metadata.name", "metadata.namespace", "spec.nodeName", "spec.serviceAccountName", "status.hostIP", "status.podIP")
var validFieldPathExpressionsEnv = sets.NewString("metadata.name", "metadata.namespace", "metadata.uid", "spec.nodeName", "spec.serviceAccountName", "status.hostIP", "status.podIP")
var validContainerResourceFieldPathExpressions = sets.NewString("limits.cpu", "limits.memory", "requests.cpu", "requests.memory")
func validateEnvVarValueFrom(ev api.EnvVar, fldPath *field.Path) field.ErrorList {