client-go: kmodules.xyz/client-go/core/v1 Index | Files

package v1

import "kmodules.xyz/client-go/core/v1"

Index

Package Files

configmap.go endpoints.go kubernetes.go node.go pod.go pv.go pvc.go rc.go secret.go service.go serviceaccount.go

func AddFinalizer Uses

func AddFinalizer(m metav1.ObjectMeta, finalizer string) metav1.ObjectMeta

func CreateOrPatchConfigMap Uses

func CreateOrPatchConfigMap(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ConfigMap) *core.ConfigMap, opts metav1.PatchOptions) (*core.ConfigMap, kutil.VerbType, error)

func CreateOrPatchEndpoints Uses

func CreateOrPatchEndpoints(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Endpoints) *core.Endpoints, opts metav1.PatchOptions) (*core.Endpoints, kutil.VerbType, error)

func CreateOrPatchNode Uses

func CreateOrPatchNode(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Node) *core.Node, opts metav1.PatchOptions) (*core.Node, kutil.VerbType, error)

func CreateOrPatchPV Uses

func CreateOrPatchPV(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.PersistentVolume) *core.PersistentVolume, opts metav1.PatchOptions) (*core.PersistentVolume, kutil.VerbType, error)

func CreateOrPatchPVC Uses

func CreateOrPatchPVC(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.PersistentVolumeClaim) *core.PersistentVolumeClaim, opts metav1.PatchOptions) (*core.PersistentVolumeClaim, kutil.VerbType, error)

func CreateOrPatchPod Uses

func CreateOrPatchPod(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Pod) *core.Pod, opts metav1.PatchOptions) (*core.Pod, kutil.VerbType, error)

func CreateOrPatchRC Uses

func CreateOrPatchRC(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ReplicationController) *core.ReplicationController, opts metav1.PatchOptions) (*core.ReplicationController, kutil.VerbType, error)

func CreateOrPatchSecret Uses

func CreateOrPatchSecret(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Secret) *core.Secret, opts metav1.PatchOptions, forceSyncType ...bool) (*core.Secret, kutil.VerbType, error)

func CreateOrPatchService Uses

func CreateOrPatchService(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Service) *core.Service, opts metav1.PatchOptions) (*core.Service, kutil.VerbType, error)

func CreateOrPatchServiceAccount Uses

func CreateOrPatchServiceAccount(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ServiceAccount) *core.ServiceAccount, opts metav1.PatchOptions) (*core.ServiceAccount, kutil.VerbType, error)

func EnsureContainerDeleted Uses

func EnsureContainerDeleted(containers []core.Container, name string) []core.Container

func EnsureEnvVarDeleted Uses

func EnsureEnvVarDeleted(vars []core.EnvVar, name string) []core.EnvVar

func EnsureOwnerReference Uses

func EnsureOwnerReference(dependent metav1.Object, owner *metav1.OwnerReference)

EnsureOwnerReference adds owner if absent or syncs owner if already present.

If you are writing a controller or an operator, use the following code snippet for dependent objects. Here, `controller = true` and `blockOwnerDeletion = true`

owner := metav1.NewControllerRef(foo, samplev1alpha1.SchemeGroupVersion.WithKind("Foo")) EnsureOwnerReference(dependent, owner)

If our CRD is not a controller but just want to be a owner, use the following code snippet. Here, `controller = false` and `blockOwnerDeletion = false`

owner := NewOwnerRef(foo, samplev1alpha1.SchemeGroupVersion.WithKind("Foo")) EnsureOwnerReference(dependent, owner)

To understand the impact of `blockOwnerDeletion`, read: - https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/#foreground-cascading-deletion - https://github.com/kubernetes/apimachinery/blob/v0.17.0/pkg/apis/meta/v1/types.go#L297-L323

func EnsureVolumeDeleted Uses

func EnsureVolumeDeleted(volumes []core.Volume, name string) []core.Volume

func EnsureVolumeMountDeleted Uses

func EnsureVolumeMountDeleted(mounts []core.VolumeMount, name string) []core.VolumeMount

