Skip to content

Commit dc6cc7b

Browse files
committed
Make kubelet dir configurable (fixes #229) (#232)
# Description This should fix #229 from secret-operator's perspective. There are still outstanding issues in zk-op that I'll open a new issue for.
1 parent 172ad83 commit dc6cc7b

File tree

7 files changed

+34
-10
lines changed

7 files changed

+34
-10
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ All notable changes to this project will be documented in this file.
1111
- After upgrading you will need to
1212
`rmdir /var/lib/kubelet/plugins_registry/secrets.stackable.tech-reg.sock` manually.
1313
This applies to *all* users, not just Microk8s.
14+
- Made kubeletDir configurable ([#232]).
15+
- Microk8s users will need to `--set kubeletDir=/var/snap/microk8s/common/var/lib/kubelet`.
1416

1517
[#212]: https://github.com/stackabletech/secret-operator/pull/212
1618
[#231]: https://github.com/stackabletech/secret-operator/pull/231
19+
[#232]: https://github.com/stackabletech/secret-operator/pull/232
1720

1821
## [0.6.0] - 2022-11-07
1922

Tiltfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ default_registry("docker.stackable.tech/sandbox")
22

33
custom_build(
44
'docker.stackable.tech/sandbox/secret-operator',
5-
'nix run -f . crate2nix generate && nix-build . -A docker --argstr dockerName "${EXPECTED_REGISTRY}/secret-operator" && ./result/load-image | docker load',
5+
'nix shell -f . crate2nix -c crate2nix generate && nix-build . -A docker --argstr dockerName "${EXPECTED_REGISTRY}/secret-operator" && ./result/load-image | docker load',
66
deps=['rust', 'Cargo.toml', 'Cargo.lock', 'default.nix', "nix", 'build.rs', 'vendor'],
77
# ignore=['result*', 'Cargo.nix', 'target', *.yaml],
88
outputs_image_ref_to='result/ref',

default.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ rec {
5353
}
5454
];
5555

56-
crate2nix = pkgs.crate2nix;
56+
# need to use vendored crate2nix because of https://github.com/kolloch/crate2nix/issues/264
57+
crate2nix = pkgs.callPackage sources.crate2nix {};
5758
tilt = pkgs.tilt;
5859
}

deploy/helm/secret-operator/templates/daemonset.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ spec:
4545
- name: csi
4646
mountPath: /csi
4747
- name: mountpoint
48-
mountPath: /var/lib/kubelet/pods
48+
mountPath: {{ .Values.kubeletDir }}/pods
4949
mountPropagation: Bidirectional
5050
- name: external-provisioner
5151
image: k8s.gcr.io/sig-storage/csi-provisioner:v3.1.0
@@ -60,7 +60,7 @@ spec:
6060
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.4.0
6161
args:
6262
- --csi-address=/csi/csi.sock
63-
- --kubelet-registration-path=/var/lib/kubelet/plugins/secrets.stackable.tech/csi.sock
63+
- --kubelet-registration-path={{ .Values.kubeletDir }}/plugins/secrets.stackable.tech/csi.sock
6464
volumeMounts:
6565
- name: registration-sock
6666
mountPath: /registration
@@ -71,13 +71,13 @@ spec:
7171
hostPath:
7272
# node-driver-registrar appends a driver-unique filename to this path to avoid conflicts
7373
# see https://github.com/stackabletech/secret-operator/issues/229 for why this path should not be too long
74-
path: /var/lib/kubelet/plugins_registry
74+
path: {{ .Values.kubeletDir }}/plugins_registry
7575
- name: csi
7676
hostPath:
77-
path: /var/lib/kubelet/plugins/secrets.stackable.tech/
77+
path: {{ .Values.kubeletDir }}/plugins/secrets.stackable.tech/
7878
- name: mountpoint
7979
hostPath:
80-
path: /var/lib/kubelet/pods/
80+
path: {{ .Values.kubeletDir }}/pods/
8181
{{- with .Values.nodeSelector }}
8282
nodeSelector:
8383
{{- toYaml . | nindent 8 }}

deploy/helm/secret-operator/values.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ nodeSelector: {}
5050
tolerations: []
5151

5252
affinity: {}
53+
54+
# Kubelet dir may vary in environments such as microk8s, see https://github.com/stackabletech/secret-operator/issues/229
55+
kubeletDir: /var/lib/kubelet

docs/modules/ROOT/pages/installation.adoc

+5
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ $ helm install secret-operator stackable/secret-operator
3636

3737
Helm will deploy the operator in Kubernetes containers and apply the CRDs. You're now ready to deploy secrets!
3838

39+
=== Microk8s
40+
41+
Microk8s uses a non-standard Kubelet state directory. Installing secret-operator on Microk8s requires the argument
42+
`--set kubeletDir=/var/snap/microk8s/common/var/lib/kubelet` to be added to the `helm install` command.
43+
3944
== Building the operator from source
4045

4146
See xref:building.adoc[] for more information.

nix/sources.json

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
{
2+
"crate2nix": {
3+
"branch": "master",
4+
"description": "nix build file generator for rust crates",
5+
"homepage": "",
6+
"owner": "kolloch",
7+
"repo": "crate2nix",
8+
"rev": "fd2b9cf70ef55529b6793036b648ce2d9e2e7ba1",
9+
"sha256": "0cc15msc0c3asmilr1czsjf4vbzqzj13w3ff33nyq6gxq3md84k3",
10+
"type": "tarball",
11+
"url": "https://github.com/kolloch/crate2nix/archive/fd2b9cf70ef55529b6793036b648ce2d9e2e7ba1.tar.gz",
12+
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13+
},
214
"nixpkgs": {
315
"branch": "nixpkgs-unstable",
416
"description": "Nix Packages collection",
517
"homepage": "",
618
"owner": "NixOS",
719
"repo": "nixpkgs",
8-
"rev": "3bbb296d9a0088c314ce83038b896753bbe33acb",
9-
"sha256": "0dlq1zjcki30k2afg749a7c34vyb86sx1irab48l2g214nhj83hw",
20+
"rev": "79feedf38536de2a27d13fe2eaf200a9c05193ba",
21+
"sha256": "0ndv4nq0rap8m0qr50qliz6fib5gd8bg5flr67lmvcifx6lmri5v",
1022
"type": "tarball",
11-
"url": "https://github.com/NixOS/nixpkgs/archive/3bbb296d9a0088c314ce83038b896753bbe33acb.tar.gz",
23+
"url": "https://github.com/NixOS/nixpkgs/archive/79feedf38536de2a27d13fe2eaf200a9c05193ba.tar.gz",
1224
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
1325
}
1426
}

0 commit comments

Comments
 (0)