Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
f7f85526
Commit
f7f85526
authored
Apr 03, 2017
by
Taylor Thomas
Committed by
GitHub
Apr 03, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2203 from seh/sort-more-kinds-for-installation
Add more object kinds to sorted installation order
parents
9cfdbd1f
4178ec08
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
21 deletions
+98
-21
kind_sorter.go
pkg/tiller/kind_sorter.go
+24
-10
kind_sorter_test.go
pkg/tiller/kind_sorter_test.go
+74
-11
No files found.
pkg/tiller/kind_sorter.go
View file @
f7f85526
...
...
@@ -24,8 +24,12 @@ import (
type
SortOrder
[]
string
// InstallOrder is the order in which manifests should be installed (by Kind).
//
// Those occurring earlier in the list get installed before those occurring later in the list.
var
InstallOrder
SortOrder
=
[]
string
{
"Namespace"
,
"ResourceQuota"
,
"LimitRange"
,
"Secret"
,
"ConfigMap"
,
"PersistentVolume"
,
...
...
@@ -36,32 +40,42 @@ var InstallOrder SortOrder = []string{
"Role"
,
"RoleBinding"
,
"Service"
,
"DaemonSet"
,
"Pod"
,
"ReplicationController"
,
"ReplicaSet"
,
"Deployment"
,
"DaemonSet"
,
"Ingress"
,
"StatefulSet"
,
"Job"
,
"CronJob"
,
"Ingress"
,
}
// UninstallOrder is the order in which manifests should be uninstalled (by Kind).
//
// Those occurring earlier in the list get uninstalled before those occurring later in the list.
var
UninstallOrder
SortOrder
=
[]
string
{
"Ingress"
,
"Service"
,
"Pod"
,
"ReplicationController"
,
"CronJob"
,
"Job"
,
"StatefulSet"
,
"Deployment"
,
"ReplicaSet"
,
"ReplicationController"
,
"Pod"
,
"DaemonSet"
,
"ConfigMap"
,
"Secret"
,
"PersistentVolumeClaim"
,
"PersistentVolume"
,
"RoleBinding"
,
"Role"
,
"ClusterRoleBinding"
,
"ClusterRole"
,
"ServiceAccount"
,
"Ingress"
,
"Job"
,
"PersistentVolumeClaim"
,
"PersistentVolume"
,
"ConfigMap"
,
"Secret"
,
"LimitRange"
,
"ResourceQuota"
,
"Namespace"
,
}
...
...
pkg/tiller/kind_sorter_test.go
View file @
f7f85526
...
...
@@ -26,12 +26,12 @@ import (
func
TestKindSorter
(
t
*
testing
.
T
)
{
manifests
:=
[]
manifest
{
{
name
:
"
m
"
,
name
:
"
i
"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"ClusterRole"
},
},
{
name
:
"
"
,
name
:
"
j
"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"ClusterRoleBinding"
},
},
...
...
@@ -41,7 +41,17 @@ func TestKindSorter(t *testing.T) {
head
:
&
util
.
SimpleHead
{
Kind
:
"ConfigMap"
},
},
{
name
:
"k"
,
name
:
"u"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"CronJob"
},
},
{
name
:
"n"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"DaemonSet"
},
},
{
name
:
"r"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Deployment"
},
},
...
...
@@ -51,35 +61,85 @@ func TestKindSorter(t *testing.T) {
head
:
&
util
.
SimpleHead
{
Kind
:
"HonkyTonkSet"
},
},
{
name
:
"s"
,
name
:
"v"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Ingress"
},
},
{
name
:
"t"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Job"
},
},
{
name
:
"h"
,
name
:
"c"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"LimitRange"
},
},
{
name
:
"a"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Namespace"
},
},
{
name
:
"
w
"
,
name
:
"
f
"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Role"
},
head
:
&
util
.
SimpleHead
{
Kind
:
"PersistentVolume"
},
},
{
name
:
"g"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"PersistentVolumeClaim"
},
},
{
name
:
"o"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Pod"
},
},
{
name
:
"q"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"ReplicaSet"
},
},
{
name
:
"p"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"ReplicationController"
},
},
{
name
:
"b"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"ResourceQuota"
},
},
{
name
:
"k"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Role"
},
},
{
name
:
"l"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"RoleBinding"
},
},
{
name
:
"r"
,
name
:
"d"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Secret"
},
},
{
name
:
"m"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Service"
},
},
{
name
:
"
l
"
,
name
:
"
h
"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"ServiceAccount"
},
},
{
name
:
"s"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"StatefulSet"
},
},
}
for
_
,
test
:=
range
[]
struct
{
...
...
@@ -87,11 +147,14 @@ func TestKindSorter(t *testing.T) {
order
SortOrder
expected
string
}{
{
"install"
,
InstallOrder
,
"
helm works
!"
},
{
"uninstall"
,
UninstallOrder
,
"
rkeow mlsh
!"
},
{
"install"
,
InstallOrder
,
"
abcdefghijklmnopqrstuv
!"
},
{
"uninstall"
,
UninstallOrder
,
"
vmutsrqponlkjihgfedcba
!"
},
}
{
var
buf
bytes
.
Buffer
t
.
Run
(
test
.
description
,
func
(
t
*
testing
.
T
)
{
if
got
,
want
:=
len
(
test
.
expected
),
len
(
manifests
);
got
!=
want
{
t
.
Fatalf
(
"Expected %d names in order, got %d"
,
want
,
got
)
}
defer
buf
.
Reset
()
for
_
,
r
:=
range
sortByKind
(
manifests
,
test
.
order
)
{
buf
.
WriteString
(
r
.
name
)
...
...
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