45 lines
1.3 KiB
YAML
45 lines
1.3 KiB
YAML
|
---
|
||
|
apiVersion: v1
|
||
|
kind: ConfigMap
|
||
|
metadata:
|
||
|
name: longhorn-nixos-path
|
||
|
namespace: longhorn-system
|
||
|
data:
|
||
|
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/run/wrappers/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin
|
||
|
---
|
||
|
apiVersion: kyverno.io/v1
|
||
|
kind: ClusterPolicy
|
||
|
metadata:
|
||
|
name: longhorn-add-nixos-path
|
||
|
annotations:
|
||
|
policies.kyverno.io/title: Add Environment Variables from ConfigMap
|
||
|
policies.kyverno.io/subject: Pod
|
||
|
policies.kyverno.io/category: Other
|
||
|
policies.kyverno.io/description: >-
|
||
|
Longhorn invokes executables on the host system, and needs
|
||
|
to be aware of the host systems PATH. This modifies all
|
||
|
deployments such that the PATH is explicitly set to support
|
||
|
NixOS based systems.
|
||
|
spec:
|
||
|
rules:
|
||
|
- name: add-env-vars
|
||
|
match:
|
||
|
resources:
|
||
|
kinds:
|
||
|
- Pod
|
||
|
namespaces:
|
||
|
- longhorn-system
|
||
|
mutate:
|
||
|
patchStrategicMerge:
|
||
|
spec:
|
||
|
initContainers:
|
||
|
- (name): "*"
|
||
|
envFrom:
|
||
|
- configMapRef:
|
||
|
name: longhorn-nixos-path
|
||
|
containers:
|
||
|
- (name): "*"
|
||
|
envFrom:
|
||
|
- configMapRef:
|
||
|
name: longhorn-nixos-path
|
||
|
---
|