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

Commit

Permalink
schema/app: add parameter to set support of sd_notify()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Alessandro Puccetti committed Jun 22, 2016
1 parent baa3e9c commit 6b4cef9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
3 changes: 2 additions & 1 deletion examples/image.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
"protocol": "tcp",
"socketActivated": true
}
]
],
"supportsNotify" : false
},
"dependencies": [
{
Expand Down
1 change: 1 addition & 0 deletions schema/types/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type App struct {
MountPoints []MountPoint `json:"mountPoints,omitempty"`
Ports []Port `json:"ports,omitempty"`
Isolators Isolators `json:"isolators,omitempty"`
SupportsNotify bool `json:"supportsNotify"`
}

// app is a model to facilitate extra validation during the
Expand Down
20 changes: 20 additions & 0 deletions schema/types/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ func TestAppValid(t *testing.T) {
Group: "0",
WorkingDirectory: "/tmp",
},
App{
Exec: []string{},
User: "0",
Group: "0",
WorkingDirectory: "/tmp",
SupportsNotify: false,
},
}
for i, tt := range tests {
if err := tt.assertValid(); err != nil {
Expand Down Expand Up @@ -211,6 +218,19 @@ func TestAppUnmarshal(t *testing.T) {
},
false,
},
{
`{"Exec":["/a"],"User":"0","Group":"0"}`,
&App{
Exec: Exec{
"/a",
},
User: "0",
Group: "0",
Environment: make(Environment, 0),
SupportsNotify: false,
},
false,
},
}
for i, tt := range tests {
a := &App{}
Expand Down
4 changes: 3 additions & 1 deletion spec/aci.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ JSON Schema for the Image Manifest (app image manifest, ACI manifest), conformin
"count": 1000,
"protocol": "tcp"
}
]
],
"supportsNotify" : false
},
"dependencies": [
{
Expand Down Expand Up @@ -239,6 +240,7 @@ JSON Schema for the Image Manifest (app image manifest, ACI manifest), conformin
* **port** (integer, required) port number that will be used; see also **count**. Must be >=1 and <=65535.
* **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.
* **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().
* **supportsNotify** (boolean, optional, defaults to "false" if unset) if set to true, the application should use [sd_notify()](https://www.freedesktop.org/software/systemd/man/sd_notify.html) to signal when it is ready. Setting this parameter to true for an application that does not send a ready signal with `sd_notify()` may result in misbehave.
* **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.
* **imageName** (string of type [AC Identifier](types.md#ac-identifier-type), required) name of the dependent App Container Image.
* **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.
Expand Down

0 comments on commit 6b4cef9

Please sign in to comment.