Skip to content

Commit 8404fd6

Browse files
committed
chore(controller): use env replace creds volume
1 parent cfcfa6f commit 8404fd6

4 files changed

Lines changed: 4 additions & 46 deletions

File tree

charts/controller/templates/_helpers.tpl

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
{{/* Generate controller deployment envs */}}
2-
{{- define "controller.envs" -}}
3-
{{ $redisNodeCount := .Values.redis.replicas | int }}
2+
{{- define "controller.envs" }}
43
env:
54
- name: REGISTRATION_MODE
65
value: {{ .Values.registrationMode }}
7-
# NOTE(bacongobbler): use drycc/registry_proxy to work around Docker --insecure-registry requirements
8-
- name: "DRYCC_REGISTRY_PROXY_HOST"
9-
value: "127.0.0.1"
106
# Environmental variable value for $INGRESS_CLASS
117
- name: "DRYCC_INGRESS_CLASS"
128
value: "{{ .Values.global.ingressClass }}"
139
- name: "DRYCC_PLATFORM_DOMAIN"
1410
value: "{{ .Values.global.platformDomain }}"
1511
- name: "K8S_API_VERIFY_TLS"
1612
value: "{{ .Values.k8sApiVerifyTls }}"
17-
- name: "DRYCC_REGISTRY_PROXY_PORT"
18-
value: "{{ .Values.global.registryProxyPort }}"
1913
- name: "DRYCC_REGISTRY_LOCATION"
2014
value: "{{ .Values.global.registryLocation }}"
2115
- name: "DRYCC_REGISTRY_SECRET_PREFIX"
@@ -75,16 +69,11 @@ env:
7569
valueFrom:
7670
fieldRef:
7771
fieldPath: metadata.namespace
78-
{{- if eq .Values.global.redisLocation "on-cluster"}}
79-
- name: DRYCC_REDIS_ADDRS
80-
value: "{{range $i := until $redisNodeCount}}drycc-redis-{{$i}}.drycc-redis.{{$.Release.Namespace}}.svc.{{$.Values.global.clusterDomain}}:6379{{if lt (add 1 $i) $redisNodeCount}},{{end}}{{end}}"
81-
{{- else if eq .Values.global.redisLocation "off-cluster" }}
8272
- name: DRYCC_REDIS_ADDRS
8373
valueFrom:
8474
secretKeyRef:
8575
name: redis-creds
8676
key: addrs
87-
{{- end }}
8877
- name: DRYCC_REDIS_PASSWORD
8978
valueFrom:
9079
secretKeyRef:

rootfs/api/models/release.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,34 +39,7 @@ def __str__(self):
3939

4040
@property
4141
def image(self):
42-
if (settings.REGISTRY_LOCATION != 'on-cluster'):
43-
return self.build.image
44-
# Builder pushes to internal registry, exclude SHA based images from being returned
45-
registry = self.config.registry
46-
if (
47-
registry.get('username', None) and
48-
registry.get('password', None) and
49-
# SHA means it came from a git push (builder)
50-
not self.build.sha and
51-
# hostname tells Builder where to push images
52-
not registry.get('hostname', None)
53-
):
54-
return self.build.image
55-
56-
# return image if it is already in a registry, test host and then host + port
57-
if (
58-
self.build.image.startswith(settings.REGISTRY_HOST) or
59-
self.build.image.startswith(settings.REGISTRY_URL)
60-
):
61-
return self.build.image
62-
63-
# Sort out image information based on build type
64-
if self.build.type == 'dockerfile' or self.build.type == 'buildpack':
65-
# DockerFile or buildpack
66-
return '{}/{}:git-{}'.format(settings.REGISTRY_URL, self.app.id, str(self.build.sha))
67-
elif self.build.type == 'image':
68-
# Drycc Pull, docker image in local registry
69-
return self.build.image
42+
return self.build.image
7043

7144
def new(self, user, config, build, summary=None, source_version='latest'):
7245
"""

rootfs/api/settings/production.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,6 @@
390390
)
391391

392392
# registry settings
393-
REGISTRY_HOST = os.environ.get('DRYCC_REGISTRY_PROXY_HOST', '127.0.0.1')
394-
REGISTRY_PORT = os.environ.get('DRYCC_REGISTRY_PROXY_PORT', 5000)
395-
REGISTRY_URL = '{}:{}'.format(REGISTRY_HOST, REGISTRY_PORT)
396393
REGISTRY_LOCATION = os.environ.get('DRYCC_REGISTRY_LOCATION', 'on-cluster')
397394
REGISTRY_SECRET_PREFIX = os.environ.get('DRYCC_REGISTRY_SECRET_PREFIX', 'private-registry')
398395

rootfs/api/tests/test_build.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from django.contrib.auth import get_user_model
99
from django.core.cache import cache
10-
from django.conf import settings
1110
from django.test.utils import override_settings
1211
from unittest import mock
1312
from rest_framework.authtoken.models import Token
@@ -560,7 +559,7 @@ def test_build_image_in_registry(self, mock_requests):
560559

561560
# post an image as a build using registry hostname
562561
url = "/v2/apps/{app_id}/builds".format(**locals())
563-
image = '{}/autotest/example'.format(settings.REGISTRY_HOST)
562+
image = '127.0.0.1:5000/autotest/example'
564563
body = {'image': image, 'stack': 'container'}
565564
response = self.client.post(url, body)
566565
self.assertEqual(response.status_code, 201, response.data)
@@ -571,7 +570,7 @@ def test_build_image_in_registry(self, mock_requests):
571570

572571
# post an image as a build using registry hostname + port
573572
url = "/v2/apps/{app_id}/builds".format(**locals())
574-
image = '{}/autotest/example'.format(settings.REGISTRY_URL)
573+
image = '127.0.0.1:5000/autotest/example'
575574
body = {'image': image, 'stack': 'container'}
576575
response = self.client.post(url, body)
577576
self.assertEqual(response.status_code, 201, response.data)

0 commit comments

Comments
 (0)