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:
parent
62b5ca9ad8
commit
9c53503051
40
conf/zuul/components/Preview.dhall
Normal file
40
conf/zuul/components/Preview.dhall
Normal 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)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
@ -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
|
||||
|
@ -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
|
||||
)
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ merger:
|
||||
scheduler:
|
||||
config:
|
||||
secretName: zuul-yaml-conf
|
||||
preview:
|
||||
count: 0
|
||||
registry:
|
||||
count: 0
|
||||
launcher:
|
||||
|
@ -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
|
||||
|
@ -14,5 +14,6 @@ cert_manager: "{{ (raw_spec['withCertManager'] | default(true)) | bool }}"
|
||||
spec_defaults:
|
||||
web: {}
|
||||
registry: {}
|
||||
preview: {}
|
||||
externalConfig: {}
|
||||
withCertManager: true
|
||||
|
Loading…
Reference in New Issue
Block a user