Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

be explicit about ports for workers and servers #217

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions 3.component_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ A Server is used for long-running, scalable workloads that have a network endpoi
- A Server is daemonized. A runtime MUST attempt to restart replicas that exit regardless of error code.
- A Server has a network endpoint with an automatically assigned virtual IP address (VIP) and DNS name addressable within the network scope to which the component belongs.

> If a Server does not provide at least one `port` on at least one `container`, implementations SHOULD emit an error.


##### Singleton Server
Workload type name: `core.oam.dev/v1alpha1.SingletonServer`

Expand All @@ -143,6 +146,8 @@ A Singleton Server is a special case of the Server workload type that is limited
- A Singleton Server is daemonized. A runtime MUST attempt to restart the singleton replica if it exits regardless of error code.
- A Singleton Server has a network endpoint with an automatically assigned virtual IP address (VIP) and DNS name addressable within the network scope to which the component belongs.

> If a Singleton Server does not provide at least one `port` on at least one `container`, implementations SHOULD emit an error.

##### Worker
Workload type name: `core.oam.dev/v1alpha1.Worker`

Expand All @@ -151,13 +156,16 @@ A worker is used for long-running, scalable workloads that do not have a service
- An application operator can increase or decrease the number of worker replicas by applying and configuring traits when available.
- A worker is daemonized. A runtime MUST attempt to restart replicas that exit regardless of error code.

> If a Worker declares a `port` on any `container`, this SHOULD result in a validation error.

##### Singleton Worker
Workload type name: `core.oam.dev/v1alpha1.SingletonWorker`

A singleton worker is a special case of the worker workload type that is limited to at most one replica. The singleton worker workload type as the following characteristics:
- Defines a container runtime where at most one replica of the same container may be run at a time.
- A singleton worker is daemonized. A runtime MUST attempt to restart the singleton replica if it exits regardless of error code.

> If a Singleton Worker declares a `port` on any `container`, this SHOULD result in a validation error.

##### Task
Workload type name: `core.oam.dev/v1alpha1.Task`
Expand Down Expand Up @@ -258,14 +266,16 @@ Resources describe compute resources attached to a runtime.

| Attribute | Type | Required | Default Value | Description |
|-----------|------|----------|---------------|-------------|
| `cpu` | [`CPU`](#cpu) | Y | | Specifies the attributes of the cpu resource required for the container. |
| `memory` | [`Memory`](#memory) | Y | | Specifies the attributes of the memory resource required for the container. |
| `cpu` | [`CPU`](#cpu) | N | | Specifies the attributes of the cpu resource required for the container. |
| `memory` | [`Memory`](#memory) | N | | Specifies the attributes of the memory resource required for the container. |
| `gpu` | [`GPU`](#gpu) | N | | Specifies the attributes of the gpu resources required for the container. |
| `volumes` | [`[]Volume`](#volume) | N | | Specifies the attributes of the volumes that the container uses. |
| `extended` | [`[]ExtendedResource`](#extendedresource) | N | | Implementation-specific extended resource requirements |

For any resource that cannot be satisfied by the underlying platform, the platform MUST return an error and cease deployment. A resource is considered a requirement, and failure to meet that requirement means the runtime MUST NOT deploy the application. For example, if an application requests `1P` of memory, and that amount of memory is not available, the application deployment must fail. Likewise, if an application requires `1` gpu, and the runtime does not provide gpus, the application deployment MUST fail.

If resources are not specified, the underlying platform is free to choose a suitable default.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might cause weird & hard to debug errors. Is there a specific reason for making this to be not required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes -- issue #182

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this was complicated by the fact that the way different platforms measure CPU and memory turn out to be different, as we discovered on Kubernetes a few weeks back.

Copy link
Contributor Author

@technosophos technosophos Oct 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe I should ask. In Kubernetes, a sensible default for CPU is somewhere around 0.05 and maybe 0.1, because in Kubernetes, this is how much of a Kubernetes Node's actual CPU you need. I am assuming that for SF, the sane default is 1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do fractional cores as well, but I am thinking of cases where the default causes activation of the container to fail and makes it hard and not obvious for the operator to debug(we have seen such cases when we were doing SF Mesh).
Also, the issue #182 mentions Resources are optional for containers, they are mandatory as well in the current schema(is that comment meaning different resources than this one below?).
resources | Resources | Y |   | Resources required by the container.-- | -- | -- | -- | --

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed that section from this PR, opening another PR to deal with just #182


#### CPU

| Attribute | Type | Required | Default Value | Description |
Expand Down