Skip to content

Commit 853341c

Browse files
committed
chore(docker): update docker client
1 parent 152012f commit 853341c

8 files changed

Lines changed: 13 additions & 16 deletions

File tree

charts/controller/templates/controller-deployment.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ spec:
6666
- name: "K8S_API_VERIFY_TLS"
6767
value: "{{ .Values.k8s_api_verify_tls }}"
6868
- name: "DRYCC_REGISTRY_PROXY_PORT"
69-
value: "{{ .Values.global.registry_service_port }}"
69+
value: "{{ .Values.global.registry_proxy_port }}"
7070
- name: "APP_STORAGE"
7171
value: "{{ .Values.global.storage}}"
7272
- name: "DRYCC_REGISTRY_LOCATION"
7373
value: "{{ .Values.global.registry_location }}"
74+
- name: "DRYCC_REGISTRY_SECRET_PREFIX"
75+
value: "{{ .Values.global.registry_secret_prefix }}"
7476
- name: "IMAGE_PULL_POLICY"
7577
value: "{{ .Values.app_pull_policy }}"
7678
- name: "TZ"

charts/controller/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ global:
4949
# - off-cluster: Use registry outside the Kubernetes cluster (example: dockerhub,quay.io,self-hosted)
5050
registry_location: "on-cluster"
5151
# The host port to which registry proxy binds to
52-
registry_service_port: 5555
52+
registry_proxy_port: 5555
53+
# Prefix for the imagepull secret created when using private registry
54+
registry_secret_prefix: "private-registry"
5355
# Role-Based Access Control for Kubernetes >= 1.5
5456
use_rbac: false
5557
# Please check `kubernetes.io/ingress.class`

rootfs/api/models/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import base64
33
from collections import OrderedDict
44
from datetime import datetime
5-
from docker.auth import auth as docker_auth
5+
from docker import auth as docker_auth
66
import functools
77
import json
88
import logging
@@ -1076,6 +1076,7 @@ def image_pull_secret(self, namespace, registry, image):
10761076
return name
10771077

10781078
def _get_private_registry_config(self, image, registry=None):
1079+
name = settings.REGISTRY_SECRET_PREFIX
10791080
if registry:
10801081
# try to get the hostname information
10811082
hostname = registry.get('hostname', None)

rootfs/api/settings/production.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@
341341
REGISTRY_PORT = os.environ.get('DRYCC_REGISTRY_PROXY_PORT', 5000)
342342
REGISTRY_URL = '{}:{}'.format(REGISTRY_HOST, REGISTRY_PORT)
343343
REGISTRY_LOCATION = os.environ.get('DRYCC_REGISTRY_LOCATION', 'on-cluster')
344+
REGISTRY_SECRET_PREFIX = os.environ.get('DRYCC_REGISTRY_SECRET_PREFIX', 'private-registry')
344345

345346
# logger settings
346347
LOGGER_HOST = os.environ.get('DRYCC_LOGGER_SERVICE_HOST', '127.0.0.1')

rootfs/api/tests/test_app.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -621,15 +621,6 @@ def test_get_private_registry_config(self, mock_requests):
621621
self.assertEqual(name, "private-registry")
622622
self.assertEqual(create, True)
623623

624-
@override_settings(REGISTRY_LOCATION="ecr")
625-
def test_get_private_registry_config_ecr(self, mock_requests):
626-
registry = {}
627-
image = "test.com/test/test"
628-
docker_config, name, create = App()._get_private_registry_config(image, registry)
629-
self.assertEqual(docker_config, None)
630-
self.assertEqual(name, "private-registry-ecr")
631-
self.assertEqual(create, False)
632-
633624
@override_settings(REGISTRY_LOCATION="off-cluster")
634625
def test_get_private_registry_config_off_cluster(self, mock_requests):
635626
registry = {}

rootfs/registry/dockerclient.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import docker
1212
import docker.constants
13-
from docker.auth import auth
13+
from docker import auth
1414
from docker.errors import APIError
1515
import requests
1616

@@ -26,7 +26,7 @@ class DockerClient(object):
2626

2727
def __init__(self):
2828
timeout = os.environ.get('DOCKER_CLIENT_TIMEOUT', docker.constants.DEFAULT_TIMEOUT_SECONDS)
29-
self.client = docker.Client(version='auto', timeout=timeout)
29+
self.client = docker.APIClient(version='auto', timeout=timeout)
3030
self.registry = settings.REGISTRY_HOST + ':' + str(settings.REGISTRY_PORT)
3131

3232
def login(self, repository, creds=None):

rootfs/registry/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from registry.dockerclient import DockerClient
1414

1515

16-
@mock.patch('docker.Client')
16+
@mock.patch('docker.APIClient')
1717
class DockerClientTest(unittest.TestCase):
1818
"""Test that the client makes appropriate Docker engine API calls."""
1919

rootfs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ django-auth-ldap==1.2.15
55
django-cors-middleware==1.3.1
66
django-guardian==1.4.9
77
djangorestframework==3.6.4
8-
docker-py==1.10.6
8+
docker==3.7.2
99
gunicorn==19.9.0
1010
idna==2.6
1111
jmespath==0.9.3

0 commit comments

Comments
 (0)