Skip to content

Commit ae8d133

Browse files
committed
Merge pull request #229 from helgi/remove_platform_domain
ref(*): remove the notion of a platform domain known to workflow
2 parents 8efaf49 + baf1f27 commit ae8d133

11 files changed

Lines changed: 45 additions & 52 deletions

File tree

client/controller/api/apps.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type App struct {
66
ID string `json:"id"`
77
Owner string `json:"owner"`
88
Updated string `json:"updated"`
9-
URL string `json:"url"`
9+
URL string `json:"-"`
1010
UUID string `json:"uuid"`
1111
}
1212

client/controller/models/apps/apps.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ func List(c *client.Client, results int) ([]api.App, int, error) {
2323
return []api.App{}, -1, err
2424
}
2525

26+
for name, app := range apps {
27+
// Add in app URL based on controller hostname, port included
28+
app.URL = fmt.Sprintf("%s.%s", app.ID, c.ControllerURL.Host)
29+
apps[name] = app
30+
}
31+
2632
return apps, count, nil
2733
}
2834

@@ -51,6 +57,9 @@ func New(c *client.Client, id string) (api.App, error) {
5157
return api.App{}, err
5258
}
5359

60+
// Add in app URL based on controller hostname, port included
61+
app.URL = fmt.Sprintf("%s.%s", app.ID, c.ControllerURL.Host)
62+
5463
return app, nil
5564
}
5665

@@ -70,6 +79,9 @@ func Get(c *client.Client, appID string) (api.App, error) {
7079
return api.App{}, err
7180
}
7281

82+
// Add in app URL based on controller hostname, port included
83+
app.URL = fmt.Sprintf("%s.%s", app.ID, c.ControllerURL.Host)
84+
7385
return app, nil
7486
}
7587

client/controller/models/apps/apps_test.go

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const appFixture string = `
2121
"owner": "test",
2222
"structure": {},
2323
"updated": "2014-01-01T00:00:00UTC",
24-
"url": "example-go.example.com",
2524
"uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75"
2625
}`
2726

