@@ -3,7 +3,6 @@ package integration
3
3
import (
4
4
"fmt"
5
5
"os"
6
- "path/filepath"
7
6
"time"
8
7
9
8
. "github.com/onsi/ginkgo"
@@ -24,53 +23,23 @@ var _ = Describe("disconnected installation", func() {
24
23
Context ("with an existing package mirror and image registry" , func () {
25
24
Context ("on CentOS" , func () {
26
25
ItOnAWS ("should install successfully [slow]" , func (aws infrastructureProvisioner ) {
27
- WithInfrastructure (NodeCount {1 , 1 , 2 , 1 , 1 }, CentOS7 , aws , func (nodes provisionedNodes , sshKey string ) {
26
+ distro := CentOS7
27
+ WithInfrastructure (NodeCount {1 , 1 , 2 , 1 , 1 }, distro , aws , func (nodes provisionedNodes , sshKey string ) {
28
28
// One of the workers is used as the repository and registry
29
29
repoNode := nodes .worker [1 ]
30
30
nodes .worker = nodes .worker [0 :1 ]
31
31
32
- // Create a package repo
33
32
By ("Creating a package repository" )
34
- start := time .Now ()
35
- err := copyFileToRemote ("test-resources/disconnected-installation/mirror-rpms.sh" , "/tmp/mirror-rpms.sh" , repoNode , sshKey , 10 * time .Second )
36
- FailIfError (err , "Failed to copy script to remote node" )
37
- cmds := []string {"chmod +x /tmp/mirror-rpms.sh" , "sudo /tmp/mirror-rpms.sh" }
38
- err = runViaSSH (cmds , []NodeDeets {repoNode }, sshKey , 45 * time .Minute )
39
- FailIfError (err , "Failed to mirror package repositories" )
40
- elapsed := time .Since (start )
41
- fmt .Println ("Creating a package repository took" , elapsed )
33
+ err := createPackageRepositoryMirror (repoNode , distro , sshKey )
34
+ FailIfError (err , "Error creating local package repo" )
42
35
43
- // Deploy a docker registry on the node
44
36
By ("Deploying a docker registry" )
45
37
caFile , err := deployAuthenticatedDockerRegistry (repoNode , dockerRegistryPort , sshKey )
46
38
FailIfError (err , "Failed to deploy docker registry" )
47
39
48
- By ("Adding the docker registry self-signed cert to the registry node" )
49
- registry := fmt .Sprintf ("%s:%d" , repoNode .PublicIP , dockerRegistryPort )
50
- err = copyFileToRemote (caFile , "/tmp/docker-registry-ca.crt" , repoNode , sshKey , 30 * time .Second )
51
- FailIfError (err , "Failed to copy registry cert to registry node" )
52
- cmds = []string {
53
- fmt .Sprintf ("sudo mkdir -p /etc/docker/certs.d/%s" , registry ),
54
- fmt .Sprintf ("sudo mv /tmp/docker-registry-ca.crt /etc/docker/certs.d/%s/ca.crt" , registry ),
55
- }
56
- err = runViaSSH (cmds , []NodeDeets {repoNode }, sshKey , 10 * time .Minute )
57
- FailIfError (err , "Error adding self-signed cert to registry node" )
58
-
59
- By ("Copying KET to the registry node for seeding" )
60
- err = copyFileToRemote (filepath .Join (currentKismaticDir , "kismatic.tar.gz" ), "/tmp/kismatic.tar.gz" , repoNode , sshKey , 5 * time .Minute )
61
- FailIfError (err , "Error copying KET to the registry node" )
62
-
63
- By ("Seeding the registry" )
64
- start = time .Now ()
65
- cmds = []string {
66
- fmt .Sprintf ("sudo docker login -u kismaticuser -p kismaticpassword %s" , registry ),
67
- "sudo tar -xf /tmp/kismatic.tar.gz" ,
68
- fmt .Sprintf ("sudo ./kismatic seed-registry --server %s" , registry ),
69
- }
70
- err = runViaSSH (cmds , []NodeDeets {repoNode }, sshKey , 30 * time .Minute )
71
- FailIfError (err , "Failed to seed the registry" )
72
- elapsed = time .Since (start )
73
- fmt .Println ("Seeding the registry took" , elapsed )
40
+ By ("Seeding the local registry" )
41
+ err = seedRegistry (repoNode , caFile , dockerRegistryPort , sshKey )
42
+ FailIfError (err , "Error seeding local registry" )
74
43
75
44
By ("Disabling internet access" )
76
45
err = disableInternetAccess (nodes .allNodes (), sshKey )
@@ -82,7 +51,7 @@ var _ = Describe("disconnected installation", func() {
82
51
err = copyFileToRemote ("test-resources/disconnected-installation/configure-rpm-mirrors.sh" , "/tmp/configure-rpm-mirrors.sh" , n , sshKey , 15 * time .Second )
83
52
FailIfError (err , "Failed to copy script to nodes" )
84
53
}
85
- cmds = []string {
54
+ cmds : = []string {
86
55
"chmod +x /tmp/configure-rpm-mirrors.sh" ,
87
56
fmt .Sprintf ("sudo /tmp/configure-rpm-mirrors.sh http://%s" , repoNode .PrivateIP ),
88
57
}
@@ -110,53 +79,24 @@ var _ = Describe("disconnected installation", func() {
110
79
111
80
Context ("on Ubuntu" , func () {
112
81
ItOnAWS ("should install successfully [slow]" , func (aws infrastructureProvisioner ) {
113
- WithInfrastructure (NodeCount {1 , 1 , 2 , 1 , 1 }, Ubuntu1604LTS , aws , func (nodes provisionedNodes , sshKey string ) {
82
+ distro := Ubuntu1604LTS
83
+ WithInfrastructure (NodeCount {1 , 1 , 2 , 1 , 1 }, distro , aws , func (nodes provisionedNodes , sshKey string ) {
114
84
// One of the workers is used as the repository and registry
115
85
repoNode := nodes .worker [1 ]
116
86
nodes .worker = nodes .worker [0 :1 ]
117
87
118
- // Create a package repo
119
88
By ("Creating a package repository" )
120
- start := time .Now ()
121
- err := copyFileToRemote ("test-resources/disconnected-installation/mirror-debs.sh" , "/tmp/mirror-debs.sh" , repoNode , sshKey , 10 * time .Second )
122
- FailIfError (err , "Failed to copy script to remote node" )
123
- cmds := []string {"chmod +x /tmp/mirror-debs.sh" , "sudo /tmp/mirror-debs.sh" }
124
- err = runViaSSH (cmds , []NodeDeets {repoNode }, sshKey , 45 * time .Minute )
125
- FailIfError (err , "Failed to mirror package repositories" )
126
- elapsed := time .Since (start )
127
- fmt .Println ("Creating a package repository took" , elapsed )
89
+ err := createPackageRepositoryMirror (repoNode , distro , sshKey )
90
+ FailIfError (err , "Error creating local package repo" )
128
91
129
92
// Deploy a docker registry on the node
130
93
By ("Deploying a docker registry" )
131
94
caFile , err := deployAuthenticatedDockerRegistry (repoNode , dockerRegistryPort , sshKey )
132
95
FailIfError (err , "Failed to deploy docker registry" )
133
96
134
- By ("Adding the docker registry self-signed cert to the registry node" )
135
- registry := fmt .Sprintf ("%s:%d" , repoNode .PublicIP , dockerRegistryPort )
136
- err = copyFileToRemote (caFile , "/tmp/docker-registry-ca.crt" , repoNode , sshKey , 30 * time .Second )
137
- FailIfError (err , "Failed to copy registry cert to registry node" )
138
- cmds = []string {
139
- fmt .Sprintf ("sudo mkdir -p /etc/docker/certs.d/%s" , registry ),
140
- fmt .Sprintf ("sudo mv /tmp/docker-registry-ca.crt /etc/docker/certs.d/%s/ca.crt" , registry ),
141
- }
142
- err = runViaSSH (cmds , []NodeDeets {repoNode }, sshKey , 10 * time .Minute )
143
- FailIfError (err , "Error adding self-signed cert to registry node" )
144
-
145
- By ("Copying KET to the registry node for seeding" )
146
- err = copyFileToRemote (filepath .Join (currentKismaticDir , "kismatic.tar.gz" ), "/tmp/kismatic.tar.gz" , repoNode , sshKey , 5 * time .Minute )
147
- FailIfError (err , "Error copying KET to the registry node" )
148
-
149
- By ("Seeding the registry" )
150
- start = time .Now ()
151
- cmds = []string {
152
- fmt .Sprintf ("sudo docker login -u kismaticuser -p kismaticpassword %s" , registry ),
153
- "sudo tar -xf /tmp/kismatic.tar.gz" ,
154
- fmt .Sprintf ("sudo ./kismatic seed-registry --server %s" , registry ),
155
- }
156
- err = runViaSSH (cmds , []NodeDeets {repoNode }, sshKey , 30 * time .Minute )
157
- FailIfError (err , "Failed to seed the registry" )
158
- elapsed = time .Since (start )
159
- fmt .Println ("Seeding the registry took" , elapsed )
97
+ By ("Seeding the local registry" )
98
+ err = seedRegistry (repoNode , caFile , dockerRegistryPort , sshKey )
99
+ FailIfError (err , "Error seeding local registry" )
160
100
161
101
By ("Disabling internet access" )
162
102
err = disableInternetAccess (nodes .allNodes (), sshKey )
@@ -168,7 +108,7 @@ var _ = Describe("disconnected installation", func() {
168
108
err = copyFileToRemote ("test-resources/disconnected-installation/configure-deb-mirrors.sh" , "/tmp/configure-deb-mirrors.sh" , n , sshKey , 15 * time .Second )
169
109
FailIfError (err , "Failed to copy script to nodes" )
170
110
}
171
- cmds = []string {
111
+ cmds : = []string {
172
112
"chmod +x /tmp/configure-deb-mirrors.sh" ,
173
113
fmt .Sprintf ("sudo /tmp/configure-deb-mirrors.sh http://%s" , repoNode .PrivateIP ),
174
114
}
0 commit comments