Add zuul-preview service

This change adds an optional preview configuration to the spec:

  preview:
    image: docker.io/zuul/zuul-preview:latest
    count: 0

Change-Id: Id9d902b3b9f25b1bf3fa459634396d7520681417
This commit is contained in:
Tristan Cacqueray 2020-04-08 12:19:34 +00:00
parent 62b5ca9ad8
commit 9c53503051
6 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,40 @@
let Kubernetes = ../../Kubernetes.dhall
let F = ../functions.dhall
let InputPreview = (../input.dhall).Preview.Type
in \(app-name : Text)
-> \(image-name : Optional Text)
-> \(data-dir : List F.Volume.Type)
-> \(input-preview : InputPreview)
-> F.KubernetesComponent::{
, Service = Some (F.mkService app-name "preview" "preview" 80)
, Deployment = Some
( F.mkDeployment
app-name
F.Component::{
, name = "preview"
, count = F.defaultNat input-preview.count 0
, data-dir = data-dir
, container = Kubernetes.Container::{
, name = "preview"
, image = image-name
, imagePullPolicy = Some "IfNotPresent"
, ports = Some
[ Kubernetes.ContainerPort::{
, name = Some "preview"
, containerPort = 80
}
]
, env = Some
[ Kubernetes.EnvVar::{
, name = "ZUUL_API_URL"
, value = Some "http://web:9000"
}
]
, volumeMounts = Some (F.mkVolumeMount data-dir)
}
}
)
}

View File

@ -97,6 +97,10 @@ let Schemas =
, public-url = None Text
}
}
, Preview =
{ Type = { image : Optional Text, count : Optional Natural }
, default = { image = None Text, count = None Natural }
}
, Launcher =
{ Type = { image : Optional Text, config : UserSecret }
, default.image = None Text
@ -143,6 +147,7 @@ let Input =
, web : Schemas.Web.Type
, scheduler : Schemas.Scheduler.Type
, registry : Schemas.Registry.Type
, preview : Schemas.Preview.Type
, launcher : Schemas.Launcher.Type
, database : Optional UserSecret
, zookeeper : Optional UserSecret
@ -159,6 +164,7 @@ let Input =
, web = Schemas.Web.default
, scheduler = Schemas.Scheduler.default
, registry = Schemas.Registry.default
, preview = Schemas.Preview.default
, executor = Schemas.Executor.default
, launcher = Schemas.Launcher.default
, connections = Schemas.Connections.default

View File

@ -390,6 +390,12 @@ in \(input : Input)
zuul-data-dir
[ etc-zuul-registry ]
input.registry
, Preview =
./components/Preview.dhall
input.name
(zuul-image "preview")
zuul-data-dir
input.preview
}
, Nodepool =
let nodepool-image =
@ -586,6 +592,7 @@ in \(input : Input)
# mkUnion Components.Zuul.Web
# mkUnion Components.Zuul.Merger
# mkUnion Components.Zuul.Registry
# mkUnion Components.Zuul.Preview
# mkUnion Components.Nodepool.Launcher
)
}

View File

@ -13,6 +13,8 @@ merger:
scheduler:
config:
secretName: zuul-yaml-conf
preview:
count: 0
registry:
count: 0
launcher:

View File

@ -134,6 +134,8 @@
key: kube.config
registry:
count: 1
preview:
count: 1
withCertManager: "{{ withCertManager }}"
- name: Wait maximum 4 minutes for the scheduler deployment
@ -172,6 +174,18 @@
command: kubectl get Issuers zuul-ca -o yaml
when: withCertManager
- name: Test the preview service
block:
- name: Get preview service ip
command: kubectl get svc preview -o "jsonpath={.spec.clusterIP}"
register: _preview_ip
- name: Connect to the preview service
uri:
url: "http://{{ _preview_ip.stdout_lines[0] }}"
method: POST
status_code: 403
- name: Test the registry
block:
- name: Get registry service ip

View File

@ -14,5 +14,6 @@ cert_manager: "{{ (raw_spec['withCertManager'] | default(true)) | bool }}"
spec_defaults:
web: {}
registry: {}
preview: {}
externalConfig: {}
withCertManager: true