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
589f58ca
Commit
589f58ca
authored
Dec 22, 2016
by
Bowei Du
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove HostRecord annotation (beta feature)
The annotation has made it to GA so this code should be deleted.
parent
a8b168a7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
0 additions
and
79 deletions
+0
-79
util.go
pkg/api/endpoints/util.go
+0
-12
util.go
pkg/api/v1/endpoints/util.go
+0
-12
BUILD
pkg/api/validation/BUILD
+0
-1
validation.go
pkg/api/validation/validation.go
+0
-30
endpoints_controller.go
pkg/controller/endpoint/endpoints_controller.go
+0
-24
No files found.
pkg/api/endpoints/util.go
View file @
589f58ca
...
@@ -28,18 +28,6 @@ import (
...
@@ -28,18 +28,6 @@ import (
hashutil
"k8s.io/kubernetes/pkg/util/hash"
hashutil
"k8s.io/kubernetes/pkg/util/hash"
)
)
const
(
// TODO: to be deleted after v1.3 is released
// Its value is the json representation of map[string(IP)][HostRecord]
// example: '{"10.245.1.6":{"HostName":"my-webserver"}}'
PodHostnamesAnnotation
=
"endpoints.beta.kubernetes.io/hostnames-map"
)
// TODO: to be deleted after v1.3 is released
type
HostRecord
struct
{
HostName
string
}
// RepackSubsets takes a slice of EndpointSubset objects, expands it to the full
// RepackSubsets takes a slice of EndpointSubset objects, expands it to the full
// representation, and then repacks that into the canonical layout. This
// representation, and then repacks that into the canonical layout. This
// ensures that code which operates on these objects can rely on the common
// ensures that code which operates on these objects can rely on the common
...
...
pkg/api/v1/endpoints/util.go
View file @
589f58ca
...
@@ -28,18 +28,6 @@ import (
...
@@ -28,18 +28,6 @@ import (
hashutil
"k8s.io/kubernetes/pkg/util/hash"
hashutil
"k8s.io/kubernetes/pkg/util/hash"
)
)
const
(
// TODO: to be deleted after v1.3 is released
// Its value is the json representation of map[string(IP)][HostRecord]
// example: '{"10.245.1.6":{"HostName":"my-webserver"}}'
PodHostnamesAnnotation
=
"endpoints.beta.kubernetes.io/hostnames-map"
)
// TODO: to be deleted after v1.3 is released
type
HostRecord
struct
{
HostName
string
}
// RepackSubsets takes a slice of EndpointSubset objects, expands it to the full
// RepackSubsets takes a slice of EndpointSubset objects, expands it to the full
// representation, and then repacks that into the canonical layout. This
// representation, and then repacks that into the canonical layout. This
// ensures that code which operates on these objects can rely on the common
// ensures that code which operates on these objects can rely on the common
...
...
pkg/api/validation/BUILD
View file @
589f58ca
...
@@ -19,7 +19,6 @@ go_library(
...
@@ -19,7 +19,6 @@ go_library(
tags = ["automanaged"],
tags = ["automanaged"],
deps = [
deps = [
"//pkg/api:go_default_library",
"//pkg/api:go_default_library",
"//pkg/api/endpoints:go_default_library",
"//pkg/api/meta:go_default_library",
"//pkg/api/meta:go_default_library",
"//pkg/api/pod:go_default_library",
"//pkg/api/pod:go_default_library",
"//pkg/api/resource:go_default_library",
"//pkg/api/resource:go_default_library",
...
...
pkg/api/validation/validation.go
View file @
589f58ca
...
@@ -28,7 +28,6 @@ import (
...
@@ -28,7 +28,6 @@ import (
"github.com/golang/glog"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/endpoints"
utilpod
"k8s.io/kubernetes/pkg/api/pod"
utilpod
"k8s.io/kubernetes/pkg/api/pod"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/resource"
apiservice
"k8s.io/kubernetes/pkg/api/service"
apiservice
"k8s.io/kubernetes/pkg/api/service"
...
@@ -183,13 +182,6 @@ func ValidatePodSpecificAnnotationUpdates(newPod, oldPod *api.Pod, fldPath *fiel
...
@@ -183,13 +182,6 @@ func ValidatePodSpecificAnnotationUpdates(newPod, oldPod *api.Pod, fldPath *fiel
func
ValidateEndpointsSpecificAnnotations
(
annotations
map
[
string
]
string
,
fldPath
*
field
.
Path
)
field
.
ErrorList
{
func
ValidateEndpointsSpecificAnnotations
(
annotations
map
[
string
]
string
,
fldPath
*
field
.
Path
)
field
.
ErrorList
{
allErrs
:=
field
.
ErrorList
{}
allErrs
:=
field
.
ErrorList
{}
// TODO: remove this after we EOL the annotation.
hostnamesMap
,
exists
:=
annotations
[
endpoints
.
PodHostnamesAnnotation
]
if
exists
&&
!
isValidHostnamesMap
(
hostnamesMap
)
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
endpoints
.
PodHostnamesAnnotation
,
`must be a valid json representation of map[string(IP)][HostRecord] e.g. "{"10.245.1.6":{"HostName":"my-webserver"}}"`
))
}
return
allErrs
return
allErrs
}
}
...
@@ -3725,28 +3717,6 @@ func ValidateLoadBalancerStatus(status *api.LoadBalancerStatus, fldPath *field.P
...
@@ -3725,28 +3717,6 @@ func ValidateLoadBalancerStatus(status *api.LoadBalancerStatus, fldPath *field.P
return
allErrs
return
allErrs
}
}
// TODO: remove this after we EOL the annotation that carries it.
func
isValidHostnamesMap
(
serializedPodHostNames
string
)
bool
{
if
len
(
serializedPodHostNames
)
==
0
{
return
false
}
podHostNames
:=
map
[
string
]
endpoints
.
HostRecord
{}
err
:=
json
.
Unmarshal
([]
byte
(
serializedPodHostNames
),
&
podHostNames
)
if
err
!=
nil
{
return
false
}
for
ip
,
hostRecord
:=
range
podHostNames
{
if
len
(
validation
.
IsDNS1123Label
(
hostRecord
.
HostName
))
!=
0
{
return
false
}
if
net
.
ParseIP
(
ip
)
==
nil
{
return
false
}
}
return
true
}
func
sysctlIntersection
(
a
[]
api
.
Sysctl
,
b
[]
api
.
Sysctl
)
[]
string
{
func
sysctlIntersection
(
a
[]
api
.
Sysctl
,
b
[]
api
.
Sysctl
)
[]
string
{
lookup
:=
make
(
map
[
string
]
struct
{},
len
(
a
))
lookup
:=
make
(
map
[
string
]
struct
{},
len
(
a
))
result
:=
[]
string
{}
result
:=
[]
string
{}
...
...
pkg/controller/endpoint/endpoints_controller.go
View file @
589f58ca
...
@@ -22,8 +22,6 @@ import (
...
@@ -22,8 +22,6 @@ import (
"strconv"
"strconv"
"time"
"time"
"encoding/json"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/api/v1/endpoints"
"k8s.io/kubernetes/pkg/api/v1/endpoints"
...
@@ -371,7 +369,6 @@ func (e *EndpointController) syncService(key string) error {
...
@@ -371,7 +369,6 @@ func (e *EndpointController) syncService(key string) error {
}
}
subsets
:=
[]
v1
.
EndpointSubset
{}
subsets
:=
[]
v1
.
EndpointSubset
{}
podHostNames
:=
map
[
string
]
endpoints
.
HostRecord
{}
var
tolerateUnreadyEndpoints
bool
var
tolerateUnreadyEndpoints
bool
if
v
,
ok
:=
service
.
Annotations
[
TolerateUnreadyEndpointsAnnotation
];
ok
{
if
v
,
ok
:=
service
.
Annotations
[
TolerateUnreadyEndpointsAnnotation
];
ok
{
...
@@ -424,11 +421,6 @@ func (e *EndpointController) syncService(key string) error {
...
@@ -424,11 +421,6 @@ func (e *EndpointController) syncService(key string) error {
if
len
(
hostname
)
>
0
&&
if
len
(
hostname
)
>
0
&&
getSubdomain
(
pod
)
==
service
.
Name
&&
getSubdomain
(
pod
)
==
service
.
Name
&&
service
.
Namespace
==
pod
.
Namespace
{
service
.
Namespace
==
pod
.
Namespace
{
hostRecord
:=
endpoints
.
HostRecord
{
HostName
:
hostname
,
}
// TODO: stop populating podHostNames annotation in 1.4
podHostNames
[
string
(
pod
.
Status
.
PodIP
)]
=
hostRecord
epa
.
Hostname
=
hostname
epa
.
Hostname
=
hostname
}
}
...
@@ -465,17 +457,6 @@ func (e *EndpointController) syncService(key string) error {
...
@@ -465,17 +457,6 @@ func (e *EndpointController) syncService(key string) error {
}
}
}
}
serializedPodHostNames
:=
""
if
len
(
podHostNames
)
>
0
{
b
,
err
:=
json
.
Marshal
(
podHostNames
)
if
err
!=
nil
{
return
err
}
serializedPodHostNames
=
string
(
b
)
}
newAnnotations
:=
make
(
map
[
string
]
string
)
newAnnotations
[
endpoints
.
PodHostnamesAnnotation
]
=
serializedPodHostNames
if
reflect
.
DeepEqual
(
currentEndpoints
.
Subsets
,
subsets
)
&&
if
reflect
.
DeepEqual
(
currentEndpoints
.
Subsets
,
subsets
)
&&
reflect
.
DeepEqual
(
currentEndpoints
.
Labels
,
service
.
Labels
)
{
reflect
.
DeepEqual
(
currentEndpoints
.
Labels
,
service
.
Labels
)
{
glog
.
V
(
5
)
.
Infof
(
"endpoints are equal for %s/%s, skipping update"
,
service
.
Namespace
,
service
.
Name
)
glog
.
V
(
5
)
.
Infof
(
"endpoints are equal for %s/%s, skipping update"
,
service
.
Namespace
,
service
.
Name
)
...
@@ -487,11 +468,6 @@ func (e *EndpointController) syncService(key string) error {
...
@@ -487,11 +468,6 @@ func (e *EndpointController) syncService(key string) error {
if
newEndpoints
.
Annotations
==
nil
{
if
newEndpoints
.
Annotations
==
nil
{
newEndpoints
.
Annotations
=
make
(
map
[
string
]
string
)
newEndpoints
.
Annotations
=
make
(
map
[
string
]
string
)
}
}
if
len
(
serializedPodHostNames
)
==
0
{
delete
(
newEndpoints
.
Annotations
,
endpoints
.
PodHostnamesAnnotation
)
}
else
{
newEndpoints
.
Annotations
[
endpoints
.
PodHostnamesAnnotation
]
=
serializedPodHostNames
}
glog
.
V
(
4
)
.
Infof
(
"Update endpoints for %v/%v, ready: %d not ready: %d"
,
service
.
Namespace
,
service
.
Name
,
readyEps
,
notReadyEps
)
glog
.
V
(
4
)
.
Infof
(
"Update endpoints for %v/%v, ready: %d not ready: %d"
,
service
.
Namespace
,
service
.
Name
,
readyEps
,
notReadyEps
)
createEndpoints
:=
len
(
currentEndpoints
.
ResourceVersion
)
==
0
createEndpoints
:=
len
(
currentEndpoints
.
ResourceVersion
)
==
0
...
...
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