resources

package
v0.0.0-...-9ec3720 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// JujuFieldManager marks the resource changes were made by Juju.
	JujuFieldManager = "juju"
)

Variables

This section is empty.

Functions

func ListEventsForObject

func ListEventsForObject(ctx context.Context, client kubernetes.Interface,
	namespace string, name string, kind string) ([]corev1.Event, error)

ListEventsForObject returns all the events for the specified object.

Types

type Applier

type Applier interface {
	// Apply adds an apply operation to the applier.
	Apply(Resource)
	// Delete adds an delete operation to the applier.
	Delete(Resource)
	// Run processes the slice of the operations.
	Run(ctx context.Context, client kubernetes.Interface, noRollback bool) error
}

Applier defines methods for processing a slice of resource operations.

func NewApplier

func NewApplier() Applier

NewApplier creates a new applier.

type DaemonSet

type DaemonSet struct {
	appsv1.DaemonSet
}

DaemonSet extends the k8s daemonset.

func NewDaemonSet

func NewDaemonSet(name string, namespace string, in *appsv1.DaemonSet) *DaemonSet

NewDaemonSet creates a new daemonSet resource.

func (*DaemonSet) Apply

func (ds *DaemonSet) Apply(ctx context.Context, client kubernetes.Interface) error

Apply patches the resource change.

func (*DaemonSet) Clone

func (ds *DaemonSet) Clone() Resource

Clone returns a copy of the resource.

func (*DaemonSet) ComputeStatus

func (ds *DaemonSet) ComputeStatus(ctx context.Context, client kubernetes.Interface, now time.Time) (string, status.Status, time.Time, error)

ComputeStatus returns a juju status for the resource.

func (*DaemonSet) Delete

func (ds *DaemonSet) Delete(ctx context.Context, client kubernetes.Interface) error

Delete removes the resource.

func (*DaemonSet) Events

func (ds *DaemonSet) Events(ctx context.Context, client kubernetes.Interface) ([]corev1.Event, error)

Events emitted by the resource.

func (*DaemonSet) Get

func (ds *DaemonSet) Get(ctx context.Context, client kubernetes.Interface) error

Get refreshes the resource.

type Deployment

type Deployment struct {
	appsv1.Deployment
}

Deployment extends the k8s deployment.

func NewDeployment

func NewDeployment(name string, namespace string, in *appsv1.Deployment) *Deployment

NewDeployment creates a new deployment resource.

func (*Deployment) Apply

func (d *Deployment) Apply(ctx context.Context, client kubernetes.Interface) error

Apply patches the resource change.

func (*Deployment) Clone

func (d *Deployment) Clone() Resource

Clone returns a copy of the resource.

func (*Deployment) ComputeStatus

func (d *Deployment) ComputeStatus(ctx context.Context, client kubernetes.Interface, now time.Time) (string, status.Status, time.Time, error)

ComputeStatus returns a juju status for the resource.

func (*Deployment) Delete

func (d *Deployment) Delete(ctx context.Context, client kubernetes.Interface) error

Delete removes the resource.

func (*Deployment) Events

func (d *Deployment) Events(ctx context.Context, client kubernetes.Interface) ([]corev1.Event, error)

Events emitted by the resource.

func (*Deployment) Get

func (d *Deployment) Get(ctx context.Context, client kubernetes.Interface) error

Get refreshes the resource.

type PersistentVolume

type PersistentVolume struct {
	corev1.PersistentVolume
}

PersistentVolume extends the k8s persistentVolume.

func NewPersistentVolume

func NewPersistentVolume(name string, in *corev1.PersistentVolume) *PersistentVolume

NewPersistentVolume creates a new persistent volume resource.

func (*PersistentVolume) Apply

func (pv *PersistentVolume) Apply(ctx context.Context, client kubernetes.Interface) error

Apply patches the resource change.

func (*PersistentVolume) Clone

func (pv *PersistentVolume) Clone() Resource

Clone returns a copy of the resource.

func (*PersistentVolume) ComputeStatus

func (pv *PersistentVolume) ComputeStatus(ctx context.Context, client kubernetes.Interface, now time.Time) (string, status.Status, time.Time, error)

ComputeStatus returns a juju status for the resource.

func (*PersistentVolume) Delete

