Skip to content

Commit 7851c0c

Browse files
committed
chore(python): bump python 3.12
1 parent ca2d8af commit 7851c0c

37 files changed

Lines changed: 236 additions & 213 deletions

charts/controller/templates/controller-api-deployment.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,3 @@ spec:
8484
name: http
8585
{{- include "controller.limits" . | indent 8 }}
8686
{{- include "controller.envs" . | indent 8 }}
87-
volumeMounts:
88-
- name: controller-config
89-
readOnly: false
90-
mountPath: /etc/controller
91-
volumes:
92-
- name: controller-config
93-
configMap:
94-
name: controller-config

charts/controller/templates/controller-cronjob-daily.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
spec:
1717
template:
1818
metadata:
19-
labels:
19+
labels: {{- include "common.labels.standard" . | nindent 12 }}
2020
app: drycc-controller-conjob
2121
spec:
2222
restartPolicy: OnFailure

charts/controller/templates/controller-cronjob-hourly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
spec:
1717
template:
1818
metadata:
19-
labels:
19+
labels: {{- include "common.labels.standard" . | nindent 12 }}
2020
app: drycc-controller-conjob
2121
spec:
2222
restartPolicy: OnFailure

charts/controller/templates/controller-job-init.yaml renamed to charts/controller/templates/controller-job-upgrade.yaml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
apiVersion: batch/v1
22
kind: Job
33
metadata:
4-
name: drycc-controller-job-init
4+
name: drycc-controller-job-upgrade
5+
labels:
6+
heritage: drycc
7+
annotations:
8+
component.drycc.cc/version: {{ .Values.imageTag }}
59
spec:
610
template:
11+
metadata:
12+
labels: {{- include "common.labels.standard" . | nindent 8 }}
13+
app: drycc-controller-job-upgrade
714
spec:
815
initContainers:
9-
- name: drycc-controller-job-init
16+
- name: drycc-controller-job-upgrade-init
1017
image: {{.Values.imageRegistry}}/{{.Values.imageOrg}}/python-dev:latest
1118
imagePullPolicy: {{.Values.imagePullPolicy}}
1219
args:
@@ -15,10 +22,10 @@ spec:
1522
- -u
1623
- $(DRYCC_DATABASE_URL),$(DRYCC_DATABASE_REPLICA_URL),$(DRYCC_RABBITMQ_URL)
1724
- -a
18-
- $(DRYCC_REDIS_ADDRS),$(DRYCC_CONTROLLER_API_SERVICE_HOST):$(DRYCC_CONTROLLER_API_SERVICE_PORT)
19-
{{- include "controller.envs" . | indent 6 }}
25+
- $(DRYCC_REDIS_ADDRS)
26+
{{- include "controller.envs" . | indent 8 }}
2027
containers:
21-
- name: drycc-controller-job-init
28+
- name: drycc-controller-job-upgrade
2229
image: {{.Values.imageRegistry}}/{{.Values.imageOrg}}/controller:{{.Values.imageTag}}
2330
imagePullPolicy: {{.Values.imagePullPolicy}}
2431
{{- if .Values.diagnosticMode.enabled }}
@@ -37,6 +44,14 @@ spec:
3744
python -u /workspace/manage.py cluster_lock unlock
3845
{{- end }}
3946
{{- include "controller.envs" . | indent 8 }}
47+
volumeMounts:
48+
- name: controller-config
49+
readOnly: false
50+
mountPath: /etc/controller
51+
volumes:
52+
- name: controller-config
53+
configMap:
54+
name: controller-config
4055
restartPolicy: Never
4156
backoffLimit: 0
4257
ttlSecondsAfterFinished: 3600

rootfs/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM registry.drycc.cc/drycc/base:${CODENAME}
44
ENV DRYCC_UID=1001 \
55
DRYCC_GID=1001 \
66
DRYCC_HOME_DIR=/workspace \
7-
PYTHON_VERSION="3.11"
7+
PYTHON_VERSION="3.12"
88

99
RUN groupadd drycc --gid ${DRYCC_GID} \
1010
&& useradd drycc -u ${DRYCC_UID} -g ${DRYCC_GID} -s /bin/bash -m -d ${DRYCC_HOME_DIR}

rootfs/Dockerfile.test

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ COPY requirements.txt ${DRYCC_HOME_DIR}/requirements.txt
77
COPY dev_requirements.txt ${DRYCC_HOME_DIR}/dev_requirements.txt
88

99
ENV PGDATA="/opt/drycc/postgresql/data" \
10-
PYTHON_VERSION="3.11" \
11-
REDIS_VERSION="7.0.11" \
12-
RABBITMQ_VERSION="3.12.0" \
13-
POSTGRES_VERSION="15.3" \
14-
GOSU_VERSION="1.16"
10+
PYTHON_VERSION="3.12" \
11+
REDIS_VERSION="7.2.4" \
12+
RABBITMQ_VERSION="3.12.13" \
13+
POSTGRES_VERSION="15.5" \
14+
GOSU_VERSION="1.17"
1515

1616
RUN buildDeps='gcc rustc cargo libffi-dev musl-dev openssl'; \
1717
install-packages mercurial ca-certificates git $buildDeps \

