Documentation
¶
Index ¶
- Variables
- func Apply(c *client.Client, obj, owner client.Object, action ActionFunc) error
- func CreateOrUpdate(c client.Client, obj client.Object) (string, error)
- func Delete(c *client.Client, obj gitops.K8sObjectRef) error
- func DeleteAll(c *client.Client, deleted []gitops.K8sObjectRef)
- func Get(c client.Client, obj client.Object) (string, error)
- func GetOrCreate(c client.Client, obj client.Object) (string, error)
- type AbstractWorkload
- type ActionFunc
- type DeploymentWrapper
- func (d *DeploymentWrapper) Apply(c *client.Client) error
- func (d *DeploymentWrapper) GetName() string
- func (d *DeploymentWrapper) GetNamespace() string
- func (d *DeploymentWrapper) GetObject() client.Object
- func (d *DeploymentWrapper) GetPodTemplateSpec() corev1.PodTemplateSpec
- func (d *DeploymentWrapper) ListAll(c *client.Client, opts []client.ListOption) (workloads []AbstractWorkload, err error)
- func (d *DeploymentWrapper) SetPodTemplateSpec(template corev1.PodTemplateSpec)
- type StatefulSetWrapper
- func (s *StatefulSetWrapper) Apply(c *client.Client) error
- func (s *StatefulSetWrapper) GetName() string
- func (d *StatefulSetWrapper) GetNamespace() string
- func (d *StatefulSetWrapper) GetObject() client.Object
- func (s *StatefulSetWrapper) GetPodTemplateSpec() corev1.PodTemplateSpec
- func (s *StatefulSetWrapper) ListAll(c *client.Client, opts []client.ListOption) (workloads []AbstractWorkload, err error)
- func (s *StatefulSetWrapper) SetPodTemplateSpec(template corev1.PodTemplateSpec)
Constants ¶
This section is empty.
Variables ¶
var WrapperTypes = []AbstractWorkload{ &DeploymentWrapper{}, &StatefulSetWrapper{}, }
WrapperTypes holds a placeholder for each type, used for generic iteration
Functions ¶
func Apply ¶
Apply is a functional interface for interacting with the K8s apiserver in a consistent way. Each sigs.k8s.io/controller-runtime/pkg/client.Object argument must implement the necessary Reader/Writer interfaces implemented by sigs.k8s.io/controller-runtime/pkg/client.Client.
func CreateOrUpdate ¶
CreateOrUpdate is an Action that applies a resource in the K8s apiserver.
Types ¶
type AbstractWorkload ¶ added in v0.10.0
type AbstractWorkload interface { GetObject() client.Object GetName() string GetNamespace() string GetPodTemplateSpec() corev1.PodTemplateSpec SetPodTemplateSpec(corev1.PodTemplateSpec) GetDeletionTimestamp() *metav1.Time GetAnnotations() map[string]string SetAnnotations(map[string]string) ListAll(c *client.Client, opts []client.ListOption) ([]AbstractWorkload, error) Apply(c *client.Client) error }
AbstractWorkload is an interface with functionality common to Deployments and StatefulSets. It's used for generic manipulation of a workload.
type ActionFunc ¶
ActionFunc is a type of function that makes a sequence of API calls to a K8s apiserver. If any API call fails, the ActionFunc should return a string describing the failed call, plus the error returned by the sigs.k8s.io/controller-runtime/pkg/client.Client. Otherwise, the ActionFunc should return a string describing its successful result, and a nil error.
func MkPatchAction ¶
func MkPatchAction(patch func(client.Object) client.Object) ActionFunc
MkPatchAction returns an Action that applies the patch specified when called.
type DeploymentWrapper ¶ added in v0.10.0
type DeploymentWrapper struct {
*appsv1.Deployment
}
DeploymentWrapper implements AbstractWorkload for Deployments
func (*DeploymentWrapper) Apply ¶ added in v0.10.0
func (d *DeploymentWrapper) Apply(c *client.Client) error
func (*DeploymentWrapper) GetName ¶ added in v0.10.0
func (d *DeploymentWrapper) GetName() string
func (*DeploymentWrapper) GetNamespace ¶ added in v0.10.0
func (d *DeploymentWrapper) GetNamespace() string
func (*DeploymentWrapper) GetObject ¶ added in v0.10.0
func (d *DeploymentWrapper) GetObject() client.Object
func (*DeploymentWrapper) GetPodTemplateSpec ¶ added in v0.10.0
func (d *DeploymentWrapper) GetPodTemplateSpec() corev1.PodTemplateSpec
func (*DeploymentWrapper) ListAll ¶ added in v0.10.0
func (d *DeploymentWrapper) ListAll(c *client.Client, opts []client.ListOption) (workloads []AbstractWorkload, err error)
func (*DeploymentWrapper) SetPodTemplateSpec ¶ added in v0.10.0
func (d *DeploymentWrapper) SetPodTemplateSpec(template corev1.PodTemplateSpec)
type StatefulSetWrapper ¶ added in v0.10.0
type StatefulSetWrapper struct {
*appsv1.StatefulSet
}
StatefulSetWrapper implements AbstractWorkload for StatefulSets
func (*StatefulSetWrapper) Apply ¶ added in v0.10.0
func (s *StatefulSetWrapper) Apply(c *client.Client) error
func (*StatefulSetWrapper) GetName ¶ added in v0.10.0
func (s *StatefulSetWrapper) GetName() string
func (*StatefulSetWrapper) GetNamespace ¶ added in v0.10.0
func (d *StatefulSetWrapper) GetNamespace() string
func (*StatefulSetWrapper) GetObject ¶ added in v0.10.0
func (d *StatefulSetWrapper) GetObject() client.Object
func (*StatefulSetWrapper) GetPodTemplateSpec ¶ added in v0.10.0
func (s *StatefulSetWrapper) GetPodTemplateSpec() corev1.PodTemplateSpec
func (*StatefulSetWrapper) ListAll ¶ added in v0.10.0
func (s *StatefulSetWrapper) ListAll(c *client.Client, opts []client.ListOption) (workloads []AbstractWorkload, err error)
func (*StatefulSetWrapper) SetPodTemplateSpec ¶ added in v0.10.0
func (s *StatefulSetWrapper) SetPodTemplateSpec(template corev1.PodTemplateSpec)