models

package
v0.0.0-...-e71a76f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeWarning = "warning"
	EventTypeNormal  = "normal"

	EventReasonMountFailed     = "mountFailed"
	EventReasonCrashLoop       = "crashLoop"
	EventReasonImagePullFailed = "imagePullFailed"

	EventObjectKindDeployment = "deployment"
)

Variables

This section is empty.

Functions

func CreatePciVendorSelector

func CreatePciVendorSelector(vendorID, deviceID string) string

Types

type CustomCert

type CustomCert struct {
	ClusterIssuer string `bson:"clusterIssuer"`
	CommonName    string `bson:"commonName"`
}

type DeploymentPublic

type DeploymentPublic struct {
	Name      string            `bson:"name"`
	Namespace string            `bson:"namespace"`
	Labels    map[string]string `bson:"labels"`

	Image            string          `bson:"image"`
	ImagePullSecrets []string        `bson:"imagePullSecrets"`
	EnvVars          []EnvVar        `bson:"envVars"`
	Resources        Resources       `bson:"resources"`
	Command          []string        `bson:"command"`
	Args             []string        `bson:"args"`
	InitCommands     []string        `bson:"initCommands"`
	InitContainers   []InitContainer `bson:"initContainers"`
	Volumes          []Volume        `bson:"volumes"`
	CreatedAt        time.Time       `bson:"createdAt"`

	// Disabled is a flag that can be set to true to disable the deployment.
	// This is useful for deployments that should not be running, but should still exist.
	// A disabled deployment has replicas set to 0.
	Disabled bool `bson:"disabled"`
}

func CreateDeploymentPublicFromRead

func CreateDeploymentPublicFromRead(deployment *appsv1.Deployment) *DeploymentPublic

CreateDeploymentPublicFromRead creates a DeploymentPublic from a appsv1.Deployment.

func (*DeploymentPublic) Created

func (d *DeploymentPublic) Created() bool

func (*DeploymentPublic) IsPlaceholder

func (d *DeploymentPublic) IsPlaceholder() bool

type DeploymentStatus

type DeploymentStatus struct {
	Name                string
	Generation          int
	DesiredReplicas     int
	ReadyReplicas       int
	AvailableReplicas   int
	UnavailableReplicas int
}

func CreateDeploymentStatusFromRead

func CreateDeploymentStatusFromRead(read *appsv1.Deployment) *DeploymentStatus

type EgressRule

type EgressRule struct {
	// IpBlock defines what is allowed by the network policy
	IpBlock *IpBlock `bson:"ipBlock,omitempty"`
	// PodSelector defines what is allowed by the network policy
	PodSelector map[string]string `bson:"podSelector,omitempty"`
	// NamespaceSelector defines what is allowed by the network policy
	NamespaceSelector map[string]string `bson:"namespaceSelector,omitempty"`
}

type EnvVar

type EnvVar struct {
	Name  string `bson:"name"`
	Value string `bson:"value"`
}

func EnvVarFromK8s

func EnvVarFromK8s(envVar *v1.EnvVar) EnvVar

EnvVarFromK8s converts a v1.EnvVar to an EnvVar.

func (*EnvVar) ToK8sEnvVar

func (envVar *EnvVar) ToK8sEnvVar() v1.EnvVar

ToK8sEnvVar converts an EnvVar to a v1.EnvVar.

type Event

type Event struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Reason      string `json:"reason"`
	Description string `json:"description"`
	ObjectKind  string `json:"objectKind"`
}

type HpaPublic

type HpaPublic struct {
	Name                     string    `bson:"name"`
	Namespace                string    `bson:"namespace"`
	MinReplicas              int       `bson:"minReplicas"`
	MaxReplicas              int       `bson:"maxReplicas"`
	Target                   Target    `bson:"target"`
	CpuAverageUtilization    int       `bson:"cpuAverageUtilization"`
	MemoryAverageUtilization int       `bson:"memoryAverageUtilization"`
	CreatedAt                time.Time `bson:"createdAt"`
}

func CreateHpaPublicFromRead

func CreateHpaPublicFromRead(hpa *v2.HorizontalPodAutoscaler) *HpaPublic

CreateHpaPublicFromRead creates a HpaPublic from a v2.HorizontalPodAutoscaler.

func (*HpaPublic) Created

func (h *HpaPublic) Created() bool

func (*HpaPublic) IsPlaceholder

func (h *HpaPublic) IsPlaceholder() bool

type IngressPublic

type IngressPublic struct {
	Name         string      `bson:"name"`
	Namespace    string      `bson:"namespace"`
	ServiceName  string      `bson:"serviceName"`
	ServicePort  int         `bson:"servicePort"`
	IngressClass string      `bson:"ingressClassName"`
	Hosts        []string    `bson:"host"`
	Placeholder  bool        `bson:"placeholder"`
	CreatedAt    time.Time   `bson:"createdAt"`
	CustomCert   *CustomCert `bson:"customCert,omitempty"`
	TlsSecret    *string     `bson:"tlsSecret,omitempty"`
}

func CreateIngressPublicFromRead

func CreateIngressPublicFromRead(ingress *v1.Ingress) *IngressPublic

CreateIngressPublicFromRead creates a IngressPublic from a v1.Ingress.

func (*IngressPublic) Created

func (i *IngressPublic) Created() bool

func (*IngressPublic) IsPlaceholder

func (i *IngressPublic) IsPlaceholder() bool

type IngressRule

type IngressRule struct {
	// IpBlock defines what is allowed by the network policy
	IpBlock *IpBlock `bson:"ipBlock,omitempty"`
	// PodSelector defines what is allowed by the network policy
	PodSelector map[string]string `bson:"podSelector,omitempty"`
	// NamespaceSelector defines what is allowed by the network policy
	NamespaceSelector map[string]string `bson:"namespaceSelector,omitempty"`
}

type InitContainer

type InitContainer struct {
	Name    string   `bson:"name"`
	Image   string   `bson:"image"`
	Command []string `bson:"command"`
	Args    []string `bson:"args"`
}

type IpBlock

type IpBlock struct {
	// CIDR defines what is allowed by the network policy
	CIDR string `bson:"cidr"`
	// Except are the blocked CIDRs, and are subsets of CIDR
	Except []string `bson:"except"`
}

type JobPublic

type JobPublic struct {
	Name      string    `bson:"name"`
	Namespace string    `bson:"namespace"`
	Image     string    `bson:"image"`
	Command   []string  `bson:"command"`
	Args      []string  `bson:"args"`
	Volumes   []Volume  `bson:"volumes"`
	MaxTries  *int      `bson:"maxTries,omitempty"`
	CreatedAt time.Time `bson:"createdAt"`
}

func CreateJobPublicFromRead

func CreateJobPublicFromRead(job *v1.Job) *JobPublic

CreateJobPublicFromRead creates a JobPublic from a v1.Job.

func (*JobPublic) Created

func (job *JobPublic) Created() bool

func (*JobPublic) IsPlaceholder

func (job *JobPublic) IsPlaceholder() bool

type K8sResource

type K8sResource interface {
	Created() bool
}

type Limits

type Limits struct {
	CPU    string `bson:"cpu"`
	Memory string `bson:"memory"`
}

type LogLine

type LogLine struct {
	DeploymentName string
	PodName        string
	Line           string
	CreatedAt      time.Time
}

type NamespacePublic

type NamespacePublic struct {
	Name      string    `bson:"name"`
	CreatedAt time.Time `bson:"createdAt"`
}

func CreateNamespacePublicFromRead

func CreateNamespacePublicFromRead(namespace *v1.Namespace) *NamespacePublic

CreateNamespacePublicFromRead creates a NamespacePublic from a v1.Namespace.

func (*NamespacePublic) Created

func (n *NamespacePublic) Created() bool

func (*NamespacePublic) IsPlaceholder

func (n *NamespacePublic) IsPlaceholder() bool

