diff --git a/pkg/api/types.go b/pkg/api/types.go index 45a66361d9..52e6dae81b 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -2099,6 +2099,17 @@ type PodSpec struct { // If specified, the pod's tolerations. // +optional Tolerations []Toleration + // HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts + // file if specified. This is only valid for non-hostNetwork pods. + // +optional + HostAliases []HostAlias +} + +// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the +// pod's hosts file. +type HostAlias struct { + IP string + Hostnames []string } // Sysctl defines a kernel parameter to be set diff --git a/pkg/api/v1/types.go b/pkg/api/v1/types.go index 4bd30ba9f4..15e63cc518 100644 --- a/pkg/api/v1/types.go +++ b/pkg/api/v1/types.go @@ -2406,6 +2406,21 @@ type PodSpec struct { // If specified, the pod's tolerations. // +optional Tolerations []Toleration `json:"tolerations,omitempty" protobuf:"bytes,22,opt,name=tolerations"` + // HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts + // file if specified. This is only valid for non-hostNetwork pods. + // +optional + // +patchMergeKey=IP + // +patchStrategy=merge + HostAliases []HostAlias `json:"hostMappings,omitempty" patchStrategy:"merge" patchMergeKey:"IP" protobuf:"bytes,23,rep,name=hostMappings"` +} + +// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the +// pod's hosts file. +type HostAlias struct { + // IP address of the host file entry. + IP string `json:"ip,omitempty" protobuf:"bytes,1,opt,name=ip"` + // Hostnames for the the above IP address. + Hostnames []string `json:"hostnames,omitempty" protobuf:"bytes,2,rep,name=hostnames"` } // PodSecurityContext holds pod-level security attributes and common container settings.