From 1652e59c9b3ad817c336cb089527e6ca672e0cae Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Wed, 19 May 2021 17:05:42 -0700 Subject: [PATCH] mark ContainerImage.names as optional kubelet is the only writer of v1.Node .status.images[].names. When an image has neither RepoDigests nor RepoTags, the value gets stored in etcd as null. Marking the field as optional can help JSON API clients to avoid hitting serialization error when the returned status contains null .status.images[].names. --- pkg/apis/core/types.go | 1 + staging/src/k8s.io/api/core/v1/types.go | 1 + 2 files changed, 2 insertions(+) diff --git a/pkg/apis/core/types.go b/pkg/apis/core/types.go index 43146537870..9a74daecce3 100644 --- a/pkg/apis/core/types.go +++ b/pkg/apis/core/types.go @@ -4206,6 +4206,7 @@ type PodSignature struct { // ContainerImage describe a container image type ContainerImage struct { // Names by which this image is known. + // +optional Names []string // The size of the image in bytes. // +optional diff --git a/staging/src/k8s.io/api/core/v1/types.go b/staging/src/k8s.io/api/core/v1/types.go index 6d98efa56bd..d5e86a7c7b8 100644 --- a/staging/src/k8s.io/api/core/v1/types.go +++ b/staging/src/k8s.io/api/core/v1/types.go @@ -4872,6 +4872,7 @@ type PodSignature struct { type ContainerImage struct { // Names by which this image is known. // e.g. ["k8s.gcr.io/hyperkube:v1.0.7", "dockerhub.io/google_containers/hyperkube:v1.0.7"] + // +optional Names []string `json:"names" protobuf:"bytes,1,rep,name=names"` // The size of the image in bytes. // +optional