Skip to content

Commit

Permalink
Adds csi-attacher rock (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiubelu authored Aug 2, 2024
1 parent fc3749b commit 6ac8203
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
59 changes: 59 additions & 0 deletions csi-attacher/4.5.1/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2024 Canonical, Ltd.
# See LICENSE file for licensing details

# Based on: https://github.com/kubernetes-csi/external-attacher/blob/v4.5.1/Dockerfile
name: csi-attacher
summary: csi-attacher rock
description: |
A rock containing csi-attacher.
The external-attacher is a sidecar container that attaches volumes to nodes
by calling ControllerPublish and ControllerUnpublish functions of CSI drivers.
It is necessary because internal Attach/Detach controller running in Kubernetes
controller-manager does not have any direct interfaces to CSI drivers.
license: Apache-2.0
version: 4.5.1

base: bare
build-base: ubuntu@22.04
run-user: _daemon_

platforms:
amd64:
arm64:

environment:
APP_VERSION: 4.5.1

# Services to be loaded by the Pebble entrypoint.
services:
csi-attacher:
summary: "csi-attacher service"
override: replace
startup: enabled
command: "/csi-attacher"
on-success: shutdown
on-failure: shutdown

parts:
build-csi-attacher:
plugin: go
source: https://github.com/kubernetes-csi/external-attacher.git
source-type: git
source-tag: v${CRAFT_PROJECT_VERSION}
source-depth: 1
build-snaps:
- go/1.21/stable
build-environment:
- CGO_ENABLED: 0
- GOOS: linux
- GOARCH: $CRAFT_ARCH_BUILD_FOR
- VERSION: $CRAFT_PROJECT_VERSION
- LDFLAGS: >
-X main.version=${VERSION} -extldflags "-static"
go-buildtags:
- "mod=vendor"
go-generate:
- ./cmd/csi-attacher
organize:
bin/csi-attacher: ./
18 changes: 18 additions & 0 deletions tests/sanity/test_csi_attacher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# Copyright 2024 Canonical, Ltd.
# See LICENSE file for licensing details
#

from k8s_test_harness.util import docker_util, env_util


def test_csi_attacher_rock():
"""Test csi-attacher rock."""
rock = env_util.get_build_meta_info_for_rock_version(
"csi-attacher", "4.5.1", "amd64"
)
image = rock.image

# check binary.
process = docker_util.run_in_docker(image, ["/csi-attacher", "--help"])
assert "Usage of /csi-attacher" in process.stderr

0 comments on commit 6ac8203

Please sign in to comment.