-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnapcraft.yaml
376 lines (320 loc) · 10 KB
/
snapcraft.yaml
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
name: juju
version: 4.0-beta5
summary: Juju - a model-driven operator lifecycle manager for K8s and machines
license: AGPL-3.0
description: |
A model-driven **universal operator lifecycle manager** for multi cloud and hybrid cloud application management on K8s and machines.
**What is an operator lifecycle manager?**
Kubernetes operators are containers with operations code, that drive your applications on K8s. Juju is an operator lifecycle manager that manages the installation, integration and configuration of operators on the cluster. Juju also extends the idea of operators to traditional application management on Linux and Windows servers, or cloud instances.
**Model-driven operations and integration**
Organise your operators into models, which group together applications that can be tightly integrated on the same substrate and operated by the same team. Capture resource allocation, storage, networking and integration information in the model to simplify ongoing operations.
**Better day-2 operations**
Each operator code package, called a charm, declares methods for actions like backup, restore, or security audit. Calling these methods provides remote administration of the application with no low-level access required.
**Learn more**
- https://juju.is/
- https://discourse.charmhub.io/
- https://github.com/juju/juju
**Note**
This snap needs to read any relevant locally stored cloud credentials in order to manage resources on your behalf in a specified cloud.
It also can read private ssh keys. The privileged interface auto connections include:
- lxd
- ssh-keys
confinement: strict
grade: devel
base: core24
apps:
juju:
environment:
# Make sure we access snap binaries first (i.e. juju-metadata lp:1759013)
PATH: "$SNAP/bin:$SNAP/usr/bin:/snap/bin:$PATH"
command: bin/juju
plugs:
- network
- network-bind
- ssh-keys
- lxd
# Needed to read the JAAS plugin binary
- jaas-plugin
# Needed so that juju can still use the real ~/.local/share/juju.
- dot-local-share-juju
# Needed to read lxd config.
- config-lxd
# Needed to read ~/.kube, ~/.novarc, ~/.aws etc.
- dot-aws
- dot-azure
- dot-google
- dot-kubernetes
- dot-maas
- dot-openstack
- dot-oracle
# Needed so that arbitrary cloud/credential yaml files can be read and backups written.
- home
# Needed to that SSO via the web browser can work.
- desktop
fetch-oci:
daemon: oneshot
command: wrappers/fetch-oci
start-timeout: 1m
stop-timeout: 35s
plugs:
- network
parts:
wrappers:
plugin: dump
source: snap/local
musl-compat:
source: https://github.com/juju/musl-compat.git
source-type: git
source-depth: 1
plugin: nil
build-packages:
- musl-tools
override-build: |
set -ex
MACHINE_TYPE="$(gcc -dumpmachine | awk -F'-' '{print $1}')"
if [ "${MACHINE_TYPE}" = "powerpc64le" ]; then
cat <<EOM | tee -a "/usr/lib/powerpc64le-linux-musl/musl-gcc.specs"
%rename cpp_options x_cpp_options
*cpp_options:
-mlong-double-64 %(x_cpp_options)
%rename cc1 x_cc1
*cc1:
-mlong-double-64 %(x_cc1)
EOM
fi
ln -s $(pwd)/include/sys/queue.h /usr/include/${MACHINE_TYPE}-linux-musl/sys/queue.h || true
ln -s /usr/include/${MACHINE_TYPE}-linux-gnu/asm /usr/include/${MACHINE_TYPE}-linux-musl/asm || true
ln -s /usr/include/asm-generic /usr/include/${MACHINE_TYPE}-linux-musl/asm-generic || true
ln -s /usr/include/linux /usr/include/${MACHINE_TYPE}-linux-musl/linux || true
libtirpc:
after:
- musl-compat
source: https://git.launchpad.net/ubuntu/+source/libtirpc
source-branch: applied/ubuntu/noble
source-type: git
source-depth: 1
plugin: nil
build-packages:
- musl-tools
- automake
- make
override-build: |
set -ex
export CC="musl-gcc"
export PKG_CONFIG_PATH="${CRAFT_STAGE}/snap-linux-musl/lib/pkgconfig"
chmod +x autogen.sh
autoupdate
./autogen.sh
./configure --disable-shared --disable-gssapi --prefix "${CRAFT_STAGE}/snap-linux-musl"
make install
libnsl:
after:
- libtirpc
source: https://github.com/thkukuk/libnsl.git
source-tag: v2.0.0
source-type: git
source-depth: 1
plugin: nil
build-packages:
- musl-tools
- automake
- make
override-build: |
set -ex
export CC="musl-gcc"
export PKG_CONFIG_PATH="${CRAFT_STAGE}/snap-linux-musl/lib/pkgconfig"
./autogen.sh
autoreconf -i
autoconf
./configure --disable-shared --prefix "${CRAFT_STAGE}/snap-linux-musl"
make install
libuv:
after:
- musl-compat
source: https://git.launchpad.net/ubuntu/+source/libuv1
source-branch: applied/ubuntu/noble
source-type: git
source-depth: 1
plugin: nil
build-packages:
- musl-tools
- automake
- make
override-build: |
set -ex
export CC="musl-gcc"
export PKG_CONFIG_PATH="${CRAFT_STAGE}/snap-linux-musl/lib/pkgconfig"
./autogen.sh
./configure --disable-shared --prefix "${CRAFT_STAGE}/snap-linux-musl"
make install
libsqlite3:
after:
- musl-compat
source: https://git.launchpad.net/ubuntu/+source/sqlite3
source-branch: applied/ubuntu/noble
source-type: git
source-depth: 1
plugin: nil
build-packages:
- musl-tools
- automake
- make
override-build: |
set -ex
export CC="musl-gcc"
export PKG_CONFIG_PATH="${CRAFT_STAGE}/snap-linux-musl/lib/pkgconfig"
./configure --disable-shared --prefix "${CRAFT_STAGE}/snap-linux-musl"
make install
liblz4:
after:
- musl-compat
source: https://git.launchpad.net/ubuntu/+source/lz4
source-branch: applied/ubuntu/noble
source-type: git
source-depth: 1
plugin: nil
build-packages:
- musl-tools
- make
override-build: |
set -ex
export CC="musl-gcc"
export PKG_CONFIG_PATH="${CRAFT_STAGE}/snap-linux-musl/lib/pkgconfig"
cd lib
make install PREFIX="${CRAFT_STAGE}/snap-linux-musl" BUILD_SHARED=no BUILD_STATIC=yes
libdqlite:
after:
- libnsl
- liblz4
- libuv
- libsqlite3
source: https://github.com/canonical/dqlite.git
source-tag: v1.18.0
source-type: git
source-depth: 1
plugin: nil
build-packages:
- musl-tools
- automake
- autopoint
- gettext
- libtool
- make
- pkg-config
- tcl
- tclsh
override-build: |
set -ex
export CC="musl-gcc"
export PKG_CONFIG_PATH="${CRAFT_STAGE}/snap-linux-musl/lib/pkgconfig"
autoreconf -i
./configure --disable-shared --enable-build-raft --prefix "${CRAFT_STAGE}/snap-linux-musl"
make install
jujud:
after:
- libdqlite
plugin: nil
source: .
build-snaps:
- go/1.23/stable
build-packages:
- musl-tools
override-build: |
set -ex
# TODO: use make plugin.
export CC=musl-gcc
export PKG_CONFIG_PATH="${CRAFT_STAGE}/snap-linux-musl/lib/pkgconfig"
export PACKAGES="libuv dqlite liblz4 sqlite3"
export GOBIN="${CRAFT_PART_INSTALL}/bin"
export CGO_ENABLED=1
export CGO_CFLAGS="$(pkg-config --cflags ${PACKAGES})"
export CGO_LDFLAGS="$(pkg-config --libs ${PACKAGES}) -Wl,-z,stack-size=1048576"
export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"
export GO_LDFLAGS='-s -w -extldflags "-static" -linkmode "external" -X github.com/juju/juju/version.GitCommit= -X github.com/juju/juju/version.GitTreeState= -X github.com/juju/juju/version.build='
go mod download
go install -tags libsqlite3,dqlite -ldflags "${GO_LDFLAGS}" github.com/juju/juju/cmd/jujud-controller
mv ${SNAPCRAFT_PART_INSTALL}/bin/jujud-controller ${SNAPCRAFT_PART_INSTALL}/bin/jujud
juju:
after:
- jujud
plugin: nil
source: .
build-snaps:
- go/1.23/stable
override-build: |
set -ex
# TODO: use make plugin.
export GOBIN="${CRAFT_PART_INSTALL}/bin"
export CGO_ENABLED=0
export GO_LDFLAGS='-s -w -extldflags "-static" -X github.com/juju/juju/version.GitCommit= -X github.com/juju/juju/version.GitTreeState= -X github.com/juju/juju/version.build='
go mod download
go install -ldflags "${GO_LDFLAGS}" github.com/juju/juju/cmd/juju github.com/juju/juju/cmd/jujuc github.com/juju/juju/cmd/plugins/juju-metadata
mkdir -p ${CRAFT_PART_INSTALL}/bash_completions
cp -a etc/bash_completion.d/juju* ${CRAFT_PART_INSTALL}/bash_completions/.
jujud=${CRAFT_STAGE}/bin/jujud
version=$($jujud version)
hash=$(sha256sum $jujud | cut -d " " -f 1)
cat > jujud-versions.yaml <<EOF
versions:
- version: $version
sha256: $hash
EOF
cp -a jujud-versions.yaml ${CRAFT_PART_INSTALL}/bin
stage-packages:
- openssh-client
hooks:
connect-plug-peers: {}
disconnect-plug-peers: {}
post-refresh: {}
slots:
juju-bin:
interface: content
content: juju
source:
read:
- $SNAP/bin
plugs:
peers:
interface: content
content: microk8s
target: $SNAP_DATA/microk8s
jaas-plugin:
interface: content
content: jaas-plugin
target: $SNAP/usr/bin
dot-local-share-juju:
interface: personal-files
write:
- $HOME/.local/share/juju
config-lxd:
interface: personal-files
read:
- $HOME/snap/lxd/common/config
dot-aws:
interface: personal-files
read:
- $HOME/.aws
dot-azure:
interface: personal-files
read:
- $HOME/.azure
dot-google:
interface: personal-files
read:
- $HOME/.config/gcloud
dot-kubernetes:
interface: personal-files
read:
- $HOME/.kube
dot-maas:
interface: personal-files
read:
- $HOME/.maasrc
dot-oracle:
interface: personal-files
read:
- $HOME/.oci
dot-openstack:
interface: personal-files
read:
- $HOME/.novarc