func EnsureVolumeMountDeletedByPath Uses

func EnsureVolumeMountDeletedByPath(mounts []core.VolumeMount, mountPath string) []core.VolumeMount

func HasFinalizer Uses

func HasFinalizer(m metav1.ObjectMeta, finalizer string) bool

func IsMaster Uses

func IsMaster(node core.Node) bool

IsMaster returns whether a node is a master.

func IsOwnedBy Uses

func IsOwnedBy(dependent metav1.Object, owner metav1.Object) (owned bool, controller bool)

IsOwnedBy checks if the dependent has a owner reference to the given owner

func IsServiceAccountToken Uses

func IsServiceAccountToken(secret *core.Secret, sa *core.ServiceAccount) bool

IsServiceAccountToken returns true if the secret is a valid api token for the service account

func MergeLocalObjectReferences Uses

func MergeLocalObjectReferences(l1, l2 []core.LocalObjectReference) []core.LocalObjectReference

func MergeServicePorts Uses

func MergeServicePorts(cur, desired []core.ServicePort) []core.ServicePort

func NewOwnerRef Uses

func NewOwnerRef(owner metav1.Object, gvk schema.GroupVersionKind) *metav1.OwnerReference

NewOwnerRef creates an OwnerReference pointing to the given owner.

func NodeReady Uses

func NodeReady(node core.Node) bool

NodeReady returns whether a node is ready.

func ObfuscateSecret Uses

func ObfuscateSecret(in core.Secret) *core.Secret

func PatchConfigMap Uses

func PatchConfigMap(ctx context.Context, c kubernetes.Interface, cur *core.ConfigMap, transform func(*core.ConfigMap) *core.ConfigMap, opts metav1.PatchOptions) (*core.ConfigMap, kutil.VerbType, error)

func PatchConfigMapObject Uses

func PatchConfigMapObject(ctx context.Context, c kubernetes.Interface, cur, mod *core.ConfigMap, opts metav1.PatchOptions) (*core.ConfigMap, kutil.VerbType, error)

func PatchEndpoints Uses

func PatchEndpoints(ctx context.Context, c kubernetes.Interface, cur *core.Endpoints, transform func(*core.Endpoints) *core.Endpoints, opts metav1.PatchOptions) (*core.Endpoints, kutil.VerbType, error)

func PatchEndpointsObject Uses

func PatchEndpointsObject(ctx context.Context, c kubernetes.Interface, cur, mod *core.Endpoints, opts metav1.PatchOptions) (*core.Endpoints, kutil.VerbType, error)

func PatchNode Uses

func PatchNode(ctx context.Context, c kubernetes.Interface, cur *core.Node, transform func(*core.Node) *core.Node, opts metav1.PatchOptions) (*core.Node, kutil.VerbType, error)

func PatchNodeObject Uses

func PatchNodeObject(ctx context.Context, c kubernetes.Interface, cur, mod *core.Node, opts metav1.PatchOptions) (*core.Node, kutil.VerbType, error)

func PatchPV Uses

func PatchPV(ctx context.Context, c kubernetes.Interface, cur *core.PersistentVolume, transform func(*core.PersistentVolume) *core.PersistentVolume, opts metav1.PatchOptions) (*core.PersistentVolume, kutil.VerbType, error)

func PatchPVC Uses

func PatchPVC(ctx context.Context, c kubernetes.Interface, cur *core.PersistentVolumeClaim, transform func(*core.PersistentVolumeClaim) *core.PersistentVolumeClaim, opts metav1.PatchOptions) (*core.PersistentVolumeClaim, kutil.VerbType, error)

func PatchPVCObject Uses

func PatchPVCObject(ctx context.Context, c kubernetes.Interface, cur, mod *core.PersistentVolumeClaim, opts metav1.PatchOptions) (*core.PersistentVolumeClaim, kutil.VerbType, error)

func PatchPVObject Uses

func PatchPVObject(ctx context.Context, c kubernetes.Interface, cur, mod *core.PersistentVolume, opts metav1.PatchOptions) (*core.PersistentVolume, kutil.VerbType, error)

func PatchPod Uses

func PatchPod(ctx context.Context, c kubernetes.Interface, cur *core.Pod, transform func(*core.Pod) *core.Pod, opts metav1.PatchOptions) (*core.Pod, kutil.VerbType, error)

func PatchPodObject Uses

func PatchPodObject(ctx context.Context, c kubernetes.Interface, cur, mod *core.Pod, opts metav1.PatchOptions) (*core.Pod, kutil.VerbType, error)

func PatchRC Uses

func PatchRC(ctx context.Context, c kubernetes.Interface, cur *core.ReplicationController, transform func(*core.ReplicationController) *core.ReplicationController, opts metav1.PatchOptions) (*core.ReplicationController, kutil.VerbType, error)

func PatchRCObject Uses

func PatchRCObject(ctx context.Context, c kubernetes.Interface, cur, mod *core.ReplicationController, opts metav1.PatchOptions) (*core.ReplicationController, kutil.VerbType, error)

func PatchSecret Uses

func PatchSecret(ctx context.Context, c kubernetes.Interface, cur *core.Secret, transform func(*core.Secret) *core.Secret, opts metav1.PatchOptions) (*core.Secret, kutil.VerbType, error)

func PatchSecretObject Uses

func PatchSecretObject(ctx context.Context, c kubernetes.Interface, cur, mod *core.Secret, opts metav1.PatchOptions) (*core.Secret, kutil.VerbType, error)

func PatchService Uses

func PatchService(ctx context.Context, c kubernetes.Interface, cur *core.Service, transform func(*core.Service) *core.Service, opts metav1.PatchOptions) (*core.Service, kutil.VerbType, error)

func PatchServiceAccount Uses

func PatchServiceAccount(ctx context.Context, c kubernetes.Interface, cur *core.ServiceAccount, transform func(*core.ServiceAccount) *core.ServiceAccount, opts metav1.PatchOptions) (*core.ServiceAccount, kutil.VerbType, error)

func PatchServiceAccountObject Uses

func PatchServiceAccountObject(ctx context.Context, c kubernetes.Interface, cur, mod *core.ServiceAccount, opts metav1.PatchOptions) (*core.ServiceAccount, kutil.VerbType, error)

func PatchServiceObject Uses

func PatchServiceObject(ctx context.Context, c kubernetes.Interface, cur, mod *core.Service, opts metav1.PatchOptions) (*core.Service, kutil.VerbType, error)

func PodRunningAndReady Uses

func PodRunningAndReady(pod core.Pod) (bool, error)

ref: https://github.com/coreos/prometheus-operator/blob/c79166fcff3dae7bb8bc1e6bddc81837c2d97c04/pkg/k8sutil/k8sutil.go#L64 PodRunningAndReady returns whether a pod is running and each container has passed it's ready state.

func RemoveFinalizer Uses

func RemoveFinalizer(m metav1.ObjectMeta, finalizer string) metav1.ObjectMeta

func RemoveOwnerReference Uses

func RemoveOwnerReference(dependent metav1.Object, owner metav1.Object)

func RemoveToleration Uses

func RemoveToleration(tolerations []core.Toleration, key string) []core.Toleration

func RestartPods Uses

func RestartPods(ctx context.Context, c kubernetes.Interface, namespace string, selector *metav1.LabelSelector) error

func TryUpdateConfigMap Uses

func TryUpdateConfigMap(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ConfigMap) *core.ConfigMap, opts metav1.UpdateOptions) (result *core.ConfigMap, err error)

func TryUpdateNode Uses

func TryUpdateNode(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Node) *core.Node, opts metav1.UpdateOptions) (result *core.Node, err error)

func TryUpdatePV Uses

func TryUpdatePV(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.PersistentVolume) *core.PersistentVolume, opts metav1.UpdateOptions) (result *core.PersistentVolume, err error)

func TryUpdatePVC Uses

