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
9eeae345
Unverified
Commit
9eeae345
authored
Sep 19, 2016
by
Atanas Mirchev
Committed by
Ilya Dmitrichenko
Sep 24, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add node CIDR allocation as an option to kubeadm.
This is useful for users who are used to deploying with a flannel overlay network.
parent
38b53e31
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
11 deletions
+26
-11
types.go
cmd/kubeadm/app/api/types.go
+3
-0
init.go
cmd/kubeadm/app/cmd/init.go
+10
-5
manifests.go
cmd/kubeadm/app/master/manifests.go
+13
-6
No files found.
cmd/kubeadm/app/api/types.go
View file @
9eeae345
...
@@ -51,6 +51,9 @@ type InitFlags struct {
...
@@ -51,6 +51,9 @@ type InitFlags struct {
CIDR
net
.
IPNet
CIDR
net
.
IPNet
DNSDomain
string
DNSDomain
string
}
}
PodNetwork
struct
{
CIDR
net
.
IPNet
}
CloudProvider
string
CloudProvider
string
Schedulable
bool
Schedulable
bool
}
}
...
...
cmd/kubeadm/app/cmd/init.go
View file @
9eeae345
...
@@ -65,22 +65,27 @@ func NewCmdInit(out io.Writer, s *kubeadmapi.KubeadmConfig) *cobra.Command {
...
@@ -65,22 +65,27 @@ func NewCmdInit(out io.Writer, s *kubeadmapi.KubeadmConfig) *cobra.Command {
&
s
.
InitFlags
.
API
.
ExternalDNSNames
,
"api-external-dns-names"
,
[]
string
{},
&
s
.
InitFlags
.
API
.
ExternalDNSNames
,
"api-external-dns-names"
,
[]
string
{},
`(optional) The DNS names to advertise, in case you have configured them yourself.`
,
`(optional) The DNS names to advertise, in case you have configured them yourself.`
,
)
)
cmd
.
PersistentFlags
()
.
IPNetVar
(
cmd
.
PersistentFlags
()
.
IPNetVar
(
&
s
.
InitFlags
.
Services
.
CIDR
,
"service-cidr"
,
*
kubeadmapi
.
DefaultServicesCIDR
,
&
s
.
InitFlags
.
Services
.
CIDR
,
"service-cidr"
,
*
kubeadmapi
.
DefaultServicesCIDR
,
`(optional) use alternative range of IP address for service VIPs, e.g. "10.16.0.0/12"`
,
`(optional) Use alterantive range of IP address for service VIPs, defaults to `
+
kubeadmapi
.
DefaultServicesCIDRString
,
)
cmd
.
PersistentFlags
()
.
IPNetVar
(
&
s
.
InitFlags
.
PodNetwork
.
CIDR
,
"pod-network-cidr"
,
net
.
IPNet
{},
`(optional) Specify range of IP addresses for the pod overlay network, e.g. 10.3.0.0/16.`
+
`If set, the control plane will automatically attempt to allocate Pod network CIDRs for every node.`
,
)
)
cmd
.
PersistentFlags
()
.
StringVar
(
cmd
.
PersistentFlags
()
.
StringVar
(
&
s
.
InitFlags
.
Services
.
DNSDomain
,
"service-dns-domain"
,
kubeadmapi
.
DefaultServiceDNSDomain
,
&
s
.
InitFlags
.
Services
.
DNSDomain
,
"service-dns-domain"
,
kubeadmapi
.
DefaultServiceDNSDomain
,
`(optional)
u
se alternative domain for services, e.g. "myorg.internal"`
,
`(optional)
U
se alternative domain for services, e.g. "myorg.internal"`
,
)
)
cmd
.
PersistentFlags
()
.
StringVar
(
cmd
.
PersistentFlags
()
.
StringVar
(
&
s
.
InitFlags
.
CloudProvider
,
"cloud-provider"
,
""
,
&
s
.
InitFlags
.
CloudProvider
,
"cloud-provider"
,
""
,
`(optional)
e
nable a specific cloud provider features (external load-balancers, storage, etc), e.g. "gce"`
,
`(optional)
E
nable a specific cloud provider features (external load-balancers, storage, etc), e.g. "gce"`
,
)
)
cmd
.
PersistentFlags
()
.
BoolVar
(
cmd
.
PersistentFlags
()
.
BoolVar
(
&
s
.
InitFlags
.
Schedulable
,
"schedule-workload"
,
false
,
&
s
.
InitFlags
.
Schedulable
,
"schedule-workload"
,
false
,
`(optional)
a
llow to schedule workload to the node`
,
`(optional)
A
llow to schedule workload to the node`
,
)
)
// TODO (phase1+) @errordeveloper make the flags below not show up in --help but rather on --advanced-help
// TODO (phase1+) @errordeveloper make the flags below not show up in --help but rather on --advanced-help
...
...
cmd/kubeadm/app/master/manifests.go
View file @
9eeae345
...
@@ -262,7 +262,6 @@ func getComponentCommand(component string, s *kubeadmapi.KubeadmConfig) (command
...
@@ -262,7 +262,6 @@ func getComponentCommand(component string, s *kubeadmapi.KubeadmConfig) (command
"--cluster-signing-cert-file="
+
pkiDir
+
"/ca.pem"
,
"--cluster-signing-cert-file="
+
pkiDir
+
"/ca.pem"
,
"--cluster-signing-key-file="
+
pkiDir
+
"/ca-key.pem"
,
"--cluster-signing-key-file="
+
pkiDir
+
"/ca-key.pem"
,
"--insecure-experimental-approve-all-kubelet-csrs-for-group=system:kubelet-bootstrap"
,
"--insecure-experimental-approve-all-kubelet-csrs-for-group=system:kubelet-bootstrap"
,
"--cluster-cidr="
+
s
.
InitFlags
.
Services
.
CIDR
.
String
(),
},
},
scheduler
:
[]
string
{
scheduler
:
[]
string
{
// TODO: consider adding --address=127.0.0.1 in order to not expose the scheduler port to the rest of the world
// TODO: consider adding --address=127.0.0.1 in order to not expose the scheduler port to the rest of the world
...
@@ -281,12 +280,20 @@ func getComponentCommand(component string, s *kubeadmapi.KubeadmConfig) (command
...
@@ -281,12 +280,20 @@ func getComponentCommand(component string, s *kubeadmapi.KubeadmConfig) (command
command
=
append
(
command
,
s
.
EnvParams
[
"component_loglevel"
])
command
=
append
(
command
,
s
.
EnvParams
[
"component_loglevel"
])
command
=
append
(
command
,
baseFlags
[
component
]
...
)
command
=
append
(
command
,
baseFlags
[
component
]
...
)
if
component
==
controllerManager
&&
s
.
InitFlags
.
CloudProvider
!=
""
{
if
component
==
controllerManager
{
command
=
append
(
command
,
"--cloud-provider="
+
s
.
InitFlags
.
CloudProvider
)
if
s
.
InitFlags
.
CloudProvider
!=
""
{
command
=
append
(
command
,
"--cloud-provider="
+
s
.
InitFlags
.
CloudProvider
)
// Only append the --cloud-config option if there's a such file
// Only append the --cloud-config option if there's a such file
if
_
,
err
:=
os
.
Stat
(
DefaultCloudConfigPath
);
err
==
nil
{
if
_
,
err
:=
os
.
Stat
(
DefaultCloudConfigPath
);
err
==
nil
{
command
=
append
(
command
,
"--cloud-config="
+
DefaultCloudConfigPath
)
command
=
append
(
command
,
"--cloud-config="
+
DefaultCloudConfigPath
)
}
}
if
s
.
InitFlags
.
PodNetwork
.
CIDR
.
IP
!=
nil
{
// Let the controller-manager allocate Node CIDRs for the Pod overlay network.
// Each node will get a subspace of the address CIDR provided with --cluster-cidr.
command
=
append
(
command
,
"--allocate-node-cidrs=true"
,
"--cluster-cidr="
+
s
.
InitFlags
.
PodNetwork
.
CIDR
.
String
())
}
}
}
}
...
...
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