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