Skip to content

Commit 0b8b993

Browse files
sfzyladk8s-ci-robot
authored andcommitted
Make sure ubuntu gets proper version of cloud-init (kubernetes-sigs#538)
* Make sure ubuntu gets proper version of cloud-init * Add Goss test * Use packer-goss provisioner to execute Goss tests * Add packer docs * Add link to packer documentation in README file. * Add link to packer-goss * Add Ansible as prerequisite for packer
1 parent b97293e commit 0b8b993

File tree

8 files changed

+81
-0
lines changed

8 files changed

+81
-0
lines changed

build/amis/ansible/roles/common/defaults/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ common_rpms:
2222
- jq
2323
- nfs-utils
2424
common_extra_rpms: []
25+
cloud_init_version: 18.3-52-gc5f78957-1~bddeb~18.04.1
2526
common_debs:
2627
- openssh-client
2728
- openssh-server
@@ -33,6 +34,9 @@ common_debs:
3334
- ntp
3435
- jq
3536
- nfs-client
37+
38+
common_pinned_debs:
39+
- "cloud-init={{ cloud_init_version }}"
3640
common_extra_debs: []
3741
common_redhat_epel_rpm: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
3842
common_redhat_cloud_init_copr_rpm: "https://copr.fedorainfracloud.org/coprs/jdetiber/cloud-init/repo/epel-7/jdetiber-cloud-init-epel-7.repo"

build/amis/ansible/roles/common/tasks/debian.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,10 @@
3838
force_apt_get: True
3939
name: "{{ common_extra_debs }}"
4040
state: latest
41+
42+
- name: install pinned debs
43+
apt:
44+
force_apt_get: True
45+
name: "{{ common_pinned_debs }}"
46+
state: present
47+
force: yes

build/amis/packer/goss/goss.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package:
2+
{{range $name, $vers := index .Vars "packages"}}
3+
{{$name}}:
4+
installed: true
5+
versions:
6+
{{range $vers}}
7+
- {{.}}
8+
{{end}}
9+
{{end}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
packages:
2+
cloud-init:
3+
- "18.3+52.gc5f78957"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
packages:
2+
cloud-init:
3+
- "18.3-52-gc5f78957-1~bddeb~18.04.1"

build/amis/packer/packer.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,27 @@
9898
"--extra-vars",
9999
"kubernetes_version={{user `kubernetes_version`}} kubernetes_cni_version={{user `kubernetes_cni_version`}}"
100100
]
101+
},
102+
{
103+
"type": "goss",
104+
"vars_file": "goss/redhat-vars.yaml",
105+
"tests": [
106+
"goss/goss.yaml"
107+
],
108+
"only": [
109+
"amazon-2",
110+
"centos-7"
111+
]
112+
},
113+
{
114+
"type": "goss",
115+
"vars_file": "goss/ubuntu-vars.yaml",
116+
"tests": [
117+
"goss/goss.yaml"
118+
],
119+
"only": [
120+
"ubuntu-1804"
121+
]
101122
}
102123
]
103124
}

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [Getting started](getting-started.md)
66
- [List of AMIs](amis.md)
77
- [Accessing cluster instances](accessing-instances.md)
8+
- [Packer](packer.md)
89

910
## Development
1011

docs/packer.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Using Packer and baking AMIs
2+
3+
## Overview
4+
5+
[Packer](http://packer.io/) is well known tool for baking images of any kind.
6+
We use it to bake our AMIs.
7+
8+
## Prerequisites
9+
10+
* `packer` binary
11+
* [packer-goss](https://github.com/YaleUniversity/packer-provisioner-goss) plugin
12+
* ansible
13+
14+
## Plugin instalation
15+
16+
To install `packer-goss` plugin the following should be executed inside of the
17+
`build/amis/packer` directory:
18+
19+
```bash
20+
$ curl -o packer-goss https://github.com/YaleUniversity/packer-provisioner-goss/releases/download/v0.3.0/packer-provisioner-goss-v0.3.0-linux-amd64
21+
22+
$ chmod +x packer-goss
23+
```
24+
25+
## Running Packer
26+
27+
The following command should build all the AMIs:
28+
29+
```bash
30+
$ AWS_REGION=us-east-1 packer build -var-file=base-images-us-east-1.json packer.json
31+
```
32+
33+
**NOTE** that AWS credentials have to be set.

0 commit comments

Comments
 (0)