Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
ddb5b638
Commit
ddb5b638
authored
Nov 14, 2017
by
Zihong Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'None' option to DNSPolicy and define DNSConfig field in Pod API
parent
920a5b31
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
4 deletions
+96
-4
types.go
pkg/apis/core/types.go
+45
-1
kube_features.go
pkg/features/kube_features.go
+7
-0
types.go
staging/src/k8s.io/api/core/v1/types.go
+44
-3
No files found.
pkg/apis/core/types.go
View file @
ddb5b638
...
@@ -2183,6 +2183,11 @@ const (
...
@@ -2183,6 +2183,11 @@ const (
// DNSDefault indicates that the pod should use the default (as
// DNSDefault indicates that the pod should use the default (as
// determined by kubelet) DNS settings.
// determined by kubelet) DNS settings.
DNSDefault
DNSPolicy
=
"Default"
DNSDefault
DNSPolicy
=
"Default"
// DNSNone indicates that the pod should use empty DNS settings. DNS
// parameters such as nameservers and search paths should be defined via
// DNSConfig.
DNSNone
DNSPolicy
=
"None"
)
)
// A node selector represents the union of the results of one or more label queries
// A node selector represents the union of the results of one or more label queries
...
@@ -2482,7 +2487,12 @@ type PodSpec struct {
...
@@ -2482,7 +2487,12 @@ type PodSpec struct {
// before the system actively tries to terminate the pod; value must be positive integer
// before the system actively tries to terminate the pod; value must be positive integer
// +optional
// +optional
ActiveDeadlineSeconds
*
int64
ActiveDeadlineSeconds
*
int64
// Required: Set DNS policy.
// Set DNS policy for the pod.
// Defaults to "ClusterFirst".
// Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'.
// DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy.
// To have DNS options set along with hostNetwork, you have to specify DNS policy
// explicitly to 'ClusterFirstWithHostNet'.
// +optional
// +optional
DNSPolicy
DNSPolicy
DNSPolicy
DNSPolicy
// NodeSelector is a selector which must be true for the pod to fit on a node
// NodeSelector is a selector which must be true for the pod to fit on a node
...
@@ -2546,6 +2556,11 @@ type PodSpec struct {
...
@@ -2546,6 +2556,11 @@ type PodSpec struct {
// The higher the value, the higher the priority.
// The higher the value, the higher the priority.
// +optional
// +optional
Priority
*
int32
Priority
*
int32
// Specifies the DNS parameters of a pod.
// Parameters specified here will be merged to the generated DNS
// configuration based on DNSPolicy.
// +optional
DNSConfig
*
PodDNSConfig
}
}
// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
...
@@ -2635,6 +2650,35 @@ const (
...
@@ -2635,6 +2650,35 @@ const (
PodQOSBestEffort
PodQOSClass
=
"BestEffort"
PodQOSBestEffort
PodQOSClass
=
"BestEffort"
)
)
// PodDNSConfig defines the DNS parameters of a pod in addition to
// those generated from DNSPolicy.
type
PodDNSConfig
struct
{
// A list of DNS name server IP addresses.
// This will be appended to the base nameservers generated from DNSPolicy.
// Duplicated nameservers will be removed.
// +optional
Nameservers
[]
string
// A list of DNS search domains for host-name lookup.
// This will be appended to the base search paths generated from DNSPolicy.
// Duplicated search paths will be removed.
// +optional
Searches
[]
string
// A list of DNS resolver options.
// This will be merged with the base options generated from DNSPolicy.
// Duplicated entries will be removed. Resolution options given in Options
// will override those that appear in the base DNSPolicy.
// +optional
Options
[]
PodDNSConfigOption
}
// PodDNSConfigOption defines DNS resolver options of a pod.
type
PodDNSConfigOption
struct
{
// Required.
Name
string
// +optional
Value
*
string
}
// PodStatus represents information about the status of a pod. Status may trail the actual
// PodStatus represents information about the status of a pod. Status may trail the actual
// state of a system.
// state of a system.
type
PodStatus
struct
{
type
PodStatus
struct
{
...
...
pkg/features/kube_features.go
View file @
ddb5b638
...
@@ -188,6 +188,12 @@ const (
...
@@ -188,6 +188,12 @@ const (
// Enable mount/attachment of Container Storage Interface (CSI) backed PVs
// Enable mount/attachment of Container Storage Interface (CSI) backed PVs
CSIPersistentVolume
utilfeature
.
Feature
=
"CSIPersistentVolume"
CSIPersistentVolume
utilfeature
.
Feature
=
"CSIPersistentVolume"
// owner @MrHohn
// alpha: v1.9
//
// Support configurable pod DNS parameters.
CustomPodDNS
utilfeature
.
Feature
=
"CustomPodDNS"
// owner: @screeley44
// owner: @screeley44
// alpha: v1.9
// alpha: v1.9
//
//
...
@@ -228,6 +234,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
...
@@ -228,6 +234,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
MountContainers
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
MountContainers
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
VolumeScheduling
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
VolumeScheduling
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
CSIPersistentVolume
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
CSIPersistentVolume
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
CustomPodDNS
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
BlockVolume
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
BlockVolume
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
// inherited features from generic apiserver, relisted here to get a conflict if it is changed
// inherited features from generic apiserver, relisted here to get a conflict if it is changed
...
...
staging/src/k8s.io/api/core/v1/types.go
View file @
ddb5b638
...
@@ -2431,6 +2431,11 @@ const (
...
@@ -2431,6 +2431,11 @@ const (
// determined by kubelet) DNS settings.
// determined by kubelet) DNS settings.
DNSDefault
DNSPolicy
=
"Default"
DNSDefault
DNSPolicy
=
"Default"
// DNSNone indicates that the pod should use empty DNS settings. DNS
// parameters such as nameservers and search paths should be defined via
// DNSConfig.
DNSNone
DNSPolicy
=
"None"
DefaultTerminationGracePeriodSeconds
=
30
DefaultTerminationGracePeriodSeconds
=
30
)
)
...
@@ -2760,10 +2765,12 @@ type PodSpec struct {
...
@@ -2760,10 +2765,12 @@ type PodSpec struct {
// Value must be a positive integer.
// Value must be a positive integer.
// +optional
// +optional
ActiveDeadlineSeconds
*
int64
`json:"activeDeadlineSeconds,omitempty" protobuf:"varint,5,opt,name=activeDeadlineSeconds"`
ActiveDeadlineSeconds
*
int64
`json:"activeDeadlineSeconds,omitempty" protobuf:"varint,5,opt,name=activeDeadlineSeconds"`
// Set DNS policy for containers within the pod.
// Set DNS policy for the pod.
// One of 'ClusterFirstWithHostNet', 'ClusterFirst' or 'Default'.
// Defaults to "ClusterFirst".
// Defaults to "ClusterFirst".
// To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'.
// Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'.
// DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy.
// To have DNS options set along with hostNetwork, you have to specify DNS policy
// explicitly to 'ClusterFirstWithHostNet'.
// +optional
// +optional
DNSPolicy
DNSPolicy
`json:"dnsPolicy,omitempty" protobuf:"bytes,6,opt,name=dnsPolicy,casttype=DNSPolicy"`
DNSPolicy
DNSPolicy
`json:"dnsPolicy,omitempty" protobuf:"bytes,6,opt,name=dnsPolicy,casttype=DNSPolicy"`
// NodeSelector is a selector which must be true for the pod to fit on a node.
// NodeSelector is a selector which must be true for the pod to fit on a node.
...
@@ -2856,6 +2863,11 @@ type PodSpec struct {
...
@@ -2856,6 +2863,11 @@ type PodSpec struct {
// The higher the value, the higher the priority.
// The higher the value, the higher the priority.
// +optional
// +optional
Priority
*
int32
`json:"priority,omitempty" protobuf:"bytes,25,opt,name=priority"`
Priority
*
int32
`json:"priority,omitempty" protobuf:"bytes,25,opt,name=priority"`
// Specifies the DNS parameters of a pod.
// Parameters specified here will be merged to the generated DNS
// configuration based on DNSPolicy.
// +optional
DNSConfig
*
PodDNSConfig
`json:"dnsConfig,omitempty" protobuf:"bytes,26,opt,name=dnsConfig"`
}
}
// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
...
@@ -2923,6 +2935,35 @@ const (
...
@@ -2923,6 +2935,35 @@ const (
PodQOSBestEffort
PodQOSClass
=
"BestEffort"
PodQOSBestEffort
PodQOSClass
=
"BestEffort"
)
)
// PodDNSConfig defines the DNS parameters of a pod in addition to
// those generated from DNSPolicy.
type
PodDNSConfig
struct
{
// A list of DNS name server IP addresses.
// This will be appended to the base nameservers generated from DNSPolicy.
// Duplicated nameservers will be removed.
// +optional
Nameservers
[]
string
`json:"nameservers,omitempty" protobuf:"bytes,1,rep,name=nameservers"`
// A list of DNS search domains for host-name lookup.
// This will be appended to the base search paths generated from DNSPolicy.
// Duplicated search paths will be removed.
// +optional
Searches
[]
string
`json:"searches,omitempty" protobuf:"bytes,2,rep,name=searches"`
// A list of DNS resolver options.
// This will be merged with the base options generated from DNSPolicy.
// Duplicated entries will be removed. Resolution options given in Options
// will override those that appear in the base DNSPolicy.
// +optional
Options
[]
PodDNSConfigOption
`json:"options,omitempty" protobuf:"bytes,3,rep,name=options"`
}
// PodDNSConfigOption defines DNS resolver options of a pod.
type
PodDNSConfigOption
struct
{
// Required.
Name
string
`json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
// +optional
Value
*
string
`json:"value,omitempty" protobuf:"bytes,2,opt,name=value"`
}
// PodStatus represents information about the status of a pod. Status may trail the actual
// PodStatus represents information about the status of a pod. Status may trail the actual
// state of a system.
// state of a system.
type
PodStatus
struct
{
type
PodStatus
struct
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment