Skip to content
This repository was archived by the owner on Aug 14, 2020. It is now read-only.

Commit c9a6592

Browse files
author
Alessandro Puccetti
committed
schema/app: add parameter to set support of sd_notify()
supportsNotify exposes if or not an application supports notifications using sd_notify(). This information may be used to signal the init process when a service is ready.
1 parent baa3e9c commit c9a6592

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

examples/image.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676
"protocol": "tcp",
7777
"socketActivated": true
7878
}
79-
]
79+
],
80+
"supportsNotify" : false
8081
},
8182
"dependencies": [
8283
{

schema/types/app.go

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ type App struct {
3232
MountPoints []MountPoint `json:"mountPoints,omitempty"`
3333
Ports []Port `json:"ports,omitempty"`
3434
Isolators Isolators `json:"isolators,omitempty"`
35+
SupportsNotify bool `json:"supportsNotify"`
3536
}
3637

3738
// app is a model to facilitate extra validation during the

schema/types/app_test.go

+20
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ func TestAppValid(t *testing.T) {
7070
Group: "0",
7171
WorkingDirectory: "/tmp",
7272
},
73+
App{
74+
Exec: []string{},
75+
User: "0",
76+
Group: "0",
77+
WorkingDirectory: "/tmp",
78+
SupportsNotify: false,
79+
},
7380
}
7481
for i, tt := range tests {
7582
if err := tt.assertValid(); err != nil {
@@ -211,6 +218,19 @@ func TestAppUnmarshal(t *testing.T) {
211218
},
212219
false,
213220
},
221+
{
222+
`{"Exec":["/a"],"User":"0","Group":"0"}`,
223+
&App{
224+
Exec: Exec{
225+
"/a",
226+
},
227+
User: "0",
228+
Group: "0",
229+
Environment: make(Environment, 0),
230+
SupportsNotify: false,
231+
},
232+
false,
233+
},
214234
}
215235
for i, tt := range tests {
216236
a := &App{}

spec/aci.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ JSON Schema for the Image Manifest (app image manifest, ACI manifest), conformin
169169
"count": 1000,
170170
"protocol": "tcp"
171171
}
172-
]
172+
],
173+
"supportsNotify" : false
173174
},
174175
"dependencies": [
175176
{
@@ -239,6 +240,7 @@ JSON Schema for the Image Manifest (app image manifest, ACI manifest), conformin
239240
* **port** (integer, required) port number that will be used; see also **count**. Must be >=1 and <=65535.
240241
* **count** (integer, optional, defaults to 1 if unset) specifies a range of ports, starting with "port" and ending with "port" + "count" - 1. Must be >=1.
241242
* **socketActivated** (boolean, optional, defaults to "false" if unsupplied) if set to true, the application expects to be [socket activated](http://www.freedesktop.org/software/systemd/man/sd_listen_fds.html) on these ports. To perform socket activation, the ACE MUST pass file descriptors using the [socket activation protocol](http://www.freedesktop.org/software/systemd/man/sd_listen_fds.html) that are listening on these ports when starting this app. If multiple apps in the same pod are using socket activation then the ACE must match the sockets to the correct apps using getsockopt() and getsockname().
243+
* **supportsNotify** (boolean, optional, defaults to "false" if unset) if set to true, the application MUST use the [sd_notify()](https://www.freedesktop.org/software/systemd/man/sd_notify.html) mechanism to signal when it is ready. Executors MAY ignore **supportsNotify**. An application with supportNotify=true MUST be able to detect if the executor had not set up the sd_notify mechanism and skip the notification without error ([sd_notify()](https://www.freedesktop.org/software/systemd/man/sd_notify.html) from libsystemd does that automatically).
242244
* **dependencies** (list of objects, optional) dependent application images that need to be placed down into the rootfs before the files from this image (if any). The ordering is significant. See [Dependency Matching](#dependency-matching) for how dependencies are retrieved.
243245
* **imageName** (string of type [AC Identifier](types.md#ac-identifier-type), required) name of the dependent App Container Image.
244246
* **imageID** (string of type [Image ID](types.md#image-id-type), optional) content hash of the dependency. If provided, the retrieved dependency must match the hash. This can be used to produce deterministic, repeatable builds of an App Container Image that has dependencies.

0 commit comments

Comments
 (0)