Skip to content

Commit

Permalink
Resiliency ubi-micro image (#168)
Browse files Browse the repository at this point in the history
* changes for podman

* updated readme and other files

Signed-off-by: root <[email protected]>

* updated makefile year

Signed-off-by: root <[email protected]>

* changed image to hardcode

* updated actions.yaml

* updated actions.yaml

* updated actions.yaml

* updated actions.yaml

* updated actions.yaml

* updated actions.yaml docker

* updated actions.yaml local

* updated actions.yaml image name

* updated actions.yaml dnf install

* updated actions.yaml yum

* updated actions.yaml apt-update

* updated actions.yaml podman build

* updated actions.yaml podman socket

* updated actions.yaml podman image load

* updated actions.yaml yum

* update to actions.yaml, checking os version

* update to actions.yaml, removing flag

* update to actions.yaml clean

* updating github actions

* adding back required build

* updating make file and actions.yaml

---------

Signed-off-by: root <[email protected]>
  • Loading branch information
IsaiasA1 authored Aug 4, 2023
1 parent 53bedee commit befedcf
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 23 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,18 @@ jobs:
- name: Install Mockgen
run: go get github.com/golang/mock/[email protected]
- name: Get dependencies
run: go mod download
run: go mod download ; sudo apt -y install dnf
- name: Mod tidy
run: go mod tidy
- name: Build podmon Docker Image
run: cd cmd/podmon ; make clean build; docker build -t podmon .
run: |
cd cmd/podmon
chmod +x ../../scripts/buildubimicro.sh
buildah unshare ../../scripts/buildubimicro.sh "registry.access.redhat.com/ubi9-micro:9.2-9"
make clean build
podman build -t docker.io/podmon . --build-arg BASEIMAGE="localhost/resiliency-ubimicro"
podman save docker.io/library/podmon -o /tmp/podmon.tar
docker load -i /tmp/podmon.tar
- name: Image scanner
uses: Azure/container-scan@v0
with:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Dell Inc., or its subsidiaries. All Rights Reserved.
# Copyright (c) 2021-2023 Dell Inc., or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
# limitations under the License.
# Includes the following generated file to get semantic version information
all:
(cd cmd/podmon; make clean build docker push)
(cd cmd/podmon; make clean build-base-image build podman push)

check:
@scripts/check.sh ./internal/monitor ./internal/k8sapi ./internal/csiapi ./internal/criapi ./cmd/podmon
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright (c) 2021-2022 Dell Inc., or its subsidiaries. All Rights Reserved.
Copyright (c) 2021-2023 Dell Inc., or its subsidiaries. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@
# Dell Container Storage Modules (CSM) for Resiliency
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](https://github.com/dell/csm/blob/main/docs/CODE_OF_CONDUCT.md)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
[![Docker Pulls](https://img.shields.io/docker/pulls/dellemc/podmon)](https://hub.docker.com/r/dellemc/podmon)
[![Podmam Pulls](https://img.shields.io/docker/pulls/dellemc/podmon)](https://hub.docker.com/r/dellemc/podmon)
[![Go version](https://img.shields.io/github/go-mod/go-version/dell/karavi-resiliency)](go.mod)
[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/dell/karavi-resiliency?include_prereleases&label=latest&style=flat-square)](https://github.com/dell/karavi-resiliency/releases/latest)
[![Releases](https://img.shields.io/badge/Releases-green.svg)](https://github.com/dell/karavi-resiliency/releases)
Expand Down Expand Up @@ -47,14 +47,15 @@ If you wish to clone and build CSM for Resiliency, a Linux host is required with

| Component | Version | Additional Information |
| --------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| Docker | v19+ | [Docker installation](https://docs.docker.com/engine/install/) |
| Golang | v1.18+ | [Golang installation](https://github.com/travis-ci/gimme) |
| git | latest | [Git installation](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) |
| Podman | v4.4.1+ | [Podman installation](https://podman.io/docs/installation) |
| Buildah | v1.29.1+ | [Buildah installation](https://www.redhat.com/sysadmin/getting-started-buildah) |
| Golang | v1.18+ | [Golang installation](https://github.com/travis-ci/gimme) |
| git | latest | [Git installation](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) |

Once all prerequisites are on the Linux host, follow the steps below to clone, build and deploy CSM for Resiliency:

1. Clone the repository: `git clone https://github.com/dell/karavi-resiliency.git`
2. Define and export the following environment variables to point to your Docker registry:
2. Define and export the following environment variables to point to your Podman registry:

```
export REGISTRY_HOST=<registry host>
Expand Down
7 changes: 2 additions & 5 deletions cmd/podmon/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@
# 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.
FROM registry.access.redhat.com/ubi8/ubi:8.8-854
ARG BASEIMAGE
FROM $BASEIMAGE AS final
LABEL vendor="Dell Inc." \
name="csm-resiliency" \
summary="Dell Container Storage Modules (CSM) for Resiliency" \
description="Makes Kubernetes applications, including those that utilize persistent storage, more resilient to various failures" \
version="2.0.0" \
license="Apache-2.0"
RUN dnf -y install openssl && \
dnf -y install nettle && \
dnf -y install gnutls && \
dnf -y install systemd
COPY podmon /podmon
ENTRYPOINT [ "/podmon" ]
12 changes: 8 additions & 4 deletions cmd/podmon/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Dell Inc., or its subsidiaries. All Rights Reserved.
# Copyright (c) 2021-2023 Dell Inc., or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,18 +17,22 @@ MINOR=0
PATCH=54
VERSION?="v$(MAJOR).$(MINOR).$(PATCH)"
REGISTRY?="${REGISTRY_HOST}:${REGISTRY_PORT}/podmon"
BASEIMAGE?="resiliency-micro:latest"

clean:
go clean ./...

build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-w' ./...

docker:
docker build --no-cache -t "$(REGISTRY):$(VERSION)" --label commit=$(shell git log --max-count 1 --format="%H") .
build-base-image:
sh ../../scripts/buildubimicro.sh "registry.access.redhat.com/ubi9-micro:9.2-9"

podman:
podman build --no-cache -t "$(REGISTRY):$(VERSION)" --build-arg BASEIMAGE=$(BASEIMAGE) --label commit=$(shell git log --max-count 1 --format="%H") .

push:
docker push "$(REGISTRY):$(VERSION)"
podman push "$(REGISTRY):$(VERSION)"

unit-test:
go test -race -v -coverprofile=c.out ./...
Expand Down
21 changes: 21 additions & 0 deletions scripts/buildubimicro.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
# Copyright (c) 2023 Dell Inc., or its subsidiaries. All Rights Reserved.
#
# 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.

microcontainer=$(buildah from $1)
micromount=$(buildah mount $microcontainer)
dnf install --installroot $micromount --releasever=8 --nodocs --setopt install_weak_deps=false openssl nettle gnutls systemd -y
dnf clean all --installroot $micromount
buildah umount $microcontainer
buildah commit $microcontainer resiliency-ubimicro
8 changes: 4 additions & 4 deletions test/podmontest/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Dell Inc., or its subsidiaries. All Rights Reserved.
# Copyright (c) 2021-2023 Dell Inc., or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -25,10 +25,10 @@ build:
rm -f podmontest
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags podmontest -ldflags '-w' -o podmontest *.go

docker:
docker build -t "$(REGISTRY):$(VERSION)" --label commit=$(shell git log --max-count 1 --format="%H") .
podman:
podman build -t "$(REGISTRY):$(VERSION)" --label commit=$(shell git log --max-count 1 --format="%H") .

push:
docker push "$(REGISTRY):$(VERSION)"
podman push "$(REGISTRY):$(VERSION)"


0 comments on commit befedcf

Please sign in to comment.