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
3cd36e36
Commit
3cd36e36
authored
Dec 20, 2016
by
Chao Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
run hack/update-staging-client-go.sh before the copy.sh changes
parent
ef44fa19
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
7 deletions
+35
-7
errors.go
staging/src/k8s.io/client-go/pkg/api/errors/errors.go
+6
-0
types.go
staging/src/k8s.io/client-go/pkg/api/types.go
+3
-0
env.go
staging/src/k8s.io/client-go/pkg/apis/kubeadm/env.go
+4
-3
pod_update.go
staging/src/k8s.io/client-go/pkg/kubelet/types/pod_update.go
+9
-0
json.go
.../src/k8s.io/client-go/pkg/runtime/serializer/json/json.go
+1
-1
decoder.go
staging/src/k8s.io/client-go/pkg/util/yaml/decoder.go
+12
-3
No files found.
staging/src/k8s.io/client-go/pkg/api/errors/errors.go
View file @
3cd36e36
...
...
@@ -404,6 +404,12 @@ func IsForbidden(err error) bool {
return
reasonForError
(
err
)
==
metav1
.
StatusReasonForbidden
}
// IsTimeout determines if err is an error which indicates that request times out due to long
// processing.
func
IsTimeout
(
err
error
)
bool
{
return
reasonForError
(
err
)
==
metav1
.
StatusReasonTimeout
}
// IsServerTimeout determines if err is an error which indicates that the request needs to be retried
// by the client.
func
IsServerTimeout
(
err
error
)
bool
{
...
...
staging/src/k8s.io/client-go/pkg/api/types.go
View file @
3cd36e36
...
...
@@ -3249,6 +3249,9 @@ const (
// - Secret.Data["token"] - a token that identifies the service account to the API
SecretTypeServiceAccountToken
SecretType
=
"kubernetes.io/service-account-token"
// SecretTypeBootstrapToken is the key for tokens used by kubeadm to validate cluster info during discovery.
SecretTypeBootstrapToken
=
"bootstrap.kubernetes.io/token"
// ServiceAccountNameKey is the key of the required annotation for SecretTypeServiceAccountToken secrets
ServiceAccountNameKey
=
"kubernetes.io/service-account.name"
// ServiceAccountUIDKey is the key of the required annotation for SecretTypeServiceAccountToken secrets
...
...
staging/src/k8s.io/client-go/pkg/apis/kubeadm/env.go
View file @
3cd36e36
...
...
@@ -19,6 +19,7 @@ package kubeadm
import
(
"fmt"
"os"
"path"
"runtime"
"strings"
)
...
...
@@ -46,9 +47,9 @@ func SetEnvParams() *EnvParams {
}
return
&
EnvParams
{
KubernetesDir
:
envParams
[
"kubernetes_dir"
]
,
HostPKIPath
:
envParams
[
"host_pki_path"
]
,
HostEtcdPath
:
envParams
[
"host_etcd_path"
]
,
KubernetesDir
:
path
.
Clean
(
envParams
[
"kubernetes_dir"
])
,
HostPKIPath
:
path
.
Clean
(
envParams
[
"host_pki_path"
])
,
HostEtcdPath
:
path
.
Clean
(
envParams
[
"host_etcd_path"
])
,
HyperkubeImage
:
envParams
[
"hyperkube_image"
],
RepositoryPrefix
:
envParams
[
"repo_prefix"
],
DiscoveryImage
:
envParams
[
"discovery_image"
],
...
...
staging/src/k8s.io/client-go/pkg/kubelet/types/pod_update.go
View file @
3cd36e36
...
...
@@ -27,6 +27,15 @@ const ConfigMirrorAnnotationKey = "kubernetes.io/config.mirror"
const
ConfigFirstSeenAnnotationKey
=
"kubernetes.io/config.seen"
const
ConfigHashAnnotationKey
=
"kubernetes.io/config.hash"
// This key needs to sync with the key used by the rescheduler, which currently
// lives in contrib. Its presence indicates 2 things, as far as the kubelet is
// concerned:
// 1. Resource related admission checks will prioritize the admission of
// pods bearing the key, over pods without the key, regardless of QoS.
// 2. The OOM score of pods bearing the key will be <= pods without
// the key (where the <= part is determied by QoS).
const
CriticalPodAnnotationKey
=
"scheduler.alpha.kubernetes.io/critical-pod"
// PodOperation defines what changes will be made on a pod configuration.
type
PodOperation
int
...
...
staging/src/k8s.io/client-go/pkg/runtime/serializer/json/json.go
View file @
3cd36e36
...
...
@@ -194,7 +194,7 @@ func (s *Serializer) RecognizesData(peek io.Reader) (ok, unknown bool, err error
// we could potentially look for '---'
return
false
,
true
,
nil
}
_
,
ok
=
utilyaml
.
GuessJSONStream
(
peek
,
2048
)
_
,
_
,
ok
=
utilyaml
.
GuessJSONStream
(
peek
,
2048
)
return
ok
,
false
,
nil
}
...
...
staging/src/k8s.io/client-go/pkg/util/yaml/decoder.go
View file @
3cd36e36
...
...
@@ -181,6 +181,7 @@ type YAMLOrJSONDecoder struct {
bufferSize
int
decoder
decoder
rawData
[]
byte
}
// NewYAMLOrJSONDecoder returns a decoder that will process YAML documents
...
...
@@ -198,10 +199,11 @@ func NewYAMLOrJSONDecoder(r io.Reader, bufferSize int) *YAMLOrJSONDecoder {
// provide object, or returns an error.
func
(
d
*
YAMLOrJSONDecoder
)
Decode
(
into
interface
{})
error
{
if
d
.
decoder
==
nil
{
buffer
,
isJSON
:=
GuessJSONStream
(
d
.
r
,
d
.
bufferSize
)
buffer
,
origData
,
isJSON
:=
GuessJSONStream
(
d
.
r
,
d
.
bufferSize
)
if
isJSON
{
glog
.
V
(
4
)
.
Infof
(
"decoding stream as JSON"
)
d
.
decoder
=
json
.
NewDecoder
(
buffer
)
d
.
rawData
=
origData
}
else
{
glog
.
V
(
4
)
.
Infof
(
"decoding stream as YAML"
)
d
.
decoder
=
NewYAMLToJSONDecoder
(
buffer
)
...
...
@@ -215,6 +217,13 @@ func (d *YAMLOrJSONDecoder) Decode(into interface{}) error {
glog
.
V
(
4
)
.
Infof
(
"reading stream failed: %v"
,
readErr
)
}
js
:=
string
(
data
)
// if contents from io.Reader are not complete,
// use the original raw data to prevent panic
if
int64
(
len
(
js
))
<=
syntax
.
Offset
{
js
=
string
(
d
.
rawData
)
}
start
:=
strings
.
LastIndex
(
js
[
:
syntax
.
Offset
],
"
\n
"
)
+
1
line
:=
strings
.
Count
(
js
[
:
start
],
"
\n
"
)
return
fmt
.
Errorf
(
"json: line %d: %s"
,
line
,
syntax
.
Error
())
...
...
@@ -296,10 +305,10 @@ func (r *LineReader) Read() ([]byte, error) {
// GuessJSONStream scans the provided reader up to size, looking
// for an open brace indicating this is JSON. It will return the
// bufio.Reader it creates for the consumer.
func
GuessJSONStream
(
r
io
.
Reader
,
size
int
)
(
io
.
Reader
,
bool
)
{
func
GuessJSONStream
(
r
io
.
Reader
,
size
int
)
(
io
.
Reader
,
[]
byte
,
bool
)
{
buffer
:=
bufio
.
NewReaderSize
(
r
,
size
)
b
,
_
:=
buffer
.
Peek
(
size
)
return
buffer
,
hasJSONPrefix
(
b
)
return
buffer
,
b
,
hasJSONPrefix
(
b
)
}
var
jsonPrefix
=
[]
byte
(
"{"
)
...
...
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