|
| 1 | +package v1alpha3 |
| 2 | + |
| 3 | +import ( |
| 4 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 5 | +) |
| 6 | + |
| 7 | +// +genclient |
| 8 | +// +genclient:noStatus |
| 9 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 10 | +// +groupName=multicluster.linkerd.io |
| 11 | + |
| 12 | +type Link struct { |
| 13 | + // TypeMeta is the metadata for the resource, like kind and apiversion |
| 14 | + metav1.TypeMeta `json:",inline"` |
| 15 | + |
| 16 | + // ObjectMeta contains the metadata for the particular object, including |
| 17 | + // things like... |
| 18 | + // - name |
| 19 | + // - namespace |
| 20 | + // - self link |
| 21 | + // - labels |
| 22 | + // - ... etc ... |
| 23 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 24 | + |
| 25 | + // Spec is the custom resource spec |
| 26 | + Spec LinkSpec `json:"spec"` |
| 27 | + |
| 28 | + // Status defines the current state of a Link |
| 29 | + Status LinkStatus `json:"status,omitempty"` |
| 30 | +} |
| 31 | + |
| 32 | +// LinkSpec specifies a LinkSpec resource. |
| 33 | +type LinkSpec struct { |
| 34 | + TargetClusterName string `json:"targetClusterName,omitempty"` |
| 35 | + TargetClusterDomain string `json:"targetClusterDomain,omitempty"` |
| 36 | + TargetClusterLinkerdNamespace string `json:"targetClusterLinkerdNamespace,omitempty"` |
| 37 | + ClusterCredentialsSecret string `json:"clusterCredentialsSecret,omitempty"` |
| 38 | + GatewayAddress string `json:"gatewayAddress,omitempty"` |
| 39 | + GatewayPort string `json:"gatewayPort,omitempty"` |
| 40 | + GatewayIdentity string `json:"gatewayIdentity,omitempty"` |
| 41 | + ProbeSpec ProbeSpec `json:"probeSpec,omitempty"` |
| 42 | + Selector *metav1.LabelSelector `json:"selector,omitempty"` |
| 43 | + RemoteDiscoverySelector *metav1.LabelSelector `json:"remoteDiscoverySelector,omitempty"` |
| 44 | + FederatedServiceSelector *metav1.LabelSelector `json:"federatedServiceSelector,omitempty"` |
| 45 | + ExcludedAnnotations []string `json:"excludedAnnotations,omitempty"` |
| 46 | + ExcludedLabels []string `json:"excludedLabels,omitempty"` |
| 47 | +} |
| 48 | + |
| 49 | +// ProbeSpec for gateway health probe |
| 50 | +type ProbeSpec struct { |
| 51 | + Path string `json:"path,omitempty"` |
| 52 | + Port string `json:"port,omitempty"` |
| 53 | + Period string `json:"period,omitempty"` |
| 54 | + Timeout string `json:"timeout,omitempty"` |
| 55 | + FailureThreshold string `json:"failureThreshold,omitempty"` |
| 56 | +} |
| 57 | + |
| 58 | +// LinkStatus holds information about the status services mirrored with this |
| 59 | +// Link. |
| 60 | +type LinkStatus struct { |
| 61 | + // +optional |
| 62 | + MirrorServices []ServiceStatus `json:"mirrorServices,omitempty"` |
| 63 | + // +optional |
| 64 | + FederatedServices []ServiceStatus `json:"federatedServices,omitempty"` |
| 65 | +} |
| 66 | + |
| 67 | +type ServiceStatus struct { |
| 68 | + Conditions []LinkCondition `json:"conditions,omitempty"` |
| 69 | + ControllerName string `json:"controllerName,omitempty"` |
| 70 | + RemoteRef ObjectRef `json:"remoteRef,omitempty"` |
| 71 | +} |
| 72 | + |
| 73 | +// LinkCondition represents the service state of an ExternalWorkload |
| 74 | +type LinkCondition struct { |
| 75 | + // Type of the condition |
| 76 | + Type string `json:"type"` |
| 77 | + // Status of the condition. |
| 78 | + // Can be True, False, Unknown |
| 79 | + Status metav1.ConditionStatus `json:"status"` |
| 80 | + // Last time an ExternalWorkload was probed for a condition. |
| 81 | + // +optional |
| 82 | + LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"` |
| 83 | + // Last time a condition transitioned from one status to another. |
| 84 | + // +optional |
| 85 | + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` |
| 86 | + // Unique one word reason in CamelCase that describes the reason for a |
| 87 | + // transition. |
| 88 | + // +optional |
| 89 | + Reason string `json:"reason,omitempty"` |
| 90 | + // Human readable message that describes details about last transition. |
| 91 | + // +optional |
| 92 | + Message string `json:"message"` |
| 93 | + // LocalRef is a reference to the local mirror or federated service. |
| 94 | + LocalRef ObjectRef `json:"localRef,omitempty"` |
| 95 | +} |
| 96 | + |
| 97 | +type ObjectRef struct { |
| 98 | + Group string `json:"group,omitempty"` |
| 99 | + Kind string `json:"kind,omitempty"` |
| 100 | + Name string `json:"name,omitempty"` |
| 101 | + Namespace string `json:"namespace,omitempty"` |
| 102 | +} |
| 103 | + |
| 104 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 105 | + |
| 106 | +// LinkList is a list of LinkList resources. |
| 107 | +type LinkList struct { |
| 108 | + metav1.TypeMeta `json:",inline"` |
| 109 | + metav1.ListMeta `json:"metadata"` |
| 110 | + |
| 111 | + Items []Link `json:"items"` |
| 112 | +} |
0 commit comments