diff --git a/compose/kube-router-k8s-control-plane/docker-compose.yaml b/compose/kube-router-k8s-control-plane/docker-compose.yaml index cb207715..791bb13c 100644 --- a/compose/kube-router-k8s-control-plane/docker-compose.yaml +++ b/compose/kube-router-k8s-control-plane/docker-compose.yaml @@ -9,21 +9,21 @@ services: etcd: network_mode: "service:pause" - image: k8s.gcr.io/etcd:3.4.3 + image: k8s.gcr.io/etcd:3.4.9 command: etcd kube-apiserver: network_mode: "service:pause" - image: k8s.gcr.io/hyperkube:v1.17.2 + image: k8s.gcr.io/hyperkube:v1.18.8 command: kube-apiserver --etcd-servers http://127.0.0.1:2379 --address 0.0.0.0 --disable-admission-plugins=ServiceAccount --allow-privileged kube-controller-manager: network_mode: "service:pause" - image: k8s.gcr.io/hyperkube:v1.17.2 + image: k8s.gcr.io/hyperkube:v1.18.8 command: kube-controller-manager --master http://localhost:8080 --allocate-node-cidrs --cluster-cidr=10.CLUSTER.0.0/16 "Edit the CLUSTER placeholder first. Then, remove this line.": kube-scheduler: network_mode: "service:pause" - image: k8s.gcr.io/hyperkube:v1.17.2 + image: k8s.gcr.io/hyperkube:v1.18.8 command: kube-scheduler --master http://localhost:8080 diff --git a/compose/simple-k8s-control-plane/docker-compose.yaml b/compose/simple-k8s-control-plane/docker-compose.yaml index 7c370e7b..aabc0746 100644 --- a/compose/simple-k8s-control-plane/docker-compose.yaml +++ b/compose/simple-k8s-control-plane/docker-compose.yaml @@ -9,20 +9,20 @@ services: etcd: network_mode: "service:pause" - image: k8s.gcr.io/etcd:3.4.3 + image: k8s.gcr.io/etcd:3.4.9 command: etcd kube-apiserver: network_mode: "service:pause" - image: k8s.gcr.io/hyperkube:v1.17.2 + image: k8s.gcr.io/hyperkube:v1.18.8 command: kube-apiserver --etcd-servers http://127.0.0.1:2379 --address 0.0.0.0 --disable-admission-plugins=ServiceAccount kube-controller-manager: network_mode: "service:pause" - image: k8s.gcr.io/hyperkube:v1.17.2 + image: k8s.gcr.io/hyperkube:v1.18.8 command: kube-controller-manager --master http://localhost:8080 kube-scheduler: network_mode: "service:pause" - image: k8s.gcr.io/hyperkube:v1.17.2 + image: k8s.gcr.io/hyperkube:v1.18.8 command: kube-scheduler --master http://localhost:8080 diff --git a/prepare-vms/infra/scaleway b/prepare-vms/infra/scaleway new file mode 100644 index 00000000..7615e024 --- /dev/null +++ b/prepare-vms/infra/scaleway @@ -0,0 +1,5 @@ +INFRACLASS=scaleway +if ! [ -f ~/.config/scw/config.yaml ]; then + warn "~/.config/scw/config.yaml not found." + warn "Make sure that the scaleway CLI is installed and configured." +fi diff --git a/prepare-vms/lib/commands.sh b/prepare-vms/lib/commands.sh index 0918b101..1a190b7e 100644 --- a/prepare-vms/lib/commands.sh +++ b/prepare-vms/lib/commands.sh @@ -65,6 +65,14 @@ _cmd_deploy() { sleep 1 done" + # Special case for scaleway since it doesn't come with sudo + if [ "$INFRACLASS" = "scaleway" ]; then + pssh -l root " + grep DEBIAN_FRONTEND /etc/environment || echo DEBIAN_FRONTEND=noninteractive >> /etc/environment + grep cloud-init /etc/sudoers && rm /etc/sudoers + apt-get update && apt-get install sudo -y" + fi + # Copy settings and install Python YAML parser pssh -I tee /tmp/settings.yaml tags/$TAG/ips.txt +} + +infra_stop() { + for ID in $(scw_get_ids_by_tag $TAG); do + info "Scheduling deletion of instance $ID..." + scw instance server delete force-shutdown=true server-id=$ID & + done + info "Waiting for deletion to complete..." + wait +} + +scw_get_ids_by_tag() { + TAG=$1 + scw instance server list name=$TAG -o json | jq -r .[].id +} + +scw_get_ips_by_tag() { + TAG=$1 + scw instance server list name=$TAG -o json | jq -r .[].public_ip.address +} + +infra_opensg() { + die "unimplemented" +} + +infra_disableaddrchecks() { + die "unimplemented" +} diff --git a/prepare-vms/map-dns.py b/prepare-vms/map-dns.py index 698cad56..6dcdfc2c 100755 --- a/prepare-vms/map-dns.py +++ b/prepare-vms/map-dns.py @@ -1,21 +1,44 @@ #!/usr/bin/env python +""" +There are two ways to use this script: + +1. Pass a tag name as a single argument. +It will then take the clusters corresponding to that tag, and assign one +domain name per cluster. Currently it gets the domains from a hard-coded +path. There should be more domains than clusters. +Example: ./map-dns.py 2020-08-15-jp + +2. Pass a domain as the 1st argument, and IP addresses then. +It will configure the domain with the listed IP addresses. +Example: ./map-dns.py open-duck.site 1.2.3.4 2.3.4.5 3.4.5.6 + +In both cases, the domains should be configured to use GANDI LiveDNS. +""" import os import requests +import sys import yaml # configurable stuff domains_file = "../../plentydomains/domains.txt" config_file = os.path.join( os.environ["HOME"], ".config/gandi/config.yaml") -tag = "test" +tag = None apiurl = "https://dns.api.gandi.net/api/v5/domains" +if len(sys.argv) == 2: + tag = sys.argv[1] + domains = open(domains_file).read().split() + ips = open(f"tags/{tag}/ips.txt").read().split() + settings_file = f"tags/{tag}/settings.yaml" + clustersize = yaml.safe_load(open(settings_file))["clustersize"] +else: + domains = [sys.argv[1]] + ips = sys.argv[2:] + clustersize = len(ips) + # inferred stuff -domains = open(domains_file).read().split() apikey = yaml.safe_load(open(config_file))["apirest"]["key"] -ips = open(f"tags/{tag}/ips.txt").read().split() -settings_file = f"tags/{tag}/settings.yaml" -clustersize = yaml.safe_load(open(settings_file))["clustersize"] # now do the fucking work while domains and ips: diff --git a/slides/k8s/configuration.md b/slides/k8s/configuration.md index 4d5908c1..db5bbc09 100644 --- a/slides/k8s/configuration.md +++ b/slides/k8s/configuration.md @@ -210,6 +210,8 @@ (through files that get created in the container filesystem) +- That second link also includes a list of all the fields that can be used with the downward API + --- ## Environment variables, pros and cons diff --git a/slides/k8s/localkubeconfig.md b/slides/k8s/localkubeconfig.md index 6d96fd4b..0014c917 100644 --- a/slides/k8s/localkubeconfig.md +++ b/slides/k8s/localkubeconfig.md @@ -34,11 +34,11 @@ - Download the `kubectl` binary from one of these links: - [Linux](https://storage.googleapis.com/kubernetes-release/release/v1.15.3/bin/linux/amd64/kubectl) + [Linux](https://storage.googleapis.com/kubernetes-release/release/v1.18.8/bin/linux/amd64/kubectl) | - [macOS](https://storage.googleapis.com/kubernetes-release/release/v1.15.3/bin/darwin/amd64/kubectl) + [macOS](https://storage.googleapis.com/kubernetes-release/release/v1.18.8/bin/darwin/amd64/kubectl) | - [Windows](https://storage.googleapis.com/kubernetes-release/release/v1.15.3/bin/windows/amd64/kubectl.exe) + [Windows](https://storage.googleapis.com/kubernetes-release/release/v1.18.8/bin/windows/amd64/kubectl.exe) - On Linux and macOS, make the binary executable with `chmod +x kubectl`