Documentation ¶
Index ¶
- func DeploymentImpl(o Object) (*apps.Deployment, bool)
- func GetAppProto(ctx context.Context, aps AppProtocolStrategy, p *core.ServicePort) string
- func GetClusterID(ctx context.Context) (clusterID string, err error)
- func GetK8sInterface(ctx context.Context) kubernetes.Interface
- func GetPort(cn *core.Container, portName string) (*core.ContainerPort, error)
- func ObjErrorf(o Object, format string, args ...any) error
- func PodImpl(o Object) (*core.Pod, bool)
- func RecordWorkloadInfo(span trace.Span, wl Workload)
- func ReplicaSetImpl(o Object) (*apps.ReplicaSet, bool)
- func ServiceImpl(o Object) (*core.Service, bool)
- func StatefulSetImpl(o Object) (*apps.StatefulSet, bool)
- func WithK8sInterface(ctx context.Context, ki kubernetes.Interface) context.Context
- type AppProtocolStrategy
- type Object
- func GetPod(c context.Context, name, namespace string) (Object, error)
- func GetService(c context.Context, name, namespace string) (Object, error)
- func Pod(d *core.Pod) Object
- func Pods(c context.Context, namespace string, labelSelector labels.Set) ([]Object, error)
- func Service(d *core.Service) Object
- func Services(c context.Context, namespace string, labelSelector labels.Set) ([]Object, error)
- type StateListener
- type UnsupportedWorkloadKindError
- type Watcher
- func (w *Watcher) Active() bool
- func (w *Watcher) AddStateListener(l *StateListener)
- func (w *Watcher) Cancel()
- func (w *Watcher) EnsureStarted(c context.Context, cb func(bool))
- func (w *Watcher) Get(c context.Context, obj any) (any, bool, error)
- func (w *Watcher) HasSynced() bool
- func (w *Watcher) List(c context.Context) []any
- func (w *Watcher) RemoveStateListener(rl *StateListener)
- func (w *Watcher) Watch(c context.Context, ready *sync.WaitGroup)
- type Workload
- func Deployment(d *apps.Deployment) Workload
- func Deployments(c context.Context, namespace string, labelSelector labels.Set) ([]Workload, error)
- func GetDeployment(c context.Context, name, namespace string) (Workload, error)
- func GetReplicaSet(c context.Context, name, namespace string) (Workload, error)
- func GetStatefulSet(c context.Context, name, namespace string) (Workload, error)
- func GetWorkload(c context.Context, name, namespace, workloadKind string) (obj Workload, err error)
- func ReplicaSet(d *apps.ReplicaSet) Workload
- func ReplicaSets(c context.Context, namespace string, labelSelector labels.Set) ([]Workload, error)
- func StatefulSet(d *apps.StatefulSet) Workload
- func StatefulSets(c context.Context, namespace string, labelSelector labels.Set) ([]Workload, error)
- func WrapWorkload(workload runtime.Object) (Workload, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeploymentImpl ¶
func DeploymentImpl(o Object) (*apps.Deployment, bool)
DeploymentImpl casts the given Object as an *apps.Deployment and returns it together with a status flag indicating whether the cast was possible.
func GetAppProto ¶
func GetAppProto(ctx context.Context, aps AppProtocolStrategy, p *core.ServicePort) string
GetAppProto determines the application protocol of the given ServicePort. The given AppProtocolStrategy used if the port's appProtocol attribute is unset.
func GetClusterID ¶
GetClusterID returns the cluster ID for the given cluster. If there is an error, it still returns a usable ID along with the error.
func GetK8sInterface ¶
func GetK8sInterface(ctx context.Context) kubernetes.Interface
func PodImpl ¶
PodImpl casts the given Object as an *core.Pod and returns it together with a status flag indicating whether the cast was possible.
func RecordWorkloadInfo ¶ added in v2.7.2
func ReplicaSetImpl ¶
func ReplicaSetImpl(o Object) (*apps.ReplicaSet, bool)
ReplicaSetImpl casts the given Object as an *apps.ReplicaSet and returns it together with a status flag indicating whether the cast was possible.
func ServiceImpl ¶
ServiceImpl casts the given Object as an *core.Service and returns it together with a status flag indicating whether the cast was possible.
func StatefulSetImpl ¶
func StatefulSetImpl(o Object) (*apps.StatefulSet, bool)
StatefulSetImpl casts the given Object as an *apps.StatefulSet and returns it together with a status flag indicating whether the cast was possible.
func WithK8sInterface ¶
Types ¶
type AppProtocolStrategy ¶
type AppProtocolStrategy int
AppProtocolStrategy specifies how the application protocol for a service port is determined in case the service.spec.ports.appProtocol is not set.
const ( // Http2Probe means never guess. Choose HTTP/1.1 or HTTP/2 by probing (this is the default behavior). Http2Probe AppProtocolStrategy = iota // PortName means trust educated guess based on port name when appProtocol is missing and perform a http2 probe // if no such guess can be made. PortName // Http means just assume HTTP/1.1. Http // Http2 means just assume HTTP/2. Http2 )
func NewAppProtocolStrategy ¶
func NewAppProtocolStrategy(s string) (AppProtocolStrategy, error)
func (*AppProtocolStrategy) EnvDecode ¶
func (aps *AppProtocolStrategy) EnvDecode(val string) (err error)
func (AppProtocolStrategy) MarshalYAML ¶
func (aps AppProtocolStrategy) MarshalYAML() (any, error)
func (AppProtocolStrategy) String ¶
func (aps AppProtocolStrategy) String() string
func (*AppProtocolStrategy) UnmarshalYAML ¶
func (aps *AppProtocolStrategy) UnmarshalYAML(node *yaml.Node) (err error)
type Object ¶
type Object interface { runtime.Object meta.Object GetAnnotations() map[string]string GetKind() string Delete(context.Context) error Refresh(context.Context) error Selector() (labels.Selector, error) Update(context.Context) error Patch(context.Context, types.PatchType, []byte, ...string) error }
type StateListener ¶ added in v2.6.0
type StateListener struct {
Cb func()
}
type UnsupportedWorkloadKindError ¶ added in v2.6.2
type UnsupportedWorkloadKindError string
func (UnsupportedWorkloadKindError) Error ¶ added in v2.6.2
func (u UnsupportedWorkloadKindError) Error() string
type Watcher ¶ added in v2.6.0
Watcher watches some resource and can be cancelled.
func NewWatcher ¶ added in v2.6.0
func (*Watcher) Active ¶ added in v2.6.0
Active returns true if the watcher has been started and not yet cancelled.
func (*Watcher) AddStateListener ¶ added in v2.6.0
func (w *Watcher) AddStateListener(l *StateListener)
AddStateListener adds a listener function that will be called when the watcher changes its state (starts or is cancelled).
func (*Watcher) EnsureStarted ¶ added in v2.6.0
func (*Watcher) HasSynced ¶ added in v2.6.0
HasSynced returns true if this Watcher's controller has synced, or if this watcher hasn't started yet.
func (*Watcher) RemoveStateListener ¶ added in v2.6.0
func (w *Watcher) RemoveStateListener(rl *StateListener)
RemoveStateListener removes a listener function.
type Workload ¶
type Workload interface { Object GetPodTemplate() *core.PodTemplateSpec Replicas() int Updated(int64) bool }
func Deployment ¶
func Deployment(d *apps.Deployment) Workload
func Deployments ¶
Deployments returns all deployments found in the given Namespace.
func GetDeployment ¶
func GetReplicaSet ¶
func GetStatefulSet ¶
func GetWorkload ¶
GetWorkload returns a workload for the given name, namespace, and workloadKind. The workloadKind is optional. A search is performed in the following order if it is empty:
- Deployments
- ReplicaSets
- StatefulSets
The first match is returned.
func ReplicaSet ¶
func ReplicaSet(d *apps.ReplicaSet) Workload
func ReplicaSets ¶
ReplicaSets returns all replica sets found in the given Namespace.
func StatefulSet ¶
func StatefulSet(d *apps.StatefulSet) Workload