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
609cdfd2
Commit
609cdfd2
authored
Jan 09, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19331 from resouer/hash-util
Auto commit by PR queue bot
parents
13f3e137
2a529769
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
13 deletions
+13
-13
util.go
pkg/api/endpoints/util.go
+3
-3
common.go
pkg/kubelet/config/common.go
+2
-2
helpers.go
pkg/kubelet/container/helpers.go
+2
-2
docker_test.go
pkg/kubelet/dockertools/docker_test.go
+2
-2
deployment.go
pkg/util/deployment/deployment.go
+2
-2
hash.go
pkg/util/hash/hash.go
+1
-1
hash_test.go
pkg/util/hash/hash_test.go
+1
-1
No files found.
pkg/api/endpoints/util.go
View file @
609cdfd2
...
...
@@ -25,7 +25,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util
"
hashutil
"k8s.io/kubernetes/pkg/util/hash
"
)
// RepackSubsets takes a slice of EndpointSubset objects, expands it to the full
...
...
@@ -138,7 +138,7 @@ func hashAddresses(addrs addressSet) string {
}
sort
.
Sort
(
addrsReady
(
slice
))
hasher
:=
md5
.
New
()
util
.
DeepHashObject
(
hasher
,
slice
)
hash
util
.
DeepHashObject
(
hasher
,
slice
)
return
hex
.
EncodeToString
(
hasher
.
Sum
(
nil
)[
0
:
])
}
...
...
@@ -191,7 +191,7 @@ func SortSubsets(subsets []api.EndpointSubset) []api.EndpointSubset {
}
func
hashObject
(
hasher
hash
.
Hash
,
obj
interface
{})
[]
byte
{
util
.
DeepHashObject
(
hasher
,
obj
)
hash
util
.
DeepHashObject
(
hasher
,
obj
)
return
hasher
.
Sum
(
nil
)
}
...
...
pkg/kubelet/config/common.go
View file @
609cdfd2
...
...
@@ -27,7 +27,7 @@ import (
"k8s.io/kubernetes/pkg/api/validation"
kubetypes
"k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util
/hash
"
utilyaml
"k8s.io/kubernetes/pkg/util/yaml"
"github.com/golang/glog"
...
...
@@ -47,7 +47,7 @@ func applyDefaults(pod *api.Pod, source string, isFile bool, nodeName string) er
}
else
{
fmt
.
Fprintf
(
hasher
,
"url:%s"
,
source
)
}
util
.
DeepHashObject
(
hasher
,
pod
)
hash
.
DeepHashObject
(
hasher
,
pod
)
pod
.
UID
=
types
.
UID
(
hex
.
EncodeToString
(
hasher
.
Sum
(
nil
)[
0
:
]))
glog
.
V
(
5
)
.
Infof
(
"Generated UID %q pod %q from %s"
,
pod
.
UID
,
pod
.
Name
,
source
)
}
...
...
pkg/kubelet/container/helpers.go
View file @
609cdfd2
...
...
@@ -25,7 +25,7 @@ import (
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/kubelet/util/format"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util
"
hashutil
"k8s.io/kubernetes/pkg/util/hash
"
"k8s.io/kubernetes/third_party/golang/expansion"
"github.com/golang/glog"
...
...
@@ -127,7 +127,7 @@ func ConvertPodStatusToRunningPod(podStatus *PodStatus) Pod {
// the running container with its desired spec.
func
HashContainer
(
container
*
api
.
Container
)
uint64
{
hash
:=
adler32
.
New
()
util
.
DeepHashObject
(
hash
,
*
container
)
hash
util
.
DeepHashObject
(
hash
,
*
container
)
return
uint64
(
hash
.
Sum32
())
}
...
...
pkg/kubelet/dockertools/docker_test.go
View file @
609cdfd2
...
...
@@ -36,7 +36,7 @@ import (
"k8s.io/kubernetes/pkg/kubelet/network"
kubetypes
"k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util
"
hashutil
"k8s.io/kubernetes/pkg/util/hash
"
"k8s.io/kubernetes/pkg/util/parsers"
)
...
...
@@ -116,7 +116,7 @@ func TestGetContainerID(t *testing.T) {
func
verifyPackUnpack
(
t
*
testing
.
T
,
podNamespace
,
podUID
,
podName
,
containerName
string
)
{
container
:=
&
api
.
Container
{
Name
:
containerName
}
hasher
:=
adler32
.
New
()
util
.
DeepHashObject
(
hasher
,
*
container
)
hash
util
.
DeepHashObject
(
hasher
,
*
container
)
computedHash
:=
uint64
(
hasher
.
Sum32
())
podFullName
:=
fmt
.
Sprintf
(
"%s_%s"
,
podName
,
podNamespace
)
_
,
name
:=
BuildDockerName
(
KubeletContainerName
{
podFullName
,
types
.
UID
(
podUID
),
container
.
Name
},
container
)
...
...
pkg/util/deployment/deployment.go
View file @
609cdfd2
...
...
@@ -25,7 +25,7 @@ import (
"k8s.io/kubernetes/pkg/apis/extensions"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/util
"
hashutil
"k8s.io/kubernetes/pkg/util/hash
"
)
// GetOldRCs returns the old RCs targeted by the given Deployment; get PodList and RCList from client interface.
...
...
@@ -141,7 +141,7 @@ func CloneAndAddLabel(labels map[string]string, labelKey string, labelValue uint
func
GetPodTemplateSpecHash
(
template
api
.
PodTemplateSpec
)
uint32
{
podTemplateSpecHasher
:=
adler32
.
New
()
util
.
DeepHashObject
(
podTemplateSpecHasher
,
template
)
hash
util
.
DeepHashObject
(
podTemplateSpecHasher
,
template
)
return
podTemplateSpecHasher
.
Sum32
()
}
...
...
pkg/util/hash.go
→
pkg/util/hash
/hash
.go
View file @
609cdfd2
...
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
util
package
hash
import
(
"hash"
...
...
pkg/util/hash_test.go
→
pkg/util/hash
/hash
_test.go
View file @
609cdfd2
...
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
util
package
hash
import
(
"fmt"
...
...
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