Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ci-pr deployment #75

Merged
merged 2 commits into from
Nov 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions deployments/with-creds/ci-pr/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: ci
apiVersion: v1
version: 0.1.1
appVersion: 0.0.139
description: A Concourse deployment used by Concourse to ship Concourse
maintainers:
- name: cirocosta
email: [email protected]
- name: kmannem
email: [email protected]
- name: svohra
email: [email protected]
32 changes: 32 additions & 0 deletions deployments/with-creds/ci-pr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ci-pr

The `ci-pr` deployment deploys the workers used to run untrusted workloads that
when someeone pushes a PR to `concourse/concourse`.

It relies solely on the [Concourse chart](https://github.com/concourse/concourse-chart).


## Restrictions

Being a deployment that's supposed to accept untrusted workloads (from community
PRs), network constraints are set to this deployment - see [`NetworkPolicy`].

[`NetworkPolicy`]: ./templates/network-policy.yaml


## Deploying

To deploy these workers, run `make deploy-ci-pr` from `/deployments/with-creds`.

If you want to force a rolling update (recreate all pods), say after updating
secrets, increment the `rollingUpdate` annotation declared in [`values.yaml`].

[`values.yaml`]: ./values.yaml


## Debugging

Metrics, logs, and debug endpoints work the same as for the [`ci`] deployment.
Check that deployment's README to know more.

[`ci`]: ../ci
6 changes: 6 additions & 0 deletions deployments/with-creds/ci-pr/requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: concourse
repository: https://kubernetes-charts.storage.googleapis.com/
version: 8.2.7
digest: sha256:cb825c3e6f195eb63ddf2401a73ce01bb9852d28cc8bb309b40e9f1393eaec00
generated: "2019-10-16T08:08:05.20907-04:00"
5 changes: 5 additions & 0 deletions deployments/with-creds/ci-pr/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
dependencies:
- name: concourse
version: 8.2.7
repository: https://kubernetes-charts.storage.googleapis.com/
1 change: 1 addition & 0 deletions deployments/with-creds/ci-pr/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Take off!
30 changes: 30 additions & 0 deletions deployments/with-creds/ci-pr/templates/network-policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: only-external
namespace: {{ .Release.Name }}
spec:
podSelector:
matchLabels:
release: {{ .Release.Name }}
policyTypes:
- Ingress
- Egress
ingress: [] # disallow any ingress
egress:
- ports: # allow dns
- port: 53
protocol: TCP
- port: 53
protocol: UDP
- to:
- namespaceSelector: # allow pods in `ci` namespace laeblled `ci-web`
matchLabels:
release: ci
podSelector:
matchLabels:
app: ci-web
- ipBlock:
cidr: 0.0.0.0/0 # allow any out
except:
- 10.0.0.0/8 # except internal comms
46 changes: 46 additions & 0 deletions deployments/with-creds/ci-pr/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
postgresql:
enabled: false

concourse:
image: concourse/concourse
imageDigest: sha256:e93a0149e3efe9186e403a188066c93a96ea2f223b24d49952275b63dc3e2c4d

postgresql:
enabled: false

web:
enabled: false

persistence:
worker:
storageClass: ssd
size: 750Gi

worker:
replicas: 3
terminationGracePeriodSeconds: 3600
livenessProbe:
periodSeconds: 60
failureThreshold: 10
timeoutSeconds: 45
nodeSelector: { cloud.google.com/gke-nodepool: ci-workers-pr }
hardAntiAffinity: true
env:
- name: CONCOURSE_GARDEN_NETWORK_POOL
value: "10.254.0.0/16"
- name: CONCOURSE_GARDEN_MAX_CONTAINERS
value: "500"
- name: CONCOURSE_GARDEN_DENY_NETWORK
value: "169.254.169.254/32"
resources:
limits: { cpu: 7500m, memory: 14Gi }
requests: { cpu: 0m, memory: 0Gi }

concourse:
worker:
rebalanceInterval: 2h
baggageclaim: { driver: overlay }
tag: "pr"
healthcheckTimeout: 40s
tsa:
hosts: ['ci-web.ci.svc.cluster.local:2222']
2 changes: 0 additions & 2 deletions deployments/with-creds/ci/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,3 @@ concourse:
rebalanceInterval: 2h
baggageclaim: { driver: overlay }
healthcheckTimeout: 40s
tsa:
hosts: ['ci-web.hush-house.svc.cluster.local:2222']
9 changes: 9 additions & 0 deletions terraform/cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ resource "google_container_cluster" "main" {
horizontal_pod_autoscaling {
disabled = false
}

network_policy_config {
disabled = false
}
}

master_auth {
Expand All @@ -54,6 +58,11 @@ resource "google_container_cluster" "main" {
start_time = "03:00"
}
}

network_policy {
provider = "CALICO"
enabled = true
}
}

resource "google_container_node_pool" "main" {
Expand Down
17 changes: 15 additions & 2 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module "cluster" {
machine-type = "n1-standard-4"
max = 5
min = 1
node_count = 3
node_count = 4
preemptible = false
version = "1.12.5-gke.5"
},
Expand All @@ -56,7 +56,7 @@ module "cluster" {
auto-upgrade = false
disk-size = "50"
disk-type = "pd-ssd"
image = "ubuntu"
image = "UBUNTU"
local-ssds = 0
machine-type = "custom-8-16384"
max = 20
Expand All @@ -80,6 +80,19 @@ module "cluster" {
version = "1.14.7-gke.14 "
},

"ci-workers-pr" = {
auto-upgrade = false
disk-size = "50"
disk-type = "pd-ssd"
image = "COS"
local-ssds = 0
machine-type = "custom-8-16384"
max = 10
min = 1
node_count = 3
preemptible = false
version = "1.14.7-gke.14 "
},
}
}

Expand Down