openapi: "3.0.0"
info:
  version: 0.1.5
  title: Automium CRDs
  license:
    name: Apache
  description: |
    # Introduction
    Cloud Applications need a scalable and resilient infrastructure, not just a Kubernetes cluster that operates containers.
    Automium is responsible for controlling the IaaS below it as well as exposing its own APIs to manage core and extras components described below.
paths:
  /apis/core.automium.io/v1beta1/namespaces/{namespace}/services:
    get:
      summary: Services
      description: |
        Automium provides composable and reusable services ready to be deployed in your infrastructure, such as a Kubernetes cluster.
        Each service is built upon a proven process of Continuous Deployments in order to test and delivery 3 components:
        - Ansible Role, versioned and described on GitHub with the service configurations. The role is publicly available also on Ansible Galaxy to simplify further usages.
        - Cloud Image baked by the CI process. Every change to the configuration is tested and delivered as a Cloud Image to the Automium catalog.
        - Terraform Module. Every service needs one or more infrastructure resources, such as a number of variable nodes when you deploy a cluster service. All the needed resources are described in a specific Terraform module.

        Service is a core component of Automium API. It's the CRD with which the user interacts. An example of CR for creating a Kubernetes cluster could be the following:
        ```
        apiVersion: core.automium.io/v1beta1
        kind: Service
        metadata:
          labels:
            app: kubernetes-cluster
          name: mycluster
        spec:
          flavor: e3standard.x4
          replicas: 1
          version: v1.16.4-1-7d8af23e
        ```
        Linked services, such as the described cluster for other node pools, must use the specific environment variable "cluster_name", like in the following example of CR:
        ```
        apiVersion: core.automium.io/v1beta1
        kind: Service
        metadata:
          labels:
            app: kubernetes-nodepool
          name: mynodepool
        spec:
          env:
          - name: cluster_name
            value: mycluster
          flavor: e3standard.x5
          replicas: 3
          version: v1.16.4-1-7d8af23e
        ```
      responses:
        '200':
          description: An array of Services
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Services"
  /apis/core.automium.io/v1beta1/namespaces/{namespace}/modules:
    get:
      summary: Modules
      description: "> WARNING: this a resource generated and managed automatically by the controller; it's not meant to be created, edited or deleted by hand. You could potentially destroy your infrastructure by playing around with this resource."
      responses:
        '200':
          description: An array of Modules
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Modules"
  /apis/core.automium.io/v1beta1/namespaces/{namespace}/nodes:
    get:
      summary: Nodes
      description: "> WARNING: this a resource generated and managed automatically by the controller; it's not meant to be created, edited or deleted by hand. You could potentially destroy your infrastructure by playing around with this resource."
      responses:
        '200':
          description: An array of Nodes
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Nodes"
  /apis/extras.automium.io/v1beta1/namespaces/{namespace}/monitorings:
    get:
      summary: Monitorings
      description: "> WARNING: this a resource generated and managed automatically by the controller; it's not meant to be created, edited or deleted by hand."
      responses:
        '200':
          description: An array of Monitoring
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Monitoring"
  /apis/extras.automium.io/v1beta1/namespaces/{namespace}/backups:
    get:
      summary: Backups
      description: "> WARNING: this a resource generated and managed automatically by the controller; it's not meant to be created, edited or deleted by hand."
      responses:
        '200':
          description: An array of Backups
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Backups"
  /apis/extras.automium.io/v1beta1/namespaces/{namespace}/applications:
    get:
      summary: Applications
      responses:
        '200':
          description: An array of Applications
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Application"
components:
  schemas:
    Services:
      type: array
      items:
        $ref: "#/components/schemas/Service"
    Modules:
      type: array
      items:
        $ref: "#/components/schemas/Module"
    Nodes:
      type: array
      items:
        $ref: "#/components/schemas/Node"
    Monitorings:
      type: array
      items:
        $ref: "#/components/schemas/Monitoring"
    Backups:
      type: array
      items:
        $ref: "#/components/schemas/Backup"
    Applications:
      type: array
      items:
        $ref: "#/components/schemas/Application"
    Service:
      properties:
        apiVersion:
          description: 'APIVersion defines the versioned schema of this representation
            of an object. Servers should convert recognized schemas to the latest
            internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
          type: string
        kind:
          description: 'Kind is a string value representing the REST resource this
            object represents. Servers may infer this from the endpoint the client
            submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
          type: string
        metadata:
          description: 'In order to specify which application you want to deploy,
            you need to add a label "app". Applications available: "kubernetes-cluster"
            for a k8s control plane, and "kubernetes-nodepool" for a k8s node pool.'
          type: object
        spec:
          properties:
            env:
              description: Env is an array of EnvVar used for configuring the service.
              items:
                type: object
              type: array
            extra:
              description: Extra is an array of ExtraSpec used for configuring the
                extra components, such as monitoring or backups, for this service.
              items:
                properties:
                  name:
                    description: Name is the extra component name.
                    type: string
                  parameters:
                    description: Parameters is a map which can be used to further
                      configure the extra component.
                    type: object
                  version:
                    description: Version is the extra component version.
                    type: string
                required:
                - name
                - version
                type: object
              type: array
            flavor:
              description: Flavor is the flavor which will be used for node instances.
              type: string
            replicas:
              description: Replicas is the number of service replicas.
              format: int64
              minimum: 0
              type: integer
            tags:
              description: Tags is an optional field for service tagging. Not used
                at the moment.
              items:
                type: string
              type: array
            version:
              description: Version is the image version which will be used for the
                nodes.
              type: string
          required:
          - replicas
          - flavor
          - version
          type: object
        status:
          properties:
            moduleRef:
              description: ModuleRef contains the reference to the module used by
                this service
              type: string
            phase:
              description: Phase is the service phase. It can be "Running", "Completed",
                "Pending" or "Failed"
              type: string
          required:
          - phase
          - moduleRef
          type: object
    Module:
      properties:
        apiVersion:
          description: 'APIVersion defines the versioned schema of this representation
            of an object. Servers should convert recognized schemas to the latest
            internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
          type: string
        kind:
          description: 'Kind is a string value representing the REST resource this
            object represents. Servers may infer this from the endpoint the client
            submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
          type: string
        metadata:
          type: object
        spec:
          properties:
            env:
              description: Env is an array of EnvVar used for configuration. Defined
                in the Service.
              items:
                type: object
              type: array
            flavor:
              description: Flavor is the flavor which will be used for node instances.
                Defined in the Service.
              type: string
            image:
              description: Image is the full image name, populated by the source and
                the version defined in the Service.
              type: string
            replicas:
              description: Replicas is the desired number of replicas. Defined in
                the Service.
              format: int64
              type: integer
            source:
              description: Source is the application type defined in the Service.
              type: string
          required:
          - source
          - image
          - replicas
          - flavor
          type: object
        status:
          properties:
            currentReplicas:
              description: CurrentReplicas are the current active replicas.
              format: int64
              type: integer
            phase:
              description: Phase is the service phase. It can be "Running", "Completed",
                "Pending" or "Failed".
              type: string
            replicas:
              description: Replicas are the desired active replicas.
              format: int64
              type: integer
            updatedReplicas:
              description: CurrentReplicas are the current updated replicas with the
                new spec.
              format: int64
              type: integer
          required:
          - phase
          - replicas
          - currentReplicas
          - updatedReplicas
          type: object
    Node:
       properties:
        apiVersion:
          description: 'APIVersion defines the versioned schema of this representation
            of an object. Servers should convert recognized schemas to the latest
            internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
          type: string
        kind:
          description: 'Kind is a string value representing the REST resource this
            object represents. Servers may infer this from the endpoint the client
            submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
          type: string
        metadata:
          type: object
        spec:
          properties:
            deletionDate:
              description: DeletionDate is the date timestamp on which the Node resource
                has been marked for deletion
              type: string
            hostname:
              description: Hostname specifies the node which will be tracked by this
                resource
              type: string
          required:
          - hostname
          - deletionDate
          type: object
        status:
          properties:
            nodeHealthChecks:
              description: NodeHealthChecks contains the Consul health checks related
                to this node
              items:
                properties:
                  checkID:
                    description: CheckID is the ID of the Consul health check
                    type: string
                  name:
                    description: Name is the name of the Consul health check
                    type: string
                  output:
                    description: Output is the output of the Consul health check command.
                      64 chars maximum
                    type: string
                  serviceID:
                    description: ServiceID is the ID of the Consul service which belongs
                      this check
                    type: string
                  serviceName:
                    description: ServiceName is the name of the Consul service which
                      belongs this check
                    type: string
                  status:
                    description: Status is the status of the Consul health check.
                      Can be "passing", "warning" or "critical"
                    type: string
                required:
                - checkID
                - name
                - status
                - output
                - serviceID
                - serviceName
                type: object
              type: array
            nodeProperties:
              description: NodeProperties contains the node information, such as hostname,
                internal and external IPs and metadata
              properties:
                address:
                  description: Address is the node private address
                  type: string
                flavor:
                  description: Flavor is the node flavor. Can be a cloud-provider
                    flavor or a string combination of vCPU-Memory-DiskSize
                  type: string
                id:
                  description: ID is the node ID on Consul If the node is not registered,
                    this field will be populated with "non-existent-machine"
                  type: string
                image:
                  description: Image is the base image from which the node has been
                    launched
                  type: string
                node:
                  description: Node is the node name on Consul If the node is not
                    registered, this field will be populated with "non-existent-machine"
                  type: string
                publicAddress:
                  description: PublicAddress is the node public address. Empty if
                    the node have only the private IP.
                  type: string
              required:
              - id
              - node
              - address
              - publicAddress
              - flavor
              - image
              type: object
          type: object
    Monitoring:
      properties:
        apiVersion:
          description: 'APIVersion defines the versioned schema of this representation
            of an object. Servers should convert recognized schemas to the latest
            internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
          type: string
        kind:
          description: 'Kind is a string value representing the REST resource this
            object represents. Servers may infer this from the endpoint the client
            submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
          type: string
        metadata:
          type: object
        spec:
          properties:
            cluster:
              description: Cluster is the Rancher name for the target cluster.
              type: string
            parameters:
              description: Parameters are custom answers for the Monitoring application.
              type: object
            version:
              description: Version is the version of the Monitoring application to
                deploy.
              type: string
          required:
          - cluster
          - version
          type: object
        status:
          type: object
    Backup:
      properties:
        apiVersion:
          description: 'APIVersion defines the versioned schema of this representation
            of an object. Servers should convert recognized schemas to the latest
            internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
          type: string
        kind:
          description: 'Kind is a string value representing the REST resource this
            object represents. Servers may infer this from the endpoint the client
            submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
          type: string
        metadata:
          type: object
        spec:
          properties:
            cluster:
              description: Cluster is the Rancher name for the target cluster.
              type: string
            parameters:
              description: Parameters are custom answers for the Backup application.
              type: object
            version:
              description: Version is the version of the Backup application to deploy.
              type: string
          required:
          - cluster
          - version
          type: object
        status:
          type: object
    Application:
      properties:
        apiVersion:
          description: 'APIVersion defines the versioned schema of this representation
            of an object. Servers should convert recognized schemas to the latest
            internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
          type: string
        kind:
          description: 'Kind is a string value representing the REST resource this
            object represents. Servers may infer this from the endpoint the client
            submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
          type: string
        metadata:
          type: object
        spec:
          properties:
            cluster:
              description: Cluster is the cluster name in Rancher.
              type: string
            name:
              description: Name is the name of the extra application to deploy.
              type: string
            namespace:
              description: Namespace is the Kubernetes target namespace. If it exists,
                it will be moved into the Project defined in this resource.
              type: string
            parameters:
              description: Parameters are the custom answers that will be provided
                when deploying the extra application.
              type: object
            project:
              description: Project is the Rancher project where the extra applicaton
                will be deployed.
              type: string
            version:
              description: Version is the version of the extra application to deploy.
              type: string
          required:
          - name
          - version
          - cluster
          - project
          - namespace
          type: object
        status:
          properties:
            error:
              description: Error is the error string populated if something wrong
                happend during the deploy.
              type: string
            phase:
              description: Phase is the deploy status as reported from Rancher.
              type: string
          required:
          - phase
          type: object