type NetworkPolicyPublic

type NetworkPolicyPublic struct {
	Name         string            `bson:"name"`
	Namespace    string            `bson:"namespace"`
	EgressRules  []EgressRule      `bson:"egress,omitempty"`
	IngressRules []IngressRule     `bson:"ingress,omitempty"`
	Selector     map[string]string `bson:"selector,omitempty"`
	CreatedAt    time.Time         `bson:"createdAt"`
}

func CreateNetworkPolicyPublicFromRead

func CreateNetworkPolicyPublicFromRead(policy *v1.NetworkPolicy) *NetworkPolicyPublic

func (*NetworkPolicyPublic) Created

func (npo *NetworkPolicyPublic) Created() bool

func (*NetworkPolicyPublic) IsPlaceholder

func (npo *NetworkPolicyPublic) IsPlaceholder() bool

type NodePublic

type NodePublic struct {
	Name string `json:"name"`
	CPU  struct {
		Total int `json:"total"`
	} `json:"cpu"`
	RAM struct {
		Total int `json:"total"`
	} `json:"ram"`
	Schedulable bool `json:"schedulable"`
}

func CreateNodePublicFromGet

func CreateNodePublicFromGet(node *corev1.Node) *NodePublic

type PciHostDevice

type PciHostDevice struct {
	PciVendorSelector string
	ResourceName      string
}

type PermittedHostDevices

type PermittedHostDevices struct {
	PciHostDevices []PciHostDevice
}

type PodDeleted

type PodDeleted struct {
	DeploymentName string
	PodName        string
}

type PodPublic

type PodPublic struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

func CreatePodPublicFromRead

func CreatePodPublicFromRead(pod v1.Pod) *PodPublic

type Port

type Port struct {
	Name       string `bson:"name"`
	Protocol   string `bson:"protocol"`
	Port       int    `bson:"port"`
	TargetPort int    `bson:"targetPort"`
}

type PvPublic

type PvPublic struct {
	Name      string `bson:"name"`
	Capacity  string `bson:"capacity"`
	NfsServer string `bson:"nfsServer"`
	NfsPath   string `bson:"nfsPath"`
	// Released is true if the volume is released.
	// This is mainly used to be able to repair the volume.
	// If it is released, then recreate the volume.
	Released  bool      `bson:"released"`
	CreatedAt time.Time `bson:"createdAt"`
}

func CreatePvPublicFromRead

func CreatePvPublicFromRead(pv *v1.PersistentVolume) *PvPublic

CreatePvPublicFromRead creates a PvPublic from a v1.PersistentVolume.

func (*PvPublic) Created

func (pv *PvPublic) Created() bool

func (*PvPublic) IsPlaceholder

func (pv *PvPublic) IsPlaceholder() bool

type PvcPublic

type PvcPublic struct {
	Name      string    `bson:"name"`
	Namespace string    `bson:"namespace"`
	Capacity  string    `bson:"capacity"`
	PvName    string    `bson:"pvName"`
	CreatedAt time.Time `bson:"createdAt"`
}

func CreatePvcPublicFromRead

func CreatePvcPublicFromRead(pvc *v1.PersistentVolumeClaim) *PvcPublic

CreatePvcPublicFromRead creates a PvcPublic from a v1.PersistentVolumeClaim.

func (*PvcPublic) Created

func (pvc *PvcPublic) Created() bool

func (*PvcPublic) IsPlaceholder

func (pvc *PvcPublic) IsPlaceholder() bool

type Requests

type Requests struct {
	CPU    string `bson:"cpu"`
	Memory string `bson:"memory"`
}

type Resources

type Resources struct {
	Limits   Limits   `bson:"limits"`
	Requests Requests `bson:"requests"`
}

type SecretPublic

type SecretPublic struct {
	Name        string            `json:"name"`
	Namespace   string            `json:"namespace"`
	Data        map[string][]byte `json:"data"`
	Type        string            `json:"type"`
	CreatedAt   time.Time         `json:"createdAt"`
	Placeholder bool              `json:"placeholder"`
}

