Skip to content

Commit

Permalink
Adds longhorn-manager command patch (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiubelu authored Sep 11, 2024
1 parent ace11d4 commit e15dd97
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
13 changes: 13 additions & 0 deletions v1.7.0/longhorn-manager/longhorn-csi-plugin-command.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/csi/deployment.go b/csi/deployment.go
index 68ed5c5f2..b0e523a4a 100644
--- a/csi/deployment.go
+++ b/csi/deployment.go
@@ -375,7 +375,7 @@ func NewPluginDeployment(namespace, serviceAccount, nodeDriverRegistrarImage, li
},
},
},
- Args: []string{
+ Command: []string{
"longhorn-manager",
"-d",
"csi",
16 changes: 16 additions & 0 deletions v1.7.0/longhorn-manager/rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ parts:
- CGO_ENABLED: 0
- VERSION: $CRAFT_PROJECT_VERSION
override-build: |
# NOTE(claudiub): The original longhorn-manager image doesn't have an entrypoint, only a CMD.
# This means that when the image is launched, it will run the CMD directly. Basically, the
# CMD is the ENTRYPOINT (binary + arguments). That works fine with the current deployments.
#
# longhorn-manager will create the daemonset.apps/longhorn-csi-plugin, which will
# have a longhorn-manager container, which doesn't override the entrypoint, only the
# args (aka CMD).
# But in our rock scenario, Pebble is the entrypoint, which will get those arguments and pass them
# on onto the service defined above. This results in an invalid command being run, something like:
# longhorn-manager -d daemon longhorn-manager -d csi --nodeid=...
#
# This patch updates the mentioned container args to command, overriding the Pebble entrypoint,
# avoiding this problem.
cp $CRAFT_PROJECT_DIR/longhorn-csi-plugin-command.patch ./
git apply -v longhorn-csi-plugin-command.patch
# https://github.com/longhorn/longhorn-manager/blob/v1.7.0/package/Dockerfile#L15
mkdir -p $CRAFT_PART_INSTALL/usr/local/sbin/
cp package/launch-manager package/nsmounter $CRAFT_PART_INSTALL/usr/local/sbin/
Expand Down

0 comments on commit e15dd97

Please sign in to comment.