resources

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(objects ...Fetchable) bool

func Fetch

func Fetch(ctx context.Context, objects ...Fetchable) error

func GetDaemonSetStatus added in v0.31.0

func GetDaemonSetStatus(ds *appsv1.DaemonSet) (ready bool, message string)

DaemonSet is ready when: - exists, not deleted, observed - pods for all desired nodes are updated, ready and available.

func Hash

func Hash(items ...any) (string, error)

Hash returns hex sha256 for concatenated json serialization. Excludes trailing nil, returns "" if there is nothing left.

func Sync

func Sync(ctx context.Context, objects ...Syncable) error

Types

type BaseManagedResource

type BaseManagedResource[T ResourceObject] struct {
	// contains filtered or unexported fields
}

func (*BaseManagedResource[T]) Exists

func (r *BaseManagedResource[T]) Exists() bool

func (*BaseManagedResource[T]) Fetch

func (r *BaseManagedResource[T]) Fetch(ctx context.Context) error

func (*BaseManagedResource[T]) IsAnnotationChanged added in v0.31.0

func (r *BaseManagedResource[T]) IsAnnotationChanged(ann string) bool

func (*BaseManagedResource[T]) IsUpdated

func (r *BaseManagedResource[T]) IsUpdated() bool

func (*BaseManagedResource[T]) Name

func (r *BaseManagedResource[T]) Name() string

func (*BaseManagedResource[T]) NewObject

func (r *BaseManagedResource[T]) NewObject() T

func (*BaseManagedResource[T]) OldObject

func (r *BaseManagedResource[T]) OldObject() T

func (*BaseManagedResource[T]) Sync

func (r *BaseManagedResource[T]) Sync(ctx context.Context) error

type CABundle

type CABundle struct {
	Source     ytv1.FileObjectReference
	VolumeName string
	MountPath  string
	FileName   string
}

CABundle represents mounted configmap with trusted certificates

func NewCABundle

func NewCABundle(source *ytv1.FileObjectReference) *CABundle

func NewCARootBundle

func NewCARootBundle(source *ytv1.FileObjectReference) *CABundle

func (*CABundle) AddContainerEnv

func (t *CABundle) AddContainerEnv(container *corev1.Container)

func (*CABundle) AddVolume

func (t *CABundle) AddVolume(podSpec *corev1.PodSpec)

func (*CABundle) AddVolumeMount

func (t *CABundle) AddVolumeMount(container *corev1.Container)

type ConfigMap

type ConfigMap struct {
	BaseManagedResource[*corev1.ConfigMap]
}

func NewConfigMap

func NewConfigMap(name string, labeller *labeller2.Labeller, apiProxy apiproxy.APIProxy) *ConfigMap

func (*ConfigMap) Build

func (s *ConfigMap) Build() *corev1.ConfigMap

type DaemonSet added in v0.31.0

type DaemonSet struct {
	BaseManagedResource[*appsv1.DaemonSet]
}

func NewDaemonSet added in v0.31.0

func NewDaemonSet(
	name string,
	labeller *labeller.Labeller,
	proxy apiproxy.APIProxy,
) *DaemonSet

func (*DaemonSet) Build added in v0.31.0

func (d *DaemonSet) Build(maxUnavailable int32) *appsv1.DaemonSet

func (*DaemonSet) Status added in v0.31.0

func (d *DaemonSet) Status() (ready bool, message string)

type Deployment

type Deployment struct {
	BaseManagedResource[*appsv1.Deployment]
	// contains filtered or unexported fields
}

func NewDeployment

func NewDeployment(
	name string,
	labeller *labeller2.Labeller,
	ytsaurus *apiproxy.Ytsaurus,
	tolerations []corev1.Toleration,
	nodeSelector map[string]string,
) *Deployment

func (*Deployment) ArePodsReady

func (d *Deployment) ArePodsReady(ctx context.Context) bool

func (*Deployment) ArePodsRemoved

func (d *Deployment) ArePodsRemoved(ctx context.Context) bool

func (*Deployment) Build

func (d *Deployment) Build() *appsv1.Deployment

func (*Deployment) GetReplicas added in v0.31.0

func (d *Deployment) GetReplicas() int32

type Fetchable

type Fetchable interface {
	Fetch(ctx context.Context) error
	Exists() bool
}

type HTTPService

type HTTPService struct {
	BaseManagedResource[*corev1.Service]
	// contains filtered or unexported fields
}

func NewHTTPService

func NewHTTPService(name string, transport *ytv1.HTTPTransportSpec, labeller *labeller.Labeller, apiProxy apiproxy.APIProxy) *HTTPService

func (*HTTPService) Build

func (s *HTTPService) Build() *corev1.Service

func (*HTTPService) SetChytProxyHttpNodePort

func (s *HTTPService) SetChytProxyHttpNodePort(port *int32)

func (*HTTPService) SetChytProxyHttpPort

func (s *HTTPService) SetChytProxyHttpPort(port *int32)

func (*HTTPService) SetChytProxyHttpsNodePort

func (s *HTTPService) SetChytProxyHttpsNodePort(port *int32)

func (*HTTPService) SetChytProxyHttpsPort

func (s *HTTPService) SetChytProxyHttpsPort(port *int32)

func (*HTTPService) SetHttpNodePort

func (s *HTTPService) SetHttpNodePort(port *int32)

func (*HTTPService) SetHttpPort

func (s *HTTPService) SetHttpPort(port *int32)

func (*HTTPService) SetHttpsNodePort

func (s *HTTPService) SetHttpsNodePort(port *int32)

func (*HTTPService) SetHttpsPort

func (s *HTTPService) SetHttpsPort(port *int32)

type HeadlessService

type HeadlessService struct {
	BaseManagedResource[*corev1.Service]
}

func NewHeadlessService

func NewHeadlessService(name string, labeller *labeller2.Labeller, apiProxy apiproxy.APIProxy) *HeadlessService

func (*HeadlessService) Build

func (s *HeadlessService) Build() *corev1.Service

type Job

type Job struct {
	BaseManagedResource[*batchv1.Job]
}

func NewJob

func NewJob(name string, l *labeller.Labeller, apiProxy apiproxy.APIProxy) *Job

func (*Job) Build

func (j *Job) Build() *batchv1.Job

func (*Job) Status added in v0.31.0

func (j *Job) Status() batchv1.JobStatus

type ManagedResource

type ManagedResource[T ResourceObject] interface {
	Fetchable
	Syncable

	Name() string
	OldObject() T
	NewObject() T
	Build() T
}

type MonitoringService

type MonitoringService struct {
	BaseManagedResource[*corev1.Service]
	// contains filtered or unexported fields
}

func NewMonitoringService

func NewMonitoringService(monitoringTargetPort int32, labeller *labeller2.Labeller, apiProxy apiproxy.APIProxy) *MonitoringService

func (*MonitoringService) AddPort

func (s *MonitoringService) AddPort(port corev1.ServicePort)

func (*MonitoringService) Build

func (s *MonitoringService) Build() *corev1.Service

func (*MonitoringService) GetServiceMeta

func (s *MonitoringService) GetServiceMeta(name string) metav1.ObjectMeta

type RPCService

type RPCService struct {
	BaseManagedResource[*corev1.Service]

	Ports []corev1.ServicePort
}

func NewRPCService

func NewRPCService(name string, ports []corev1.ServicePort, labeller *labeller.Labeller, apiProxy apiproxy.APIProxy) *RPCService

func (*RPCService) Build

func (s *RPCService) Build() *corev1.Service

type ResourceObject

type ResourceObject interface {
	client.Object
}

type StatefulSet

type StatefulSet struct {
	BaseManagedResource[*appsv1.StatefulSet]
	// contains filtered or unexported fields
}

func NewStatefulSet

func NewStatefulSet(
	name string,
	labeller *labeller2.Labeller,
	proxy apiproxy.APIProxy,
	commonSpec *ytv1.CommonSpec,
) *StatefulSet

func (*StatefulSet) ArePodsReady

func (s *StatefulSet) ArePodsReady(ctx context.Context, instanceCount int, minReadyInstanceCount *int, byContainerNames []string) bool

func (*StatefulSet) ArePodsRemoved

func (s *StatefulSet) ArePodsRemoved(ctx context.Context) bool

func (*StatefulSet) Build

func (s *StatefulSet) Build() *appsv1.StatefulSet

func (*StatefulSet) GetReplicas added in v0.31.0

func (s *StatefulSet) GetReplicas() int32

func (*StatefulSet) ListPods

func (s *StatefulSet) ListPods(ctx context.Context) ([]corev1.Pod, error)

type StringSecret

type StringSecret struct {
	BaseManagedResource[*corev1.Secret]
}

func NewStringSecret

func NewStringSecret(name string, reconciler *labeller.Labeller, apiProxy apiproxy.APIProxy) *StringSecret

func (*StringSecret) Build

func (s *StringSecret) Build() *corev1.Secret

func (*StringSecret) GetEnvSource

func (s *StringSecret) GetEnvSource() corev1.EnvFromSource

func (*StringSecret) GetValue

func (s *StringSecret) GetValue(key string) (string, bool)

func (*StringSecret) NeedSync

func (s *StringSecret) NeedSync(key, value string) bool

type Syncable

type Syncable interface {
	Sync(ctx context.Context) error
}

type TCPService

type TCPService struct {
	BaseManagedResource[*corev1.Service]
	// contains filtered or unexported fields
}

func NewTCPService

func NewTCPService(name string,
	serviceType corev1.ServiceType,
	portCount int32,
	minPort int32,
	labeller *labeller2.Labeller,
	apiProxy apiproxy.APIProxy) *TCPService

func (*TCPService) Build

func (s *TCPService) Build() *corev1.Service

type TLSSecret

type TLSSecret struct {
	SecretName string
	VolumeName string
	MountPath  string
}

TLSSecret represents mounted kubernetes.io/tls secret https://kubernetes.io/docs/concepts/configuration/secret/#tls-secrets

func NewTLSSecret

func NewTLSSecret(secretName string, volumeName string, mountPath string) *TLSSecret

func (*TLSSecret) AddVolume

func (t *TLSSecret) AddVolume(podSpec *corev1.PodSpec)

func (*TLSSecret) AddVolumeMount

func (t *TLSSecret) AddVolumeMount(container *corev1.Container)

Jump to

Keyboard shortcuts

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