@@ -37,7 +36,6 @@ const appsFixture string = `
3736
"owner": "test",
3837
"structure": {},
3938
"updated": "2014-01-01T00:00:00UTC",
40-
"url": "example-go.example.com",
4139
"uuid": "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75"
4240
}
4341
]
@@ -157,15 +155,6 @@ func (f *fakeHTTPServer) ServeHTTP(res http.ResponseWriter, req *http.Request) {
157155
func TestAppsCreate(t *testing.T) {
158156
t.Parallel()
159157

160-
expected := api.App{
161-
ID: "example-go",
162-
Created: "2014-01-01T00:00:00UTC",
163-
Owner: "test",
164-
Updated: "2014-01-01T00:00:00UTC",
165-
URL: "example-go.example.com",
166-
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
167-
}
168-
169158
handler := fakeHTTPServer{createID: false, createWithoutID: false}
170159
server := httptest.NewServer(&handler)
171160
defer server.Close()
@@ -176,6 +165,15 @@ func TestAppsCreate(t *testing.T) {
176165
t.Fatal(err)
177166
}
178167

168+
expected := api.App{
169+
ID: "example-go",
170+
Created: "2014-01-01T00:00:00UTC",
171+
Owner: "test",
172+
Updated: "2014-01-01T00:00:00UTC",
173+
URL: fmt.Sprintf("example-go.%s", u.Host),
174+
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
175+
}
176+
179177
httpClient := client.CreateHTTPClient(false)
180178

181179
client := client.Client{HTTPClient: httpClient, ControllerURL: *u, Token: "abc"}
@@ -196,15 +194,6 @@ func TestAppsCreate(t *testing.T) {
196194
func TestAppsGet(t *testing.T) {
197195
t.Parallel()
198196

199-
expected := api.App{
200-
ID: "example-go",
201-
Created: "2014-01-01T00:00:00UTC",
202-
Owner: "test",
203-
Updated: "2014-01-01T00:00:00UTC",
204-
URL: "example-go.example.com",
205-
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
206-
}
207-
208197
handler := fakeHTTPServer{}
209198
server := httptest.NewServer(&handler)
210199
defer server.Close()
@@ -215,6 +204,15 @@ func TestAppsGet(t *testing.T) {
215204
t.Fatal(err)
216205
}
217206

207+
expected := api.App{
208+
ID: "example-go",
209+
Created: "2014-01-01T00:00:00UTC",
210+
Owner: "test",
211+
Updated: "2014-01-01T00:00:00UTC",
212+
URL: fmt.Sprintf("example-go.%s", u.Host),
213+
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
214+
}
215+
218216
httpClient := client.CreateHTTPClient(false)
219217

220218
client := client.Client{HTTPClient: httpClient, ControllerURL: *u, Token: "abc"}
@@ -288,17 +286,6 @@ func TestAppsRun(t *testing.T) {
288286
func TestAppsList(t *testing.T) {
289287
t.Parallel()
290288

291-
expected := []api.App{
292-
{
293-
ID: "example-go",
294-
Created: "2014-01-01T00:00:00UTC",
295-
Owner: "test",
296-
Updated: "2014-01-01T00:00:00UTC",
297-
URL: "example-go.example.com",
298-
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
299-
},
300-
}
301-
302289
handler := fakeHTTPServer{}
303290
server := httptest.NewServer(&handler)
304291
defer server.Close()
@@ -309,6 +296,17 @@ func TestAppsList(t *testing.T) {
309296
t.Fatal(err)
310297
}
311298

299+
expected := []api.App{
300+
{
301+
ID: "example-go",
302+
Created: "2014-01-01T00:00:00UTC",
303+
Owner: "test",
304+
Updated: "2014-01-01T00:00:00UTC",
305+
URL: fmt.Sprintf("example-go.%s", u.Host),
306+
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
307+
},
308+
}
309+
312310
httpClient := client.CreateHTTPClient(false)
313311

314312
client := client.Client{HTTPClient: httpClient, ControllerURL: *u, Token: "abc"}

rootfs/api/models.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,6 @@ def save(self, **kwargs):
184184
def __str__(self):
185185
return self.id
186186

187-
@property
188-
def url(self):
189-
return self.id + '.' + settings.DEIS_DOMAIN
190-
191187
def _get_job_id(self, container_type):
192188
app = self.id
193189
release = self.release_set.latest()

rootfs/api/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class AppSerializer(serializers.ModelSerializer):
131131
class Meta:
132132
"""Metadata options for a :class:`AppSerializer`."""
133133
model = models.App
134-
fields = ['uuid', 'id', 'owner', 'url', 'structure', 'created', 'updated']
134+
fields = ['uuid', 'id', 'owner', 'structure', 'created', 'updated']
135135
read_only_fields = ['uuid']
136136

137137

rootfs/api/tests/test_app.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,10 @@ def test_response_data(self):
6060
content_type='application/json',
6161
HTTP_AUTHORIZATION='token {}'.format(self.token))
6262
for key in response.data:
63-
self.assertIn(key, ['uuid', 'created', 'updated', 'id', 'owner', 'url', 'structure'])
63+
self.assertIn(key, ['uuid', 'created', 'updated', 'id', 'owner', 'structure'])
6464
expected = {
6565
'id': 'test',
6666
'owner': self.user.username,
67-
'url': 'test.deisapp.local',
6867
'structure': {}
6968
}
7069
self.assertDictContainsSubset(expected, response.data)

rootfs/api/tests/test_hooks.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ def test_build_hook(self):
113113
self.assertEqual(response.status_code, 200)
114114
self.assertIn('release', response.data)
115115
self.assertIn('version', response.data['release'])
116-
self.assertIn('domains', response.data)
117116

118117
def test_build_hook_procfile(self):
119118
"""Test creating a Procfile build via an API Hook"""
@@ -139,7 +138,6 @@ def test_build_hook_procfile(self):
139138
self.assertEqual(response.status_code, 200)
140139
self.assertIn('release', response.data)
141140
self.assertIn('version', response.data['release'])
142-
self.assertIn('domains', response.data)
143141
# make sure build fields were populated
144142
url = '/v2/apps/{app_id}/builds'.format(**locals())
145143
response = self.client.get(url, HTTP_AUTHORIZATION='token {}'.format(self.token))
@@ -183,7 +181,6 @@ def test_build_hook_dockerfile(self):
183181
self.assertEqual(response.status_code, 200)
184182
self.assertIn('release', response.data)
185183
self.assertIn('version', response.data['release'])
186-
self.assertIn('domains', response.data)
187184
# make sure build fields were populated
188185
url = '/v2/apps/{app_id}/builds'.format(**locals())
189186
response = self.client.get(url, HTTP_AUTHORIZATION='token {}'.format(self.token))

rootfs/api/views.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,7 @@ def create(self, request, *args, **kwargs):
405405
request.data['owner'] = self.user
406406
super(BuildHookViewSet, self).create(request, *args, **kwargs)
407407
# return the application databag
408-
response = {'release': {'version': app.release_set.latest().version},
409-
'domains': ['.'.join([app.id, settings.DEIS_DOMAIN])]}
408+
response = {'release': {'version': app.release_set.latest().version}}
410409
return Response(response, status=status.HTTP_200_OK)
411410

412411
def post_save(self, build):

rootfs/bin/boot

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ etcd_safe_mkdir /deis/platform
6464
etcd_safe_mkdir /deis/scheduler
6565
etcd_safe_mkdir /deis/services
6666

67-
# HACK: set up keys for platform
68-
etcd_safe_mkdir /deis/platform
69-
ETCD_PATH=/deis/platform etcd_set_default domain localhost
70-
7167
# wait for confd to run once and install initial templates
7268
until confd -onetime -node "$ETCD" --confdir /app --log-level error; do
7369
echo "controller: waiting for confd to write initial templates..."

rootfs/deis/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@
274274
# default deis settings
275275
LOG_LINES = 1000
276276
TEMPDIR = tempfile.mkdtemp(prefix='deis')
277-
DEIS_DOMAIN = 'deisapp.local'
278277

279278
# standard datetime format used for logging, model timestamps, etc.
280279
DEIS_DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S%Z'

0 commit comments

Comments
 (0)