github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/apiserver/params/kubernetes.go (about)

     1  // Copyright 2018 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package params
     5  
     6  import (
     7  	"github.com/juju/juju/core/constraints"
     8  )
     9  
    10  // KubernetesProvisioningInfo holds unit provisioning info.
    11  type KubernetesProvisioningInfo struct {
    12  	PodSpec     string                       `json:"pod-spec"`
    13  	Constraints constraints.Value            `json:"constraints"`
    14  	Placement   string                       `json:"placement,omitempty"`
    15  	Tags        map[string]string            `json:"tags,omitempty"`
    16  	Filesystems []KubernetesFilesystemParams `json:"filesystems,omitempty"`
    17  	Volumes     []KubernetesVolumeParams     `json:"volumes,omitempty"`
    18  	Devices     []KubernetesDeviceParams     `json:"devices,omitempty"`
    19  }
    20  
    21  // KubernetesProvisioningInfoResult holds unit provisioning info or an error.
    22  type KubernetesProvisioningInfoResult struct {
    23  	Error  *Error                      `json:"error,omitempty"`
    24  	Result *KubernetesProvisioningInfo `json:"result"`
    25  }
    26  
    27  // KubernetesProvisioningInfoResults holds multiple provisioning info results.
    28  type KubernetesProvisioningInfoResults struct {
    29  	Results []KubernetesProvisioningInfoResult `json:"results"`
    30  }
    31  
    32  // KubernetesFilesystemParams holds the parameters for creating a storage filesystem.
    33  type KubernetesFilesystemParams struct {
    34  	StorageName string                                `json:"storagename"`
    35  	Size        uint64                                `json:"size"`
    36  	Provider    string                                `json:"provider"`
    37  	Attributes  map[string]interface{}                `json:"attributes,omitempty"`
    38  	Tags        map[string]string                     `json:"tags,omitempty"`
    39  	Attachment  *KubernetesFilesystemAttachmentParams `json:"attachment,omitempty"`
    40  }
    41  
    42  // KubernetesFilesystemAttachmentParams holds the parameters for
    43  // creating a filesystem attachment.
    44  type KubernetesFilesystemAttachmentParams struct {
    45  	Provider   string `json:"provider"`
    46  	MountPoint string `json:"mount-point,omitempty"`
    47  	ReadOnly   bool   `json:"read-only,omitempty"`
    48  }
    49  
    50  // KubernetesVolumeParams holds the parameters for creating a storage volume.
    51  type KubernetesVolumeParams struct {
    52  	StorageName string                            `json:"storagename"`
    53  	Size        uint64                            `json:"size"`
    54  	Provider    string                            `json:"provider"`
    55  	Attributes  map[string]interface{}            `json:"attributes,omitempty"`
    56  	Tags        map[string]string                 `json:"tags,omitempty"`
    57  	Attachment  *KubernetesVolumeAttachmentParams `json:"attachment,omitempty"`
    58  }
    59  
    60  // KubernetesVolumeAttachmentParams holds the parameters for
    61  // creating a volume attachment.
    62  type KubernetesVolumeAttachmentParams struct {
    63  	Provider string `json:"provider"`
    64  	ReadOnly bool   `json:"read-only,omitempty"`
    65  }
    66  
    67  // KubernetesFilesystemInfo describes a storage filesystem in the cloud
    68  // as reported to the model.
    69  type KubernetesFilesystemInfo struct {
    70  	StorageName  string                 `json:"storagename"`
    71  	Pool         string                 `json:"pool"`
    72  	Size         uint64                 `json:"size"`
    73  	MountPoint   string                 `json:"mount-point,omitempty"`
    74  	ReadOnly     bool                   `json:"read-only,omitempty"`
    75  	FilesystemId string                 `json:"filesystem-id"`
    76  	Status       string                 `json:"status"`
    77  	Info         string                 `json:"info"`
    78  	Data         map[string]interface{} `json:"data,omitempty"`
    79  	Volume       KubernetesVolumeInfo   `json:"volume"`
    80  }
    81  
    82  // Volume describes a storage volume in the cloud
    83  // as reported to the model.
    84  type KubernetesVolumeInfo struct {
    85  	VolumeId   string                 `json:"volume-id"`
    86  	Pool       string                 `json:"pool,omitempty"`
    87  	Size       uint64                 `json:"size"`
    88  	Persistent bool                   `json:"persistent"`
    89  	Status     string                 `json:"status"`
    90  	Info       string                 `json:"info"`
    91  	Data       map[string]interface{} `json:"data,omitempty"`
    92  }
    93  
    94  // DeviceType defines a device type.
    95  type DeviceType string
    96  
    97  // KubernetesDeviceParams holds a set of device constraints.
    98  type KubernetesDeviceParams struct {
    99  	Type       DeviceType        `bson:"type"`
   100  	Count      int64             `bson:"count"`
   101  	Attributes map[string]string `bson:"attributes,omitempty"`
   102  }