-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/scaleway: add kubernetes deployment to run in repair mode
Adds a daemon mode to the command. Updates golang/go#21238. Change-Id: Iab76a2fbe4263e21f925571b2f3bfc6d22f1fe5e Reviewed-on: https://go-review.googlesource.com/52270 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
- Loading branch information
Showing
7 changed files
with
129 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
scaleway | ||
ca-certificates.crt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright 2017 The Go Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
FROM scratch | ||
LABEL maintainer "golang-dev@googlegroups.com" | ||
|
||
COPY ca-certificates.crt /etc/ssl/certs/ | ||
COPY scaleway / | ||
ENTRYPOINT ["/scaleway"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2017 The Go Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
|
||
FROM golang:1.8 | ||
LABEL maintainer "golang-dev@googlegroups.com" | ||
|
||
# BEGIN deps (run `make update-deps` to update) | ||
|
||
# Repo go4.org at 034d17a (2017-05-25) | ||
ENV REV=034d17a462f7b2dcd1a4a73553ec5357ff6e6c6e | ||
RUN go get -d go4.org/types &&\ | ||
(cd /go/src/go4.org && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV) | ||
|
||
# Optimization to speed up iterative development, not necessary for correctness: | ||
RUN go install go4.org/types | ||
# END deps. | ||
|
||
COPY . /go/src/golang.org/x/build/ | ||
|
||
RUN go install -ldflags "-linkmode=external -extldflags '-static -pthread' -X 'main.Version=$version'" golang.org/x/build/cmd/scaleway |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2017 The Go Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
|
||
VERSION=latest | ||
DOCKER_IMAGE_build0=build0/scaleway:latest | ||
DOCKER_CTR_build0=scaleway-build0 | ||
|
||
build0: *.go Dockerfile.0 | ||
docker build --force-rm -f Dockerfile.0 --tag=$(DOCKER_IMAGE_build0) ../.. | ||
|
||
scaleway: build0 | ||
docker create --name $(DOCKER_CTR_build0) $(DOCKER_IMAGE_build0) | ||
docker cp $(DOCKER_CTR_build0):/go/bin/$@ $@ | ||
docker rm $(DOCKER_CTR_build0) | ||
|
||
ca-certificates.crt: | ||
docker create --name $(DOCKER_CTR_build0) $(DOCKER_IMAGE_build0) | ||
docker cp $(DOCKER_CTR_build0):/etc/ssl/certs/$@ $@ | ||
docker rm $(DOCKER_CTR_build0) | ||
|
||
update-deps: | ||
go install golang.org/x/build/cmd/gitlock | ||
gitlock --update=Dockerfile.0 golang.org/x/build/cmd/scaleway | ||
|
||
docker-prod: Dockerfile scaleway ca-certificates.crt | ||
docker build --force-rm --tag=gcr.io/symbolic-datum-552/scaleway:$(VERSION) . | ||
docker-dev: Dockerfile scaleway ca-certificates.crt | ||
docker build --force-rm --tag=gcr.io/go-dashboard-dev/scaleway:latest . | ||
|
||
push-prod: docker-prod | ||
gcloud docker -- push gcr.io/symbolic-datum-552/scaleway:$(VERSION) | ||
push-dev: docker-dev | ||
gcloud docker -- push gcr.io/go-dashboard-dev/scaleway:latest | ||
|
||
.PHONY: clean | ||
clean: | ||
$(RM) scaleway | ||
$(RM) ca-certificates.crt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
The scaleway command creates ARM servers on Scaleway.com. | ||
|
||
The Makefile, Dockerfiles, and kubernetes deployment file | ||
are for running the command in daemon mode for server repair. | ||
This will check on Scaleway and restart down or wedged instances. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment # TODO(jessfraz): make this a cronjob once out of k8s alpha and remove daemon mode | ||
metadata: | ||
name: scaleway-deployment | ||
spec: | ||
replicas: 1 # more than one will create a race with creating new servers | ||
template: | ||
metadata: | ||
labels: | ||
app: scaleway | ||
annotations: | ||
container.seccomp.security.alpha.kubernetes.io/scaleway: docker/default | ||
container.apparmor.security.beta.kubernetes.io/scaleway: runtime/default | ||
spec: | ||
volumes: | ||
- name: secrets-volume | ||
secret: | ||
secretName: scaleway-secrets # http://go/golang-k8s-scaleway-secret | ||
items: | ||
- key: scalewayToken | ||
path: go-scaleway.token | ||
- key: masterKey | ||
path: gobuilder-master.key | ||
containers: | ||
- name: scaleway | ||
image: gcr.io/symbolic-datum-552/scaleway:latest | ||
imagePullPolicy: Always | ||
command: ["/scaleway", "-daemon"] | ||
volumeMounts: | ||
- name: secrets-volume | ||
mountPath: /keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters