Documentation ¶
Index ¶
- Constants
- Variables
- func ContainerSpecOf(pod *v1.Pod, status v1.ContainerStatus) v1.Container
- func DuplicateYAMLDetectedError(duplicatedYaml string) string
- func ExtractPodTemplateSpec(obj interface{}) ([]*v1.PodTemplateSpec, error)
- func ExtractPods(obj interface{}) ([]*v1.PodSpec, error)
- func FakePodSpec(image reference.NamedTagged) v1.PodSpec
- func FakePodStatus(image reference.NamedTagged, phase string) v1.PodStatus
- func FindImageNamedTaggedMatching(pod v1.PodSpec, selector container.RefSelector) (reference.NamedTagged, error)
- func FindImageRefMatching(pod v1.PodSpec, selector container.RefSelector) (reference.Named, error)
- func FixContainerStatusImages(pod *v1.Pod)
- func FixContainerStatusImagesNoMutation(pod *v1.Pod) *v1.Pod
- func FragmentsToEntities(es []K8sEntity) map[string][]K8sEntity
- func LabelPairsToSelector(lps []model.LabelPair) labels.Selector
- func LocatorMatchesOne(l ImageLocator, entities []K8sEntity) bool
- func ManagedByTiltSelector() labels.Selector
- func MustTarget(name model.TargetName, yaml string) model.K8sTarget
- func NewTarget(name model.TargetName, applySpec v1alpha1.KubernetesApplySpec, ...) (model.K8sTarget, error)
- func NewTargetForEntities(name model.TargetName, entities []K8sEntity, locators []ImageLocator) (model.K8sTarget, error)
- func NewTargetForYAML(name model.TargetName, yaml string, locators []ImageLocator) (model.K8sTarget, error)
- func NewTiltLabelMap() map[string]string
- func NormalizeContainerID(id string) (container.ID, error)
- func OwnerRefToObjectRef(owner metav1.OwnerReference, namespace string) v1.ObjectReference
- func PodContainsRef(pod v1.PodSpec, selector container.RefSelector) (bool, error)
- func PortForwardTemplateSpec(forwards []model.PortForward) *v1alpha1.PortForwardTemplateSpec
- func ProvideClientConfig(contextOverride KubeContextOverride, nsFlag NamespaceOverride) clientcmd.ClientConfig
- func ProvideContainerRuntime(ctx context.Context, kCli Client) container.Runtime
- func ProvideKubeConfig(clientLoader clientcmd.ClientConfig, contextOverride KubeContextOverride) (*api.Config, error)
- func ProvideServerVersion(maybeClientset ClientsetOrError) (*version.Info, error)
- func ReferenceGVK(involvedObject v1.ObjectReference) schema.GroupVersionKind
- func RuntimeObjToOwnerRef(obj runtime.Object) metav1.OwnerReference
- func SelectorEqual(a, b labels.Selector) bool
- func SelectorStringFromParts(parts []string) string
- func SerializeSpecYAML(decoded []K8sEntity) (string, error)
- func SerializeSpecYAMLToBuffer(decoded []K8sEntity) (*bytes.Buffer, error)
- func ServiceURL(service *v1.Service, ip NodeIP) (*url.URL, error)
- func SetsAsLabelSelectors(sets []labels.Set) []metav1.LabelSelector
- func TiltManagedByLabel() model.LabelPair
- func UniqueNames(entities []K8sEntity, minComponents int) []string
- func UniqueNamesMeta(es []EntityMeta, minComponents int) []string
- type Client
- type ClientsetOrError
- type ClusterName
- type EntityMeta
- type Env
- type ExecCall
- type FakeK8sClient
- func (c *FakeK8sClient) CheckConnected(ctx context.Context) (*version.Info, error)
- func (c *FakeK8sClient) ContainerLogs(ctx context.Context, pID PodID, cName container.Name, n Namespace, ...) (io.ReadCloser, error)
- func (c *FakeK8sClient) ContainerRuntime(ctx context.Context) container.Runtime
- func (c *FakeK8sClient) CreatePortForwarder(ctx context.Context, namespace Namespace, podID PodID, ...) (PortForwarder, error)
- func (c *FakeK8sClient) Delete(_ context.Context, entities []K8sEntity, wait bool) error
- func (c *FakeK8sClient) EmitPodDelete(p *v1.Pod)
- func (c *FakeK8sClient) Exec(ctx context.Context, podID PodID, cName container.Name, n Namespace, ...) error
- func (c *FakeK8sClient) GetMetaByReference(ctx context.Context, ref v1.ObjectReference) (metav1.Object, error)
- func (c *FakeK8sClient) Inject(entities ...K8sEntity)
- func (c *FakeK8sClient) ListMeta(_ context.Context, gvk schema.GroupVersionKind, ns Namespace) ([]metav1.Object, error)
- func (c *FakeK8sClient) LocalRegistry(ctx context.Context) container.Registry
- func (c *FakeK8sClient) NodeIP(ctx context.Context) NodeIP
- func (c *FakeK8sClient) OwnerFetcher() OwnerFetcher
- func (c *FakeK8sClient) PodFromInformerCache(ctx context.Context, nn types.NamespacedName) (*v1.Pod, error)
- func (c *FakeK8sClient) SetLogReaderForPodContainer(pID PodID, cName container.Name, reader io.Reader)
- func (c *FakeK8sClient) SetLogsForPodContainer(pID PodID, cName container.Name, logs string)
- func (c *FakeK8sClient) TearDown()
- func (c *FakeK8sClient) Upsert(_ context.Context, entities []K8sEntity, timeout time.Duration) ([]K8sEntity, error)
- func (c *FakeK8sClient) UpsertEvent(event *v1.Event)
- func (c *FakeK8sClient) UpsertPod(pod *v1.Pod)
- func (c *FakeK8sClient) UpsertService(s *v1.Service)
- func (c *FakeK8sClient) WatchEvents(ctx context.Context, ns Namespace) (<-chan *v1.Event, error)
- func (c *FakeK8sClient) WatchMeta(ctx context.Context, gvk schema.GroupVersionKind, ns Namespace) (<-chan metav1.Object, error)
- func (c *FakeK8sClient) WatchPods(ctx context.Context, ns Namespace) (<-chan ObjectUpdate, error)
- func (c *FakeK8sClient) WatchServices(ctx context.Context, ns Namespace) (<-chan *v1.Service, error)
- type FakeMinikube
- type FakePortForwardClient
- func (c *FakePortForwardClient) CreatePortForwardCallCount() int
- func (c *FakePortForwardClient) CreatePortForwarder(ctx context.Context, namespace Namespace, podID PodID, ...) (PortForwarder, error)
- func (c *FakePortForwardClient) LastForwardContext() context.Context
- func (c *FakePortForwardClient) LastForwardPortHost() string
- func (c *FakePortForwardClient) LastForwardPortPodID() PodID
- func (c *FakePortForwardClient) LastForwardPortRemotePort() int
- func (c *FakePortForwardClient) LastForwarder() FakePortForwarder
- func (c *FakePortForwardClient) PortForwardCalls() []PortForwardCall
- type FakePortForwarder
- type ImageLocator
- type InformerSet
- type JSONPath
- type JSONPathImageLocator
- func (l *JSONPathImageLocator) EqualsImageLocator(other interface{}) bool
- func (l *JSONPathImageLocator) Extract(e K8sEntity) ([]reference.Named, error)
- func (l *JSONPathImageLocator) Inject(e K8sEntity, selector container.RefSelector, injectRef reference.Named, ...) (K8sEntity, bool, error)
- func (l *JSONPathImageLocator) MatchesType(e K8sEntity) bool
- func (l *JSONPathImageLocator) ToSpec() v1alpha1.KubernetesImageLocator
- type JSONPathImageObjectLocator
- func (l *JSONPathImageObjectLocator) EqualsImageLocator(other interface{}) bool
- func (l *JSONPathImageObjectLocator) Extract(e K8sEntity) ([]reference.Named, error)
- func (l *JSONPathImageObjectLocator) Inject(e K8sEntity, selector container.RefSelector, injectRef reference.Named, ...) (K8sEntity, bool, error)
- func (l *JSONPathImageObjectLocator) MatchesType(e K8sEntity) bool
- func (l *JSONPathImageObjectLocator) ToSpec() v1alpha1.KubernetesImageLocator
- type K8sClient
- func (k *K8sClient) CheckConnected(ctx context.Context) (*version.Info, error)
- func (k *K8sClient) ContainerLogs(ctx context.Context, pID PodID, cName container.Name, n Namespace, ...) (io.ReadCloser, error)
- func (c K8sClient) ContainerRuntime(ctx context.Context) container.Runtime
- func (k *K8sClient) CreatePortForwarder(ctx context.Context, namespace Namespace, podID PodID, ...) (PortForwarder, error)
- func (k *K8sClient) Delete(ctx context.Context, entities []K8sEntity, wait bool) error
- func (k *K8sClient) Exec(ctx context.Context, podID PodID, cName container.Name, n Namespace, ...) error
- func (k *K8sClient) GetMetaByReference(ctx context.Context, ref v1.ObjectReference) (metav1.Object, error)
- func (k *K8sClient) ListMeta(ctx context.Context, gvk schema.GroupVersionKind, ns Namespace) ([]metav1.Object, error)
- func (c K8sClient) LocalRegistry(ctx context.Context) container.Registry
- func (c K8sClient) NodeIP(ctx context.Context) NodeIP
- func (k *K8sClient) OwnerFetcher() OwnerFetcher
- func (k *K8sClient) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
- func (k *K8sClient) ToRESTConfig() (*rest.Config, error)
- func (k *K8sClient) ToRESTMapper() (meta.RESTMapper, error)
- func (k *K8sClient) ToRawKubeConfigLoader() clientcmd.ClientConfig
- func (k *K8sClient) Upsert(ctx context.Context, entities []K8sEntity, timeout time.Duration) ([]K8sEntity, error)
- func (kCli *K8sClient) WatchMeta(ctx context.Context, gvk schema.GroupVersionKind, ns Namespace) (<-chan metav1.Object, error)
- type K8sEntity
- func CopyEntities(entities []K8sEntity) []K8sEntity
- func Filter(entities []K8sEntity, test func(e K8sEntity) (bool, error)) (passing, rest []K8sEntity, err error)
- func FilterByHasPodTemplateSpec(entities []K8sEntity) (passing, rest []K8sEntity, err error)
- func FilterByImage(entities []K8sEntity, img container.RefSelector, locators []ImageLocator, ...) (passing, rest []K8sEntity, err error)
- func FilterByMatchesPodTemplateSpec(withPodSpec K8sEntity, entities []K8sEntity) (passing, rest []K8sEntity, err error)
- func FilterByMetadataLabels(entities []K8sEntity, labels map[string]string) (passing, rest []K8sEntity, err error)
- func FilterBySelectorMatchesLabels(entities []K8sEntity, labels map[string]string) (passing, rest []K8sEntity, err error)
- func ImmutableEntities(entities []K8sEntity) []K8sEntity
- func InjectCommandAndArgs(entity K8sEntity, ref reference.Named, cmd *v1alpha1.ImageMapOverrideCommand, ...) (K8sEntity, error)
- func InjectImageDigest(entity K8sEntity, selector container.RefSelector, injectRef reference.Named, ...) (K8sEntity, bool, error)
- func InjectImagePullPolicy(entity K8sEntity, policy v1.PullPolicy) (K8sEntity, error)
- func InjectLabels(entity K8sEntity, labels []model.LabelPair) (K8sEntity, error)
- func InjectParallelPodManagementPolicy(entity K8sEntity) K8sEntity
- func InjectPodTemplateSpecHashes(entity K8sEntity) (K8sEntity, error)
- func MutableAndImmutableEntities(entities entityList) (mutable, immutable []K8sEntity)
- func MutableEntities(entities []K8sEntity) []K8sEntity
- func NewK8sEntity(obj runtime.Object) K8sEntity
- func NewNamespaceEntity(name string) K8sEntity
- func OverwriteLabels(entity K8sEntity, labels []model.LabelPair) (K8sEntity, error)
- func ParseYAML(k8sYaml io.Reader) ([]K8sEntity, error)
- func ParseYAMLFromString(yaml string) ([]K8sEntity, error)
- func ReverseSortedEntities(entities []K8sEntity) []K8sEntity
- func SortedEntities(entities []K8sEntity) []K8sEntity
- func (e K8sEntity) Annotations() map[string]string
- func (e K8sEntity) Clean()
- func (e K8sEntity) DeepCopy() K8sEntity
- func (e K8sEntity) FindImages(locators []ImageLocator, envVarImages []container.RefSelector) ([]reference.Named, error)
- func (e K8sEntity) GVK() schema.GroupVersionKind
- func (e K8sEntity) HasImage(image container.RefSelector, locators []ImageLocator, inEnvVars bool) (bool, error)
- func (e K8sEntity) HasKind(kind string) bool
- func (e K8sEntity) HasName(name string) bool
- func (e K8sEntity) HasNamespace(ns string) bool
- func (e K8sEntity) ImmutableOnceCreated() bool
- func (e K8sEntity) Labels() map[string]string
- func (e K8sEntity) MatchesMetadataLabels(labels map[string]string) (bool, error)
- func (e K8sEntity) Meta() metav1.Object
- func (e K8sEntity) Name() string
- func (e K8sEntity) Namespace() Namespace
- func (e K8sEntity) NamespaceOrDefault(defaultVal string) string
- func (e K8sEntity) SelectorMatchesLabels(labels map[string]string) bool
- func (e K8sEntity) SetUID(UID string)
- func (e K8sEntity) ToObjectReference() v1.ObjectReference
- func (e K8sEntity) UID() types.UID
- func (e K8sEntity) WithNamespace(ns string) K8sEntity
- type KubeContext
- type KubeContextOverride
- type LoadBalancer
- type LoadBalancerSpec
- type MetaClient
- type MinikubeClient
- type NaiveRuntimeSource
- type Namespace
- type NamespaceOverride
- type NodeID
- type NodeIP
- type ObjRefList
- type ObjectRefTree
- type ObjectSelector
- func MustKindSelector(kind string) ObjectSelector
- func MustNameSelector(name string) ObjectSelector
- func NewFullmatchCaseInsensitiveObjectSelector(apiVersion string, kind string, name string, namespace string) (ObjectSelector, error)
- func NewPartialMatchObjectSelector(apiVersion string, kind string, name string, namespace string) (ObjectSelector, error)
- func ParseObjectSelector(spec v1alpha1.ObjectSelector) (ObjectSelector, error)
- func SelectorFromString(s string) (ObjectSelector, error)
- type ObjectUpdate
- type OwnerFetcher
- type PodAndCName
- type PodID
- type PodTemplateSpecHash
- type PortForwardCall
- type PortForwardClient
- type PortForwarder
- type RESTConfigOrError
- type RESTMapper
- type ReaderCloser
- type ResourceClient
- type RuntimeSource
- type ServiceName
- type TypeIndex
- type UIDSet
Constants ¶
const ContainerIDPrefix = "docker://"
const DefaultNamespace = Namespace("default")
NOTE(nick): This isn't right. DefaultNamespace is a function of your kubectl context.
const MagicTestContainerID = "tilt-testcontainer"
A magic constant. If the docker client returns this constant, we always match even if the container doesn't have the correct image name.
const MagicTestExplodingPort = 34743
MagicTestExplodingPort causes FakePortForwarder to fail to initialize (i.e. return an error as soon as ForwardPorts is called without ever becoming ready).
const ManagedByLabel = "app.kubernetes.io/managed-by"
https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/
const ManagedByValue = "tilt"
const ManifestNameLabel = "tilt-manifest"
const TiltPodTemplateHashLabel = "tilt.dev/pod-template-hash"
Variables ¶
var EventGVR = v1.SchemeGroupVersion.WithResource("events")
var ForbiddenFieldsRe = regexp.MustCompile(`updates to .* are forbidden`)
var MetadataAnnotationsTooLongRe = regexp.MustCompile(`metadata.annotations: Too long: must have at most \d+ bytes.*`)
var NoFilter = func(v reflect.Value) bool { return true }
var PodGVR = v1.SchemeGroupVersion.WithResource("pods")
var ServiceGVR = v1.SchemeGroupVersion.WithResource("services")
Functions ¶
func ContainerSpecOf ¶
func DuplicateYAMLDetectedError ¶ added in v0.17.0
func ExtractPodTemplateSpec ¶ added in v0.1.0
func ExtractPodTemplateSpec(obj interface{}) ([]*v1.PodTemplateSpec, error)
func ExtractPods ¶
func FakePodSpec ¶
func FakePodSpec(image reference.NamedTagged) v1.PodSpec
func FakePodStatus ¶
func FakePodStatus(image reference.NamedTagged, phase string) v1.PodStatus
func FindImageNamedTaggedMatching ¶ added in v0.2.0
func FindImageNamedTaggedMatching(pod v1.PodSpec, selector container.RefSelector) (reference.NamedTagged, error)
func FindImageRefMatching ¶ added in v0.2.0
func FixContainerStatusImages ¶ added in v0.8.2
Kubernetes has a bug where the image ref in the container status can be wrong (though this does not mean the container is running unexpected code)
Repro steps: 1) Create an image and give it two different tags (A and B) 2) Deploy Pods with both A and B in the pod spec 3) The PodStatus will choose A or B for both pods.
More details here: https://github.com/kubernetes/kubernetes/issues/51017
For Tilt, it's pretty important that the image tag is correct (for matching purposes). To work around this bug, we change the image reference in ContainerStatus to match the ContainerSpec.
func FixContainerStatusImagesNoMutation ¶ added in v0.17.9
FixContainerStatusImagesNoMutation is the same as FixContainerStatusImages but it does not mutate the input. It instead makes a deep copy and returns that with the updated status. It should be used over FixContainerStatusImages when the source of the pod is shared such as an informer.
func FragmentsToEntities ¶ added in v0.14.0
FragmentsToEntities maps all possible fragments (e.g. foo, foo:secret, foo:secret:default) to the k8s entity or entities that they correspond to
func LabelPairsToSelector ¶ added in v0.8.7
func LocatorMatchesOne ¶ added in v0.15.2
func LocatorMatchesOne(l ImageLocator, entities []K8sEntity) bool
func ManagedByTiltSelector ¶ added in v0.10.7
func MustTarget ¶ added in v0.14.0
func MustTarget(name model.TargetName, yaml string) model.K8sTarget
func NewTarget ¶ added in v0.6.0
func NewTarget( name model.TargetName, applySpec v1alpha1.KubernetesApplySpec, podReadinessMode model.PodReadinessMode, links []model.Link) (model.K8sTarget, error)
func NewTargetForEntities ¶ added in v0.23.0
func NewTargetForEntities(name model.TargetName, entities []K8sEntity, locators []ImageLocator) (model.K8sTarget, error)
func NewTargetForYAML ¶ added in v0.23.0
func NewTargetForYAML(name model.TargetName, yaml string, locators []ImageLocator) (model.K8sTarget, error)
func NewTiltLabelMap ¶ added in v0.10.7
func NormalizeContainerID ¶ added in v0.9.6
func OwnerRefToObjectRef ¶ added in v0.10.5
func OwnerRefToObjectRef(owner metav1.OwnerReference, namespace string) v1.ObjectReference
func PodContainsRef ¶
func PortForwardTemplateSpec ¶ added in v0.23.0
func PortForwardTemplateSpec(forwards []model.PortForward) *v1alpha1.PortForwardTemplateSpec
PortForwardTemplateSpec creates a port-forward template if necessary. Returns nil if no port-forwards.
func ProvideClientConfig ¶ added in v0.7.11
func ProvideClientConfig(contextOverride KubeContextOverride, nsFlag NamespaceOverride) clientcmd.ClientConfig
func ProvideContainerRuntime ¶ added in v0.7.11
func ProvideKubeConfig ¶ added in v0.7.11
func ProvideKubeConfig(clientLoader clientcmd.ClientConfig, contextOverride KubeContextOverride) (*api.Config, error)
func ProvideServerVersion ¶ added in v0.7.11
func ProvideServerVersion(maybeClientset ClientsetOrError) (*version.Info, error)
func ReferenceGVK ¶ added in v0.17.9
func ReferenceGVK(involvedObject v1.ObjectReference) schema.GroupVersionKind
func RuntimeObjToOwnerRef ¶ added in v0.10.5
func RuntimeObjToOwnerRef(obj runtime.Object) metav1.OwnerReference
func SelectorEqual ¶ added in v0.7.1
func SelectorStringFromParts ¶ added in v0.17.5
func SerializeSpecYAML ¶ added in v0.8.8
Serializes the provided K8s objects as YAML.
By convention, all K8s objects contain ObjectMetadata, Spec, and Status. This only serializes the metadata and spec, skipping the status.
func SerializeSpecYAMLToBuffer ¶ added in v0.17.13
func SetsAsLabelSelectors ¶ added in v0.21.3
func SetsAsLabelSelectors(sets []labels.Set) []metav1.LabelSelector
func TiltManagedByLabel ¶ added in v0.10.7
func UniqueNames ¶ added in v0.9.3
func UniqueNamesMeta ¶ added in v0.23.0
func UniqueNamesMeta(es []EntityMeta, minComponents int) []string
Calculates names for workloads by using the shortest uniquely matching identifiers
Types ¶
type Client ¶
type Client interface { InformerSet // Updates the entities, creating them if necessary. // // Tries to update them in-place if possible. But for certain resource types, // we might need to fallback to deleting and re-creating them. // // Returns entities in the order that they were applied (which may be different // than they were passed in) and with UUIDs from the Kube API Upsert(ctx context.Context, entities []K8sEntity, timeout time.Duration) ([]K8sEntity, error) // Delete all given entities, optionally waiting for them to be fully deleted. // // Currently ignores any "not found" errors, because that seems like the correct // behavior for our use cases. Delete(ctx context.Context, entities []K8sEntity, wait bool) error GetMetaByReference(ctx context.Context, ref v1.ObjectReference) (metav1.Object, error) ListMeta(ctx context.Context, gvk schema.GroupVersionKind, ns Namespace) ([]metav1.Object, error) // Streams the container logs ContainerLogs(ctx context.Context, podID PodID, cName container.Name, n Namespace, startTime time.Time) (io.ReadCloser, error) // Opens a tunnel to the specified pod+port. Returns the tunnel's local port and a function that closes the tunnel CreatePortForwarder(ctx context.Context, namespace Namespace, podID PodID, optionalLocalPort, remotePort int, host string) (PortForwarder, error) WatchMeta(ctx context.Context, gvk schema.GroupVersionKind, ns Namespace) (<-chan metav1.Object, error) ContainerRuntime(ctx context.Context) container.Runtime // Some clusters support a local image registry that we can push to. LocalRegistry(ctx context.Context) container.Registry // Some clusters support a node IP where all servers are reachable. NodeIP(ctx context.Context) NodeIP Exec(ctx context.Context, podID PodID, cName container.Name, n Namespace, cmd []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error // Returns version information about the apiserver, or an error if we're not connected. CheckConnected(ctx context.Context) (*version.Info, error) OwnerFetcher() OwnerFetcher }
func ProvideK8sClient ¶ added in v0.7.1
func ProvideK8sClient( globalCtx context.Context, env Env, maybeRESTConfig RESTConfigOrError, maybeClientset ClientsetOrError, pfClient PortForwardClient, configNamespace Namespace, mkClient MinikubeClient, clientLoader clientcmd.ClientConfig) Client
type ClientsetOrError ¶ added in v0.10.8
type ClientsetOrError struct { Clientset *kubernetes.Clientset Error error }
func ProvideClientset ¶ added in v0.10.8
func ProvideClientset(cfg RESTConfigOrError) ClientsetOrError
type ClusterName ¶ added in v0.10.7
type ClusterName string
func ProvideClusterName ¶ added in v0.10.7
func ProvideClusterName(ctx context.Context, config *api.Config) ClusterName
type EntityMeta ¶ added in v0.23.0
type EntityMeta interface { Name() string Namespace() Namespace GVK() schema.GroupVersionKind }
type Env ¶
type Env string
const ( EnvUnknown Env = "unknown" EnvGKE Env = "gke" EnvMinikube Env = "minikube" EnvDockerDesktop Env = "docker-for-desktop" EnvMicroK8s Env = "microk8s" EnvCRC Env = "crc" EnvKrucible Env = "krucible" // Kind v0.6 substantially changed the protocol for detecting and pulling, // so we represent them as two separate envs. EnvKIND5 Env = "kind-0.5-" EnvKIND6 Env = "kind-0.6+" EnvK3D Env = "k3d" EnvRancherDesktop Env = "rancher-desktop" EnvNone Env = "none" // k8s not running (not neces. a problem, e.g. if using Tilt x Docker Compose) )
TODO(nick): Port this to use ctlptl's cluster detection code.
func (Env) IsDevCluster ¶ added in v0.17.0
type FakeK8sClient ¶
type FakeK8sClient struct { FakePortForwardClient Yaml string Lb LoadBalancerSpec DeletedYaml string DeleteError error LastPodQueryNamespace Namespace LastPodQueryImage reference.NamedTagged PodLogsByPodAndContainer map[PodAndCName]ReaderCloser LastPodLogStartTime time.Time LastPodLogContext context.Context LastPodLogPipeWriter *io.PipeWriter ContainerLogsError error EventsWatchErr error UpsertError error UpsertResult []K8sEntity LastUpsertResult []K8sEntity UpsertTimeout time.Duration Runtime container.Runtime Registry container.Registry FakeNodeIP NodeIP ExecCalls []ExecCall ExecOutputs []io.Reader ExecErrors []error // contains filtered or unexported fields }
func NewFakeK8sClient ¶
func NewFakeK8sClient(t testing.TB) *FakeK8sClient
func (*FakeK8sClient) CheckConnected ¶ added in v0.23.3
func (*FakeK8sClient) ContainerLogs ¶
func (*FakeK8sClient) ContainerRuntime ¶ added in v0.7.11
func (c *FakeK8sClient) ContainerRuntime(ctx context.Context) container.Runtime
func (*FakeK8sClient) CreatePortForwarder ¶ added in v0.10.8
func (c *FakeK8sClient) CreatePortForwarder(ctx context.Context, namespace Namespace, podID PodID, optionalLocalPort, remotePort int, host string) (PortForwarder, error)
func (*FakeK8sClient) EmitPodDelete ¶ added in v0.14.0
func (c *FakeK8sClient) EmitPodDelete(p *v1.Pod)
func (*FakeK8sClient) GetMetaByReference ¶ added in v0.17.8
func (c *FakeK8sClient) GetMetaByReference(ctx context.Context, ref v1.ObjectReference) (metav1.Object, error)
func (*FakeK8sClient) Inject ¶ added in v0.20.2
func (c *FakeK8sClient) Inject(entities ...K8sEntity)
Inject adds an entity or replaces it for subsequent retrieval.
Entities are keyed by UID.
func (*FakeK8sClient) ListMeta ¶ added in v0.17.9
func (c *FakeK8sClient) ListMeta(_ context.Context, gvk schema.GroupVersionKind, ns Namespace) ([]metav1.Object, error)
func (*FakeK8sClient) LocalRegistry ¶ added in v0.14.0
func (c *FakeK8sClient) LocalRegistry(ctx context.Context) container.Registry
func (*FakeK8sClient) NodeIP ¶ added in v0.14.0
func (c *FakeK8sClient) NodeIP(ctx context.Context) NodeIP
func (*FakeK8sClient) OwnerFetcher ¶ added in v0.23.5
func (c *FakeK8sClient) OwnerFetcher() OwnerFetcher
func (*FakeK8sClient) PodFromInformerCache ¶ added in v0.19.2
func (c *FakeK8sClient) PodFromInformerCache(ctx context.Context, nn types.NamespacedName) (*v1.Pod, error)
func (*FakeK8sClient) SetLogReaderForPodContainer ¶ added in v0.17.11
func (*FakeK8sClient) SetLogsForPodContainer ¶ added in v0.7.11
func (c *FakeK8sClient) SetLogsForPodContainer(pID PodID, cName container.Name, logs string)
func (*FakeK8sClient) TearDown ¶ added in v0.8.9
func (c *FakeK8sClient) TearDown()
func (*FakeK8sClient) UpsertEvent ¶ added in v0.20.2
func (c *FakeK8sClient) UpsertEvent(event *v1.Event)
func (*FakeK8sClient) UpsertPod ¶ added in v0.19.2
func (c *FakeK8sClient) UpsertPod(pod *v1.Pod)
func (*FakeK8sClient) UpsertService ¶ added in v0.20.2
func (c *FakeK8sClient) UpsertService(s *v1.Service)
func (*FakeK8sClient) WatchEvents ¶ added in v0.8.4
func (*FakeK8sClient) WatchMeta ¶ added in v0.17.9
func (c *FakeK8sClient) WatchMeta(ctx context.Context, gvk schema.GroupVersionKind, ns Namespace) (<-chan metav1.Object, error)
func (*FakeK8sClient) WatchPods ¶
func (c *FakeK8sClient) WatchPods(ctx context.Context, ns Namespace) (<-chan ObjectUpdate, error)
func (*FakeK8sClient) WatchServices ¶
type FakeMinikube ¶ added in v0.14.0
type FakePortForwardClient ¶ added in v0.10.8
type FakePortForwardClient struct {
// contains filtered or unexported fields
}
func NewFakePortForwardClient ¶ added in v0.20.8
func NewFakePortForwardClient() *FakePortForwardClient
func (*FakePortForwardClient) CreatePortForwardCallCount ¶ added in v0.10.8
func (c *FakePortForwardClient) CreatePortForwardCallCount() int
func (*FakePortForwardClient) CreatePortForwarder ¶ added in v0.10.8
func (c *FakePortForwardClient) CreatePortForwarder(ctx context.Context, namespace Namespace, podID PodID, optionalLocalPort, remotePort int, host string) (PortForwarder, error)
func (*FakePortForwardClient) LastForwardContext ¶ added in v0.10.8
func (c *FakePortForwardClient) LastForwardContext() context.Context
func (*FakePortForwardClient) LastForwardPortHost ¶ added in v0.10.15
func (c *FakePortForwardClient) LastForwardPortHost() string
func (*FakePortForwardClient) LastForwardPortPodID ¶ added in v0.10.8
func (c *FakePortForwardClient) LastForwardPortPodID() PodID
func (*FakePortForwardClient) LastForwardPortRemotePort ¶ added in v0.10.8
func (c *FakePortForwardClient) LastForwardPortRemotePort() int
func (*FakePortForwardClient) LastForwarder ¶ added in v0.10.8
func (c *FakePortForwardClient) LastForwarder() FakePortForwarder
func (*FakePortForwardClient) PortForwardCalls ¶ added in v0.20.2
func (c *FakePortForwardClient) PortForwardCalls() []PortForwardCall
type FakePortForwarder ¶ added in v0.10.8
type FakePortForwarder struct {
// contains filtered or unexported fields
}
func NewFakePortForwarder ¶ added in v0.20.8
func NewFakePortForwarder(ctx context.Context, localPort int, namespace Namespace) FakePortForwarder
func (FakePortForwarder) Addresses ¶ added in v0.20.8
func (pf FakePortForwarder) Addresses() []string
func (FakePortForwarder) ForwardPorts ¶ added in v0.10.8
func (pf FakePortForwarder) ForwardPorts() error
func (FakePortForwarder) LocalPort ¶ added in v0.10.8
func (pf FakePortForwarder) LocalPort() int
func (FakePortForwarder) Namespace ¶ added in v0.20.2
func (pf FakePortForwarder) Namespace() Namespace
func (FakePortForwarder) ReadyCh ¶ added in v0.20.8
func (pf FakePortForwarder) ReadyCh() <-chan struct{}
func (FakePortForwarder) TriggerFailure ¶ added in v0.20.8
func (pf FakePortForwarder) TriggerFailure(err error)
TriggerFailure allows tests to inject errors during forwarding that will be returned by ForwardPorts.
type ImageLocator ¶ added in v0.15.2
type ImageLocator interface { // Checks whether two image locators are the same. EqualsImageLocator(other interface{}) bool // Find all the images in this entity. Extract(e K8sEntity) ([]reference.Named, error) // Matches the type of this entity. MatchesType(e K8sEntity) bool // Find all the images in this entity that match the given selector, // and replace them with the injected ref. // If the injected ref has a pull policy sibling, set it to the given pull policy. // // Returns a new entity with the injected ref. Returns a boolean indicated // whether there was at least one successful injection. Inject(e K8sEntity, selector container.RefSelector, injectRef reference.Named, policy v1.PullPolicy) (K8sEntity, bool, error) ToSpec() v1alpha1.KubernetesImageLocator }
func ParseImageLocators ¶ added in v0.20.8
func ParseImageLocators(locators []v1alpha1.KubernetesImageLocator) ([]ImageLocator, error)
type InformerSet ¶ added in v0.19.2
type InformerSet interface { // For all watchers, a namespace must be specified. WatchPods(ctx context.Context, ns Namespace) (<-chan ObjectUpdate, error) WatchServices(ctx context.Context, ns Namespace) (<-chan *v1.Service, error) WatchEvents(ctx context.Context, ns Namespace) (<-chan *v1.Event, error) // Fetch a pod from the informer cache. // // If no informer has started, start one now on the given ctx. // // The pod should be treated as immutable (since it's a pointer to a shared cache reference). PodFromInformerCache(ctx context.Context, nn types.NamespacedName) (*v1.Pod, error) }
type JSONPath ¶ added in v0.7.11
type JSONPath struct {
// contains filtered or unexported fields
}
A wrapper around JSONPath with utility functions for locating particular types we need (like strings).
Improves the error message to include the problematic path.
func NewJSONPath ¶ added in v0.7.11
func (JSONPath) FindStrings ¶ added in v0.15.0
Extract all the strings from the given object. Returns an error if the object at the specified path isn't a string.
type JSONPathImageLocator ¶ added in v0.15.2
type JSONPathImageLocator struct {
// contains filtered or unexported fields
}
func MustJSONPathImageLocator ¶ added in v0.15.2
func MustJSONPathImageLocator(selector ObjectSelector, path string) *JSONPathImageLocator
func NewJSONPathImageLocator ¶ added in v0.15.2
func NewJSONPathImageLocator(selector ObjectSelector, path string) (*JSONPathImageLocator, error)
func (*JSONPathImageLocator) EqualsImageLocator ¶ added in v0.15.2
func (l *JSONPathImageLocator) EqualsImageLocator(other interface{}) bool
func (*JSONPathImageLocator) Extract ¶ added in v0.15.2
func (l *JSONPathImageLocator) Extract(e K8sEntity) ([]reference.Named, error)
func (*JSONPathImageLocator) Inject ¶ added in v0.15.2
func (l *JSONPathImageLocator) Inject(e K8sEntity, selector container.RefSelector, injectRef reference.Named, pullPolicy v1.PullPolicy) (K8sEntity, bool, error)
func (*JSONPathImageLocator) MatchesType ¶ added in v0.15.2
func (l *JSONPathImageLocator) MatchesType(e K8sEntity) bool
func (*JSONPathImageLocator) ToSpec ¶ added in v0.20.8
func (l *JSONPathImageLocator) ToSpec() v1alpha1.KubernetesImageLocator
type JSONPathImageObjectLocator ¶ added in v0.15.2
type JSONPathImageObjectLocator struct {
// contains filtered or unexported fields
}
func MustJSONPathImageObjectLocator ¶ added in v0.15.2
func MustJSONPathImageObjectLocator(selector ObjectSelector, path, repoField, tagField string) *JSONPathImageObjectLocator
func NewJSONPathImageObjectLocator ¶ added in v0.15.2
func NewJSONPathImageObjectLocator(selector ObjectSelector, path, repoField, tagField string) (*JSONPathImageObjectLocator, error)
func (*JSONPathImageObjectLocator) EqualsImageLocator ¶ added in v0.15.2
func (l *JSONPathImageObjectLocator) EqualsImageLocator(other interface{}) bool
func (*JSONPathImageObjectLocator) Extract ¶ added in v0.15.2
func (l *JSONPathImageObjectLocator) Extract(e K8sEntity) ([]reference.Named, error)
func (*JSONPathImageObjectLocator) Inject ¶ added in v0.15.2
func (l *JSONPathImageObjectLocator) Inject(e K8sEntity, selector container.RefSelector, injectRef reference.Named, _ v1.PullPolicy) (K8sEntity, bool, error)
pullPolicy is ignored for this injector for now, since it's less standard if it turns out there's a demand for this, we can plumb it through to image_object
func (*JSONPathImageObjectLocator) MatchesType ¶ added in v0.15.2
func (l *JSONPathImageObjectLocator) MatchesType(e K8sEntity) bool
func (*JSONPathImageObjectLocator) ToSpec ¶ added in v0.20.8
func (l *JSONPathImageObjectLocator) ToSpec() v1alpha1.KubernetesImageLocator
type K8sClient ¶
type K8sClient struct { InformerSet // contains filtered or unexported fields }
func (*K8sClient) CheckConnected ¶ added in v0.23.3
Loosely adapted from ctlptl.
func (*K8sClient) ContainerLogs ¶
func (K8sClient) ContainerRuntime ¶ added in v0.7.11
func (*K8sClient) CreatePortForwarder ¶ added in v0.10.8
func (*K8sClient) Delete ¶
Deletes all given entities.
Currently ignores any "not found" errors, because that seems like the correct behavior for our use cases.
func (*K8sClient) GetMetaByReference ¶ added in v0.17.8
func (K8sClient) LocalRegistry ¶ added in v0.14.0
func (*K8sClient) OwnerFetcher ¶ added in v0.23.5
func (k *K8sClient) OwnerFetcher() OwnerFetcher
func (*K8sClient) ToDiscoveryClient ¶ added in v0.17.13
func (k *K8sClient) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
func (*K8sClient) ToRESTConfig ¶ added in v0.17.13
func (*K8sClient) ToRESTMapper ¶ added in v0.17.13
func (k *K8sClient) ToRESTMapper() (meta.RESTMapper, error)
func (*K8sClient) ToRawKubeConfigLoader ¶ added in v0.17.13
func (k *K8sClient) ToRawKubeConfigLoader() clientcmd.ClientConfig
type K8sEntity ¶
func CopyEntities ¶ added in v0.10.15
func Filter ¶ added in v0.1.0
func Filter(entities []K8sEntity, test func(e K8sEntity) (bool, error)) (passing, rest []K8sEntity, err error)
Filter returns two slices of entities: those passing the given test, and the remainder of the input.
func FilterByHasPodTemplateSpec ¶ added in v0.7.11
func FilterByImage ¶ added in v0.1.0
func FilterByImage(entities []K8sEntity, img container.RefSelector, locators []ImageLocator, inEnvVars bool) (passing, rest []K8sEntity, err error)
func FilterByMatchesPodTemplateSpec ¶ added in v0.7.11
func FilterByMetadataLabels ¶ added in v0.7.11
func FilterBySelectorMatchesLabels ¶ added in v0.7.11
func ImmutableEntities ¶
func InjectCommandAndArgs ¶ added in v0.14.0
func InjectCommandAndArgs(entity K8sEntity, ref reference.Named, cmd *v1alpha1.ImageMapOverrideCommand, args *v1alpha1.ImageMapOverrideArgs) (K8sEntity, error)
func InjectImageDigest ¶
func InjectImageDigest(entity K8sEntity, selector container.RefSelector, injectRef reference.Named, locators []ImageLocator, matchInEnvVars bool, policy v1.PullPolicy) (K8sEntity, bool, error)
Iterate through the fields of a k8s entity and replace a image name with its digest.
policy: The pull policy to set on the replaced image.
When working with a local k8s cluster, we want to set this to Never, to ensure that k8s fails hard if the image is missing from docker.
Returns: the new entity, whether the image was replaced, and an error.
func InjectImagePullPolicy ¶
func InjectImagePullPolicy(entity K8sEntity, policy v1.PullPolicy) (K8sEntity, error)
Iterate through the fields of a k8s entity and replace the image pull policy on all images.
func InjectLabels ¶
func InjectParallelPodManagementPolicy ¶ added in v0.10.0
By default, StatefulSets use OrderedPodManagement.
This is a bad policy for development. If the pod goes into a crash loop, the StatefulSet operator will get wedged and require manual intervention. See: https://github.com/tilt-dev/tilt/issues/1962
Tilt should change all statefulsets to use a parallel policy.
func InjectPodTemplateSpecHashes ¶ added in v0.10.16
Iterate through the fields of a k8s entity and add the pod template spec hash on all pod template specs
func MutableAndImmutableEntities ¶ added in v0.10.15
func MutableAndImmutableEntities(entities entityList) (mutable, immutable []K8sEntity)
MutableAndImmutableEntities returns two lists of k8s entities: mutable ones (that can simply be `kubectl apply`'d), and immutable ones (such as jobs and pods, which will need to be `--force`'d). (We assume input entities are already sorted in a safe order to apply -- see kustomize/ordering.go.)
func MutableEntities ¶
func NewK8sEntity ¶ added in v0.10.4
func NewNamespaceEntity ¶ added in v0.10.15
func OverwriteLabels ¶ added in v0.7.11
func ParseYAML ¶
Parse the YAML into entities. Loosely based on https://github.com/kubernetes/cli-runtime/blob/d6a36215b15f83b94578f2ffce5d00447972e8ae/pkg/genericclioptions/resource/visitor.go#L583
func ParseYAMLFromString ¶
func ReverseSortedEntities ¶ added in v0.17.8
func SortedEntities ¶ added in v0.10.15
func (K8sEntity) Annotations ¶ added in v0.17.7
func (K8sEntity) Clean ¶ added in v0.16.0
func (e K8sEntity) Clean()
Clean up internal bookkeeping fields. See https://github.com/kubernetes/kubernetes/issues/90066
func (K8sEntity) FindImages ¶ added in v0.4.1
func (e K8sEntity) FindImages(locators []ImageLocator, envVarImages []container.RefSelector) ([]reference.Named, error)
func (K8sEntity) GVK ¶ added in v0.10.4
func (e K8sEntity) GVK() schema.GroupVersionKind
func (K8sEntity) HasImage ¶ added in v0.1.0
func (e K8sEntity) HasImage(image container.RefSelector, locators []ImageLocator, inEnvVars bool) (bool, error)
HasImage indicates whether the given entity is tagged with the given image.
func (K8sEntity) HasNamespace ¶ added in v0.7.11
func (K8sEntity) ImmutableOnceCreated ¶
Most entities can be updated once running, but a few cannot.
func (K8sEntity) MatchesMetadataLabels ¶ added in v0.7.11
MatchesMetadataLabels indicates whether the given label(s) are a subset of metadata labels for the given entity.
func (K8sEntity) NamespaceOrDefault ¶ added in v0.17.2
func (K8sEntity) SelectorMatchesLabels ¶ added in v0.7.11
SelectorMatchesLabels indicates whether the pod selector of the given entity matches the given label(s). For an empty selector, returns `false`. Currently only supports Services, but may be expanded to support other types that match pods via selectors.
func (K8sEntity) ToObjectReference ¶ added in v0.10.5
func (e K8sEntity) ToObjectReference() v1.ObjectReference
func (K8sEntity) WithNamespace ¶ added in v0.10.8
type KubeContext ¶ added in v0.6.0
type KubeContext string
func ProvideKubeContext ¶ added in v0.7.11
func ProvideKubeContext(config *api.Config) (KubeContext, error)
type KubeContextOverride ¶ added in v0.17.4
type KubeContextOverride string
type LoadBalancer ¶
type LoadBalancer struct { Spec LoadBalancerSpec URL *url.URL }
type LoadBalancerSpec ¶
func ToLoadBalancerSpec ¶
func ToLoadBalancerSpec(entity K8sEntity) (LoadBalancerSpec, bool)
Try to convert the current entity to a LoadBalancerSpec service
func ToLoadBalancerSpecs ¶
func ToLoadBalancerSpecs(entities []K8sEntity) []LoadBalancerSpec
type MetaClient ¶ added in v0.23.5
type MetaClient interface { GetMetaByReference(ctx context.Context, ref v1.ObjectReference) (metav1.Object, error) ListMeta(ctx context.Context, gvk schema.GroupVersionKind, ns Namespace) ([]metav1.Object, error) WatchMeta(ctx context.Context, gvk schema.GroupVersionKind, ns Namespace) (<-chan metav1.Object, error) }
type MinikubeClient ¶ added in v0.14.0
type MinikubeClient interface { Version(ctx context.Context) (string, error) DockerEnv(ctx context.Context) (map[string]string, bool, error) NodeIP(ctx context.Context) (NodeIP, error) }
func ProvideMinikubeClient ¶ added in v0.14.0
func ProvideMinikubeClient(context KubeContext) MinikubeClient
type NaiveRuntimeSource ¶ added in v0.8.10
type NaiveRuntimeSource struct {
// contains filtered or unexported fields
}
func NewNaiveRuntimeSource ¶ added in v0.8.10
func NewNaiveRuntimeSource(r container.Runtime) NaiveRuntimeSource
type Namespace ¶
type Namespace string
func ProvideConfigNamespace ¶ added in v0.7.11
func ProvideConfigNamespace(clientLoader clientcmd.ClientConfig) Namespace
The namespace in the kubeconfig. Used as a default namespace in some (but not all) client commands. https://godoc.org/k8s.io/client-go/tools/clientcmd/api/v1#Context
type NamespaceOverride ¶ added in v0.20.9
type NamespaceOverride string
type NodeIP ¶ added in v0.1.0
type NodeIP string
Some K8s environments expose a single IP for the whole cluster.
type ObjRefList ¶ added in v0.19.7
type ObjRefList []v1.ObjectReference
func ToRefList ¶ added in v0.20.9
func ToRefList(entities []K8sEntity) ObjRefList
func (ObjRefList) ContainsUID ¶ added in v0.19.7
func (o ObjRefList) ContainsUID(uid types.UID) bool
func (ObjRefList) GetByUID ¶ added in v0.19.7
func (o ObjRefList) GetByUID(uid types.UID) (v1.ObjectReference, bool)
func (ObjRefList) UIDSet ¶ added in v0.19.7
func (o ObjRefList) UIDSet() UIDSet
type ObjectRefTree ¶ added in v0.10.5
type ObjectRefTree struct { Ref v1.ObjectReference CreationTimestamp metav1.Time Owners []ObjectRefTree }
The ObjectRefTree only contains immutable properties of a Kubernetes object: the name, namespace, and UID
func (ObjectRefTree) String ¶ added in v0.10.5
func (t ObjectRefTree) String() string
func (ObjectRefTree) UIDs ¶ added in v0.10.5
func (t ObjectRefTree) UIDs() []types.UID
type ObjectSelector ¶ added in v0.15.2
type ObjectSelector struct {
// contains filtered or unexported fields
}
A selector matches an entity if all non-empty selector fields match the corresponding entity fields
func MustKindSelector ¶ added in v0.15.2
func MustKindSelector(kind string) ObjectSelector
Create a selector that matches the Kind. Useful for testing.
func MustNameSelector ¶ added in v0.15.2
func MustNameSelector(name string) ObjectSelector
Create a selector that matches the Name. Useful for testing.
func NewFullmatchCaseInsensitiveObjectSelector ¶ added in v0.15.2
func NewFullmatchCaseInsensitiveObjectSelector(apiVersion string, kind string, name string, namespace string) (ObjectSelector, error)
Creates a new ObjectSelector If an arg is an empty string it will become an empty regex that matches all input Otherwise the arg must match the input exactly
func NewPartialMatchObjectSelector ¶ added in v0.15.2
func NewPartialMatchObjectSelector(apiVersion string, kind string, name string, namespace string) (ObjectSelector, error)
Creates a new ObjectSelector If an arg is an empty string, it will become an empty regex that matches all input Otherwise the arg will match input from the beginning (prefix matching)
func ParseObjectSelector ¶ added in v0.20.8
func ParseObjectSelector(spec v1alpha1.ObjectSelector) (ObjectSelector, error)
func SelectorFromString ¶ added in v0.17.5
func SelectorFromString(s string) (ObjectSelector, error)
format is <name:required>:<kind:optional>:<namespace:optional>
func (ObjectSelector) EqualsSelector ¶ added in v0.15.2
func (o1 ObjectSelector) EqualsSelector(o2 ObjectSelector) bool
func (ObjectSelector) Matches ¶ added in v0.15.2
func (k ObjectSelector) Matches(e K8sEntity) bool
func (ObjectSelector) ToSpec ¶ added in v0.20.8
func (k ObjectSelector) ToSpec() v1alpha1.ObjectSelector
type ObjectUpdate ¶ added in v0.14.0
type ObjectUpdate struct {
// contains filtered or unexported fields
}
A wrapper object around SharedInformer objects, to make them a bit easier to use correctly.
func (ObjectUpdate) AsDeletedKey ¶ added in v0.14.0
func (r ObjectUpdate) AsDeletedKey() (Namespace, string, bool)
Returns (namespace, name, isDelete).
The informer's OnDelete handler sometimes gives us a structured object, and sometimes returns a DeletedFinalStateUnknown object. To make this easier to handle correctly, we never allow access to the OnDelete object. Instead, we force the caller to use AsDeletedKey() to get the identifier of the object.
For more info, see: https://godoc.org/k8s.io/client-go/tools/cache#ResourceEventHandler
func (ObjectUpdate) AsNamespacedName ¶ added in v0.19.3
func (r ObjectUpdate) AsNamespacedName() (types.NamespacedName, bool)
Returns the object update as the NamespacedName of the pod.
type OwnerFetcher ¶ added in v0.10.5
type OwnerFetcher struct {
// contains filtered or unexported fields
}
func NewOwnerFetcher ¶ added in v0.23.5
func NewOwnerFetcher(ctx context.Context, metaClient MetaClient) OwnerFetcher
func (OwnerFetcher) OwnerTreeOf ¶ added in v0.10.5
func (v OwnerFetcher) OwnerTreeOf(ctx context.Context, entity K8sEntity) (result ObjectRefTree, err error)
func (OwnerFetcher) OwnerTreeOfRef ¶ added in v0.10.7
func (v OwnerFetcher) OwnerTreeOfRef(ctx context.Context, ref v1.ObjectReference) (result ObjectRefTree, err error)
type PodAndCName ¶ added in v0.7.11
For keying PodLogsByPodAndContainer
type PodTemplateSpecHash ¶ added in v0.10.16
type PodTemplateSpecHash string
func HashPodTemplateSpec ¶ added in v0.10.16
func HashPodTemplateSpec(spec *v1.PodTemplateSpec) (PodTemplateSpecHash, error)
func ReadPodTemplateSpecHashes ¶ added in v0.10.19
func ReadPodTemplateSpecHashes(entity K8sEntity) ([]PodTemplateSpecHash, error)
ReadPodTemplateSpecHashes pulls the PodTemplateSpecHash that Tilt injected into this entity's metadata during deploy (if any)
type PortForwardCall ¶ added in v0.20.2
type PortForwardClient ¶ added in v0.10.8
type PortForwardClient interface { // Creates a new port-forwarder that's bound to the given context's lifecycle. // When the context is canceled, the port-forwarder will close. CreatePortForwarder(ctx context.Context, namespace Namespace, podID PodID, localPort int, remotePort int, host string) (PortForwarder, error) }
func ProvidePortForwardClient ¶ added in v0.10.8
func ProvidePortForwardClient( maybeRESTConfig RESTConfigOrError, maybeClientset ClientsetOrError) PortForwardClient
type PortForwarder ¶
type PortForwarder interface { // The local port we're listening on. LocalPort() int // Addresses that we're listening on. Addresses() []string // ReadyCh will be closed by ForwardPorts once the forwarding is successfully set up. // // ForwardPorts might return an error during initialization before forwarding is successfully set up, in which // case this channel will NOT be closed. ReadyCh() <-chan struct{} // Listens on the configured port and forward all traffic to the container. // Returns when the port-forwarder sees an unrecoverable error or // when the context passed at creation is canceled. ForwardPorts() error }
type RESTConfigOrError ¶ added in v0.10.8
func ProvideRESTConfig ¶
func ProvideRESTConfig(clientLoader clientcmd.ClientConfig) RESTConfigOrError
type RESTMapper ¶ added in v0.17.9
type RESTMapper interface { meta.RESTMapper Reset() }
type ReaderCloser ¶ added in v0.17.11
func (ReaderCloser) Close ¶ added in v0.17.11
func (b ReaderCloser) Close() error
type ResourceClient ¶ added in v0.22.14
type ResourceClient interface { Apply(target kube.ResourceList) (*kube.Result, error) CreateOrReplace(target kube.ResourceList) (*kube.Result, error) Delete(existing kube.ResourceList) (*kube.Result, []error) Create(l kube.ResourceList) (*kube.Result, error) Build(r io.Reader, validate bool) (kube.ResourceList, error) }
We've adapted Helm's kubernetes client for our needs
type RuntimeSource ¶ added in v0.8.10
type ServiceName ¶
type ServiceName string
Source Files ¶
- client.go
- container.go
- encoder.go
- entity.go
- env.go
- errors.go
- exec.go
- exploding_client.go
- extract.go
- fake_client.go
- image.go
- ip.go
- json_path.go
- label.go
- label_selector.go
- labels.go
- locator.go
- minikube.go
- minikube_fake.go
- names.go
- object_selector.go
- owner_fetcher.go
- pod.go
- pod_template.go
- portforward.go
- ref.go
- registry.go
- resource.go
- runtime.go
- serialize.go
- statefulset.go
- target.go
- uid.go
- watch.go
Directories ¶
Path | Synopsis |
---|---|
package jsonpath is a template engine using jsonpath syntax, which can be seen at http://goessner.net/articles/JsonPath/.
|
package jsonpath is a template engine using jsonpath syntax, which can be seen at http://goessner.net/articles/JsonPath/. |