func CreateSecretPublicFromRead

func CreateSecretPublicFromRead(secret *v1.Secret) *SecretPublic

CreateSecretPublicFromRead creates a SecretPublic from a v1.Secret.

func (*SecretPublic) Created

func (secret *SecretPublic) Created() bool

func (*SecretPublic) IsPlaceholder

func (secret *SecretPublic) IsPlaceholder() bool

type ServicePublic

type ServicePublic struct {
	Name           string            `bson:"name"`
	Namespace      string            `bson:"namespace"`
	Ports          []Port            `bson:"ports"`
	LoadBalancerIP *string           `bson:"loadBalancerIp"`
	Selector       map[string]string `bson:"selector"`
	CreatedAt      time.Time         `bson:"createdAt"`
}

func CreateServicePublicFromRead

func CreateServicePublicFromRead(service *v1.Service) *ServicePublic

CreateServicePublicFromRead creates a ServicePublic from a v1.Service.

func (*ServicePublic) Created

func (s *ServicePublic) Created() bool

func (*ServicePublic) GetFQDN

func (s *ServicePublic) GetFQDN() string

func (*ServicePublic) IsNodePort

func (s *ServicePublic) IsNodePort() bool

func (*ServicePublic) IsPlaceholder

func (s *ServicePublic) IsPlaceholder() bool

type Target

type Target struct {
	Kind       string `json:"kind"`
	Name       string `json:"name"`
	ApiVersion string `json:"apiVersion"`
}

type VmPublic

type VmPublic struct {
	ID        string            `bson:"id"`
	Name      string            `bson:"name"`
	Namespace string            `bson:"namespace"`
	Labels    map[string]string `bson:"labels"`

	CpuCores int      `bson:"cpuCores"`
	RAM      int      `bson:"memory"`
	DiskSize int      `bson:"diskSize"`
	GPUs     []string `bson:"gpus"`

	CloudInit string `bson:"cloudInit"`
	// Image is the URL of the image to use for the VM
	// It may either be an HTTP URL or a Docker image.
	//
	// If it is an HTTP URL, it must be in the format: http(s)://<url>
	// If it is a Docker image, it must be in the format: docker://<image>
	Image string `bson:"image"`

	Running bool `bson:"running"`

	CreatedAt time.Time `bson:"createdAt"`
}

func CreateVmPublicFromRead

func CreateVmPublicFromRead(vm *kubevirtv1.VirtualMachine) *VmPublic

func (*VmPublic) Created

func (vm *VmPublic) Created() bool

func (*VmPublic) IsPlaceholder

func (vm *VmPublic) IsPlaceholder() bool

type VmSnapshotPublic

type VmSnapshotPublic struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Namespace string    `json:"namespace"`
	VmID      string    `json:"vmId"`
	Status    string    `json:"status"`
	CreatedAt time.Time `json:"createdAt"`
}

func CreateVmSnapshotPublicFromRead

func CreateVmSnapshotPublicFromRead(vmSnapshot *v1alpha1.VirtualMachineSnapshot) *VmSnapshotPublic

func (*VmSnapshotPublic) Created

func (s *VmSnapshotPublic) Created() bool

func (*VmSnapshotPublic) IsPlaceholder

func (s *VmSnapshotPublic) IsPlaceholder() bool

type VmStatus

type VmStatus struct {
	Name            string
	PrintableStatus string
}

func CreateVmStatusFromRead

func CreateVmStatusFromRead(vm *kubevirtv1.VirtualMachine) *VmStatus

type VmiStatus

type VmiStatus struct {
	Name string
	Host *string
}

func CreateVmiStatusFromRead

func CreateVmiStatusFromRead(vmi *kubevirtv1.VirtualMachineInstance) *VmiStatus

type Volume

type Volume struct {
	Name      string  `bson:"name"`
	PvcName   *string `bson:"pvcName"`
	MountPath string  `bson:"mountPath"`
	Init      bool    `bson:"init"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL