Skip to content

Commit

Permalink
boskos: Deploying a new Boskos janitor for AWS
Browse files Browse the repository at this point in the history
This patch deploys a new Boskos janitor as a service in the same cluster
running Prow. The new service is named `boskos-janitor-aws`.

Related to kubernetes-sigs/cluster-api-provider-aws#272 and
kubernetes-sigs/cluster-api-provider-aws#606.

/area boskos
  • Loading branch information
akutz committed Feb 26, 2019
1 parent f70ee9e commit dc73326
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 2 deletions.
11 changes: 10 additions & 1 deletion boskos/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ reaper:
janitor:
go build -o janitor/janitor k8s.io/test-infra/boskos/janitor/

janitor-aws:
$(MAKE) -C ../maintenance/aws-janitor/cmd/aws-janitor-boskos

metrics:
go build -o metrics/metrics k8s.io/test-infra/boskos/metrics/

Expand All @@ -53,6 +56,12 @@ janitor-image:
docker push "$(HUB)/janitor:$(TAG)"
rm janitor/janitor

janitor-aws-image: export DOCKER_OPTS=--no-cache
janitor-aws-image: export IMAGE=$(HUB)/janitor-aws
janitor-aws-image:
$(MAKE) -C ../maintenance/aws-janitor/cmd/aws-janitor-boskos image push
$(MAKE) -C ../maintenance/aws-janitor/cmd/aws-janitor-boskos clean

metrics-image:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o metrics/metrics k8s.io/test-infra/boskos/metrics/
docker build -t "$(HUB)/metrics:$(TAG)" metrics
Expand Down Expand Up @@ -81,4 +90,4 @@ update-config: get-cluster-credentials
get-cluster-credentials:
gcloud container clusters get-credentials "$(CLUSTER)" --project="$(PROJECT)" --zone="$(ZONE)"

.PHONY: boskos client reaper janitor metrics server-image reaper-image janitor-image metrics-image server-deployment reaper-deployment janitor-deployment metrics-deployment service update-config get-cluster-credentials
.PHONY: boskos client reaper janitor janitor-aws metrics server-image reaper-image janitor-image janitor-aws-image metrics-image server-deployment reaper-deployment janitor-deployment metrics-deployment service update-config get-cluster-credentials
22 changes: 21 additions & 1 deletion boskos/janitor/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,24 @@ spec:
- name: service
secret:
secretName: service-account

---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: boskos-janitor-aws
labels:
app: boskos-janitor-aws
namespace: test-pods
spec:
replicas: 4 # 4 distributed janitor instances
template:
metadata:
labels:
app: boskos-janitor-aws
spec:
terminationGracePeriodSeconds: 300
containers:
- name: boskos-janitor-aws
image: akutz/boskos-janitor-aws:v20190226-99e2515db
args:
- --boskos-url=http://boskos.test-pods.svc.cluster.local.
1 change: 1 addition & 0 deletions maintenance/aws-janitor/cmd/aws-janitor-boskos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/aws-janitor-boskos
25 changes: 25 additions & 0 deletions maintenance/aws-janitor/cmd/aws-janitor-boskos/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2019 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM debian:stretch-20190204-slim

RUN apt-get -y update && \
apt-get -y install ca-certificates && \
update-ca-certificates && \
rm -rf /var/lib/apt/lists/*

COPY aws-janitor-boskos /usr/local/bin/

CMD ["aws-janitor-boskos"]
ENTRYPOINT ["/bin/bash", "-c"]
41 changes: 41 additions & 0 deletions maintenance/aws-janitor/cmd/aws-janitor-boskos/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2019 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

PROGRAM ?= aws-janitor-boskos
HUB ?= gcr.io/k8s-testimages
IMAGE ?= $(HUB)/$(notdir $(PROGRAM))
TAG ?= $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)

GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)

build: $(PROGRAM)
$(PROGRAM):
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o "$@"

image:
GOOS=linux GOARCH=amd64 $(MAKE) --always-make build
docker build $(DOCKER_OPTS) -t "$(IMAGE):$(TAG)" .

push: image
docker push "$(IMAGE):$(TAG)"

push-latest: push
docker tag "$(IMAGE):$(TAG)" "$(IMAGE):latest"
docker push "$(IMAGE):latest"

clean:
rm -f $(PROGRAM)

.PHONY: clean image push push-latest

0 comments on commit dc73326

Please sign in to comment.