Skip to content

Commit

Permalink
Adds csi-node-driver-registrar rock (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiubelu authored Aug 2, 2024
1 parent 4f38730 commit ad54128
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
62 changes: 62 additions & 0 deletions csi-node-driver-registrar/2.10.0/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2024 Canonical, Ltd.
# See LICENSE file for licensing details

# Based on: https://github.com/kubernetes-csi/node-driver-registrar/blob/v2.10.0/Dockerfile
name: csi-node-driver-registrar
summary: csi-node-driver-registrar rock
description: |
A rock containing the CSI node driver registrar.
The node-driver-registrar is a sidecar container that registers the CSI
driver with Kubelet using the kubelet plugin registration mechanism.
This is necessary because Kubelet is responsible for issuing CSI NodeGetInfo,
NodeStageVolume, NodePublishVolume calls. The node-driver-registrar registers
your CSI driver with Kubelet so that it knows which Unix domain socket to issue
the CSI calls on.
license: Apache-2.0
version: 2.10.0

base: bare
build-base: [email protected]
run-user: _daemon_

platforms:
amd64:
arm64:

environment:
APP_VERSION: 2.10.0

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

parts:
build-csi-node-driver-registrar:
plugin: go
source: https://github.com/kubernetes-csi/node-driver-registrar.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-node-driver-registrar
organize:
bin/csi-node-driver-registrar: ./
18 changes: 18 additions & 0 deletions tests/sanity/test_csi_node_driver_registrar.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_node_driver_registrar_rock():
"""Test csi-node-driver-registrar rock."""
rock = env_util.get_build_meta_info_for_rock_version(
"csi-node-driver-registrar", "2.10.0", "amd64"
)
image = rock.image

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

0 comments on commit ad54128

Please sign in to comment.