func (pv *PersistentVolume) Delete(ctx context.Context, client kubernetes.Interface) error

Delete removes the resource.

func (*PersistentVolume) Events

func (pv *PersistentVolume) Events(ctx context.Context, client kubernetes.Interface) ([]corev1.Event, error)

Events emitted by the resource.

func (*PersistentVolume) Get

Get refreshes the resource.

type PersistentVolumeClaim

type PersistentVolumeClaim struct {
	corev1.PersistentVolumeClaim
}

PersistentVolumeClaim extends the k8s persistentVolumeClaim.

func NewPersistentVolumeClaim

func NewPersistentVolumeClaim(name string, namespace string, in *corev1.PersistentVolumeClaim) *PersistentVolumeClaim

NewPersistentVolumeClaim creates a new persistent volume claim resource.

func (*PersistentVolumeClaim) Apply

Apply patches the resource change.

func (*PersistentVolumeClaim) Clone

func (pvc *PersistentVolumeClaim) Clone() Resource

Clone returns a copy of the resource.

func (*PersistentVolumeClaim) ComputeStatus

func (pvc *PersistentVolumeClaim) ComputeStatus(ctx context.Context, client kubernetes.Interface, now time.Time) (string, status.Status, time.Time, error)

ComputeStatus returns a juju status for the resource.

func (*PersistentVolumeClaim) Delete

Delete removes the resource.

func (*PersistentVolumeClaim) Events

Events emitted by the resource.

func (*PersistentVolumeClaim) Get

Get refreshes the resource.

type Pod

type Pod struct {
	corev1.Pod
}

Pod extends the k8s service.

func ListPods

func ListPods(ctx context.Context, client kubernetes.Interface, namespace string, opts metav1.ListOptions) ([]Pod, error)

ListPods returns a list of storage classes.

func NewPod

func NewPod(name string, namespace string, in *corev1.Pod) *Pod

NewPod creates a new service resource.

func (*Pod) Apply

func (p *Pod) Apply(ctx context.Context, client kubernetes.Interface) error

Apply patches the resource change.

func (*Pod) Clone

func (p *Pod) Clone() Resource

Clone returns a copy of the resource.

func (*Pod) ComputeStatus

func (p *Pod) ComputeStatus(ctx context.Context, client kubernetes.Interface, now time.Time) (string, status.Status, time.Time, error)

ComputeStatus returns a juju status for the resource.

func (*Pod) Delete

func (p *Pod) Delete(ctx context.Context, client kubernetes.Interface) error

Delete removes the resource.

func (*Pod) Events

func (p *Pod) Events(ctx context.Context, client kubernetes.Interface) ([]corev1.Event, error)

Events emitted by the resource.

func (*Pod) Get

func (p *Pod) Get(ctx context.Context, client kubernetes.Interface) error

Get refreshes the resource.

type Resource

type Resource interface {
	// Clone returns a copy of the resource.
	Clone() Resource
	// Apply patches the resource change.
	Apply(ctx context.Context, client kubernetes.Interface) error
	// Get refreshes the resource.
	Get(ctx context.Context, client kubernetes.Interface) error
	// Delete removes the resource.
	Delete(ctx context.Context, client kubernetes.Interface) error
	// String returns a string format containing the name and type of the resource.
	String() string
	// ComputeStatus returns a juju status for the resource.
	ComputeStatus(ctx context.Context, client kubernetes.Interface, now time.Time) (string, status.Status, time.Time, error)
	// Events emitted by the object.
	Events(ctx context.Context, client kubernetes.Interface) ([]corev1.Event, error)
}

Resource defines methods for manipulating a k8s resource.

type Secret

type Secret struct {
	corev1.Secret
}

Secret extends the k8s secret.

func NewSecret

func NewSecret(name string, namespace string, in *corev1.Secret) *Secret

NewSecret creates a new secret resource.

func (*Secret) Apply

func (s *Secret) Apply(ctx context.Context, client kubernetes.Interface) error

Apply patches the resource change.

func (*Secret) Clone

func (s *Secret) Clone() Resource

Clone returns a copy of the resource.

func (*Secret) ComputeStatus

func (s *Secret) ComputeStatus(ctx context.Context, client kubernetes.Interface, now time.Time) (string, status.Status, time.Time, error)

