outposts: make docker image prefix configurable
This commit is contained in:
parent
8a105cf5a0
commit
d21f187673
|
@ -18,3 +18,4 @@ data:
|
|||
ERROR_REPORTING__ENVIRONMENT: "{{ .Values.config.errorReporting.environment }}"
|
||||
ERROR_REPORTING__SEND_PII: "{{ .Values.config.errorReporting.sendPii }}"
|
||||
LOG_LEVEL: "{{ .Values.config.logLevel }}"
|
||||
OUTPOSTS__DOCKER_IMAGE_BASE: "{{ .Values.image.name_outposts }}"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
image:
|
||||
name: beryju/passbook
|
||||
name_static: beryju/passbook-static
|
||||
name_outposts: beryju/passbook # Prefix used for Outpost deployments, Outpost type and version is appended
|
||||
tag: 0.12.11-stable
|
||||
|
||||
serverReplicas: 1
|
||||
|
|
|
@ -21,6 +21,9 @@ error_reporting:
|
|||
environment: customer
|
||||
send_pii: false
|
||||
|
||||
outposts:
|
||||
docker_image_base: "beryju/passbook" # this is prepended to -proxy:version
|
||||
|
||||
passbook:
|
||||
avatars: gravatar # gravatar or none
|
||||
branding:
|
||||
|
|
|
@ -9,6 +9,7 @@ from docker.models.containers import Container
|
|||
from yaml import safe_dump
|
||||
|
||||
from passbook import __version__
|
||||
from passbook.lib.config import CONFIG
|
||||
from passbook.outposts.controllers.base import BaseController, ControllerException
|
||||
from passbook.outposts.models import (
|
||||
DockerServiceConnection,
|
||||
|
@ -25,8 +26,6 @@ class DockerController(BaseController):
|
|||
container: Container
|
||||
connection: DockerServiceConnection
|
||||
|
||||
image_base = "beryju/passbook"
|
||||
|
||||
def __init__(self, outpost: Outpost, connection: DockerServiceConnection) -> None:
|
||||
super().__init__(outpost, connection)
|
||||
try:
|
||||
|
@ -62,7 +61,8 @@ class DockerController(BaseController):
|
|||
return self.client.containers.get(container_name), False
|
||||
except NotFound:
|
||||
self.logger.info("Container does not exist, creating")
|
||||
image_name = f"{self.image_base}-{self.outpost.type}:{__version__}"
|
||||
image_prefix = CONFIG.y("outposts.docker_image_base")
|
||||
image_name = f"{image_prefix}-{self.outpost.type}:{__version__}"
|
||||
self.client.images.pull(image_name)
|
||||
return (
|
||||
self.client.containers.create(
|
||||
|
@ -137,11 +137,12 @@ class DockerController(BaseController):
|
|||
def get_static_deployment(self) -> str:
|
||||
"""Generate docker-compose yaml for proxy, version 3.5"""
|
||||
ports = [f"{x}:{x}" for _, x in self.deployment_ports.items()]
|
||||
image_prefix = CONFIG.y("outposts.docker_image_base")
|
||||
compose = {
|
||||
"version": "3.5",
|
||||
"services": {
|
||||
f"passbook_{self.outpost.type}": {
|
||||
"image": f"{self.image_base}-{self.outpost.type}:{__version__}",
|
||||
"image": f"{image_prefix}-{self.outpost.type}:{__version__}",
|
||||
"ports": ports,
|
||||
"environment": {
|
||||
"PASSBOOK_HOST": self.outpost.config.passbook_host,
|
||||
|
|
|
@ -17,6 +17,7 @@ from kubernetes.client import (
|
|||
)
|
||||
|
||||
from passbook import __version__
|
||||
from passbook.lib.config import CONFIG
|
||||
from passbook.outposts.controllers.k8s.base import (
|
||||
KubernetesObjectReconciler,
|
||||
NeedsUpdate,
|
||||
|
@ -30,8 +31,6 @@ if TYPE_CHECKING:
|
|||
class DeploymentReconciler(KubernetesObjectReconciler[V1Deployment]):
|
||||
"""Kubernetes Deployment Reconciler"""
|
||||
|
||||
image_base = "beryju/passbook"
|
||||
|
||||
outpost: Outpost
|
||||
|
||||
def __init__(self, controller: "KubernetesController") -> None:
|
||||
|
@ -68,6 +67,7 @@ class DeploymentReconciler(KubernetesObjectReconciler[V1Deployment]):
|
|||
container_ports.append(V1ContainerPort(container_port=port, name=port_name))
|
||||
meta = self.get_object_meta(name=self.name)
|
||||
secret_name = f"passbook-outpost-{self.controller.outpost.uuid.hex}-api"
|
||||
image_prefix = CONFIG.y("outposts.docker_image_base")
|
||||
return V1Deployment(
|
||||
metadata=meta,
|
||||
spec=V1DeploymentSpec(
|
||||
|
@ -79,7 +79,7 @@ class DeploymentReconciler(KubernetesObjectReconciler[V1Deployment]):
|
|||
containers=[
|
||||
V1Container(
|
||||
name=str(self.outpost.type),
|
||||
image=f"{self.image_base}-{self.outpost.type}:{__version__}",
|
||||
image=f"{image_prefix}-{self.outpost.type}:{__version__}",
|
||||
ports=container_ports,
|
||||
env=[
|
||||
V1EnvVar(
|
||||
|
|
|
@ -13,6 +13,7 @@ This installation automatically applies database migrations on startup. After th
|
|||
image:
|
||||
name: beryju/passbook
|
||||
name_static: beryju/passbook-static
|
||||
name_outposts: beryju/passbook # Prefix used for Outpost deployments, Outpost type and version is appended
|
||||
tag: 0.12.11-stable
|
||||
|
||||
serverReplicas: 1
|
||||
|
|
Reference in a new issue