-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalues.yml
More file actions
128 lines (102 loc) · 2.77 KB
/
Copy pathvalues.yml
File metadata and controls
128 lines (102 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
image:
registry: ghcr.io
repository: bgshacklett/swimctl
tag: latest
pullPolicy: Always
resources:
limits:
smarter-devices/i2c-1: 1
smarter-devices/i2c-20: 1
smarter-devices/i2c-21: 1
requests:
smarter-devices/i2c-1: 1
smarter-devices/i2c-20: 1
smarter-devices/i2c-21: 1
podSecurityContext:
runAsUser: 1000 # UID
runAsGroup: 1000 # GID
fsGroup: 1000 # GID for volume permission
supplementalGroups:
- 994 # Add i2c group membership
# TODO: find out why this changed from 998
deploymentStrategy: Recreate
env:
- name: NODE_RED_ENABLE_PROJECTS
value: 'true'
- name: NODE_RED_ACTIVE_PROJECT
value: swimctl-flows
- name: GITHUB_TOKEN_FLOWS
valueFrom:
secretKeyRef:
name: swimctl
key: gh_token
- name: GITHUB_OWNER_FLOWS
valueFrom:
secretKeyRef:
name: swimctl
key: gh_owner
- name: GITHUB_REPO_NAME_FLOWS
valueFrom:
secretKeyRef:
name: swimctl
key: gh_repo_name
- name: MQTT_PASSWORD
valueFrom:
secretKeyRef:
name: swimctl
key: mqtt_password
ingress:
enabled: true
hosts:
- host: swimctl.local
paths:
- path: /
pathType: ImplementationSpecific
settings:
name: settings
configMapName: node-red-settings
extraVolumeMounts:
- name: node-red-projects-settings
mountPath: /data/.config.projects.json
subPath: .config.projects.json
extraVolumes:
- name: node-red-projects-settings
configMap:
name: node-red-projects-settings
initContainers:
- name: clone-repo
image: alpine/git # or any image that has git
env:
- name: GIT_REPO
value: "https://github.com/bgshacklett/swimctl-flows.git"
- name: GIT_VERSION
value: "main"
securityContext:
runAsUser: 10003
runAsGroup: 10003
command:
- /bin/sh
- -c
- |
#!/bin/sh
rm -rf /data/projects/* &&
git clone $(GIT_REPO) /data/projects/swimctl-flows &&
cd /data/projects/swimctl-flows &&
git checkout $(GIT_VERSION)
# Create post-commit hook
cat << 'EOF' > .git/hooks/post-commit
#!/bin/bash
commit_hash=$(git rev-parse HEAD)
patch_content=$(git format-patch -1 $commit_hash --stdout | base64 | awk '{printf "%s\\n", $0}' )
url="https://api.github.com/repos/$GITHUB_OWNER_FLOWS/$GITHUB_REPO_NAME_FLOWS/actions/workflows/apply-patch.yml/dispatches"
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer $GITHUB_TOKEN_FLOWS" \
"$url" \
-d "{\"ref\":\"main\", \"inputs\": {\"patchContent\": \"$patch_content\"}}"
EOF
chmod +x .git/hooks/post-commit
#end-range
volumeMounts:
- mountPath: /data
name: data