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 (
...
@@ -24,8 +24,12 @@ import (
type
SortOrder
[]
string
type
SortOrder
[]
string
// InstallOrder is the order in which manifests should be installed (by Kind).
// 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
{
var
InstallOrder
SortOrder
=
[]
string
{
"Namespace"
,
"Namespace"
,
"ResourceQuota"
,
"LimitRange"
,
"Secret"
,
"Secret"
,
"ConfigMap"
,
"ConfigMap"
,
"PersistentVolume"
,
"PersistentVolume"
,
...
@@ -36,32 +40,42 @@ var InstallOrder SortOrder = []string{
...
@@ -36,32 +40,42 @@ var InstallOrder SortOrder = []string{
"Role"
,
"Role"
,
"RoleBinding"
,
"RoleBinding"
,
"Service"
,
"Service"
,
"DaemonSet"
,
"Pod"
,
"Pod"
,
"ReplicationController"
,
"ReplicationController"
,
"ReplicaSet"
,
"Deployment"
,
"Deployment"
,
"DaemonSet"
,
"StatefulSet"
,
"Ingress"
,
"Job"
,
"Job"
,
"CronJob"
,
"Ingress"
,
}
}
// UninstallOrder is the order in which manifests should be uninstalled (by Kind).
// 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
{
var
UninstallOrder
SortOrder
=
[]
string
{
"Ingress"
,
"Service"
,
"Service"
,
"Pod"
,
"CronJob"
,
"ReplicationController"
,
"Job"
,
"StatefulSet"
,
"Deployment"
,
"Deployment"
,
"ReplicaSet"
,
"ReplicationController"
,
"Pod"
,
"DaemonSet"
,
"DaemonSet"
,
"ConfigMap"
,
"Secret"
,
"PersistentVolumeClaim"
,
"PersistentVolume"
,
"RoleBinding"
,
"RoleBinding"
,
"Role"
,
"Role"
,
"ClusterRoleBinding"
,
"ClusterRoleBinding"
,
"ClusterRole"
,
"ClusterRole"
,
"ServiceAccount"
,
"ServiceAccount"
,
"Ingress"
,
"PersistentVolumeClaim"
,
"Job"
,
"PersistentVolume"
,
"ConfigMap"
,
"Secret"
,
"LimitRange"
,
"ResourceQuota"
,
"Namespace"
,
"Namespace"
,
}
}
...
...
pkg/tiller/kind_sorter_test.go
View file @
f7f85526
...
@@ -26,12 +26,12 @@ import (
...
@@ -26,12 +26,12 @@ import (
func
TestKindSorter
(
t
*
testing
.
T
)
{
func
TestKindSorter
(
t
*
testing
.
T
)
{
manifests
:=
[]
manifest
{
manifests
:=
[]
manifest
{
{
{
name
:
"
m
"
,
name
:
"
i
"
,
content
:
""
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"ClusterRole"
},
head
:
&
util
.
SimpleHead
{
Kind
:
"ClusterRole"
},
},
},
{
{
name
:
"
"
,
name
:
"
j
"
,
content
:
""
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"ClusterRoleBinding"
},
head
:
&
util
.
SimpleHead
{
Kind
:
"ClusterRoleBinding"
},
},
},
...
@@ -41,7 +41,17 @@ func TestKindSorter(t *testing.T) {
...
@@ -41,7 +41,17 @@ func TestKindSorter(t *testing.T) {
head
:
&
util
.
SimpleHead
{
Kind
:
"ConfigMap"
},
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
:
""
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Deployment"
},
head
:
&
util
.
SimpleHead
{
Kind
:
"Deployment"
},
},
},
...
@@ -51,35 +61,85 @@ func TestKindSorter(t *testing.T) {
...
@@ -51,35 +61,85 @@ func TestKindSorter(t *testing.T) {
head
:
&
util
.
SimpleHead
{
Kind
:
"HonkyTonkSet"
},
head
:
&
util
.
SimpleHead
{
Kind
:
"HonkyTonkSet"
},
},
},
{
{
name
:
"s"
,
name
:
"v"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Ingress"
},
},
{
name
:
"t"
,
content
:
""
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Job"
},
head
:
&
util
.
SimpleHead
{
Kind
:
"Job"
},
},
},
{
{
name
:
"h"
,
name
:
"c"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"LimitRange"
},
},
{
name
:
"a"
,
content
:
""
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Namespace"
},
head
:
&
util
.
SimpleHead
{
Kind
:
"Namespace"
},
},
},
{
{
name
:
"
w
"
,
name
:
"
f
"
,
content
:
""
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Role"
},
head
:
&
util
.
SimpleHead
{
Kind
:
"PersistentVolume"
},
},
{
name
:
"g"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"PersistentVolumeClaim"
},
},
},
{
{
name
:
"o"
,
name
:
"o"
,
content
:
""
,
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"
},
head
:
&
util
.
SimpleHead
{
Kind
:
"RoleBinding"
},
},
},
{
{
name
:
"r"
,
name
:
"d"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Secret"
},
},
{
name
:
"m"
,
content
:
""
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"Service"
},
head
:
&
util
.
SimpleHead
{
Kind
:
"Service"
},
},
},
{
{
name
:
"
l
"
,
name
:
"
h
"
,
content
:
""
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"ServiceAccount"
},
head
:
&
util
.
SimpleHead
{
Kind
:
"ServiceAccount"
},
},
},
{
name
:
"s"
,
content
:
""
,
head
:
&
util
.
SimpleHead
{
Kind
:
"StatefulSet"
},
},
}
}
for
_
,
test
:=
range
[]
struct
{
for
_
,
test
:=
range
[]
struct
{
...
@@ -87,11 +147,14 @@ func TestKindSorter(t *testing.T) {
...
@@ -87,11 +147,14 @@ func TestKindSorter(t *testing.T) {
order
SortOrder
order
SortOrder
expected
string
expected
string
}{
}{
{
"install"
,
InstallOrder
,
"
helm works
!"
},
{
"install"
,
InstallOrder
,
"
abcdefghijklmnopqrstuv
!"
},
{
"uninstall"
,
UninstallOrder
,
"
rkeow mlsh
!"
},
{
"uninstall"
,
UninstallOrder
,
"
vmutsrqponlkjihgfedcba
!"
},
}
{
}
{
var
buf
bytes
.
Buffer
var
buf
bytes
.
Buffer
t
.
Run
(
test
.
description
,
func
(
t
*
testing
.
T
)
{
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
()
defer
buf
.
Reset
()
for
_
,
r
:=
range
sortByKind
(
manifests
,
test
.
order
)
{
for
_
,
r
:=
range
sortByKind
(
manifests
,
test
.
order
)
{
buf
.
WriteString
(
r
.
name
)
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