Definition blocks

A Definition consists of the blocks instance, clusters, nodes, endpoints and dependencies:

# resource kind declaration
spec:
  # instance definition
  clusters:
    # list of cluster definitions
    -
      nodes:
        # nodes definition
      provides:
        # list of endpoint definitions
        -
  dependencies:
    # map of dependency definitions
# resource kind declaration
apiVersion: service.aep.asag.io/v1      # the AEP service resource api with version
kind: Definition                        # the resource type is a definition
metadata:
  namespace: asag                       # the vendor shortname of the definition
  name: lemp-0.1                        # a unique name of the definition per vendor
spec:
  # instance definition
  name: lemp                            # the service shortname of this definition
  version: "0.1"                        # the recipe version of this definition
  clusters:
    # list of cluster definitions
    - name:  nginx                      # the cluster shortname
      sizing:
        initial: 2                      # default amount of nodes to be deployed
        minimum: 1                      # minimum amount of nodes
        maximum: 10                     # maximum amoumt of nodes
        increment: 1                    # allowed cluster sizing change if requested
      nodes:
        # nodes definition
        podspec:
          containers:
          - image: nginx                # image to use in the container of the nodes
      provides:
        # list of endpoint definitions
        - name:  web                    # the endpoint shortname
          network: loadbalanced         # type of clustering on network level
          servicespec:
            ports:                      # list of offered ports
            - name: http
              port: 80
              protocol: TCP
            - name: https
              port: 443
              protocol: TCP
  dependencies:
    # map of dependency definitions
    db:                                # the dependency shortname
      name: mysql                      # name of the definition to depend on
      vendor: asag                     # vendor of the referenced definition

Resource kind

In AEP a resource needs to be typed and named and is defined by the resource kind and metadata. For Definitions this resource kind is Definition in the serivce.aep.asag.io API. The metadata specifies the name and the vendor of this resource which combination must be unique per AEP cluster. For Definitions namespaces respresent the vendor.

apiVersion: service.aep.asag.io/v1
kind: Definition
metadata:
  namespace: myvendor
  name: myname
# ...
apiVersion: service.aep.asag.io/v1      # the AEP service resource api with version
kind: Definition                        # the resource type is a definition
metadata:
  namespace: asag                       # the vendor shortname of the definition
  name: lemp-0.1                        # a unique name of the definition per vendor
# ...

Instance definition

The instance block primarily contains properties which identify the recipe, a list of clusters as well as a list of dependencies. It requires a name representing the wished service constellation and the version of this recipe, which means you can have different recipe versions for the same name.

spec:
  name: myservice
  version: "0.0.0"
  # ...
spec:
  name: lemp                            # the service shortname of this definition
  version: "0.1"                        # the recipe version of this definition
  # ...

Cluster definition

The cluster block primarily contains properties to define nodes, sizing and provided endpoints of this cluster. It requires a name to represent the wished cluster constellation, which means you can have different clusters within a instance definition (E.g. In a LAMP definition an apache cluster with separate mysql cluster).

spec:
  clusters:
    - name: mycluster
      # ...
spec:
  clusters:
    - name: nginx                       # the cluster shortname
      sizing:
        initial: 2                      # default amount of nodes to be deployed
        minimum: 1                      # minimum amount of nodes
        maximum: 10                     # maximum amoumt of nodes
        increment: 1                    # allowed cluster sizing change if requested
      # ...

Nodes definition

Any property in the nodes definition apply to every instance of the node. As an overview the nodes block does not offer unique properties. It can contain inheritable properties and those are in more detail described in Inheritable Properties.

spec:
  clusters:
    - 
      nodes:
        # ...
spec:
  clusters:
    - 
      nodes:
        podspec:
          containers:
          - image: nginx                # image to use in the container of the nodes
        # ...

Endpoint definition

The endpoint block primarily contains properties to define the type of clustering, filtering rules for which nodes are included as well as generic address coordinates. It requires a name to respresent the wished access constellation as a local identifier, which means you can have different endpoints within a cluster definition. (E.g. In a MySQL cluster a readwrite endpoint to the master and a readonly endpoint to the slaves) and services consuming those endpoints can find the coordinates with this identifier.

spec:
  clusters:
    -
      provides:
        - name: myendpoint
          # ...
spec:
  clusters:
    -
      provides:
        - name:  web                    # the endpoint shortname
          network: loadbalanced         # type of clustering on network level
          servicespec:
            ports:                      # list of offered ports
            - name: http
              port: 80
              protocol: TCP
            - name: https
              port: 443
              protocol: TCP
          # ...

Dependency definition

The dependency block primarily contains properties to reference other definitions. It requires a key to represent the referenced definition as a local identifier. Instead of defining a cluster to which a service relies on you can also reference a Definition of such service constellation, granted it provides the wished implementation details and endpoints. A Provision of this Definition will receive the coordinates and thus will be able to consume the provided endpoints of the dependency.

spec:
  dependencies:
    mydependency:
      # ...
spec:
  dependencies:
    db:                                # the dependency shortname
      name: mysql                      # name of the definition to depend on
      vendor: asag                     # vendor of the referenced definition