Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
4e6e51dc
Commit
4e6e51dc
authored
May 02, 2016
by
jianhuiz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy ServerAddressByClientCIDR to federation types
parent
f6eefd47
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
237 additions
and
35 deletions
+237
-35
deep_copy_generated.go
federation/apis/federation/deep_copy_generated.go
+9
-2
types.generated.go
federation/apis/federation/types.generated.go
+0
-0
types.go
federation/apis/federation/types.go
+10
-1
conversion_generated.go
federation/apis/federation/v1alpha1/conversion_generated.go
+26
-7
deep_copy_generated.go
federation/apis/federation/v1alpha1/deep_copy_generated.go
+9
-2
generated.pb.go
federation/apis/federation/v1alpha1/generated.pb.go
+152
-2
generated.proto
federation/apis/federation/v1alpha1/generated.proto
+11
-1
types.generated.go
federation/apis/federation/v1alpha1/types.generated.go
+0
-0
types.go
federation/apis/federation/v1alpha1/types.go
+10
-1
validation_test.go
federation/apis/federation/validation/validation_test.go
+8
-9
etcd_test.go
federation/registry/cluster/etcd/etcd_test.go
+1
-2
strategy_test.go
federation/registry/cluster/strategy_test.go
+1
-2
deep_copy_generated.go
pkg/api/unversioned/deep_copy_generated.go
+0
-6
No files found.
federation/apis/federation/deep_copy_generated.go
View file @
4e6e51dc
...
...
@@ -35,6 +35,7 @@ func init() {
DeepCopy_federation_ClusterMeta
,
DeepCopy_federation_ClusterSpec
,
DeepCopy_federation_ClusterStatus
,
DeepCopy_federation_ServerAddressByClientCIDR
,
);
err
!=
nil
{
// if one of the deep copy functions is malformed, detect it immediately.
panic
(
err
)
...
...
@@ -100,9 +101,9 @@ func DeepCopy_federation_ClusterMeta(in ClusterMeta, out *ClusterMeta, c *conver
func
DeepCopy_federation_ClusterSpec
(
in
ClusterSpec
,
out
*
ClusterSpec
,
c
*
conversion
.
Cloner
)
error
{
if
in
.
ServerAddressByClientCIDRs
!=
nil
{
in
,
out
:=
in
.
ServerAddressByClientCIDRs
,
&
out
.
ServerAddressByClientCIDRs
*
out
=
make
([]
unversioned
.
ServerAddressByClientCIDR
,
len
(
in
))
*
out
=
make
([]
ServerAddressByClientCIDR
,
len
(
in
))
for
i
:=
range
in
{
if
err
:=
unversioned
.
DeepCopy_unversioned
_ServerAddressByClientCIDR
(
in
[
i
],
&
(
*
out
)[
i
],
c
);
err
!=
nil
{
if
err
:=
DeepCopy_federation
_ServerAddressByClientCIDR
(
in
[
i
],
&
(
*
out
)[
i
],
c
);
err
!=
nil
{
return
err
}
}
...
...
@@ -156,3 +157,9 @@ func DeepCopy_federation_ClusterStatus(in ClusterStatus, out *ClusterStatus, c *
}
return
nil
}
func
DeepCopy_federation_ServerAddressByClientCIDR
(
in
ServerAddressByClientCIDR
,
out
*
ServerAddressByClientCIDR
,
c
*
conversion
.
Cloner
)
error
{
out
.
ClientCIDR
=
in
.
ClientCIDR
out
.
ServerAddress
=
in
.
ServerAddress
return
nil
}
federation/apis/federation/types.generated.go
View file @
4e6e51dc
This diff is collapsed.
Click to expand it.
federation/apis/federation/types.go
View file @
4e6e51dc
...
...
@@ -21,13 +21,22 @@ import (
"k8s.io/kubernetes/pkg/api/unversioned"
)
// ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.
type
ServerAddressByClientCIDR
struct
{
// The CIDR with which clients can match their IP to figure out the server address that they should use.
ClientCIDR
string
`json:"clientCIDR" protobuf:"bytes,1,opt,name=clientCIDR"`
// Address of this server, suitable for a client that matches the above CIDR.
// This can be a hostname, hostname:port, IP or IP:port.
ServerAddress
string
`json:"serverAddress" protobuf:"bytes,2,opt,name=serverAddress"`
}
// ClusterSpec describes the attributes of a kubernetes cluster.
type
ClusterSpec
struct
{
// A map of client CIDR to server address.
// This is to help clients reach servers in the most network-efficient way possible.
// Clients can use the appropriate server address as per the CIDR that they match.
// In case of multiple matches, clients should use the longest matching CIDR.
ServerAddressByClientCIDRs
[]
unversioned
.
ServerAddressByClientCIDR
`json:"serverAddressByClientCIDRs" patchStrategy:"merge" patchMergeKey:"clientCIDR"`
ServerAddressByClientCIDRs
[]
ServerAddressByClientCIDR
`json:"serverAddressByClientCIDRs" patchStrategy:"merge" patchMergeKey:"clientCIDR"`
// the type (e.g. bearer token, client certificate etc) and data of the credential used to access cluster.
// It’s used for system routines (not behalf of users)
// TODO: string may not enough, https://github.com/kubernetes/kubernetes/pull/23847#discussion_r59301275
...
...
federation/apis/federation/v1alpha1/conversion_generated.go
View file @
4e6e51dc
...
...
@@ -24,7 +24,6 @@ import (
federation
"k8s.io/kubernetes/federation/apis/federation"
api
"k8s.io/kubernetes/pkg/api"
resource
"k8s.io/kubernetes/pkg/api/resource"
unversioned
"k8s.io/kubernetes/pkg/api/unversioned"
v1
"k8s.io/kubernetes/pkg/api/v1"
conversion
"k8s.io/kubernetes/pkg/conversion"
)
...
...
@@ -43,6 +42,8 @@ func init() {
Convert_federation_ClusterSpec_To_v1alpha1_ClusterSpec
,
Convert_v1alpha1_ClusterStatus_To_federation_ClusterStatus
,
Convert_federation_ClusterStatus_To_v1alpha1_ClusterStatus
,
Convert_v1alpha1_ServerAddressByClientCIDR_To_federation_ServerAddressByClientCIDR
,
Convert_federation_ServerAddressByClientCIDR_To_v1alpha1_ServerAddressByClientCIDR
,
);
err
!=
nil
{
// if one of the conversion functions is malformed, detect it immediately.
panic
(
err
)
...
...
@@ -198,10 +199,9 @@ func Convert_federation_ClusterMeta_To_v1alpha1_ClusterMeta(in *federation.Clust
func
autoConvert_v1alpha1_ClusterSpec_To_federation_ClusterSpec
(
in
*
ClusterSpec
,
out
*
federation
.
ClusterSpec
,
s
conversion
.
Scope
)
error
{
if
in
.
ServerAddressByClientCIDRs
!=
nil
{
in
,
out
:=
&
in
.
ServerAddressByClientCIDRs
,
&
out
.
ServerAddressByClientCIDRs
*
out
=
make
([]
unversioned
.
ServerAddressByClientCIDR
,
len
(
*
in
))
*
out
=
make
([]
federation
.
ServerAddressByClientCIDR
,
len
(
*
in
))
for
i
:=
range
*
in
{
// TODO: Inefficient conversion - can we improve it?
if
err
:=
s
.
Convert
(
&
(
*
in
)[
i
],
&
(
*
out
)[
i
],
0
);
err
!=
nil
{
if
err
:=
Convert_v1alpha1_ServerAddressByClientCIDR_To_federation_ServerAddressByClientCIDR
(
&
(
*
in
)[
i
],
&
(
*
out
)[
i
],
s
);
err
!=
nil
{
return
err
}
}
...
...
@@ -219,10 +219,9 @@ func Convert_v1alpha1_ClusterSpec_To_federation_ClusterSpec(in *ClusterSpec, out
func
autoConvert_federation_ClusterSpec_To_v1alpha1_ClusterSpec
(
in
*
federation
.
ClusterSpec
,
out
*
ClusterSpec
,
s
conversion
.
Scope
)
error
{
if
in
.
ServerAddressByClientCIDRs
!=
nil
{
in
,
out
:=
&
in
.
ServerAddressByClientCIDRs
,
&
out
.
ServerAddressByClientCIDRs
*
out
=
make
([]
unversioned
.
ServerAddressByClientCIDR
,
len
(
*
in
))
*
out
=
make
([]
ServerAddressByClientCIDR
,
len
(
*
in
))
for
i
:=
range
*
in
{
// TODO: Inefficient conversion - can we improve it?
if
err
:=
s
.
Convert
(
&
(
*
in
)[
i
],
&
(
*
out
)[
i
],
0
);
err
!=
nil
{
if
err
:=
Convert_federation_ServerAddressByClientCIDR_To_v1alpha1_ServerAddressByClientCIDR
(
&
(
*
in
)[
i
],
&
(
*
out
)[
i
],
s
);
err
!=
nil
{
return
err
}
}
...
...
@@ -312,3 +311,23 @@ func autoConvert_federation_ClusterStatus_To_v1alpha1_ClusterStatus(in *federati
func
Convert_federation_ClusterStatus_To_v1alpha1_ClusterStatus
(
in
*
federation
.
ClusterStatus
,
out
*
ClusterStatus
,
s
conversion
.
Scope
)
error
{
return
autoConvert_federation_ClusterStatus_To_v1alpha1_ClusterStatus
(
in
,
out
,
s
)
}
func
autoConvert_v1alpha1_ServerAddressByClientCIDR_To_federation_ServerAddressByClientCIDR
(
in
*
ServerAddressByClientCIDR
,
out
*
federation
.
ServerAddressByClientCIDR
,
s
conversion
.
Scope
)
error
{
out
.
ClientCIDR
=
in
.
ClientCIDR
out
.
ServerAddress
=
in
.
ServerAddress
return
nil
}
func
Convert_v1alpha1_ServerAddressByClientCIDR_To_federation_ServerAddressByClientCIDR
(
in
*
ServerAddressByClientCIDR
,
out
*
federation
.
ServerAddressByClientCIDR
,
s
conversion
.
Scope
)
error
{
return
autoConvert_v1alpha1_ServerAddressByClientCIDR_To_federation_ServerAddressByClientCIDR
(
in
,
out
,
s
)
}
func
autoConvert_federation_ServerAddressByClientCIDR_To_v1alpha1_ServerAddressByClientCIDR
(
in
*
federation
.
ServerAddressByClientCIDR
,
out
*
ServerAddressByClientCIDR
,
s
conversion
.
Scope
)
error
{
out
.
ClientCIDR
=
in
.
ClientCIDR
out
.
ServerAddress
=
in
.
ServerAddress
return
nil
}
func
Convert_federation_ServerAddressByClientCIDR_To_v1alpha1_ServerAddressByClientCIDR
(
in
*
federation
.
ServerAddressByClientCIDR
,
out
*
ServerAddressByClientCIDR
,
s
conversion
.
Scope
)
error
{
return
autoConvert_federation_ServerAddressByClientCIDR_To_v1alpha1_ServerAddressByClientCIDR
(
in
,
out
,
s
)
}
federation/apis/federation/v1alpha1/deep_copy_generated.go
View file @
4e6e51dc
...
...
@@ -36,6 +36,7 @@ func init() {
DeepCopy_v1alpha1_ClusterMeta
,
DeepCopy_v1alpha1_ClusterSpec
,
DeepCopy_v1alpha1_ClusterStatus
,
DeepCopy_v1alpha1_ServerAddressByClientCIDR
,
);
err
!=
nil
{
// if one of the deep copy functions is malformed, detect it immediately.
panic
(
err
)
...
...
@@ -101,9 +102,9 @@ func DeepCopy_v1alpha1_ClusterMeta(in ClusterMeta, out *ClusterMeta, c *conversi
func
DeepCopy_v1alpha1_ClusterSpec
(
in
ClusterSpec
,
out
*
ClusterSpec
,
c
*
conversion
.
Cloner
)
error
{
if
in
.
ServerAddressByClientCIDRs
!=
nil
{
in
,
out
:=
in
.
ServerAddressByClientCIDRs
,
&
out
.
ServerAddressByClientCIDRs
*
out
=
make
([]
unversioned
.
ServerAddressByClientCIDR
,
len
(
in
))
*
out
=
make
([]
ServerAddressByClientCIDR
,
len
(
in
))
for
i
:=
range
in
{
if
err
:=
unversioned
.
DeepCopy_unversioned
_ServerAddressByClientCIDR
(
in
[
i
],
&
(
*
out
)[
i
],
c
);
err
!=
nil
{
if
err
:=
DeepCopy_v1alpha1
_ServerAddressByClientCIDR
(
in
[
i
],
&
(
*
out
)[
i
],
c
);
err
!=
nil
{
return
err
}
}
...
...
@@ -157,3 +158,9 @@ func DeepCopy_v1alpha1_ClusterStatus(in ClusterStatus, out *ClusterStatus, c *co
}
return
nil
}
func
DeepCopy_v1alpha1_ServerAddressByClientCIDR
(
in
ServerAddressByClientCIDR
,
out
*
ServerAddressByClientCIDR
,
c
*
conversion
.
Cloner
)
error
{
out
.
ClientCIDR
=
in
.
ClientCIDR
out
.
ServerAddress
=
in
.
ServerAddress
return
nil
}
federation/apis/federation/v1alpha1/generated.pb.go
View file @
4e6e51dc
...
...
@@ -31,6 +31,7 @@ limitations under the License.
ClusterMeta
ClusterSpec
ClusterStatus
ServerAddressByClientCIDR
*/
package
v1alpha1
...
...
@@ -39,7 +40,7 @@ import fmt "fmt"
import
math
"math"
import
k8s_io_kubernetes_pkg_api_resource
"k8s.io/kubernetes/pkg/api/resource"
import
k8s_io_kubernetes_pkg_api_unversioned
"k8s.io/kubernetes/pkg/api/unversioned"
import
k8s_io_kubernetes_pkg_api_v1
"k8s.io/kubernetes/pkg/api/v1"
import
io
"io"
...
...
@@ -73,6 +74,10 @@ func (m *ClusterStatus) Reset() { *m = ClusterStatus{} }
func
(
m
*
ClusterStatus
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ClusterStatus
)
ProtoMessage
()
{}
func
(
m
*
ServerAddressByClientCIDR
)
Reset
()
{
*
m
=
ServerAddressByClientCIDR
{}
}
func
(
m
*
ServerAddressByClientCIDR
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ServerAddressByClientCIDR
)
ProtoMessage
()
{}
func
init
()
{
proto
.
RegisterType
((
*
Cluster
)(
nil
),
"k8s.io.kubernetes.federation.apis.federation.v1alpha1.Cluster"
)
proto
.
RegisterType
((
*
ClusterCondition
)(
nil
),
"k8s.io.kubernetes.federation.apis.federation.v1alpha1.ClusterCondition"
)
...
...
@@ -80,6 +85,7 @@ func init() {
proto
.
RegisterType
((
*
ClusterMeta
)(
nil
),
"k8s.io.kubernetes.federation.apis.federation.v1alpha1.ClusterMeta"
)
proto
.
RegisterType
((
*
ClusterSpec
)(
nil
),
"k8s.io.kubernetes.federation.apis.federation.v1alpha1.ClusterSpec"
)
proto
.
RegisterType
((
*
ClusterStatus
)(
nil
),
"k8s.io.kubernetes.federation.apis.federation.v1alpha1.ClusterStatus"
)
proto
.
RegisterType
((
*
ServerAddressByClientCIDR
)(
nil
),
"k8s.io.kubernetes.federation.apis.federation.v1alpha1.ServerAddressByClientCIDR"
)
}
func
(
m
*
Cluster
)
Marshal
()
(
data
[]
byte
,
err
error
)
{
size
:=
m
.
Size
()
...
...
@@ -349,6 +355,32 @@ func (m *ClusterStatus) MarshalTo(data []byte) (int, error) {
return
i
,
nil
}
func
(
m
*
ServerAddressByClientCIDR
)
Marshal
()
(
data
[]
byte
,
err
error
)
{
size
:=
m
.
Size
()
data
=
make
([]
byte
,
size
)
n
,
err
:=
m
.
MarshalTo
(
data
)
if
err
!=
nil
{
return
nil
,
err
}
return
data
[
:
n
],
nil
}
func
(
m
*
ServerAddressByClientCIDR
)
MarshalTo
(
data
[]
byte
)
(
int
,
error
)
{
var
i
int
_
=
i
var
l
int
_
=
l
data
[
i
]
=
0xa
i
++
i
=
encodeVarintGenerated
(
data
,
i
,
uint64
(
len
(
m
.
ClientCIDR
)))
i
+=
copy
(
data
[
i
:
],
m
.
ClientCIDR
)
data
[
i
]
=
0x12
i
++
i
=
encodeVarintGenerated
(
data
,
i
,
uint64
(
len
(
m
.
ServerAddress
)))
i
+=
copy
(
data
[
i
:
],
m
.
ServerAddress
)
return
i
,
nil
}
func
encodeFixed64Generated
(
data
[]
byte
,
offset
int
,
v
uint64
)
int
{
data
[
offset
]
=
uint8
(
v
)
data
[
offset
+
1
]
=
uint8
(
v
>>
8
)
...
...
@@ -474,6 +506,16 @@ func (m *ClusterStatus) Size() (n int) {
return
n
}
func
(
m
*
ServerAddressByClientCIDR
)
Size
()
(
n
int
)
{
var
l
int
_
=
l
l
=
len
(
m
.
ClientCIDR
)
n
+=
1
+
l
+
sovGenerated
(
uint64
(
l
))
l
=
len
(
m
.
ServerAddress
)
n
+=
1
+
l
+
sovGenerated
(
uint64
(
l
))
return
n
}
func
sovGenerated
(
x
uint64
)
(
n
int
)
{
for
{
n
++
...
...
@@ -1098,7 +1140,7 @@ func (m *ClusterSpec) Unmarshal(data []byte) error {
if
postIndex
>
l
{
return
io
.
ErrUnexpectedEOF
}
m
.
ServerAddressByClientCIDRs
=
append
(
m
.
ServerAddressByClientCIDRs
,
k8s_io_kubernetes_pkg_api_unversioned
.
ServerAddressByClientCIDR
{})
m
.
ServerAddressByClientCIDRs
=
append
(
m
.
ServerAddressByClientCIDRs
,
ServerAddressByClientCIDR
{})
if
err
:=
m
.
ServerAddressByClientCIDRs
[
len
(
m
.
ServerAddressByClientCIDRs
)
-
1
]
.
Unmarshal
(
data
[
iNdEx
:
postIndex
]);
err
!=
nil
{
return
err
}
...
...
@@ -1496,6 +1538,114 @@ func (m *ClusterStatus) Unmarshal(data []byte) error {
}
return
nil
}
func
(
m
*
ServerAddressByClientCIDR
)
Unmarshal
(
data
[]
byte
)
error
{
l
:=
len
(
data
)
iNdEx
:=
0
for
iNdEx
<
l
{
preIndex
:=
iNdEx
var
wire
uint64
for
shift
:=
uint
(
0
);
;
shift
+=
7
{
if
shift
>=
64
{
return
ErrIntOverflowGenerated
}
if
iNdEx
>=
l
{
return
io
.
ErrUnexpectedEOF
}
b
:=
data
[
iNdEx
]
iNdEx
++
wire
|=
(
uint64
(
b
)
&
0x7F
)
<<
shift
if
b
<
0x80
{
break
}
}
fieldNum
:=
int32
(
wire
>>
3
)
wireType
:=
int
(
wire
&
0x7
)
if
wireType
==
4
{
return
fmt
.
Errorf
(
"proto: ServerAddressByClientCIDR: wiretype end group for non-group"
)
}
if
fieldNum
<=
0
{
return
fmt
.
Errorf
(
"proto: ServerAddressByClientCIDR: illegal tag %d (wire type %d)"
,
fieldNum
,
wire
)
}
switch
fieldNum
{
case
1
:
if
wireType
!=
2
{
return
fmt
.
Errorf
(
"proto: wrong wireType = %d for field ClientCIDR"
,
wireType
)
}
var
stringLen
uint64
for
shift
:=
uint
(
0
);
;
shift
+=
7
{
if
shift
>=
64
{
return
ErrIntOverflowGenerated
}
if
iNdEx
>=
l
{
return
io
.
ErrUnexpectedEOF
}
b
:=
data
[
iNdEx
]
iNdEx
++
stringLen
|=
(
uint64
(
b
)
&
0x7F
)
<<
shift
if
b
<
0x80
{
break
}
}
intStringLen
:=
int
(
stringLen
)
if
intStringLen
<
0
{
return
ErrInvalidLengthGenerated
}
postIndex
:=
iNdEx
+
intStringLen
if
postIndex
>
l
{
return
io
.
ErrUnexpectedEOF
}
m
.
ClientCIDR
=
string
(
data
[
iNdEx
:
postIndex
])
iNdEx
=
postIndex
case
2
:
if
wireType
!=
2
{
return
fmt
.
Errorf
(
"proto: wrong wireType = %d for field ServerAddress"
,
wireType
)
}
var
stringLen
uint64
for
shift
:=
uint
(
0
);
;
shift
+=
7
{
if
shift
>=
64
{
return
ErrIntOverflowGenerated
}
if
iNdEx
>=
l
{
return
io
.
ErrUnexpectedEOF
}
b
:=
data
[
iNdEx
]
iNdEx
++
stringLen
|=
(
uint64
(
b
)
&
0x7F
)
<<
shift
if
b
<
0x80
{
break
}
}
intStringLen
:=
int
(
stringLen
)
if
intStringLen
<
0
{
return
ErrInvalidLengthGenerated
}
postIndex
:=
iNdEx
+
intStringLen
if
postIndex
>
l
{
return
io
.
ErrUnexpectedEOF
}
m
.
ServerAddress
=
string
(
data
[
iNdEx
:
postIndex
])
iNdEx
=
postIndex
default
:
iNdEx
=
preIndex
skippy
,
err
:=
skipGenerated
(
data
[
iNdEx
:
])
if
err
!=
nil
{
return
err
}
if
skippy
<
0
{
return
ErrInvalidLengthGenerated
}
if
(
iNdEx
+
skippy
)
>
l
{
return
io
.
ErrUnexpectedEOF
}
iNdEx
+=
skippy
}
}
if
iNdEx
>
l
{
return
io
.
ErrUnexpectedEOF
}
return
nil
}
func
skipGenerated
(
data
[]
byte
)
(
n
int
,
err
error
)
{
l
:=
len
(
data
)
iNdEx
:=
0
...
...
federation/apis/federation/v1alpha1/generated.proto
View file @
4e6e51dc
...
...
@@ -85,7 +85,7 @@ message ClusterSpec {
// This is to help clients reach servers in the most network-efficient way possible.
// Clients can use the appropriate server address as per the CIDR that they match.
// In case of multiple matches, clients should use the longest matching CIDR.
repeated
k8s.io.kubernetes.pkg.api.unversioned.
ServerAddressByClientCIDR
serverAddressByClientCIDRs
=
1
;
repeated
ServerAddressByClientCIDR
serverAddressByClientCIDRs
=
1
;
// the type (e.g. bearer token, client certificate etc) and data of the credential used to access cluster.
// It’s used for system routines (not behalf of users)
...
...
@@ -107,3 +107,13 @@ message ClusterStatus {
optional
ClusterMeta
clusterMeta
=
4
;
}
// ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.
message
ServerAddressByClientCIDR
{
// The CIDR with which clients can match their IP to figure out the server address that they should use.
optional
string
clientCIDR
=
1
;
// Address of this server, suitable for a client that matches the above CIDR.
// This can be a hostname, hostname:port, IP or IP:port.
optional
string
serverAddress
=
2
;
}
federation/apis/federation/v1alpha1/types.generated.go
View file @
4e6e51dc
This diff is collapsed.
Click to expand it.
federation/apis/federation/v1alpha1/types.go
View file @
4e6e51dc
...
...
@@ -21,13 +21,22 @@ import (
"k8s.io/kubernetes/pkg/api/v1"
)
// ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.
type
ServerAddressByClientCIDR
struct
{
// The CIDR with which clients can match their IP to figure out the server address that they should use.
ClientCIDR
string
`json:"clientCIDR" protobuf:"bytes,1,opt,name=clientCIDR"`
// Address of this server, suitable for a client that matches the above CIDR.
// This can be a hostname, hostname:port, IP or IP:port.
ServerAddress
string
`json:"serverAddress" protobuf:"bytes,2,opt,name=serverAddress"`
}
// ClusterSpec describes the attributes of a kubernetes cluster.
type
ClusterSpec
struct
{
// A map of client CIDR to server address.
// This is to help clients reach servers in the most network-efficient way possible.
// Clients can use the appropriate server address as per the CIDR that they match.
// In case of multiple matches, clients should use the longest matching CIDR.
ServerAddressByClientCIDRs
[]
unversioned
.
ServerAddressByClientCIDR
`json:"serverAddressByClientCIDRs" patchStrategy:"merge" patchMergeKey:"clientCIDR" protobuf:"bytes,1,rep,name=serverAddressByClientCIDRs"`
ServerAddressByClientCIDRs
[]
ServerAddressByClientCIDR
`json:"serverAddressByClientCIDRs" patchStrategy:"merge" patchMergeKey:"clientCIDR" protobuf:"bytes,1,rep,name=serverAddressByClientCIDRs"`
// the type (e.g. bearer token, client certificate etc) and data of the credential used to access cluster.
// It’s used for system routines (not behalf of users)
// TODO: string may not enough, https://github.com/kubernetes/kubernetes/pull/23847#discussion_r59301275
...
...
federation/apis/federation/validation/validation_test.go
View file @
4e6e51dc
...
...
@@ -21,7 +21,6 @@ import (
"k8s.io/kubernetes/federation/apis/federation"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
)
func
TestValidateCluster
(
t
*
testing
.
T
)
{
...
...
@@ -29,7 +28,7 @@ func TestValidateCluster(t *testing.T) {
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"cluster-s"
},
Spec
:
federation
.
ClusterSpec
{
ServerAddressByClientCIDRs
:
[]
unversioned
.
ServerAddressByClientCIDR
{
ServerAddressByClientCIDRs
:
[]
federation
.
ServerAddressByClientCIDR
{
{
ClientCIDR
:
"0.0.0.0/0"
,
ServerAddress
:
"localhost:8888"
,
...
...
@@ -52,7 +51,7 @@ func TestValidateCluster(t *testing.T) {
"empty cluster addresses"
:
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"cluster-f"
},
Spec
:
federation
.
ClusterSpec
{
ServerAddressByClientCIDRs
:
[]
unversioned
.
ServerAddressByClientCIDR
{},
ServerAddressByClientCIDRs
:
[]
federation
.
ServerAddressByClientCIDR
{},
}},
"invalid_label"
:
{
ObjectMeta
:
api
.
ObjectMeta
{
...
...
@@ -81,7 +80,7 @@ func TestValidateClusterUpdate(t *testing.T) {
old
:
federation
.
Cluster
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"cluster-s"
},
Spec
:
federation
.
ClusterSpec
{
ServerAddressByClientCIDRs
:
[]
unversioned
.
ServerAddressByClientCIDR
{
ServerAddressByClientCIDRs
:
[]
federation
.
ServerAddressByClientCIDR
{
{
ClientCIDR
:
"0.0.0.0/0"
,
ServerAddress
:
"localhost:8888"
,
...
...
@@ -92,7 +91,7 @@ func TestValidateClusterUpdate(t *testing.T) {
update
:
federation
.
Cluster
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"cluster-s"
},
Spec
:
federation
.
ClusterSpec
{
ServerAddressByClientCIDRs
:
[]
unversioned
.
ServerAddressByClientCIDR
{
ServerAddressByClientCIDRs
:
[]
federation
.
ServerAddressByClientCIDR
{
{
ClientCIDR
:
"0.0.0.0/0"
,
ServerAddress
:
"localhost:8888"
,
...
...
@@ -116,7 +115,7 @@ func TestValidateClusterUpdate(t *testing.T) {
old
:
federation
.
Cluster
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"cluster-s"
},
Spec
:
federation
.
ClusterSpec
{
ServerAddressByClientCIDRs
:
[]
unversioned
.
ServerAddressByClientCIDR
{
ServerAddressByClientCIDRs
:
[]
federation
.
ServerAddressByClientCIDR
{
{
ClientCIDR
:
"0.0.0.0/0"
,
ServerAddress
:
"localhost:8888"
,
...
...
@@ -127,7 +126,7 @@ func TestValidateClusterUpdate(t *testing.T) {
update
:
federation
.
Cluster
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"cluster-newname"
},
Spec
:
federation
.
ClusterSpec
{
ServerAddressByClientCIDRs
:
[]
unversioned
.
ServerAddressByClientCIDR
{
ServerAddressByClientCIDRs
:
[]
federation
.
ServerAddressByClientCIDR
{
{
ClientCIDR
:
"0.0.0.0/0"
,
ServerAddress
:
"localhost:8888"
,
...
...
@@ -155,7 +154,7 @@ func TestValidateClusterStatusUpdate(t *testing.T) {
old
:
federation
.
Cluster
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"cluster-s"
},
Spec
:
federation
.
ClusterSpec
{
ServerAddressByClientCIDRs
:
[]
unversioned
.
ServerAddressByClientCIDR
{
ServerAddressByClientCIDRs
:
[]
federation
.
ServerAddressByClientCIDR
{
{
ClientCIDR
:
"0.0.0.0/0"
,
ServerAddress
:
"localhost:8888"
,
...
...
@@ -171,7 +170,7 @@ func TestValidateClusterStatusUpdate(t *testing.T) {
update
:
federation
.
Cluster
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"cluster-s"
},
Spec
:
federation
.
ClusterSpec
{
ServerAddressByClientCIDRs
:
[]
unversioned
.
ServerAddressByClientCIDR
{
ServerAddressByClientCIDRs
:
[]
federation
.
ServerAddressByClientCIDR
{
{
ClientCIDR
:
"0.0.0.0/0"
,
ServerAddress
:
"localhost:8888"
,
...
...
federation/registry/cluster/etcd/etcd_test.go
View file @
4e6e51dc
...
...
@@ -21,7 +21,6 @@ import (
"k8s.io/kubernetes/federation/apis/federation"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/generic"
...
...
@@ -49,7 +48,7 @@ func validNewCluster() *federation.Cluster {
},
},
Spec
:
federation
.
ClusterSpec
{
ServerAddressByClientCIDRs
:
[]
unversioned
.
ServerAddressByClientCIDR
{
ServerAddressByClientCIDRs
:
[]
federation
.
ServerAddressByClientCIDR
{
{
ClientCIDR
:
"0.0.0.0/0"
,
ServerAddress
:
"localhost:8888"
,
...
...
federation/registry/cluster/strategy_test.go
View file @
4e6e51dc
...
...
@@ -23,7 +23,6 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
apitesting
"k8s.io/kubernetes/pkg/api/testing"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"reflect"
...
...
@@ -39,7 +38,7 @@ func validNewCluster() *federation.Cluster {
},
},
Spec
:
federation
.
ClusterSpec
{
ServerAddressByClientCIDRs
:
[]
unversioned
.
ServerAddressByClientCIDR
{
ServerAddressByClientCIDRs
:
[]
federation
.
ServerAddressByClientCIDR
{
{
ClientCIDR
:
"0.0.0.0/0"
,
ServerAddress
:
"localhost:8888"
,
...
...
pkg/api/unversioned/deep_copy_generated.go
View file @
4e6e51dc
...
...
@@ -105,12 +105,6 @@ func DeepCopy_unversioned_ListMeta(in ListMeta, out *ListMeta, c *conversion.Clo
return
nil
}
func
DeepCopy_unversioned_ServerAddressByClientCIDR
(
in
ServerAddressByClientCIDR
,
out
*
ServerAddressByClientCIDR
,
c
*
conversion
.
Cloner
)
error
{
out
.
ClientCIDR
=
in
.
ClientCIDR
out
.
ServerAddress
=
in
.
ServerAddress
return
nil
}
func
DeepCopy_unversioned_Time
(
in
Time
,
out
*
Time
,
c
*
conversion
.
Cloner
)
error
{
if
newVal
,
err
:=
c
.
DeepCopy
(
in
.
Time
);
err
!=
nil
{
return
err
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment