Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

Commit ae6c5cc

Browse files
authored
[meta] update docker images (#1604)
* [meta] update docker images - use python slim base images - bump python version - bump python dependencies - bump tools version * cleanup dependencies * lint test files with new black version * link gcloud to path * do not build helm-tester docker image by default
1 parent 6714c16 commit ae6c5cc

File tree

12 files changed

+180
-205
lines changed

12 files changed

+180
-205
lines changed

.ci/jobs/elastic+helm-charts+main+template-testing.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
display-name: elastic / helm-charts - main - template testing
55
description: Main - template testing
66
scm:
7-
- git:
8-
wipe-workspace: 'True'
7+
- git:
8+
wipe-workspace: "True"
99
axes:
10-
- axis:
11-
type: slave
12-
name: label
13-
values:
14-
- docker&&virtual
15-
- axis:
16-
type: yaml
17-
name: CHART
18-
filename: helpers/matrix.yml
10+
- axis:
11+
type: slave
12+
name: label
13+
values:
14+
- docker&&virtual
15+
- axis:
16+
type: yaml
17+
name: CHART
18+
filename: helpers/matrix.yml
1919
builders:
20-
- shell: |-
21-
#!/usr/local/bin/runbld
22-
set -euo pipefail
20+
- shell: |-
21+
#!/usr/local/bin/runbld
22+
set -euo pipefail
2323
24-
cd ${CHART}
25-
make test
24+
cd ${CHART}
25+
make build test

.ci/jobs/elastic+helm-charts+pull-request+template-testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
set -euo pipefail
2424
2525
cd ${CHART}
26-
make test
26+
make build test

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ You can also use `make template` (equivalent to `helm template` ) to look at the
216216
YAML being generated:
217217

218218
It is possible to run all of the tests and linting inside of a Docker container
219-
using `make test`
219+
using `make build test`
220220

221221
Note that templating tests are formatted using [Black][], you should run
222222
`make lint-python` (equivalent to `black --diff --check .` ) to validate them or

elasticsearch/tests/elasticsearch_test.py

100755100644
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -807,12 +807,12 @@ def test_dont_add_data_volume_when_persistance_is_disabled():
807807
"""
808808
r = helm_template(config)
809809
assert "volumeClaimTemplates" not in r["statefulset"][uname]["spec"]
810-
assert (
811-
{"name": "elasticsearch-master", "mountPath": "/usr/share/elasticsearch/data"}
812-
not in r["statefulset"][uname]["spec"]["template"]["spec"]["containers"][0][
813-
"volumeMounts"
814-
]
815-
)
810+
assert {
811+
"name": "elasticsearch-master",
812+
"mountPath": "/usr/share/elasticsearch/data",
813+
} not in r["statefulset"][uname]["spec"]["template"]["spec"]["containers"][0][
814+
"volumeMounts"
815+
]
816816

817817

818818
def test_priority_class_name():
@@ -1471,7 +1471,11 @@ def test_network_policy():
14711471
{"podSelector": {"matchLabels": {"app": "elasticsearch-master"}}},
14721472
]
14731473
assert transport["ports"][0]["port"] == 9300
1474-
assert pod_selector == {"matchLabels": {"app": "elasticsearch-master",}}
1474+
assert pod_selector == {
1475+
"matchLabels": {
1476+
"app": "elasticsearch-master",
1477+
}
1478+
}
14751479

14761480

14771481
def test_default_automount_sa_token():

filebeat/tests/filebeat_test.py

Lines changed: 44 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -685,29 +685,23 @@ def test_adding_a_secret_mount():
685685
path: /usr/share/filebeat/config/certs
686686
"""
687687
r = helm_template(config)
688-
assert (
689-
{
690-
"mountPath": "/usr/share/filebeat/config/certs",
691-
"name": "elastic-certificates",
692-
}
693-
in r["daemonset"][name]["spec"]["template"]["spec"]["containers"][0][
694-
"volumeMounts"
695-
]
696-
)
688+
assert {
689+
"mountPath": "/usr/share/filebeat/config/certs",
690+
"name": "elastic-certificates",
691+
} in r["daemonset"][name]["spec"]["template"]["spec"]["containers"][0][
692+
"volumeMounts"
693+
]
697694
assert {
698695
"name": "elastic-certificates",
699696
"secret": {"secretName": "elastic-certificates-name"},
700697
} in r["daemonset"][name]["spec"]["template"]["spec"]["volumes"]
701698

702-
assert (
703-
{
704-
"mountPath": "/usr/share/filebeat/config/certs",
705-
"name": "elastic-certificates",
706-
}
707-
not in r["deployment"][name]["spec"]["template"]["spec"]["containers"][0][
708-
"volumeMounts"
709-
]
710-
)
699+
assert {
700+
"mountPath": "/usr/share/filebeat/config/certs",
701+
"name": "elastic-certificates",
702+
} not in r["deployment"][name]["spec"]["template"]["spec"]["containers"][0][
703+
"volumeMounts"
704+
]
711705
assert {
712706
"name": "elastic-certificates",
713707
"secret": {"secretName": "elastic-certificates-name"},
@@ -722,29 +716,23 @@ def test_adding_a_secret_mount():
722716
path: /usr/share/filebeat/config/certs
723717
"""
724718
r = helm_template(config)
725-
assert (
726-
{
727-
"mountPath": "/usr/share/filebeat/config/certs",
728-
"name": "elastic-certificates",
729-
}
730-
in r["deployment"][name]["spec"]["template"]["spec"]["containers"][0][
731-
"volumeMounts"
732-
]
733-
)
719+
assert {
720+
"mountPath": "/usr/share/filebeat/config/certs",
721+
"name": "elastic-certificates",
722+
} in r["deployment"][name]["spec"]["template"]["spec"]["containers"][0][
723+
"volumeMounts"
724+
]
734725
assert {
735726
"name": "elastic-certificates",
736727
"secret": {"secretName": "elastic-certificates-name"},
737728
} in r["deployment"][name]["spec"]["template"]["spec"]["volumes"]
738729

739-
assert (
740-
{
741-
"mountPath": "/usr/share/filebeat/config/certs",
742-
"name": "elastic-certificates",
743-
}
744-
not in r["daemonset"][name]["spec"]["template"]["spec"]["containers"][0][
745-
"volumeMounts"
746-
]
747-
)
730+
assert {
731+
"mountPath": "/usr/share/filebeat/config/certs",
732+
"name": "elastic-certificates",
733+
} not in r["daemonset"][name]["spec"]["template"]["spec"]["containers"][0][
734+
"volumeMounts"
735+
]
748736
assert {
749737
"name": "elastic-certificates",
750738
"secret": {"secretName": "elastic-certificates-name"},
@@ -761,15 +749,12 @@ def test_adding_a_deprecated_secret_mount():
761749
path: /usr/share/filebeat/config/certs
762750
"""
763751
r = helm_template(config)
764-
assert (
765-
{
766-
"mountPath": "/usr/share/filebeat/config/certs",
767-
"name": "elastic-certificates",
768-
}
769-
in r["daemonset"][name]["spec"]["template"]["spec"]["containers"][0][
770-
"volumeMounts"
771-
]
772-
)
752+
assert {
753+
"mountPath": "/usr/share/filebeat/config/certs",
754+
"name": "elastic-certificates",
755+
} in r["daemonset"][name]["spec"]["template"]["spec"]["containers"][0][
756+
"volumeMounts"
757+
]
773758
assert {
774759
"name": "elastic-certificates",
775760
"secret": {"secretName": "elastic-certificates-name"},
@@ -810,12 +795,13 @@ def test_adding_a_extra_volume_with_volume_mount():
810795
assert {"name": "extras", "emptyDir": {}} not in r["deployment"][name]["spec"][
811796
"template"
812797
]["spec"]["volumes"]
813-
assert (
814-
{"name": "extras", "mountPath": "/usr/share/extras", "readOnly": True,}
815-
not in r["deployment"][name]["spec"]["template"]["spec"]["containers"][0][
816-
"volumeMounts"
817-
]
818-
)
798+
assert {
799+
"name": "extras",
800+
"mountPath": "/usr/share/extras",
801+
"readOnly": True,
802+
} not in r["deployment"][name]["spec"]["template"]["spec"]["containers"][0][
803+
"volumeMounts"
804+
]
819805

820806
config = """
821807
deployment:
@@ -838,12 +824,13 @@ def test_adding_a_extra_volume_with_volume_mount():
838824
assert {"name": "extras", "emptyDir": {}} not in r["daemonset"][name]["spec"][
839825
"template"
840826
]["spec"]["volumes"]
841-
assert (
842-
{"name": "extras", "mountPath": "/usr/share/extras", "readOnly": True,}
843-
not in r["daemonset"][name]["spec"]["template"]["spec"]["containers"][0][
844-
"volumeMounts"
845-
]
846-
)
827+
assert {
828+
"name": "extras",
829+
"mountPath": "/usr/share/extras",
830+
"readOnly": True,
831+
} not in r["daemonset"][name]["spec"]["template"]["spec"]["containers"][0][
832+
"volumeMounts"
833+
]
847834

848835

849836
def test_adding_a_deprecated_extra_volume_with_volume_mount():

helpers/common.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ template: ## Render chart templates
3232
helm template ./
3333

3434
.PHONY: test
35-
test: build ## Run all tests in a docker container
35+
test: ## Run all tests in a docker container
3636
docker run --rm -i --user "$$(id -u):$$(id -g)" -v $$(pwd)/../:/app -w /app/$$(basename $$(pwd)) helm-tester make test-all
3737

3838
.PHONY: test-all ## Run all tests

helpers/helm-tester/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
FROM python:3.7
1+
FROM python:3.10.2-slim
22

33
ENV HELM_VERSION=3.8.0
44

5+
RUN apt-get update && apt-get upgrade -y && \
6+
apt-get install --no-install-recommends -y make wget && \
7+
rm -rf /var/lib/apt/lists/*
8+
59
RUN wget --no-verbose https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz && \
610
tar xfv helm-v${HELM_VERSION}-linux-amd64.tar.gz && \
711
mv linux-amd64/helm /usr/local/bin/ && \
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
atomicwrites==1.3.0
2-
attrs==19.1.0
3-
importlib-metadata==0.23
4-
more-itertools==7.2.0
5-
pluggy==0.13.0
6-
py==1.10.0
7-
pytest==4.1.0
8-
PyYAML==5.4
9-
six==1.12.0
10-
zipp==0.6.0
1+
pytest==7.0.1
2+
PyYAML==6.0

helpers/terraform/Dockerfile

Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,48 @@
1-
FROM centos:7
1+
FROM python:3.10.2-slim
22

3-
ENV VAULT_VERSION 0.9.3
4-
ENV TERRAFORM_VERSION=0.11.7
5-
ENV KUBECTL_VERSION=1.21.6
3+
ENV DOCKER_VERSION=20.10.12
4+
ENV GCLOUD_VERSION=375.0.0
65
ENV HELM_VERSION=3.8.0
7-
ENV DOCKER_VERSION=18.09.7
8-
ENV JQ_VERSION=1.6
6+
ENV KUBECTL_VERSION=1.21.6
7+
ENV TERRAFORM_VERSION=0.11.7
8+
ENV VAULT_VERSION=1.9.3
99

10-
RUN yum -y install \
11-
make \
12-
openssl \
13-
unzip \
14-
which
10+
RUN apt-get update && apt-get upgrade -y && \
11+
apt-get install --no-install-recommends -y curl jq make openssl unzip && \
12+
rm -rf /var/lib/apt/lists/*
1513

16-
RUN yum -y install \
17-
https://packages.cloud.google.com/yum/pool/654962a43cb6bc6b47bc312424410b7c203e1beb73386d868d9e614839c82609-google-cloud-sdk-215.0.0-1.el7.noarch.rpm && \
18-
gcloud config set core/disable_usage_reporting true && \
19-
gcloud config set component_manager/disable_update_check true && \
20-
gcloud version
14+
RUN curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GCLOUD_VERSION}-linux-x86_64.tar.gz && \
15+
tar xvf google-cloud-sdk-${GCLOUD_VERSION}-linux-x86_64.tar.gz && \
16+
./google-cloud-sdk/install.sh --quiet --usage-reporting=false --path-update=true && \
17+
rm -fr google-cloud-sdk-${GCLOUD_VERSION}-linux-x86_64.tar.gz && \
18+
ln -s /google-cloud-sdk/bin/gcloud /usr/local/bin/gcloud && \
19+
gcloud config set component_manager/disable_update_check true && \
20+
gcloud version
2121

2222
RUN curl -O https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip && \
23-
unzip vault_${VAULT_VERSION}_linux_amd64.zip -d /usr/local/bin/ && \
24-
chmod +x /usr/local/bin/vault && \
25-
rm -f vault_${VAULT_VERSION}_linux_amd64.zip && \
26-
vault version
23+
unzip vault_${VAULT_VERSION}_linux_amd64.zip -d /usr/local/bin/ && \
24+
chmod +x /usr/local/bin/vault && \
25+
rm -f vault_${VAULT_VERSION}_linux_amd64.zip && \
26+
vault version
2727

2828
RUN curl -O https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
29-
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin/ && \
30-
rm -f terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
31-
terraform version
29+
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin/ && \
30+
rm -f terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
31+
terraform version
3232

3333
RUN curl -O https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \
34-
mv kubectl /usr/local/bin/ && \
35-
chmod a+x /usr/local/bin/kubectl && \
36-
kubectl version --client
34+
mv kubectl /usr/local/bin/ && \
35+
chmod a+x /usr/local/bin/kubectl && \
36+
kubectl version --client
3737

3838
RUN curl -O https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz && \
39-
tar xfv helm-v${HELM_VERSION}-linux-amd64.tar.gz && \
40-
mv linux-amd64/helm /usr/local/bin/ && \
41-
rm -rf helm-v${HELM_VERSION}-linux-amd64.tar.gz linux-amd64 && \
42-
helm version --client
39+
tar xfv helm-v${HELM_VERSION}-linux-amd64.tar.gz && \
40+
mv linux-amd64/helm /usr/local/bin/ && \
41+
rm -rf helm-v${HELM_VERSION}-linux-amd64.tar.gz linux-amd64 && \
42+
helm version --client
4343

4444
RUN curl -O https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz && \
45-
tar xfv docker* && \
46-
mv docker/docker /usr/local/bin && \
47-
rm -rf docker-${DOCKER_VERSION}.tgz docker/ && \
48-
docker -v
49-
50-
RUN curl -O -L https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64 && \
51-
mv jq-linux64 /usr/local/bin/jq && \
52-
chmod a+x /usr/local/bin/jq && \
53-
jq --version
45+
tar xfv docker* && \
46+
mv docker/docker /usr/local/bin && \
47+
rm -rf docker-${DOCKER_VERSION}.tgz docker/ && \
48+
docker -v

logstash/tests/logstash_test.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,10 @@ def test_adding_a_extra_port():
243243
extraPorts = r["statefulset"][name]["spec"]["template"]["spec"]["containers"][0][
244244
"ports"
245245
]
246-
assert {"name": "foo", "containerPort": 30000,} in extraPorts
246+
assert {
247+
"name": "foo",
248+
"containerPort": 30000,
249+
} in extraPorts
247250

248251

249252
def test_adding_a_extra_init_container():
@@ -660,9 +663,10 @@ def test_adding_in_logstash_config():
660663

661664
s = r["statefulset"][name]["spec"]["template"]["spec"]
662665

663-
assert {"configMap": {"name": name + "-config"}, "name": "logstashconfig",} in s[
664-
"volumes"
665-
]
666+
assert {
667+
"configMap": {"name": name + "-config"},
668+
"name": "logstashconfig",
669+
} in s["volumes"]
666670
assert {
667671
"mountPath": "/usr/share/logstash/config/logstash.yml",
668672
"name": "logstashconfig",

0 commit comments

Comments
 (0)