github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/rpc/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/version/v2"
     8  
     9  	"github.com/juju/juju/core/constraints"
    10  )
    11  
    12  // KubernetesDeploymentInfo holds deployment info from charm metadata.
    13  type KubernetesDeploymentInfo struct {
    14  	DeploymentType string `json:"deployment-type"`
    15  	ServiceType    string `json:"service-type"`
    16  }
    17  
    18  // KubernetesProvisioningInfo holds unit provisioning info.
    19  type KubernetesProvisioningInfo struct {
    20  	DeploymentInfo       *KubernetesDeploymentInfo    `json:"deployment-info,omitempty"`
    21  	PodSpec              string                       `json:"pod-spec"`
    22  	RawK8sSpec           string                       `json:"raw-k8s-spec,omitempty"`
    23  	Constraints          constraints.Value            `json:"constraints"`
    24  	Tags                 map[string]string            `json:"tags,omitempty"`
    25  	Filesystems          []KubernetesFilesystemParams `json:"filesystems,omitempty"`
    26  	Volumes              []KubernetesVolumeParams     `json:"volumes,omitempty"`
    27  	Devices              []KubernetesDeviceParams     `json:"devices,omitempty"`
    28  	CharmModifiedVersion int                          `json:"charm-modified-version,omitempty"`
    29  	ImageRepo            DockerImageInfo              `json:"image-repo,omitempty"`
    30  }
    31  
    32  // KubernetesProvisioningInfoResult holds unit provisioning info or an error.
    33  type KubernetesProvisioningInfoResult struct {
    34  	Error  *Error                      `json:"error,omitempty"`
    35  	Result *KubernetesProvisioningInfo `json:"result"`
    36  }
    37  
    38  // KubernetesProvisioningInfoResults holds multiple provisioning info results.
    39  type KubernetesProvisioningInfoResults struct {
    40  	Results []KubernetesProvisioningInfoResult `json:"results"`
    41  }
    42  
    43  // KubernetesFilesystemParams holds the parameters for creating a storage filesystem.
    44  type KubernetesFilesystemParams struct {
    45  	StorageName string                                `json:"storagename"`
    46  	Size        uint64                                `json:"size"`
    47  	Provider    string                                `json:"provider"`
    48  	Attributes  map[string]interface{}                `json:"attributes,omitempty"`
    49  	Tags        map[string]string                     `json:"tags,omitempty"`
    50  	Attachment  *KubernetesFilesystemAttachmentParams `json:"attachment,omitempty"`
    51  }
    52  
    53  // KubernetesFilesystemAttachmentParams holds the parameters for
    54  // creating a filesystem attachment.
    55  type KubernetesFilesystemAttachmentParams struct {
    56  	Provider   string `json:"provider"`
    57  	MountPoint string `json:"mount-point,omitempty"`
    58  	ReadOnly   bool   `json:"read-only,omitempty"`
    59  }
    60  
    61  // KubernetesVolumeParams holds the parameters for creating a storage volume.
    62  type KubernetesVolumeParams struct {
    63  	StorageName string                            `json:"storagename"`
    64  	Size        uint64                            `json:"size"`
    65  	Provider    string                            `json:"provider"`
    66  	Attributes  map[string]interface{}            `json:"attributes,omitempty"`
    67  	Tags        map[string]string                 `json:"tags,omitempty"`
    68  	Attachment  *KubernetesVolumeAttachmentParams `json:"attachment,omitempty"`
    69  }
    70  
    71  // KubernetesVolumeAttachmentParams holds the parameters for
    72  // creating a volume attachment.
    73  type KubernetesVolumeAttachmentParams struct {
    74  	Provider string `json:"provider"`
    75  	ReadOnly bool   `json:"read-only,omitempty"`
    76  }
    77  
    78  // KubernetesFilesystemInfo describes a storage filesystem in the cloud
    79  // as reported to the model.
    80  type KubernetesFilesystemInfo struct {
    81  	StorageName  string                 `json:"storagename"`
    82  	Pool         string                 `json:"pool"`
    83  	Size         uint64                 `json:"size"`
    84  	MountPoint   string                 `json:"mount-point,omitempty"`
    85  	ReadOnly     bool                   `json:"read-only,omitempty"`
    86  	FilesystemId string                 `json:"filesystem-id"`
    87  	Status       string                 `json:"status"`
    88  	Info         string                 `json:"info"`
    89  	Data         map[string]interface{} `json:"data,omitempty"`
    90  	Volume       KubernetesVolumeInfo   `json:"volume"`
    91  }
    92  
    93  // Volume describes a storage volume in the cloud
    94  // as reported to the model.
    95  type KubernetesVolumeInfo struct {
    96  	VolumeId   string                 `json:"volume-id"`
    97  	Pool       string                 `json:"pool,omitempty"`
    98  	Size       uint64                 `json:"size"`
    99  	Persistent bool                   `json:"persistent"`
   100  	Status     string                 `json:"status"`
   101  	Info       string                 `json:"info"`
   102  	Data       map[string]interface{} `json:"data,omitempty"`
   103  }
   104  
   105  // DeviceType defines a device type.
   106  type DeviceType string
   107  
   108  // KubernetesDeviceParams holds a set of device constraints.
   109  type KubernetesDeviceParams struct {
   110  	Type       DeviceType        `bson:"type"`
   111  	Count      int64             `bson:"count"`
   112  	Attributes map[string]string `bson:"attributes,omitempty"`
   113  }
   114  
   115  // KubernetesUpgradeArg holds args used to upgrade an operator.
   116  type KubernetesUpgradeArg struct {
   117  	AgentTag string         `json:"agent-tag"`
   118  	Version  version.Number `json:"version"`
   119  }