crd

package
v0.4.13 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package crd contains objects used to represent Kubernetes Custom Resource Definitions (CRDs) defined by Proclaim.

Index

Constants

View Source
const (
	// GroupName is the API group name used by Proclaim.
	GroupName = "proclaim.dogmatiq.io"

	// FinalizerName is the name of the finalizer used by Proclaim to ensure
	// that DNS-SD services are unadvertised when they're underlying resource
	// is deleted.
	FinalizerName = GroupName + "/unadvertise"

	// Version is the version of the API/CRDs.
	Version = "v1"
)
View Source
const ConditionTypeAdopted = "Adopted"

ConditionTypeAdopted is a condition that indicates whether or not the service instance has been adopted by a provider.

View Source
const ConditionTypeAdvertised = "Advertised"

ConditionTypeAdvertised is a condition that indicates whether or not the service instance has been advertised via a provider.

View Source
const ConditionTypeDiscoverable = "Discoverable"

ConditionTypeDiscoverable is a condition that indicates whether or not the service instance is discoverable via the DNS system.

Variables

This section is empty.

Functions

func AdvertiseErrorCondition added in v0.2.0

func AdvertiseErrorCondition(err error) metav1.Condition

AdvertiseErrorCondition returns a condition indicating that an attempt to advertise the instance failed with the given error.

func DNSRecordsCreated added in v0.2.0

func DNSRecordsCreated(m manager.Manager, res *DNSSDServiceInstance)

DNSRecordsCreated records an event indicating that new DNS records were created.

func DNSRecordsCreatedCondition added in v0.2.0

func DNSRecordsCreatedCondition() metav1.Condition

DNSRecordsCreatedCondition returns a condition indicating that the instance's DNS records have been created.

func DNSRecordsDeleted added in v0.2.0

func DNSRecordsDeleted(m manager.Manager, res *DNSSDServiceInstance)

DNSRecordsDeleted records an event indicating that existing DNS records were deleted.

func DNSRecordsDeletedCondition added in v0.2.0

func DNSRecordsDeletedCondition() metav1.Condition

DNSRecordsDeletedCondition returns a condition indicating that the instance's DNS records have been removed.

func DNSRecordsDoNotExistCondition added in v0.4.1

func DNSRecordsDoNotExistCondition() metav1.Condition

DNSRecordsDoNotExistCondition returns a condition indicating that the instance's DNS records do not exist, either because they never did or they have already been removed.

func DNSRecordsObservedCondition added in v0.2.0

func DNSRecordsObservedCondition() metav1.Condition

DNSRecordsObservedCondition returns a condition indicating that the instance's DNS records have been observed to already exist.

func DNSRecordsUpdated added in v0.2.0

func DNSRecordsUpdated(m manager.Manager, res *DNSSDServiceInstance)

DNSRecordsUpdated records an event indicating that existing DNS records were updated.

func DNSRecordsUpdatedCondition added in v0.2.0

func DNSRecordsUpdatedCondition() metav1.Condition

DNSRecordsUpdatedCondition returns a condition indicating that the instance's DNS records have been updated.

func DNSRecordsVerified added in v0.2.0

func DNSRecordsVerified(m manager.Manager, res *DNSSDServiceInstance)

DNSRecordsVerified records an event indicating that existing DNS records were verified to match the service instance spec.

func Discovered added in v0.2.0

func Discovered(m manager.Manager, res *DNSSDServiceInstance)

Discovered records an event indicating that the service instance was discovered via DNS-SD.

func DiscoveredCondition added in v0.2.0

func DiscoveredCondition() metav1.Condition

DiscoveredCondition returns a condition indicating that the DNS-SD discovery results match the advertised DNS records.

func DiscoveryError added in v0.2.0

func DiscoveryError(
	m manager.Manager,
	res *DNSSDServiceInstance,
	err error,
)

DiscoveryError records an event indicating that an error occurred while performing DNS-SD discovery.

func DiscoveryErrorCondition added in v0.2.0

func DiscoveryErrorCondition(err error) metav1.Condition

DiscoveryErrorCondition returns a condition indicating that the DNS-SD discovery failed with the given error.

func InstanceAdopted added in v0.2.0

func InstanceAdopted(m manager.Manager, res *DNSSDServiceInstance)

InstanceAdopted records an event indicating that the service instance was adopted by the controller.

func InstanceAdoptedCondition added in v0.2.0

func InstanceAdoptedCondition() metav1.Condition

InstanceAdoptedCondition returns a condition indicating that the instance has been adopted by a provider.

func InstanceIgnored added in v0.2.0

func InstanceIgnored(m manager.Manager, res *DNSSDServiceInstance)

InstanceIgnored records an event indicating that the service instance was ignored by the controller.

func InstanceIgnoredCondition added in v0.2.0

func InstanceIgnoredCondition() metav1.Condition

InstanceIgnoredCondition returns a condition indicating that the instance has been ignored by all providers.

func LookupResultOutOfSync added in v0.2.0

func LookupResultOutOfSync(m manager.Manager, res *DNSSDServiceInstance, diff string)

LookupResultOutOfSync records an event indicating that the service instance was discovered via DNS-SD, but the result did not match the advertised DNS records.

func LookupResultOutOfSyncCondition added in v0.2.0

func LookupResultOutOfSyncCondition(diff string) metav1.Condition

LookupResultOutOfSyncCondition returns a condition indicating that the instance was found by a DNS-SD lookup operation, but the result did not match the advertised DNS records.

func NegativeBrowseResult added in v0.2.0

func NegativeBrowseResult(m manager.Manager, res *DNSSDServiceInstance)

NegativeBrowseResult records an event indicating that the service instance was not discoverable via DNS-SD.

func NegativeBrowseResultCondition added in v0.2.0

func NegativeBrowseResultCondition() metav1.Condition

NegativeBrowseResultCondition returns a condition indicating that the instance was not present in the result of a DNS-SD browse operation.

func NegativeLookupResult added in v0.2.0

func NegativeLookupResult(m manager.Manager, res *DNSSDServiceInstance)

NegativeLookupResult records an event indicating that the service instance was not discoverable via DNS-SD.

func NegativeLookupResultCondition added in v0.2.0

func NegativeLookupResultCondition() metav1.Condition

NegativeLookupResultCondition returns a condition indicating that the instance could not be found by a DNS-SD lookup operation.

func ProviderError added in v0.2.0

func ProviderError(
	m manager.Manager,
	res *DNSSDServiceInstance,
	id, desc string,
	err error,
)

ProviderError records an event indicating that an error occurred while interacting with a DNS provider.

func UnadvertiseErrorCondition added in v0.2.0

func UnadvertiseErrorCondition(err error) metav1.Condition

UnadvertiseErrorCondition returns a condition indicating that an attempt to unadvertise the instance failed with the given error.

func UpdateStatus added in v0.2.0

func UpdateStatus(
	ctx context.Context,
	cli client.Client,
	res *DNSSDServiceInstance,
	updates ...StatusUpdate,
) error

UpdateStatus applies the given StatusUpdates to the given resource.

Types

type DNSSDServiceInstance

type DNSSDServiceInstance struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   DNSSDServiceInstanceSpec   `json:"spec,omitempty"`
	Status DNSSDServiceInstanceStatus `json:"status,omitempty"`
}

DNSSDServiceInstance is a resource that represents a DNS-SD service instance.

func (*DNSSDServiceInstance) Condition added in v0.2.0

func (res *DNSSDServiceInstance) Condition(t string) metav1.Condition

Condition returns the condition with the given type.

func (*DNSSDServiceInstance) DeepCopyObject

func (i *DNSSDServiceInstance) DeepCopyObject() runtime.Object

DeepCopyObject returns a deep clone of i.

type DNSSDServiceInstanceList

type DNSSDServiceInstanceList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []DNSSDServiceInstance `json:"items"`
}

DNSSDServiceInstanceList is a list of DNS-SD service instances.

func (*DNSSDServiceInstanceList) DeepCopyObject

func (l *DNSSDServiceInstanceList) DeepCopyObject() runtime.Object

DeepCopyObject returns a deep clone of l.

type DNSSDServiceInstanceSpec

type DNSSDServiceInstanceSpec struct {
	Instance Instance `json:"instance"`
}

DNSSDServiceInstanceSpec is the specification for a service instance.

func (DNSSDServiceInstanceSpec) ToDissolve added in v0.3.0

ToDissolve returns a Dissolve dnssd.Instance from a CRD service instance specification.

type DNSSDServiceInstanceStatus

type DNSSDServiceInstanceStatus struct {
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	ProviderDescription string         `json:"providerDescription,omitempty"`
	Provider            string         `json:"provider,omitempty"`
	Advertiser          map[string]any `json:"advertiser,omitempty"`
}

DNSSDServiceInstanceStatus contains the status of a service instance.

type Instance added in v0.2.0

type Instance struct {
	Name        string           `json:"name"`
	ServiceType string           `json:"serviceType"`
	Domain      string           `json:"domain"`
	TTL         metav1.Duration  `json:"ttl,omitempty"`
	Targets     [1]Target        `json:"targets"`
	Attributes  []map[string]any `json:"attributes,omitempty"`
}

Instance is a DNS-SD service instance.

type StatusUpdate added in v0.2.0

type StatusUpdate func(*DNSSDServiceInstance)

StatusUpdate is a function that updates a resource's status in some way.

func AssociateProvider added in v0.2.0

func AssociateProvider(provider string, advertiser map[string]any) StatusUpdate

AssociateProvider is an StatusUpdate that sets the Provider and Advertiser fields of the resource's status.

func If added in v0.2.0

func If(test bool, updates ...StatusUpdate) StatusUpdate

If is an StatusUpdate that conditionally applies other StatusUpdates.

func MergeCondition added in v0.2.0

func MergeCondition(c metav1.Condition) StatusUpdate

MergeCondition is an StatusUpdate that merges a new Condition into the resource's status.

If a Condition with the same type already exists, it is replaced with the new Condition, otherwise the new Condition is appended.

func UpdateProviderDescription added in v0.2.0

func UpdateProviderDescription(desc string) StatusUpdate

UpdateProviderDescription is an StatusUpdate that sets the ProviderDescription field of the resource's status.

type Target added in v0.2.0

type Target struct {
	Host     string `json:"host"`
	Port     uint16 `json:"port"`
	Priority uint16 `json:"priority,omitempty"`
	Weight   uint16 `json:"weight,omitempty"`
}

Target describes a single target address for a DNS service instance.

Jump to

Keyboard shortcuts

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