func TryUpdatePVC(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.PersistentVolumeClaim) *core.PersistentVolumeClaim, opts metav1.UpdateOptions) (result *core.PersistentVolumeClaim, err error)

func TryUpdatePod Uses

func TryUpdatePod(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Pod) *core.Pod, opts metav1.UpdateOptions) (result *core.Pod, err error)

func TryUpdateRC Uses

func TryUpdateRC(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ReplicationController) *core.ReplicationController, opts metav1.UpdateOptions) (result *core.ReplicationController, err error)

func TryUpdateSecret Uses

func TryUpdateSecret(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Secret) *core.Secret, opts metav1.UpdateOptions) (result *core.Secret, err error)

func TryUpdateService Uses

func TryUpdateService(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Service) *core.Service, opts metav1.UpdateOptions) (result *core.Service, err error)

func TryUpdateServiceAccount Uses

func TryUpdateServiceAccount(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ServiceAccount) *core.ServiceAccount, opts metav1.UpdateOptions) (result *core.ServiceAccount, err error)

func UpsertContainer Uses

func UpsertContainer(containers []core.Container, upsert core.Container) []core.Container

func UpsertContainers Uses

func UpsertContainers(containers []core.Container, addons []core.Container) []core.Container

func UpsertEnvVars Uses

func UpsertEnvVars(vars []core.EnvVar, nv ...core.EnvVar) []core.EnvVar

func UpsertMap Uses

func UpsertMap(maps, upsert map[string]string) map[string]string

func UpsertToleration Uses

func UpsertToleration(tolerations []core.Toleration, upsert core.Toleration) []core.Toleration

func UpsertVolume Uses

func UpsertVolume(volumes []core.Volume, nv ...core.Volume) []core.Volume

func UpsertVolumeClaim Uses

func UpsertVolumeClaim(volumeClaims []core.PersistentVolumeClaim, upsert core.PersistentVolumeClaim) []core.PersistentVolumeClaim

func UpsertVolumeMount Uses

func UpsertVolumeMount(mounts []core.VolumeMount, nv ...core.VolumeMount) []core.VolumeMount

func UpsertVolumeMountByPath Uses

func UpsertVolumeMountByPath(mounts []core.VolumeMount, nv core.VolumeMount) []core.VolumeMount

func WaitUntilPodDeletedBySelector Uses

func WaitUntilPodDeletedBySelector(ctx context.Context, c kubernetes.Interface, namespace string, selector *metav1.LabelSelector) error

func WaitUntilPodRunning Uses

func WaitUntilPodRunning(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta) error

func WaitUntilPodRunningBySelector Uses

func WaitUntilPodRunningBySelector(ctx context.Context, c kubernetes.Interface, namespace string, selector *metav1.LabelSelector, count int) error

func WaitUntilRCReady Uses

func WaitUntilRCReady(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta) error

func WaitUntilServiceDeletedBySelector Uses

func WaitUntilServiceDeletedBySelector(ctx context.Context, c kubernetes.Interface, namespace string, selector *metav1.LabelSelector) error

func WaitUntillPodTerminatedByLabel Uses

func WaitUntillPodTerminatedByLabel(ctx context.Context, c kubernetes.Interface, namespace string, label string) error

WaitUntillPodTerminatedByLabel waits until all pods with the label are terminated. Timeout is 5 minutes.

func WaitUntillServiceAccountDeleted Uses

func WaitUntillServiceAccountDeleted(ctx context.Context, c kubernetes.Interface, meta metav1.ObjectMeta) error

type Topology Uses

type Topology struct {
    Regions       map[string][]string
    TotalNodes    int
    InstanceTypes map[string]int

    LabelZone         string
    LabelRegion       string
    LabelInstanceType string
}

func DetectTopology Uses

func DetectTopology(ctx context.Context, kc kubernetes.Interface) (*Topology, error)

func (Topology) ConvertAffinity Uses

func (t Topology) ConvertAffinity(affinity *core.Affinity)

Package v1 imports 22 packages (graph) and is imported by 101 packages. Updated 2020-07-14. Refresh now. Tools for package owners.