diff --git a/build/amis/README.md b/build/amis/README.md index baa0dd2220..a9a7d3e4d5 100644 --- a/build/amis/README.md +++ b/build/amis/README.md @@ -6,8 +6,18 @@ This directory contains tooling for building base images for use as nodes in Kub ### Prerequisites for all images -- [Packer](https://www.packer.io/docs/installation.html) +- [Packer](https://www.packer.io/intro/getting-started/install.html) - [Ansible](http://docs.ansible.com/ansible/latest/intro_installation.html) version >= 2.4.0.0 +- [goss](https://github.com/YaleUniversity/packer-provisioner-goss) + +#### Installing the goss plugin + +To install `packer-goss` plugin the following should be executed inside of the +`build/amis/packer` directory: + +```bash +make plugins +``` ### Prerequisites for Amazon Web Services @@ -21,8 +31,8 @@ This directory contains tooling for building base images for use as nodes in Kub The following variables can be overriden when building images using the `-var` option when calling `packer build`: | Variable | Default | Description | -| ---------------------- | --------- | ----------------------------- | -| kubernetes_version | 1.13.2-00 | Kubernetes Version to install | +|------------------------|-----------|-------------------------------| +| kubernetes_version | 1.13.3-00 | Kubernetes Version to install | | kubernetes_cni_version | 0.6.0-00 | CNI Version to install | For example, to build all images for use with Kubernetes 1.11.3 for build version 1: diff --git a/build/amis/ansible/ansible.cfg b/build/amis/ansible/ansible.cfg index 38fac81143..c0307c03ef 100644 --- a/build/amis/ansible/ansible.cfg +++ b/build/amis/ansible/ansible.cfg @@ -16,3 +16,6 @@ remote_tmp = /tmp/.ansible/ filter_plugins = ./filter_plugins retry_files_enabled = False + +[ssh_connection] +pipelining = True diff --git a/build/amis/ansible/roles/containerd/defaults/main.yml b/build/amis/ansible/roles/containerd/defaults/main.yml index ffe3363396..7c848b6c2c 100644 --- a/build/amis/ansible/roles/containerd/defaults/main.yml +++ b/build/amis/ansible/roles/containerd/defaults/main.yml @@ -12,5 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. --- -containerd_version: "1.2.1" -containerd_sha256: 329d44850685f8b511779c00763df50dd24257b3a1c594aff57e77bcee1b1269 +containerd_version: "1.2.4" +containerd_sha256: "3391758c62d17a56807ddac98b05487d9e78e5beb614a0602caab747b0eda9e0" \ No newline at end of file diff --git a/build/amis/packer/Makefile b/build/amis/packer/Makefile new file mode 100644 index 0000000000..ea7f1db329 --- /dev/null +++ b/build/amis/packer/Makefile @@ -0,0 +1,39 @@ +# 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. + +# If you update this file, please follow +# https://suva.sh/posts/well-documented-makefiles + +HOSTOS := $(shell go env GOHOSTOS) +HOSTARCH := $(shell go env GOARCH) +BINARYPATHPATTERN :=${HOSTOS}-${HOSTARCH} +VERSION := v0.3.0 + +PLUGINS_GOSS_URL := https://github.com/YaleUniversity/packer-provisioner-goss/releases/download/$(VERSION)/packer-provisioner-goss-$(VERSION)-$(BINARYPATHPATTERN) +PLUGINS_GOSS_SHA256-linux-amd64 := 28be39d0ddf9ad9c14e432818261abed2f2bd83257cfba213e19d5c59b710d03 +PLUGINS_GOSS_SHA256-darwin-amd64 := 7ae43b5dbd26a166c8673fc7299e91d1c2244c7d2b3b558ce04e2e53acfa6f88 + + +${HOME}/.packer.d/plugins/packer-provisioner-goss: + mkdir -p ${HOME}/.packer.d + mkdir -p ${HOME}/.packer.d/plugins + mkdir -p /tmp/packer-plugins + curl -L -o /tmp/packer-plugins/packer-provisioner-goss ${PLUGINS_GOSS_URL} + echo ${PLUGINS_GOSS_SHA256-$(BINARYPATHPATTERN)} */tmp/packer-plugins/packer-provisioner-goss > /tmp/packer-plugins/SHA256SUMS + shasum -c /tmp/packer-plugins/SHA256SUMS + mv /tmp/packer-plugins/packer-provisioner-goss ${HOME}/.packer.d/plugins + chmod +x ${HOME}/.packer.d/plugins/packer-provisioner-goss + +.PHONY: plugins +plugins: ${HOME}/.packer.d/plugins/packer-provisioner-goss diff --git a/build/amis/packer/base-images-us-east-1.json b/build/amis/packer/base-images-us-east-1.json index 08bd71c370..5d18028772 100644 --- a/build/amis/packer/base-images-us-east-1.json +++ b/build/amis/packer/base-images-us-east-1.json @@ -1,5 +1,5 @@ { - "ubuntu_18_04_ami": "ami-0ac019f4fcb7cb7e6", - "centos_7_ami": "ami-77ec9308", - "amazon_2_ami": "ami-04681a1dbd79675a5" -} \ No newline at end of file + "ubuntu_18_04_ami": "ami-0ac019f4fcb7cb7e6", + "centos_7_ami": "ami-77ec9308", + "amazon_2_ami": "ami-009d6802948d06e52" +} diff --git a/build/amis/packer/goss/goss.yaml b/build/amis/packer/goss/goss.yaml index 0928a07b7c..f434fc6cbd 100644 --- a/build/amis/packer/goss/goss.yaml +++ b/build/amis/packer/goss/goss.yaml @@ -1,9 +1,12 @@ package: -{{range $name, $vers := index .Vars "packages"}} - {{$name}}: + cloud-init: installed: true versions: - {{range $vers}} - - {{.}} - {{end}} -{{end}} \ No newline at end of file + - "{{ .Vars.cloud_init_version }}" +service: + containerd: + enabled: true + running: true +command: + crictl ps: + exit-status: 0 diff --git a/build/amis/packer/goss/redhat-vars.yaml b/build/amis/packer/goss/redhat-vars.yaml index 4496239eff..932732f632 100644 --- a/build/amis/packer/goss/redhat-vars.yaml +++ b/build/amis/packer/goss/redhat-vars.yaml @@ -1,3 +1 @@ -packages: - cloud-init: - - "18.3+52.gc5f78957" \ No newline at end of file +cloud_init_version: "18.3+52.gc5f78957" diff --git a/build/amis/packer/goss/ubuntu-vars.yaml b/build/amis/packer/goss/ubuntu-vars.yaml index cf3416869b..ca4efa67b2 100644 --- a/build/amis/packer/goss/ubuntu-vars.yaml +++ b/build/amis/packer/goss/ubuntu-vars.yaml @@ -1,3 +1 @@ -packages: - cloud-init: - - "18.3-52-gc5f78957-1~bddeb~18.04.1" \ No newline at end of file +cloud_init_version: "18.3-52-gc5f78957-1~bddeb~18.04.1" diff --git a/build/amis/packer/packer.json b/build/amis/packer/packer.json index ce3821a655..4a8459e2c1 100644 --- a/build/amis/packer/packer.json +++ b/build/amis/packer/packer.json @@ -3,7 +3,7 @@ "aws_access_key": "", "aws_secret_key": "", "build_timestamp": "{{timestamp}}", - "kubernetes_version": "1.13.2-00", + "kubernetes_version": "1.13.3-00", "kubernetes_cni_version": "0.6.0-00", "existing_ansible_ssh_args": "{{env `ANSIBLE_SSH_ARGS`}}", "ami_groups": "all", @@ -102,6 +102,7 @@ { "type": "goss", "vars_file": "goss/redhat-vars.yaml", + "use_sudo": true, "tests": [ "goss/goss.yaml" ], @@ -113,6 +114,7 @@ { "type": "goss", "vars_file": "goss/ubuntu-vars.yaml", + "use_sudo": true, "tests": [ "goss/goss.yaml" ], diff --git a/cmd/clusterctl/examples/aws/machines.yaml.template b/cmd/clusterctl/examples/aws/machines.yaml.template index 4bf4b845fd..113715e2dd 100644 --- a/cmd/clusterctl/examples/aws/machines.yaml.template +++ b/cmd/clusterctl/examples/aws/machines.yaml.template @@ -10,8 +10,8 @@ items: set: controlplane spec: versions: - kubelet: v1.13.2 - controlPlane: v1.13.2 + kubelet: v1.13.3 + controlPlane: v1.13.3 providerSpec: value: apiVersion: awsprovider/v1alpha1 @@ -28,7 +28,7 @@ items: set: node spec: versions: - kubelet: v1.13.2 + kubelet: v1.13.3 providerSpec: value: apiVersion: awsprovider/v1alpha1 diff --git a/docs/README.md b/docs/README.md index 6eb03f73b7..7ce4153031 100644 --- a/docs/README.md +++ b/docs/README.md @@ -5,7 +5,7 @@ - [Getting started](getting-started.md) - [List of AMIs](amis.md) - [Accessing cluster instances](accessing-instances.md) -- [Packer](packer.md) +- [Building AMIs with Packer](../build/amis/README.md) ## Development diff --git a/docs/amis.md b/docs/amis.md index b25f82c23c..ff2c5f1ab6 100644 --- a/docs/amis.md +++ b/docs/amis.md @@ -4,14 +4,14 @@ -- [Kubernetes Version v1.13.2](#kubernetes-version-v1132) +- [Kubernetes Version v1.13.3](#kubernetes-version-v1133) - [Amazon Linux 2](#amazon-linux-2) - [CentOS 7](#centos-7) - [Ubuntu 18.04 (Bionic)](#ubuntu-1804-bionic) -## Kubernetes Version v1.13.2 +## Kubernetes Version v1.13.3 ### Amazon Linux 2 diff --git a/docs/creating-multinode-controlplane-clusters.md b/docs/creating-multinode-controlplane-clusters.md index c0d1f9527a..5e45d7087f 100644 --- a/docs/creating-multinode-controlplane-clusters.md +++ b/docs/creating-multinode-controlplane-clusters.md @@ -28,8 +28,8 @@ Now that you have a cluster with a single instance control plane, more control p set: controlplane spec: versions: - kubelet: v1.13.2 - controlPlane: v1.13.2 + kubelet: v1.13.3 + controlPlane: v1.13.3 providerSpec: value: apiVersion: awsprovider/v1alpha1 diff --git a/docs/packer.md b/docs/packer.md deleted file mode 100644 index 088d942a46..0000000000 --- a/docs/packer.md +++ /dev/null @@ -1,33 +0,0 @@ -# Using Packer and baking AMIs - -## Overview - -[Packer](http://packer.io/) is well known tool for baking images of any kind. -We use it to bake our AMIs. - -## Prerequisites - -* `packer` binary -* [packer-goss](https://github.com/YaleUniversity/packer-provisioner-goss) plugin -* ansible - -## Plugin instalation - -To install `packer-goss` plugin the following should be executed inside of the -`build/amis/packer` directory: - -```bash -$ curl -o packer-goss https://github.com/YaleUniversity/packer-provisioner-goss/releases/download/v0.3.0/packer-provisioner-goss-v0.3.0-linux-amd64 - -$ chmod +x packer-goss -``` - -## Running Packer - -The following command should build all the AMIs: - -```bash -$ AWS_REGION=us-east-1 packer build -var-file=base-images-us-east-1.json packer.json -``` - -**NOTE** that AWS credentials have to be set. \ No newline at end of file