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
a69697e6
Unverified
Commit
a69697e6
authored
Aug 05, 2017
by
Lucas Käldström
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubeadm: Add back labels for the Static Pod control plane
parent
898b1b33
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
9 deletions
+35
-9
BUILD
cmd/kubeadm/app/phases/controlplane/BUILD
+1
-0
manifests.go
cmd/kubeadm/app/phases/controlplane/manifests.go
+3
-0
manifests_test.go
cmd/kubeadm/app/phases/controlplane/manifests_test.go
+31
-9
No files found.
cmd/kubeadm/app/phases/controlplane/BUILD
View file @
a69697e6
...
...
@@ -21,6 +21,7 @@ go_test(
"//cmd/kubeadm/app/constants:go_default_library",
"//pkg/util/version:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/yaml:go_default_library",
],
...
...
cmd/kubeadm/app/phases/controlplane/manifests.go
View file @
a69697e6
...
...
@@ -166,6 +166,9 @@ func componentPod(container v1.Container, volumes []v1.Volume) v1.Pod {
Name
:
container
.
Name
,
Namespace
:
metav1
.
NamespaceSystem
,
Annotations
:
map
[
string
]
string
{
kubetypes
.
CriticalPodAnnotationKey
:
""
},
// The component and tier labels are useful for quickly identifying the control plane Pods when doing a .List()
// against Pods in the kube-system namespace. Can for example be used together with the WaitForPodsWithLabel function
Labels
:
map
[
string
]
string
{
"component"
:
container
.
Name
,
"tier"
:
"control-plane"
},
},
Spec
:
v1
.
PodSpec
{
Containers
:
[]
v1
.
Container
{
container
},
...
...
cmd/kubeadm/app/phases/controlplane/manifests_test.go
View file @
a69697e6
...
...
@@ -26,6 +26,7 @@ import (
"testing"
"k8s.io/api/core/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/yaml"
kubeadmapi
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
...
...
@@ -179,22 +180,43 @@ func TestComponentProbe(t *testing.T) {
func
TestComponentPod
(
t
*
testing
.
T
)
{
var
tests
=
[]
struct
{
n
string
name
string
expected
v1
.
Pod
}{
{
n
:
"foo"
,
name
:
"foo"
,
expected
:
v1
.
Pod
{
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
"v1"
,
Kind
:
"Pod"
,
},
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
,
Namespace
:
"kube-system"
,
Annotations
:
map
[
string
]
string
{
"scheduler.alpha.kubernetes.io/critical-pod"
:
""
},
Labels
:
map
[
string
]
string
{
"component"
:
"foo"
,
"tier"
:
"control-plane"
},
},
Spec
:
v1
.
PodSpec
{
Containers
:
[]
v1
.
Container
{
{
Name
:
"foo"
,
},
},
HostNetwork
:
true
,
Volumes
:
[]
v1
.
Volume
{},
},
},
},
}
for
_
,
rt
:=
range
tests
{
c
:=
v1
.
Container
{
Name
:
rt
.
n
}
v
:=
[]
v1
.
Volume
{}
actual
:=
componentPod
(
c
,
v
)
if
actual
.
ObjectMeta
.
Name
!=
rt
.
n
{
c
:=
v1
.
Container
{
Name
:
rt
.
name
}
actual
:=
componentPod
(
c
,
[]
v1
.
Volume
{})
if
!
reflect
.
DeepEqual
(
rt
.
expected
,
actual
)
{
t
.
Errorf
(
"failed componentPod:
\n\t
expected: %
s
\n\t
actual: %s
"
,
rt
.
n
,
actual
.
ObjectMeta
.
Name
,
"failed componentPod:
\n\t
expected: %
v
\n\t
actual: %v
"
,
rt
.
expected
,
actual
,
)
}
}
...
...
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