ComputeStatus returns a juju status for the resource.

func (*Secret) Delete

func (s *Secret) Delete(ctx context.Context, client kubernetes.Interface) error

Delete removes the resource.

func (*Secret) Events

func (s *Secret) Events(ctx context.Context, client kubernetes.Interface) ([]corev1.Event, error)

Events emitted by the resource.

func (*Secret) Get

func (s *Secret) Get(ctx context.Context, client kubernetes.Interface) error

Get refreshes the resource.

type Service

type Service struct {
	corev1.Service
}

Service extends the k8s service.

func NewService

func NewService(name string, namespace string, in *corev1.Service) *Service

NewService creates a new service resource.

func (*Service) Apply

func (s *Service) Apply(ctx context.Context, client kubernetes.Interface) error

Apply patches the resource change.

func (*Service) Clone

func (s *Service) Clone() Resource

Clone returns a copy of the resource.

func (*Service) ComputeStatus

func (s *Service) ComputeStatus(ctx context.Context, client kubernetes.Interface, now time.Time) (string, status.Status, time.Time, error)

ComputeStatus returns a juju status for the resource.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, client kubernetes.Interface) error

Delete removes the resource.

func (*Service) Events

func (s *Service) Events(ctx context.Context, client kubernetes.Interface) ([]corev1.Event, error)

Events emitted by the resource.

func (*Service) Get

func (s *Service) Get(ctx context.Context, client kubernetes.Interface) error

Get refreshes the resource.

type StatefulSet

type StatefulSet struct {
	appsv1.StatefulSet
}

StatefulSet extends the k8s statefulSet.

func NewStatefulSet

func NewStatefulSet(name string, namespace string, in *appsv1.StatefulSet) *StatefulSet

NewStatefulSet creates a new statefulset resource.

func (*StatefulSet) Apply

func (ss *StatefulSet) Apply(ctx context.Context, client kubernetes.Interface) error

Apply patches the resource change.

func (*StatefulSet) Clone

func (ss *StatefulSet) Clone() Resource

Clone returns a copy of the resource.

func (*StatefulSet) ComputeStatus

func (ss *StatefulSet) ComputeStatus(ctx context.Context, client kubernetes.Interface, now time.Time) (string, status.Status, time.Time, error)

ComputeStatus returns a juju status for the resource.

func (*StatefulSet) Delete

func (ss *StatefulSet) Delete(ctx context.Context, client kubernetes.Interface) error

Delete removes the resource.

func (*StatefulSet) Events

func (ss *StatefulSet) Events(ctx context.Context, client kubernetes.Interface) ([]corev1.Event, error)

Events emitted by the resource.

func (*StatefulSet) Get

func (ss *StatefulSet) Get(ctx context.Context, client kubernetes.Interface) error

Get refreshes the resource.

type StorageClass

type StorageClass struct {
	storagev1.StorageClass
}

StorageClass extends the k8s storageClass.

func ListStorageClass

func ListStorageClass(ctx context.Context, client kubernetes.Interface, opts metav1.ListOptions) ([]StorageClass, error)

ListStorageClass returns a list of storage classes.

func NewStorageClass

func NewStorageClass(name string, in *storagev1.StorageClass) *StorageClass

NewStorageClass creates a new storage class resource.

func (*StorageClass) Apply

func (sc *StorageClass) Apply(ctx context.Context, client kubernetes.Interface) error

Apply patches the resource change.

func (*StorageClass) Clone

func (sc *StorageClass) Clone() Resource

Clone returns a copy of the resource.

func (*StorageClass) ComputeStatus

func (sc *StorageClass) ComputeStatus(ctx context.Context, client kubernetes.Interface, now time.Time) (string, status.Status, time.Time, error)

ComputeStatus returns a juju status for the resource.

func (*StorageClass) Delete

func (sc *StorageClass) Delete(ctx context.Context, client kubernetes.Interface) error

Delete removes the resource.

func (*StorageClass) Events

func (sc *StorageClass) Events(ctx context.Context, client kubernetes.Interface) ([]corev1.Event, error)

Events emitted by the resource.

func (*StorageClass) Get

func (sc *StorageClass) Get(ctx context.Context, client kubernetes.Interface) error

Get refreshes the resource.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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