Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Commit 71d0347

Browse files
authored
Merge pull request #1026 from pohly/ipmctl
Bundle ipmctl
2 parents bab85ff + 3d4b1f4 commit 71d0347

File tree

94 files changed

+2313
-1018
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2313
-1018
lines changed

.dockerignore

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
*
2-
! **/*.make
3-
! Dockerfile
4-
! LICENSE
5-
! Makefile
6-
! cmd/**
7-
! pkg/**
8-
! test/cmd/**
9-
! test/test-config.d/**
10-
! test/test-config.sh
11-
! third-party/**
12-
! hack/**
13-
! vendor/**
14-
! go.mod
15-
! go.sum
16-
! operator/
2+
!*/*.make
3+
!Dockerfile
4+
!LICENSE
5+
!Makefile
6+
!cmd/
7+
!pkg/
8+
!test/
9+
!third-party/
10+
!hack/
11+
!vendor/
12+
!go.mod
13+
!go.sum
14+
!operator/
15+
!deploy/

Dockerfile

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Copyright 2021 Intel Coporation.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
15
# Image builds are not reproducible because the base layer is changing over time.
26
ARG LINUX_BASE=debian:buster-slim
37

@@ -18,7 +22,7 @@ RUN echo 'deb-src http://ftp.debian.org/debian buster-backports main' >> /etc/ap
1822
# tools and recommended packages. But this image gets pushed to a registry by the CI as a cache,
1923
# so it still makes sense to keep this layer small by removing /var/cache.
2024
RUN ${APT_GET} update && \
21-
${APT_GET} install -y gcc libndctl-dev/buster-backports make git curl iproute2 pkg-config xfsprogs e2fsprogs parted openssh-client python3 python3-venv equivs && \
25+
${APT_GET} install -y gcc libndctl-dev/buster-backports make git curl iproute2 pkg-config xfsprogs e2fsprogs parted openssh-client python3 python3-venv equivs debhelper cmake python asciidoctor pkg-config && \
2226
rm -rf /var/cache/*
2327
RUN curl -L https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -zxf - -C / && \
2428
mkdir -p /usr/local/bin/ && \
@@ -29,6 +33,20 @@ ADD hack/python3-fake-debian-package .
2933
# Creates python3_100.0_all.deb
3034
RUN equivs-build python3-fake-debian-package
3135

36+
# Build ipmctl from source.
37+
# We use the latest official release and determine that via
38+
# the HTML redirect page.
39+
RUN set -x && \
40+
git clone https://github.com/intel/ipmctl.git && \
41+
cd ipmctl && \
42+
tag=$(curl --silent https://github.com/intel/ipmctl/releases/latest | sed -e 's;.*tag/\([^"]*\).*;\1;') && \
43+
git checkout $tag && \
44+
mkdir build && \
45+
cd build && \
46+
cmake -DRELEASE=ON -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
47+
make -j all && \
48+
make install
49+
3250
# Clean image for deploying PMEM-CSI.
3351
FROM ${LINUX_BASE} as runtime
3452
ARG APT_GET="env DEBIAN_FRONTEND=noninteractive apt-get"
@@ -158,14 +176,21 @@ RUN set -x && \
158176
ls -l /usr/local/share/package-sources; \
159177
du -h /usr/local/share/package-sources
160178

179+
COPY --from=build /ipmctl/LICENSE /usr/local/share/package-licenses/ipmctl.LICENSE
180+
161181
# The actual pmem-csi-driver image.
162182
FROM runtime as pmem
163183

164184
# Move required binaries and libraries to clean container.
165-
COPY --from=binaries /usr/local/bin/pmem-* /usr/local/bin/
185+
COPY --from=binaries /usr/local/bin/pmem-* /usr/local/bin/ipmctl /usr/local/bin/
186+
COPY --from=binaries /usr/local/lib/libipmctl*.so.* /usr/local/lib/
187+
COPY --from=binaries /usr/local/man /usr/local/man
166188
COPY --from=binaries /usr/local/share/package-licenses /usr/local/share/package-licenses
167189
COPY --from=binaries /usr/local/share/package-sources /usr/local/share/package-sources
168190

191+
# /usr/local/lib is not in the default library search path.
192+
RUN for i in /usr/local/lib/*.so.*; do ln -s $i /usr/lib; done
193+
169194
# Don't rely on udevd, it isn't available (https://unix.stackexchange.com/questions/591724/how-to-add-a-block-to-udev-database-that-works-after-reboot).
170195
# Same with D-Bus.
171196
# Backup and archival of metadata inside the container is useless.

Dockerfile.UBI

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
# Copyright 2021 Intel Coporation.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# Image for building PMEM-CSI for OpenShift.
6+
#
7+
# This need a subscription for the RHEL package feed.
8+
#
9+
# On a suitable host, run
10+
# subscription-manager register --username <username> --auto-attach
11+
# to subscribe. Then build with
12+
# buildah bud -f Dockerfile.UBI
13+
#
14+
# If such a host is not available, then the same can be done in a container.
15+
# The host then only needs buildah but doesn't need to be RHEL. In the following
16+
# example, /nvme is where the GOPATH and the current directory are located.
17+
#
18+
# docker run --detach --privileged -v /var/lib/containers/:/var/lib/containers/:Z -v /nvme:/nvme --name rhel registry.access.redhat.com/rhel7:latest sleep infinity
19+
# docker exec -ti rhel subscription-manager register --username <username> --auto-attach
20+
# docker exec rhel subscription-manager repos --enable=rhel-7-server-rpms
21+
# docker exec rhel subscription-manager repos --enable=rhel-7-server-extras-rpms
22+
# docker exec rhel yum -y install buildah
23+
# docker exec rhel buildah bud -f `pwd`/Dockerfile.UBI `pwd`
24+
#
25+
# Because /var/lib/containers/ is shared with the host, buildah on the host will
26+
# have access to the resulting image:
27+
#
28+
# $ sudo buildah images
29+
# REPOSITORY TAG IMAGE ID CREATED SIZE
30+
# <none> <none> d1767ba7457c 1 minutes ago 361 MB
31+
# $ container=$(sudo buildah from d1767ba7457c)
32+
# $ sudo buildah $container ls /licenses
33+
# PMEM-CSI.LICENSE github.com go-fibmap go.LICENSE go.uber.org golang.org gomodules.xyz google.golang.org gopkg.in ipmctl.LICENSE k8s.io sigs.k8s.io
34+
#
35+
# It can be tagged either as part of "buildah bud" with "-t <tag>" or later.
36+
37+
# Image #0 as build
38+
FROM registry.access.redhat.com/ubi8
39+
40+
WORKDIR /pmem-csi
41+
COPY . .
42+
43+
ARG GO_VERSION="1.16.1"
44+
45+
# CACHEBUST is set by the CI when building releases to ensure that apt-get really gets
46+
# run instead of just using some older, cached result.
47+
ARG CACHEBUST
48+
49+
RUN dnf install -y gcc ndctl-devel make git pkg-config curl tar findutils xz cmake pkg-config gcc-c++ python36
50+
RUN curl -L https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -zxf - -C / && \
51+
mkdir -p /usr/local/bin/ && \
52+
for i in /go/bin/*; do ln -s $i /usr/local/bin/; done
53+
54+
# Build ipmctl from source.
55+
# We use the latest official release and determine that via
56+
# the HTML redirect page.
57+
RUN set -x && \
58+
git clone https://github.com/intel/ipmctl.git && \
59+
mkdir -p /usr/local/share/package-licenses && \
60+
cp LICENSE /usr/local/share/package-licenses/ipmctl.LICENSE && \
61+
cd ipmctl && \
62+
tag=$(curl --silent https://github.com/intel/ipmctl/releases/latest | sed -e 's;.*tag/\([^"]*\).*;\1;') && \
63+
git checkout $tag && \
64+
mkdir build && \
65+
cd build && \
66+
cmake -DRELEASE=ON -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
67+
make -j all && \
68+
make install
69+
70+
# build pmem-csi-driver
71+
ARG VERSION="unknown"
72+
ENV PKG_CONFIG_PATH=/usr/lib/pkgconfig/
73+
74+
# Here we choose explicitly which binaries we want in the image and in
75+
# which flavor (production or testing). The actual binary name in the
76+
# image is going to be the same, to avoid unnecessary deployment
77+
# differences.
78+
RUN set -x && \
79+
make VERSION=${VERSION} pmem-csi-driver pmem-csi-operator && \
80+
mkdir -p /usr/local/bin && \
81+
mv _output/pmem-csi-driver /usr/local/bin/pmem-csi-driver && \
82+
mv _output/pmem-csi-operator /usr/local/bin/pmem-csi-operator && \
83+
go mod vendor && \
84+
hack/copy-modules-license.sh /usr/local/share/package-licenses ./cmd/pmem-csi-driver ./cmd/pmem-csi-operator && \
85+
cp /go/LICENSE /usr/local/share/package-licenses/go.LICENSE && \
86+
cp LICENSE /usr/local/share/package-licenses/PMEM-CSI.LICENSE
87+
88+
# Now also copy copyleft source code that was used during the build of our binaries.
89+
RUN set -x && \
90+
mkdir -p /usr/local/share/package-sources && \
91+
for license in $(grep -l -r -w -e MPL -e GPL -e LGPL /usr/local/share/package-licenses | sed -e 's;^/usr/local/share/package-licenses/;;'); do \
92+
if ! (dir=$(dirname $license) && \
93+
tar -Jvcf /usr/local/share/package-sources/$(echo $dir | tr / _).tar.xz vendor/$dir ); then \
94+
exit 1; \
95+
fi; \
96+
done; \
97+
ls -l /usr/local/share/package-sources; \
98+
du -h /usr/local/share/package-sources
99+
100+
# The actual pmem-csi-driver image.
101+
# Image #1 as runtime
102+
FROM registry.access.redhat.com/ubi8
103+
LABEL name="pmem-csi-driver"
104+
LABEL vendor="Intel"
105+
# updated by hack/set-version.sh when preparing a release
106+
LABEL version="v0.9.1"
107+
# Needs to be set by Red Hat build service.
108+
# LABEL release="1"
109+
LABEL summary="A CSI driver for managing PMEM."
110+
LABEL description="Intel(R) PMEM-CSI is a Container Storage Interface (CSI) driver for container orchestrators like Kubernetes. It makes local persistent memory (PMEM) available as a filesystem volume to container applications."
111+
112+
# Update and install the minimal amount of additional packages that
113+
# are needed at runtime:
114+
# file - driver uses file utility to determine filesystem type
115+
# xfsprogs, e2fsprogs - formating filesystems
116+
# lvm2 - volume management
117+
# ndctl - pulls in the necessary library, useful by itself
118+
RUN dnf install -y file xfsprogs e2fsprogs lvm2 ndctl && \
119+
mv /var/log/dnf.rpm.log /usr/local/share/package-install.log && \
120+
rm -rf /var/cache /var/log/dnf*
121+
122+
# Move required binaries and libraries to clean container.
123+
COPY --from=0 /usr/local/bin/pmem-* /usr/local/bin/ipmctl /usr/local/bin/
124+
COPY --from=0 /usr/local/lib64/libipmctl*.so.* /usr/local/lib64
125+
COPY --from=0 /usr/local/share/package-licenses /licenses
126+
COPY --from=0 /usr/local/share/package-sources /sources
127+
128+
# /usr/local/lib is not in the default library search path.
129+
RUN for i in /usr/local/lib64/*.so.*; do ln -s $i /usr/lib64; done
130+
131+
# Download source RPMs for those packages that were installed by us above.
132+
RUN echo "Extra packages installed as separate layer:" && grep Installed: /usr/local/share/package-install.log
133+
RUN set -xe && \
134+
cd /sources && \
135+
for package in $(grep Installed: /usr/local/share/package-install.log | sed -e 's/.*Installed: //' | sort -u); do \
136+
base=${package%-*-*} && \
137+
case $base in \
138+
*) \
139+
license=$(rpm -q --qf %{license} "$base") && \
140+
case $license in \
141+
*MPL*|*GPL*) \
142+
echo "INFO: downloading source of $base because of the $license" && \
143+
dnf download --source $base \
144+
;; \
145+
*) \
146+
echo "INFO: not shipping source of $base because not required by $license" \
147+
;; \
148+
esac \
149+
;; \
150+
esac; \
151+
done && \
152+
rm -rf /var/cache /var/log/dnf*
153+
154+
RUN ls -l /sources
155+
RUN du -h /sources
156+
157+
# Don't rely on udevd, it isn't available (https://unix.stackexchange.com/questions/591724/how-to-add-a-block-to-udev-database-that-works-after-reboot).
158+
# Same with D-Bus.
159+
# Backup and archival of metadata inside the container is useless.
160+
RUN sed -i \
161+
-e 's/udev_sync = 1/udev_sync = 0/' \
162+
-e 's/udev_rules = 1/udev_rules = 0/' \
163+
-e 's/obtain_device_list_from_udev = 1/obtain_device_list_from_udev = 0/' \
164+
-e 's/multipath_component_detection = 1/multipath_component_detection = 0/' \
165+
-e 's/md_component_detection = 1/md_component_detection = 0/' \
166+
-e 's/notify_dbus = 1/notify_dbus = 0/' \
167+
-e 's/backup = 1/backup = 0/' \
168+
-e 's/archive = 1/archive = 0/' \
169+
/etc/lvm/lvm.conf
170+

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ MAJOR_MINOR_VERSION:=$(shell echo $(MAJOR_MINOR_PATCH_VERSION) | sed -e 's/\([0-
3838
# case) and add local machine to no_proxy because some tests may use a
3939
# local Docker registry. Also exclude 0.0.0.0 because otherwise Go
4040
# tests using that address try to go through the proxy.
41-
HTTP_PROXY=$(shell echo "$${HTTP_PROXY:-$${http_proxy}}")
42-
HTTPS_PROXY=$(shell echo "$${HTTPS_PROXY:-$${https_proxy}}")
43-
NO_PROXY=$(shell echo "$${NO_PROXY:-$${no_proxy}},$$(ip addr | grep inet6 | grep /64 | sed -e 's;.*inet6 \(.*\)/64 .*;\1;' | tr '\n' ','; ip addr | grep -w inet | grep -e '/\(24\|16\|8\)' | sed -e 's;.*inet \(.*\)/\(24\|16\|8\) .*;\1;' | tr '\n' ',')",0.0.0.0)
41+
HTTP_PROXY:=$(shell echo "$${HTTP_PROXY:-$${http_proxy}}")
42+
HTTPS_PROXY:=$(shell echo "$${HTTPS_PROXY:-$${https_proxy}}")
43+
NO_PROXY:=$(shell echo "$${NO_PROXY:-$${no_proxy}},$$(if command -v ip &>/dev/null; then ip addr | grep inet6 | grep /64 | sed -e 's;.*inet6 \(.*\)/64 .*;\1;' | tr '\n' ','; ip addr | grep -w inet | grep -e '/\(24\|16\|8\)' | sed -e 's;.*inet \(.*\)/\(24\|16\|8\) .*;\1;' | tr '\n' ','; fi)",0.0.0.0)
4444
export HTTP_PROXY HTTPS_PROXY NO_PROXY
4545

4646
REGISTRY_NAME?=$(shell . test/test-config.sh && echo $${TEST_BUILD_PMEM_REGISTRY})

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ versions:
3030

3131
| Kubernetes version | Required alpha feature gates | Support status
3232
|--------------------|--------------------------------|----------------
33-
| 1.13 | CSINodeInfo, CSIDriverRegistry,<br>CSIBlockVolume</br>| unsupported <sup>1</sup>
33+
| 1.13 | CSINodeInfo, CSIDriverRegistry, CSIBlockVolume | unsupported <sup>1</sup>
3434
| 1.14 | | unsupported <sup>2</sup>
3535
| 1.15 | CSIInlineVolume | unsupported <sup>3</sup>
3636
| 1.16 | | unsupported <sup>4</sup>

conf.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@
1919
"sphinx_md",
2020
"sphinx_copybutton"
2121
],
22+
"linkcheck_ignore": [
23+
".*cloudnative-k8sci.southcentralus.cloudapp.azure.com.*"
24+
],
2225
"linkcheck_anchors_ignore": [
2326
"^!",
2427
"^L[0-9]+-L[0-9]+$",
2528
"^discussion_r[0-9]+$"
2629
],
30+
"tls_verify": false,
2731
"copybutton_prompt_text": "$ ",
2832
"html_theme": "sphinx_rtd_theme",
2933
"project": "PMEM-CSI",

deploy/crd/pmem-csi.intel.com_pmemcsideployments.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ spec:
5555
spec:
5656
description: DeploymentSpec defines the desired state of Deployment
5757
properties:
58+
controllReplicas:
59+
description: ControllerReplicas determines how many copys of the controller
60+
Pod run concurrently. Zero (= unset) selects the builtin default,
61+
which is currently 1.
62+
minimum: 0
63+
type: integer
5864
controllerDriverResources:
5965
description: ControllerDriverResources Compute resources required
6066
by central driver container
@@ -86,7 +92,9 @@ spec:
8692
description: ControllerTLSSecret is the name of a secret which contains
8793
ca.crt, tls.crt and tls.key data for the scheduler extender and
8894
pod mutation webhook. A controller is started if (and only if) this
89-
secret is specified.
95+
secret is specified. The special string "-openshift-" enables the
96+
usage of https://docs.openshift.com/container-platform/4.6/security/certificates/service-serving-certificate.html
97+
to create certificates.
9098
type: string
9199
deviceMode:
92100
description: DeviceMode to use to manage PMEM devices.

deploy/kubernetes-1.19/direct/pmem-csi.yaml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -325,24 +325,8 @@ subjects:
325325
name: pmem-csi-intel-com-webhooks
326326
namespace: pmem-csi
327327
---
328-
apiVersion: v1
329-
kind: Service
330-
metadata:
331-
labels:
332-
pmem-csi.intel.com/deployment: direct-production
333-
name: pmem-csi-intel-com-controller
334-
namespace: pmem-csi
335-
spec:
336-
ports:
337-
- port: 10000
338-
targetPort: 10000
339-
selector:
340-
app.kubernetes.io/instance: pmem-csi.intel.com
341-
app.kubernetes.io/name: pmem-csi-controller
342-
pmem-csi.intel.com/deployment: direct-production
343-
---
344328
apiVersion: apps/v1
345-
kind: StatefulSet
329+
kind: Deployment
346330
metadata:
347331
labels:
348332
app.kubernetes.io/component: controller
@@ -359,7 +343,6 @@ spec:
359343
app.kubernetes.io/instance: pmem-csi.intel.com
360344
app.kubernetes.io/name: pmem-csi-controller
361345
pmem-csi.intel.com/deployment: direct-production
362-
serviceName: pmem-csi-intel-com-controller
363346
template:
364347
metadata:
365348
annotations:
@@ -380,7 +363,7 @@ spec:
380363
- -mode=webhooks
381364
- -drivername=$(PMEM_CSI_DRIVER_NAME)
382365
- -nodeSelector={"storage":"pmem"}
383-
- -caFile=/certs/ca.crt
366+
- -caFile=
384367
- -certFile=/certs/tls.crt
385368
- -keyFile=/certs/tls.key
386369
- -schedulerListen=:8000

0 commit comments

Comments
 (0)