Skip to content

Commit fd66103

Browse files
committedAug 30, 2021
add mcs serviceexports and serviceimports (#11)
Signed-off-by: Lan Luo <[email protected]>
1 parent 0d67d5b commit fd66103

File tree

4 files changed

+694
-657
lines changed

4 files changed

+694
-657
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: serviceexports.multicluster.x-k8s.io
5+
spec:
6+
group: multicluster.x-k8s.io
7+
scope: Namespaced
8+
names:
9+
plural: serviceexports
10+
singular: serviceexport
11+
kind: ServiceExport
12+
shortNames:
13+
- svcex
14+
versions:
15+
- name: v1alpha1
16+
served: true
17+
storage: true
18+
subresources:
19+
status: {}
20+
additionalPrinterColumns:
21+
- name: Age
22+
type: date
23+
jsonPath: .metadata.creationTimestamp
24+
"schema":
25+
"openAPIV3Schema":
26+
description: ServiceExport declares that the Service with the same name and
27+
namespace as this export should be consumable from other clusters.
28+
type: object
29+
properties:
30+
apiVersion:
31+
description: 'APIVersion defines the versioned schema of this representation
32+
of an object. Servers should convert recognized schemas to the latest
33+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
34+
type: string
35+
kind:
36+
description: 'Kind is a string value representing the REST resource this
37+
object represents. Servers may infer this from the endpoint the client
38+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
39+
type: string
40+
metadata:
41+
type: object
42+
status:
43+
description: status describes the current state of an exported service.
44+
Service configuration comes from the Service that had the same name
45+
and namespace as this ServiceExport. Populated by the multi-cluster
46+
service implementation's controller.
47+
type: object
48+
properties:
49+
conditions:
50+
type: array
51+
items:
52+
description: "Condition contains details for one aspect of the current
53+
state of this API Resource. --- This struct is intended for direct
54+
use as an array at the field path .status.conditions. For example,
55+
type FooStatus struct{ // Represents the observations of a
56+
foo's current state. // Known .status.conditions.type are:
57+
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
58+
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
59+
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
60+
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
61+
\n // other fields }"
62+
type: object
63+
required:
64+
- lastTransitionTime
65+
- message
66+
- reason
67+
- status
68+
- type
69+
properties:
70+
lastTransitionTime:
71+
description: lastTransitionTime is the last time the condition
72+
transitioned from one status to another. This should be when
73+
the underlying condition changed. If that is not known, then
74+
using the time when the API field changed is acceptable.
75+
type: string
76+
format: date-time
77+
message:
78+
description: message is a human readable message indicating
79+
details about the transition. This may be an empty string.
80+
type: string
81+
maxLength: 32768
82+
observedGeneration:
83+
description: observedGeneration represents the .metadata.generation
84+
that the condition was set based upon. For instance, if .metadata.generation
85+
is currently 12, but the .status.conditions[x].observedGeneration
86+
is 9, the condition is out of date with respect to the current
87+
state of the instance.
88+
type: integer
89+
format: int64
90+
minimum: 0
91+
reason:
92+
description: reason contains a programmatic identifier indicating
93+
the reason for the condition's last transition. Producers
94+
of specific condition types may define expected values and
95+
meanings for this field, and whether the values are considered
96+
a guaranteed API. The value should be a CamelCase string.
97+
This field may not be empty.
98+
type: string
99+
maxLength: 1024
100+
minLength: 1
101+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
102+
status:
103+
description: status of the condition, one of True, False, Unknown.
104+
type: string
105+
enum:
106+
- "True"
107+
- "False"
108+
- Unknown
109+
type:
110+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
111+
--- Many .condition.type values are consistent across resources
112+
like Available, but because arbitrary conditions can be useful
113+
(see .node.status.conditions), the ability to deconflict is
114+
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
115+
type: string
116+
maxLength: 316
117+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
118+
x-kubernetes-list-map-keys:
119+
- type
120+
x-kubernetes-list-type: map
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: serviceimports.multicluster.x-k8s.io
5+
spec:
6+
group: multicluster.x-k8s.io
7+
scope: Namespaced
8+
names:
9+
plural: serviceimports
10+
singular: serviceimport
11+
kind: ServiceImport
12+
shortNames:
13+
- svcim
14+
versions:
15+
- name: v1alpha1
16+
served: true
17+
storage: true
18+
subresources:
19+
status: {}
20+
additionalPrinterColumns:
21+
- name: Type
22+
type: string
23+
description: The type of this ServiceImport
24+
jsonPath: .spec.type
25+
- name: IP
26+
type: string
27+
description: The VIP for this ServiceImport
28+
jsonPath: .spec.ips
29+
- name: Age
30+
type: date
31+
jsonPath: .metadata.creationTimestamp
32+
"schema":
33+
"openAPIV3Schema":
34+
description: ServiceImport describes a service imported from clusters in a
35+
ClusterSet.
36+
type: object
37+
properties:
38+
apiVersion:
39+
description: 'APIVersion defines the versioned schema of this representation
40+
of an object. Servers should convert recognized schemas to the latest
41+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
42+
type: string
43+
kind:
44+
description: 'Kind is a string value representing the REST resource this
45+
object represents. Servers may infer this from the endpoint the client
46+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
47+
type: string
48+
metadata:
49+
type: object
50+
spec:
51+
description: spec defines the behavior of a ServiceImport.
52+
type: object
53+
required:
54+
- ports
55+
- type
56+
properties:
57+
ips:
58+
description: ip will be used as the VIP for this service when type
59+
is ClusterSetIP.
60+
type: array
61+
maxItems: 1
62+
items:
63+
type: string
64+
ports:
65+
type: array
66+
items:
67+
description: ServicePort represents the port on which the service
68+
is exposed
69+
type: object
70+
required:
71+
- port
72+
properties:
73+
appProtocol:
74+
description: The application protocol for this port. This field
75+
follows standard Kubernetes label syntax. Un-prefixed names
76+
are reserved for IANA standard service names (as per RFC-6335
77+
and http://www.iana.org/assignments/service-names). Non-standard
78+
protocols should use prefixed names such as mycompany.com/my-custom-protocol.
79+
Field can be enabled with ServiceAppProtocol feature gate.
80+
type: string
81+
name:
82+
description: The name of this port within the service. This
83+
must be a DNS_LABEL. All ports within a ServiceSpec must have
84+
unique names. When considering the endpoints for a Service,
85+
this must match the 'name' field in the EndpointPort. Optional
86+
if only one ServicePort is defined on this service.
87+
type: string
88+
port:
89+
description: The port that will be exposed by this service.
90+
type: integer
91+
format: int32
92+
protocol:
93+
description: The IP protocol for this port. Supports "TCP",
94+
"UDP", and "SCTP". Default is TCP.
95+
type: string
96+
x-kubernetes-list-type: atomic
97+
sessionAffinity:
98+
description: 'Supports "ClientIP" and "None". Used to maintain session
99+
affinity. Enable client IP based session affinity. Must be ClientIP
100+
or None. Defaults to None. Ignored when type is Headless More info:
101+
https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies'
102+
type: string
103+
sessionAffinityConfig:
104+
description: sessionAffinityConfig contains session affinity configuration.
105+
type: object
106+
properties:
107+
clientIP:
108+
description: clientIP contains the configurations of Client IP
109+
based session affinity.
110+
type: object
111+
properties:
112+
timeoutSeconds:
113+
description: timeoutSeconds specifies the seconds of ClientIP
114+
type session sticky time. The value must be >0 && <=86400(for
115+
1 day) if ServiceAffinity == "ClientIP". Default value is
116+
10800(for 3 hours).
117+
type: integer
118+
format: int32
119+
type:
120+
description: type defines the type of this service. Must be ClusterSetIP
121+
or Headless.
122+
type: string
123+
enum:
124+
- ClusterSetIP
125+
- Headless
126+
status:
127+
description: status contains information about the exported services that
128+
form the multi-cluster service referenced by this ServiceImport.
129+
type: object
130+
properties:
131+
clusters:
132+
description: clusters is the list of exporting clusters from which
133+
this service was derived.
134+
type: array
135+
items:
136+
description: ClusterStatus contains service configuration mapped
137+
to a specific source cluster
138+
type: object
139+
required:
140+
- cluster
141+
properties:
142+
cluster:
143+
description: cluster is the name of the exporting cluster. Must
144+
be a valid RFC-1123 DNS label.
145+
type: string
146+
x-kubernetes-list-map-keys:
147+
- cluster
148+
x-kubernetes-list-type: map

‎multicluster/config/crd/kustomization.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ resources:
99
- bases/multicluster.crd.antrea.io_resourceimportfilters.yaml
1010
- bases/multicluster.crd.antrea.io_resourceexports.yaml
1111
- bases/multicluster.crd.antrea.io_resourceimports.yaml
12+
- bases/multicluster.x-k8s.io_serviceexports.yaml
13+
- bases/multicluster.x-k8s.io_serviceimports.yaml
1214
#+kubebuilder:scaffold:crdkustomizeresource
1315

1416
patchesStrategicMerge:

‎multicluster/config/multi-cluster.yaml

+424-657
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.