rootfs/api/management/commands/cluster_lock.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ def add_arguments(self, parser):
2020
)
2121

2222
def lock(self):
23-
cache.set(lock_key, settings.VERSION)
23+
cache.delete(lock_key)
2424
print("lock completed!")
2525

2626
def unlock(self):
27-
cache.delete(lock_key)
27+
cache.set(lock_key, settings.VERSION)
2828
print("unlock completed!")
2929

3030
def waitting(self):
3131
while True:
32-
version = cache.get("drycc:controller:version")
32+
version = cache.get(lock_key, None)
3333
if version != settings.VERSION:
3434
print(waitting_init_msg % (version, settings.VERSION))
3535
else:

rootfs/api/models/appsettings.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from .base import UuidAuditedModel
1010

1111
User = get_user_model()
12+
logger = logging.getLogger(__name__)
1213

1314

1415
class AppSettings(UuidAuditedModel):
@@ -35,6 +36,17 @@ def __init__(self, *args, **kwargs):
3536
def __str__(self):
3637
return "{}-{}".format(self.app.id, str(self.uuid)[:7])
3738

39+
def log(self, message, level=logging.INFO):
40+
"""Logs a message in the context of this application.
41+
42+
This prefixes log messages with an application "tag" that the customized
43+
drycc-logspout will be on the lookout for. When it's seen, the message-- usually
44+
an application event of some sort like releasing or scaling, will be considered
45+
as "belonging" to the application instead of the controller and will be handled
46+
accordingly.
47+
"""
48+
logger.log(level, "[{}]: {}".format(self.app.id, message))
49+
3850
def previous(self):
3951
"""
4052
Return the previous Release to this one.
@@ -167,7 +179,7 @@ def _update_fields(self, ignore_update_fields=None):
167179
self.delete()
168180
raise AlreadyExists("{} changed nothing".format(self.owner))
169181
summary = ' '.join(self.summary)
170-
self.app.log('summary of app setting changes: {}'.format(summary), logging.DEBUG)
182+
self.log('summary of app setting changes: {}'.format(summary), logging.DEBUG)
171183

172184
def diff_canaries(self):
173185
prev_app_settings = self.previous()

rootfs/api/models/release.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ def __str__(self):
4343
def image(self):
4444
return self.build.image
4545

46+
def log(self, message, level=logging.INFO):
47+
"""Logs a message in the context of this application.
48+
49+
This prefixes log messages with an application "tag" that the customized
50+
drycc-logspout will be on the lookout for. When it's seen, the message-- usually
51+
an application event of some sort like releasing or scaling, will be considered
52+
as "belonging" to the application instead of the controller and will be handled
53+
accordingly.
54+
"""
55+
logger.log(level, "[{}]: {}".format(self.app.id, message))
56+
4657
def new(self, user, config, build, summary=None, canary=False):
4758
"""
4859
Create a new application release using the provided Build and Config
@@ -69,7 +80,7 @@ def get_port(self):
6980
creds = self.get_registry_auth()
7081

7182
if self.build.type == "buildpack":
72-
self.app.log(
83+
self.log(
7384
'buildpack type detected. Defaulting to $PORT %s' % DEFAULT_CONTAINER_PORT)
7485
return DEFAULT_CONTAINER_PORT
7586

@@ -172,7 +183,7 @@ def cleanup_old(self): # noqa
172183
Stray pods no longer relevant to the latest release
173184
"""
174185
latest_version = 'v{}'.format(self.version)
175-
self.app.log(
186+
self.log(
176187
'Cleaning up RSs for releases older than {} (latest)'.format(latest_version),
177188
level=logging.DEBUG
178189
)
@@ -194,7 +205,7 @@ def cleanup_old(self): # noqa
194205
replica_sets_removal.append(current_version)
195206

196207
if replica_sets_removal:
197-
self.app.log(
208+
self.log(
198209
'Found the following versions to cleanup: {}'.format(', '.join(replica_sets_removal)), # noqa
199210
level=logging.DEBUG
200211
)
@@ -260,7 +271,7 @@ def _cleanup_deployment_secrets_and_configs(self, namespace):
260271
# http://kubernetes.io/docs/user-guide/labels/#set-based-requirement
261272
'version__notin': versions
262273
}
263-
self.app.log('Cleaning up orphaned env var secrets for application {}'.format(namespace), level=logging.DEBUG) # noqa
274+
self.log('Cleaning up orphaned env var secrets for application {}'.format(namespace), level=logging.DEBUG) # noqa
264275
secrets = self.scheduler().secret.get(namespace, labels=labels).json()['items']
265276
if not secrets:
266277
secrets = []

rootfs/api/models/resource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def log(self, message, level=logging.INFO):
117117
as "belonging" to the application instead of the controller and will be handled
118118
accordingly.
119119
"""
120-
logger.log(level, "[{}]: {}".format(self.uuid, message))
120+
logger.log(level, "[{}]: {}".format(self.app.id, message))
121121

122122
def bind(self, *args, **kwargs):
123123
if self.status != "Ready":

0 commit comments

Comments
 (0)