github.com/apprenda/kismatic@v1.12.0/pkg/data/kubernetes_type.go (about)

     1  package data
     2  
     3  type PodList struct {
     4  	Items []Pod `json:"items"`
     5  }
     6  
     7  type Pod struct {
     8  	ObjectMeta `json:"metadata,omitempty"`
     9  	Spec       PodSpec `json:"spec,omitempty"`
    10  }
    11  
    12  type ObjectMeta struct {
    13  	Annotations     map[string]string `json:"annotations,omitempty"`
    14  	Name            string            `json:"name,omitempty"`
    15  	Namespace       string            `json:"namespace,omitempty"`
    16  	Labels          map[string]string `json:"labels,omitempty"`
    17  	OwnerReferences []OwnerReference  `json:"ownerReferences,omitempty"`
    18  }
    19  
    20  type OwnerReference struct {
    21  	APIVersion string `json:"apiVersion"`
    22  	Kind       string `json:"kind"`
    23  	Name       string `json:"name"`
    24  	UID        UID    `json:"uid"`
    25  	Controller bool   `json:"controller"`
    26  }
    27  
    28  type UID string
    29  
    30  // ObjectReference contains enough information to let you inspect or modify the referred object.
    31  type ObjectReference struct {
    32  	Kind      string
    33  	Namespace string `json:"namespace,omitempty"`
    34  	Name      string `json:"name,omitempty"`
    35  }
    36  
    37  type SerializedReference struct {
    38  	TypeMeta
    39  	Reference ObjectReference
    40  }
    41  
    42  // PodSpec is a description of a pod.
    43  type PodSpec struct {
    44  	NodeName   string      `json:"nodeName"`
    45  	Volumes    []Volume    `json:"volumes,omitempty"`
    46  	Containers []Container `json:"containers"`
    47  }
    48  
    49  // Volume represents a named volume in a pod that may be accessed by any container in the pod.
    50  type Volume struct {
    51  	Name         string `json:"name"`
    52  	VolumeSource `json:",inline"`
    53  }
    54  
    55  // Represents the source of a volume to mount.
    56  // Only one of its members may be specified.
    57  type VolumeSource struct {
    58  	HostPath              *HostPathVolumeSource              `json:"hostPath,omitempty"`
    59  	EmptyDir              *EmptyDirVolumeSource              `json:"emptyDir,omitempty"`
    60  	PersistentVolumeClaim *PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim,omitempty"`
    61  }
    62  
    63  // Represents a host path mapped into a pod.
    64  type HostPathVolumeSource struct {
    65  	Path string `json:"path"`
    66  }
    67  
    68  // Represents an empty directory for a pod.
    69  type EmptyDirVolumeSource struct {
    70  	Medium string `json:"medium,omitempty"`
    71  }
    72  
    73  // PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace.
    74  // This volume finds the bound PV and mounts that volume for the pod. A
    75  // PersistentVolumeClaimVolumeSource is, essentially, a wrapper around another
    76  // type of volume that is owned by someone else (the system).
    77  type PersistentVolumeClaimVolumeSource struct {
    78  	ClaimName string `json:"claimName"`
    79  	ReadOnly  bool   `json:"readOnly,omitempty"`
    80  }
    81  
    82  // A single application container that you want to run within a pod.
    83  type Container struct {
    84  	Name         string        `json:"name"`
    85  	VolumeMounts []VolumeMount `json:"volumeMounts,omitempty"`
    86  }
    87  
    88  // VolumeMount describes a mounting of a Volume within a container.
    89  type VolumeMount struct {
    90  	Name      string `json:"name"`
    91  	ReadOnly  bool   `json:"readOnly,omitempty"`
    92  	MountPath string `json:"mountPath"`
    93  	// Path within the volume from which the container's volume should be mounted
    94  	SubPath string `json:"subPath,omitempty"`
    95  }
    96  
    97  // PersistentVolumeList is a list of PersistentVolume items.
    98  type PersistentVolumeList struct {
    99  	TypeMeta `json:",inline"`
   100  	ListMeta `json:"metadata,omitempty"`
   101  	Items    []PersistentVolume `json:"items"`
   102  }
   103  
   104  // PersistentVolume (PV) is a storage resource provisioned by an administrator.
   105  // It is analogous to a node.
   106  type PersistentVolume struct {
   107  	TypeMeta   `json:",inline"`
   108  	ObjectMeta `json:"metadata,omitempty"`
   109  	Spec       PersistentVolumeSpec   `json:"spec,omitempty"`
   110  	Status     PersistentVolumeStatus `json:"status,omitempty"`
   111  }
   112  
   113  // Similar to VolumeSource but meant for the administrator who creates PVs.
   114  type PersistentVolumeSource struct {
   115  	// HostPath represents a directory on the host.
   116  	HostPath *HostPathVolumeSource
   117  }
   118  
   119  // PersistentVolumeClaim is a user's request for and claim to a persistent volume
   120  type PersistentVolumeClaim struct {
   121  	TypeMeta   `json:",inline"`
   122  	ObjectMeta `json:"metadata,omitempty"`
   123  
   124  	// Spec defines the volume requested by a pod author
   125  	Spec PersistentVolumeClaimSpec
   126  }
   127  
   128  // PersistentVolumeClaimSpec describes the common attributes of storage devices
   129  // and allows a Source for provider-specific attributes
   130  type PersistentVolumeClaimSpec struct {
   131  	// VolumeName is the binding reference to the PersistentVolume backing this
   132  	// claim. When set to non-empty value Selector is not evaluated
   133  	VolumeName string
   134  }
   135  
   136  // TypeMeta describes an individual object in an API response or request
   137  // with strings representing the type of the object and its API schema version.
   138  // Structures that are versioned or persisted should inline TypeMeta.
   139  type TypeMeta struct {
   140  	Kind       string `json:"kind,omitempty"`
   141  	APIVersion string `json:"apiVersion,omitempty"`
   142  }
   143  
   144  // ListMeta describes metadata that synthetic resources must have, including lists and
   145  // various status objects. A resource may have only one of {ObjectMeta, ListMeta}.
   146  type ListMeta struct {
   147  	SelfLink        string `json:"selfLink,omitempty"`
   148  	ResourceVersion string `json:"resourceVersion,omitempty"`
   149  }
   150  
   151  // PersistentVolumeSpec is the specification of a persistent volume.
   152  type PersistentVolumeSpec struct {
   153  	PersistentVolumeSource
   154  	// ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim.
   155  	// Expected to be non-nil when bound.
   156  	// claim.VolumeName is the authoritative bind between PV and PVC.
   157  	ClaimRef *ObjectReference `json:"claimRef,omitempty"`
   158  }
   159  
   160  type PersistentVolumePhase string
   161  
   162  // PersistentVolumeStatus is the current status of a persistent volume.
   163  type PersistentVolumeStatus struct {
   164  	// Phase indicates if a volume is available, bound to a claim, or released by a claim.
   165  	Phase PersistentVolumePhase `json:"phase,omitempty"`
   166  }
   167  
   168  // DaemonSetList is a collection of daemon sets.
   169  type DaemonSetList struct {
   170  	TypeMeta `json:",inline"`
   171  	ListMeta `json:"metadata,omitempty"`
   172  	// Items is a list of daemon sets.
   173  	Items []DaemonSet `json:"items"`
   174  }
   175  
   176  // DaemonSet represents the configuration of a daemon set.
   177  type DaemonSet struct {
   178  	TypeMeta   `json:",inline"`
   179  	ObjectMeta `json:"metadata,omitempty"`
   180  	Status     DaemonSetStatus `json:"status,omitempty"`
   181  }
   182  
   183  // DaemonSetStatus represents the current status of a daemon set.
   184  type DaemonSetStatus struct {
   185  	// CurrentNumberScheduled is the number of nodes that are running at least 1
   186  	// daemon pod and are supposed to run the daemon pod.
   187  	CurrentNumberScheduled int32 `json:"currentNumberScheduled"`
   188  
   189  	// NumberMisscheduled is the number of nodes that are running the daemon pod, but are
   190  	// not supposed to run the daemon pod.
   191  	NumberMisscheduled int32 `json:"numberMisscheduled"`
   192  
   193  	// DesiredNumberScheduled is the total number of nodes that should be running the daemon
   194  	// pod (including nodes correctly running the daemon pod).
   195  	DesiredNumberScheduled int32 `json:"desiredNumberScheduled"`
   196  
   197  	// NumberReady is the number of nodes that should be running the daemon pod and have one
   198  	// or more of the daemon pod running and ready.
   199  	NumberReady int32 `json:"numberReady"`
   200  }
   201  
   202  // ReplicationController represents the configuration of a replication controller.
   203  type ReplicationController struct {
   204  	TypeMeta   `json:",inline"`
   205  	ObjectMeta `json:"metadata,omitempty"`
   206  
   207  	// Status is the current status of this replication controller. This data may be
   208  	// out of date by some window of time.
   209  	Status ReplicationControllerStatus
   210  }
   211  
   212  // ReplicationControllerStatus represents the current status of a replication
   213  // controller.
   214  type ReplicationControllerStatus struct {
   215  	// Replicas is the number of actual replicas.
   216  	Replicas int32
   217  }
   218  
   219  // ReplicaSet represents the configuration of a replica set.
   220  type ReplicaSet struct {
   221  	TypeMeta   `json:",inline"`
   222  	ObjectMeta `json:"metadata,omitempty"`
   223  
   224  	// Status is the current status of this ReplicaSet. This data may be
   225  	// out of date by some window of time.
   226  	Status ReplicaSetStatus
   227  }
   228  
   229  // ReplicaSetStatus represents the current status of a ReplicaSet.
   230  type ReplicaSetStatus struct {
   231  	// Replicas is the number of actual replicas.
   232  	Replicas int32
   233  }
   234  
   235  // StatefulSet represents a set of pods with consistent identities.
   236  type StatefulSet struct {
   237  	TypeMeta   `json:",inline"`
   238  	ObjectMeta `json:"metadata,omitempty"`
   239  
   240  	Status StatefulSetStatus
   241  }
   242  
   243  // StatefulSetStatus represents the current status of a StatefulSet.
   244  type StatefulSetStatus struct {
   245  	// Replicas is the number of actual replicas.
   246  	Replicas int32
   247  }