mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-21 03:38:43 +00:00
Add dependencies for contrib/prometheus-config-reloader to vendor folder
This commit is contained in:
parent
df84b7c4fd
commit
dd03ad9b20
52 changed files with 134980 additions and 3 deletions
contrib/prometheus-config-reloader
vendor
github.com
cenkalti/backoff
ericchiang/k8s
|
@ -252,8 +252,9 @@ func (w *volumeWatcher) Run() {
|
|||
}
|
||||
|
||||
func main() {
|
||||
logger := log.NewContext(log.NewLogfmtLogger(os.Stdout)).
|
||||
With("ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller)
|
||||
logger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stdout))
|
||||
logger = log.With(logger, "ts", log.DefaultTimestampUTC)
|
||||
logger = log.With(logger, "caller", log.DefaultCaller)
|
||||
|
||||
cfg := config{}
|
||||
flags := flag.NewFlagSet("prometheus-config-reloader", flag.ExitOnError)
|
||||
|
@ -286,5 +287,5 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
newVolumeWatcher(client, cfg, logger.With("component", "volume-watcher")).Run()
|
||||
newVolumeWatcher(client, cfg, log.With(logger, "component", "volume-watcher")).Run()
|
||||
}
|
||||
|
|
20
vendor/github.com/cenkalti/backoff/LICENSE
generated
vendored
Normal file
20
vendor/github.com/cenkalti/backoff/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Cenk Altı
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
30
vendor/github.com/cenkalti/backoff/README.md
generated
vendored
Normal file
30
vendor/github.com/cenkalti/backoff/README.md
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Exponential Backoff [![GoDoc][godoc image]][godoc] [![Build Status][travis image]][travis] [![Coverage Status][coveralls image]][coveralls]
|
||||
|
||||
This is a Go port of the exponential backoff algorithm from [Google's HTTP Client Library for Java][google-http-java-client].
|
||||
|
||||
[Exponential backoff][exponential backoff wiki]
|
||||
is an algorithm that uses feedback to multiplicatively decrease the rate of some process,
|
||||
in order to gradually find an acceptable rate.
|
||||
The retries exponentially increase and stop increasing when a certain threshold is met.
|
||||
|
||||
## Usage
|
||||
|
||||
See https://godoc.org/github.com/cenkalti/backoff#pkg-examples
|
||||
|
||||
## Contributing
|
||||
|
||||
* I would like to keep this library as small as possible.
|
||||
* Please don't send a PR without opening an issue and discussing it first.
|
||||
* If proposed change is not a common use case, I will probably not accept it.
|
||||
|
||||
[godoc]: https://godoc.org/github.com/cenkalti/backoff
|
||||
[godoc image]: https://godoc.org/github.com/cenkalti/backoff?status.png
|
||||
[travis]: https://travis-ci.org/cenkalti/backoff
|
||||
[travis image]: https://travis-ci.org/cenkalti/backoff.png?branch=master
|
||||
[coveralls]: https://coveralls.io/github/cenkalti/backoff?branch=master
|
||||
[coveralls image]: https://coveralls.io/repos/github/cenkalti/backoff/badge.svg?branch=master
|
||||
|
||||
[google-http-java-client]: https://github.com/google/google-http-java-client
|
||||
[exponential backoff wiki]: http://en.wikipedia.org/wiki/Exponential_backoff
|
||||
|
||||
[advanced example]: https://godoc.org/github.com/cenkalti/backoff#example_
|
66
vendor/github.com/cenkalti/backoff/backoff.go
generated
vendored
Normal file
66
vendor/github.com/cenkalti/backoff/backoff.go
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
// Package backoff implements backoff algorithms for retrying operations.
|
||||
//
|
||||
// Use Retry function for retrying operations that may fail.
|
||||
// If Retry does not meet your needs,
|
||||
// copy/paste the function into your project and modify as you wish.
|
||||
//
|
||||
// There is also Ticker type similar to time.Ticker.
|
||||
// You can use it if you need to work with channels.
|
||||
//
|
||||
// See Examples section below for usage examples.
|
||||
package backoff
|
||||
|
||||
import "time"
|
||||
|
||||
// BackOff is a backoff policy for retrying an operation.
|
||||
type BackOff interface {
|
||||
// NextBackOff returns the duration to wait before retrying the operation,
|
||||
// or backoff. Stop to indicate that no more retries should be made.
|
||||
//
|
||||
// Example usage:
|
||||
//
|
||||
// duration := backoff.NextBackOff();
|
||||
// if (duration == backoff.Stop) {
|
||||
// // Do not retry operation.
|
||||
// } else {
|
||||
// // Sleep for duration and retry operation.
|
||||
// }
|
||||
//
|
||||
NextBackOff() time.Duration
|
||||
|
||||
// Reset to initial state.
|
||||
Reset()
|
||||
}
|
||||
|
||||
// Stop indicates that no more retries should be made for use in NextBackOff().
|
||||
const Stop time.Duration = -1
|
||||
|
||||
// ZeroBackOff is a fixed backoff policy whose backoff time is always zero,
|
||||
// meaning that the operation is retried immediately without waiting, indefinitely.
|
||||
type ZeroBackOff struct{}
|
||||
|
||||
func (b *ZeroBackOff) Reset() {}
|
||||
|
||||
func (b *ZeroBackOff) NextBackOff() time.Duration { return 0 }
|
||||
|
||||
// StopBackOff is a fixed backoff policy that always returns backoff.Stop for
|
||||
// NextBackOff(), meaning that the operation should never be retried.
|
||||
type StopBackOff struct{}
|
||||
|
||||
func (b *StopBackOff) Reset() {}
|
||||
|
||||
func (b *StopBackOff) NextBackOff() time.Duration { return Stop }
|
||||
|
||||
// ConstantBackOff is a backoff policy that always returns the same backoff delay.
|
||||
// This is in contrast to an exponential backoff policy,
|
||||
// which returns a delay that grows longer as you call NextBackOff() over and over again.
|
||||
type ConstantBackOff struct {
|
||||
Interval time.Duration
|
||||
}
|
||||
|
||||
func (b *ConstantBackOff) Reset() {}
|
||||
func (b *ConstantBackOff) NextBackOff() time.Duration { return b.Interval }
|
||||
|
||||
func NewConstantBackOff(d time.Duration) *ConstantBackOff {
|
||||
return &ConstantBackOff{Interval: d}
|
||||
}
|
60
vendor/github.com/cenkalti/backoff/context.go
generated
vendored
Normal file
60
vendor/github.com/cenkalti/backoff/context.go
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
package backoff
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// BackOffContext is a backoff policy that stops retrying after the context
|
||||
// is canceled.
|
||||
type BackOffContext interface {
|
||||
BackOff
|
||||
Context() context.Context
|
||||
}
|
||||
|
||||
type backOffContext struct {
|
||||
BackOff
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
// WithContext returns a BackOffContext with context ctx
|
||||
//
|
||||
// ctx must not be nil
|
||||
func WithContext(b BackOff, ctx context.Context) BackOffContext {
|
||||
if ctx == nil {
|
||||
panic("nil context")
|
||||
}
|
||||
|
||||
if b, ok := b.(*backOffContext); ok {
|
||||
return &backOffContext{
|
||||
BackOff: b.BackOff,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
return &backOffContext{
|
||||
BackOff: b,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
func ensureContext(b BackOff) BackOffContext {
|
||||
if cb, ok := b.(BackOffContext); ok {
|
||||
return cb
|
||||
}
|
||||
return WithContext(b, context.Background())
|
||||
}
|
||||
|
||||
func (b *backOffContext) Context() context.Context {
|
||||
return b.ctx
|
||||
}
|
||||
|
||||
func (b *backOffContext) NextBackOff() time.Duration {
|
||||
select {
|
||||
case <-b.Context().Done():
|
||||
return Stop
|
||||
default:
|
||||
return b.BackOff.NextBackOff()
|
||||
}
|
||||
}
|
158
vendor/github.com/cenkalti/backoff/exponential.go
generated
vendored
Normal file
158
vendor/github.com/cenkalti/backoff/exponential.go
generated
vendored
Normal file
|
@ -0,0 +1,158 @@
|
|||
package backoff
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
/*
|
||||
ExponentialBackOff is a backoff implementation that increases the backoff
|
||||
period for each retry attempt using a randomization function that grows exponentially.
|
||||
|
||||
NextBackOff() is calculated using the following formula:
|
||||
|
||||
randomized interval =
|
||||
RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor])
|
||||
|
||||
In other words NextBackOff() will range between the randomization factor
|
||||
percentage below and above the retry interval.
|
||||
|
||||
For example, given the following parameters:
|
||||
|
||||
RetryInterval = 2
|
||||
RandomizationFactor = 0.5
|
||||
Multiplier = 2
|
||||
|
||||
the actual backoff period used in the next retry attempt will range between 1 and 3 seconds,
|
||||
multiplied by the exponential, that is, between 2 and 6 seconds.
|
||||
|
||||
Note: MaxInterval caps the RetryInterval and not the randomized interval.
|
||||
|
||||
If the time elapsed since an ExponentialBackOff instance is created goes past the
|
||||
MaxElapsedTime, then the method NextBackOff() starts returning backoff.Stop.
|
||||
|
||||
The elapsed time can be reset by calling Reset().
|
||||
|
||||
Example: Given the following default arguments, for 10 tries the sequence will be,
|
||||
and assuming we go over the MaxElapsedTime on the 10th try:
|
||||
|
||||
Request # RetryInterval (seconds) Randomized Interval (seconds)
|
||||
|
||||
1 0.5 [0.25, 0.75]
|
||||
2 0.75 [0.375, 1.125]
|
||||
3 1.125 [0.562, 1.687]
|
||||
4 1.687 [0.8435, 2.53]
|
||||
5 2.53 [1.265, 3.795]
|
||||
6 3.795 [1.897, 5.692]
|
||||
7 5.692 [2.846, 8.538]
|
||||
8 8.538 [4.269, 12.807]
|
||||
9 12.807 [6.403, 19.210]
|
||||
10 19.210 backoff.Stop
|
||||
|
||||
Note: Implementation is not thread-safe.
|
||||
*/
|
||||
type ExponentialBackOff struct {
|
||||
InitialInterval time.Duration
|
||||
RandomizationFactor float64
|
||||
Multiplier float64
|
||||
MaxInterval time.Duration
|
||||
// After MaxElapsedTime the ExponentialBackOff stops.
|
||||
// It never stops if MaxElapsedTime == 0.
|
||||
MaxElapsedTime time.Duration
|
||||
Clock Clock
|
||||
|
||||
currentInterval time.Duration
|
||||
startTime time.Time
|
||||
random *rand.Rand
|
||||
}
|
||||
|
||||
// Clock is an interface that returns current time for BackOff.
|
||||
type Clock interface {
|
||||
Now() time.Time
|
||||
}
|
||||
|
||||
// Default values for ExponentialBackOff.
|
||||
const (
|
||||
DefaultInitialInterval = 500 * time.Millisecond
|
||||
DefaultRandomizationFactor = 0.5
|
||||
DefaultMultiplier = 1.5
|
||||
DefaultMaxInterval = 60 * time.Second
|
||||
DefaultMaxElapsedTime = 15 * time.Minute
|
||||
)
|
||||
|
||||
// NewExponentialBackOff creates an instance of ExponentialBackOff using default values.
|
||||
func NewExponentialBackOff() *ExponentialBackOff {
|
||||
b := &ExponentialBackOff{
|
||||
InitialInterval: DefaultInitialInterval,
|
||||
RandomizationFactor: DefaultRandomizationFactor,
|
||||
Multiplier: DefaultMultiplier,
|
||||
MaxInterval: DefaultMaxInterval,
|
||||
MaxElapsedTime: DefaultMaxElapsedTime,
|
||||
Clock: SystemClock,
|
||||
random: rand.New(rand.NewSource(time.Now().UnixNano())),
|
||||
}
|
||||
b.Reset()
|
||||
return b
|
||||
}
|
||||
|
||||
type systemClock struct{}
|
||||
|
||||
func (t systemClock) Now() time.Time {
|
||||
return time.Now()
|
||||
}
|
||||
|
||||
// SystemClock implements Clock interface that uses time.Now().
|
||||
var SystemClock = systemClock{}
|
||||
|
||||
// Reset the interval back to the initial retry interval and restarts the timer.
|
||||
func (b *ExponentialBackOff) Reset() {
|
||||
b.currentInterval = b.InitialInterval
|
||||
b.startTime = b.Clock.Now()
|
||||
}
|
||||
|
||||
// NextBackOff calculates the next backoff interval using the formula:
|
||||
// Randomized interval = RetryInterval +/- (RandomizationFactor * RetryInterval)
|
||||
func (b *ExponentialBackOff) NextBackOff() time.Duration {
|
||||
// Make sure we have not gone over the maximum elapsed time.
|
||||
if b.MaxElapsedTime != 0 && b.GetElapsedTime() > b.MaxElapsedTime {
|
||||
return Stop
|
||||
}
|
||||
defer b.incrementCurrentInterval()
|
||||
if b.random == nil {
|
||||
b.random = rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
}
|
||||
return getRandomValueFromInterval(b.RandomizationFactor, b.random.Float64(), b.currentInterval)
|
||||
}
|
||||
|
||||
// GetElapsedTime returns the elapsed time since an ExponentialBackOff instance
|
||||
// is created and is reset when Reset() is called.
|
||||
//
|
||||
// The elapsed time is computed using time.Now().UnixNano(). It is
|
||||
// safe to call even while the backoff policy is used by a running
|
||||
// ticker.
|
||||
func (b *ExponentialBackOff) GetElapsedTime() time.Duration {
|
||||
return b.Clock.Now().Sub(b.startTime)
|
||||
}
|
||||
|
||||
// Increments the current interval by multiplying it with the multiplier.
|
||||
func (b *ExponentialBackOff) incrementCurrentInterval() {
|
||||
// Check for overflow, if overflow is detected set the current interval to the max interval.
|
||||
if float64(b.currentInterval) >= float64(b.MaxInterval)/b.Multiplier {
|
||||
b.currentInterval = b.MaxInterval
|
||||
} else {
|
||||
b.currentInterval = time.Duration(float64(b.currentInterval) * b.Multiplier)
|
||||
}
|
||||
}
|
||||
|
||||
// Returns a random value from the following interval:
|
||||
// [randomizationFactor * currentInterval, randomizationFactor * currentInterval].
|
||||
func getRandomValueFromInterval(randomizationFactor, random float64, currentInterval time.Duration) time.Duration {
|
||||
var delta = randomizationFactor * float64(currentInterval)
|
||||
var minInterval = float64(currentInterval) - delta
|
||||
var maxInterval = float64(currentInterval) + delta
|
||||
|
||||
// Get a random value from the range [minInterval, maxInterval].
|
||||
// The formula used below has a +1 because if the minInterval is 1 and the maxInterval is 3 then
|
||||
// we want a 33% chance for selecting either 1, 2 or 3.
|
||||
return time.Duration(minInterval + (random * (maxInterval - minInterval + 1)))
|
||||
}
|
78
vendor/github.com/cenkalti/backoff/retry.go
generated
vendored
Normal file
78
vendor/github.com/cenkalti/backoff/retry.go
generated
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
package backoff
|
||||
|
||||
import "time"
|
||||
|
||||
// An Operation is executing by Retry() or RetryNotify().
|
||||
// The operation will be retried using a backoff policy if it returns an error.
|
||||
type Operation func() error
|
||||
|
||||
// Notify is a notify-on-error function. It receives an operation error and
|
||||
// backoff delay if the operation failed (with an error).
|
||||
//
|
||||
// NOTE that if the backoff policy stated to stop retrying,
|
||||
// the notify function isn't called.
|
||||
type Notify func(error, time.Duration)
|
||||
|
||||
// Retry the operation o until it does not return error or BackOff stops.
|
||||
// o is guaranteed to be run at least once.
|
||||
// It is the caller's responsibility to reset b after Retry returns.
|
||||
//
|
||||
// If o returns a *PermanentError, the operation is not retried, and the
|
||||
// wrapped error is returned.
|
||||
//
|
||||
// Retry sleeps the goroutine for the duration returned by BackOff after a
|
||||
// failed operation returns.
|
||||
func Retry(o Operation, b BackOff) error { return RetryNotify(o, b, nil) }
|
||||
|
||||
// RetryNotify calls notify function with the error and wait duration
|
||||
// for each failed attempt before sleep.
|
||||
func RetryNotify(operation Operation, b BackOff, notify Notify) error {
|
||||
var err error
|
||||
var next time.Duration
|
||||
|
||||
cb := ensureContext(b)
|
||||
|
||||
b.Reset()
|
||||
for {
|
||||
if err = operation(); err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if permanent, ok := err.(*PermanentError); ok {
|
||||
return permanent.Err
|
||||
}
|
||||
|
||||
if next = b.NextBackOff(); next == Stop {
|
||||
return err
|
||||
}
|
||||
|
||||
if notify != nil {
|
||||
notify(err, next)
|
||||
}
|
||||
|
||||
t := time.NewTimer(next)
|
||||
|
||||
select {
|
||||
case <-cb.Context().Done():
|
||||
t.Stop()
|
||||
return err
|
||||
case <-t.C:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PermanentError signals that the operation should not be retried.
|
||||
type PermanentError struct {
|
||||
Err error
|
||||
}
|
||||
|
||||
func (e *PermanentError) Error() string {
|
||||
return e.Err.Error()
|
||||
}
|
||||
|
||||
// Permanent wraps the given err in a *PermanentError.
|
||||
func Permanent(err error) *PermanentError {
|
||||
return &PermanentError{
|
||||
Err: err,
|
||||
}
|
||||
}
|
84
vendor/github.com/cenkalti/backoff/ticker.go
generated
vendored
Normal file
84
vendor/github.com/cenkalti/backoff/ticker.go
generated
vendored
Normal file
|
@ -0,0 +1,84 @@
|
|||
package backoff
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Ticker holds a channel that delivers `ticks' of a clock at times reported by a BackOff.
|
||||
//
|
||||
// Ticks will continue to arrive when the previous operation is still running,
|
||||
// so operations that take a while to fail could run in quick succession.
|
||||
type Ticker struct {
|
||||
C <-chan time.Time
|
||||
c chan time.Time
|
||||
b BackOffContext
|
||||
stop chan struct{}
|
||||
stopOnce sync.Once
|
||||
}
|
||||
|
||||
// NewTicker returns a new Ticker containing a channel that will send
|
||||
// the time at times specified by the BackOff argument. Ticker is
|
||||
// guaranteed to tick at least once. The channel is closed when Stop
|
||||
// method is called or BackOff stops. It is not safe to manipulate the
|
||||
// provided backoff policy (notably calling NextBackOff or Reset)
|
||||
// while the ticker is running.
|
||||
func NewTicker(b BackOff) *Ticker {
|
||||
c := make(chan time.Time)
|
||||
t := &Ticker{
|
||||
C: c,
|
||||
c: c,
|
||||
b: ensureContext(b),
|
||||
stop: make(chan struct{}),
|
||||
}
|
||||
t.b.Reset()
|
||||
go t.run()
|
||||
runtime.SetFinalizer(t, (*Ticker).Stop)
|
||||
return t
|
||||
}
|
||||
|
||||
// Stop turns off a ticker. After Stop, no more ticks will be sent.
|
||||
func (t *Ticker) Stop() {
|
||||
t.stopOnce.Do(func() { close(t.stop) })
|
||||
}
|
||||
|
||||
func (t *Ticker) run() {
|
||||
c := t.c
|
||||
defer close(c)
|
||||
|
||||
// Ticker is guaranteed to tick at least once.
|
||||
afterC := t.send(time.Now())
|
||||
|
||||
for {
|
||||
if afterC == nil {
|
||||
return
|
||||
}
|
||||
|
||||
select {
|
||||
case tick := <-afterC:
|
||||
afterC = t.send(tick)
|
||||
case <-t.stop:
|
||||
t.c = nil // Prevent future ticks from being sent to the channel.
|
||||
return
|
||||
case <-t.b.Context().Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Ticker) send(tick time.Time) <-chan time.Time {
|
||||
select {
|
||||
case t.c <- tick:
|
||||
case <-t.stop:
|
||||
return nil
|
||||
}
|
||||
|
||||
next := t.b.NextBackOff()
|
||||
if next == Stop {
|
||||
t.Stop()
|
||||
return nil
|
||||
}
|
||||
|
||||
return time.After(next)
|
||||
}
|
35
vendor/github.com/cenkalti/backoff/tries.go
generated
vendored
Normal file
35
vendor/github.com/cenkalti/backoff/tries.go
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
package backoff
|
||||
|
||||
import "time"
|
||||
|
||||
/*
|
||||
WithMaxTries creates a wrapper around another BackOff, which will
|
||||
return Stop if NextBackOff() has been called too many times since
|
||||
the last time Reset() was called
|
||||
|
||||
Note: Implementation is not thread-safe.
|
||||
*/
|
||||
func WithMaxTries(b BackOff, max uint64) BackOff {
|
||||
return &backOffTries{delegate: b, maxTries: max}
|
||||
}
|
||||
|
||||
type backOffTries struct {
|
||||
delegate BackOff
|
||||
maxTries uint64
|
||||
numTries uint64
|
||||
}
|
||||
|
||||
func (b *backOffTries) NextBackOff() time.Duration {
|
||||
if b.maxTries > 0 {
|
||||
if b.maxTries <= b.numTries {
|
||||
return Stop
|
||||
}
|
||||
b.numTries++
|
||||
}
|
||||
return b.delegate.NextBackOff()
|
||||
}
|
||||
|
||||
func (b *backOffTries) Reset() {
|
||||
b.numTries = 0
|
||||
b.delegate.Reset()
|
||||
}
|
202
vendor/github.com/ericchiang/k8s/LICENSE
generated
vendored
Normal file
202
vendor/github.com/ericchiang/k8s/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,202 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
7
vendor/github.com/ericchiang/k8s/Makefile
generated
vendored
Normal file
7
vendor/github.com/ericchiang/k8s/Makefile
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
test:
|
||||
go test -v ./...
|
||||
|
||||
test-examples:
|
||||
@for example in $(shell find examples/ -name '*.go'); do \
|
||||
go build -v $$example || exit 1; \
|
||||
done
|
190
vendor/github.com/ericchiang/k8s/README.md
generated
vendored
Normal file
190
vendor/github.com/ericchiang/k8s/README.md
generated
vendored
Normal file
|
@ -0,0 +1,190 @@
|
|||
# A simple Go client for Kubernetes
|
||||
|
||||
[](https://godoc.org/github.com/ericchiang/k8s)
|
||||
|
||||
A slimmed down Go client generated using Kubernetes' new [protocol buffer][protobuf] support. This package behaves similarly to [official Kubernetes' Go client][client-go], but only imports two external dependencies.
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/ericchiang/k8s"
|
||||
)
|
||||
|
||||
func main() {
|
||||
client, err := k8s.NewInClusterClient()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
nodes, err := client.CoreV1().ListNodes(context.Background())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
for _, node := range nodes.Items {
|
||||
fmt.Printf("name=%q schedulable=%t\n", *node.Metadata.Name, !*node.Spec.Unschedulable)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Should I use this or client-go?
|
||||
|
||||
client-go is a framework for building production ready controllers, components that regularly watch API resources and push the system towards a desired state. If you're writing a program that watches several resources in a loop for long durations, client-go's informers framework is a battle tested solution which will scale with the size of the cluster.
|
||||
|
||||
This client should be used by programs that just need to talk to the Kubernetes API without prescriptive solutions for caching, reconciliation on failures, or work queues. This often includes components are relatively Kubernetes agnostic, but use the Kubernetes API for small tasks when running in Kubernetes. For example, performing leader election or persisting small amounts of state in annotations or configmaps.
|
||||
|
||||
TL;DR - Use client-go if you're writing a controller.
|
||||
|
||||
## Requirements
|
||||
|
||||
* Go 1.7+ (this package uses "context" features added in 1.7)
|
||||
* Kubernetes 1.3+ (protobuf support was added in 1.3)
|
||||
* [github.com/golang/protobuf/proto][go-proto] (protobuf serialization)
|
||||
* [golang.org/x/net/http2][go-http2] (HTTP/2 support)
|
||||
|
||||
## Versioned supported
|
||||
|
||||
This client supports every API group version present since 1.3.
|
||||
|
||||
## Usage
|
||||
|
||||
### Namespace
|
||||
|
||||
When performing a list or watch operation, the namespace to list or watch in is provided as an argument.
|
||||
|
||||
```go
|
||||
pods, err := core.ListPods(ctx, "custom-namespace") // Pods from the "custom-namespace"
|
||||
```
|
||||
|
||||
A special value `AllNamespaces` indicates that the list or watch should be performed on all cluster resources.
|
||||
|
||||
```go
|
||||
pods, err := core.ListPods(ctx, k8s.AllNamespaces) // Pods in all namespaces.
|
||||
```
|
||||
|
||||
Both in-cluster and out-of-cluster clients are initialized with a primary namespace. This is the recommended value to use when listing or watching.
|
||||
|
||||
```go
|
||||
client, err := k8s.NewInClusterClient()
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
// List pods in the namespace the client is running in.
|
||||
pods, err := client.CoreV1().ListPods(ctx, client.Namespace)
|
||||
```
|
||||
|
||||
### Label selectors
|
||||
|
||||
Label selectors can be provided to any list operation.
|
||||
|
||||
```go
|
||||
l := new(k8s.LabelSelector)
|
||||
l.Eq("tier", "production")
|
||||
l.In("app", "database", "frontend")
|
||||
|
||||
pods, err := client.CoreV1().ListPods(ctx, client.Namespace, l.Selector())
|
||||
```
|
||||
|
||||
### Working with resources
|
||||
|
||||
Use the generated API types directly to create and modify resources.
|
||||
|
||||
```go
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/ericchiang/k8s"
|
||||
"github.com/ericchiang/k8s/api/v1"
|
||||
metav1 "github.com/ericchiang/k8s/apis/meta/v1"
|
||||
)
|
||||
|
||||
func createConfigMap(client *k8s.Client, name string, values map[string]string) error {
|
||||
cm := &v1.ConfigMap{
|
||||
Metadata: &metav1.ObjectMeta{
|
||||
Name: &name,
|
||||
Namespace: &client.Namespace,
|
||||
},
|
||||
Data: values,
|
||||
}
|
||||
// Will return the created configmap as well.
|
||||
_, err := client.CoreV1().CreateConfigMap(context.TODO(), cm)
|
||||
return err
|
||||
}
|
||||
```
|
||||
|
||||
API structs use pointers to `int`, `bool`, and `string` types to differentiate between the zero value and an unsupplied one. This package provides [convenience methods][string] for creating pointers to literals of basic types.
|
||||
|
||||
### Creating out-of-cluster clients
|
||||
|
||||
Out-of-cluster clients can be constructed by either creating an `http.Client` manually or parsing a [`Config`][config] object. The following is an example of creating a client from a kubeconfig:
|
||||
|
||||
```go
|
||||
import (
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/ericchiang/k8s"
|
||||
|
||||
"github.com/ghodss/yaml"
|
||||
)
|
||||
|
||||
// loadClient parses a kubeconfig from a file and returns a Kubernetes
|
||||
// client. It does not support extensions or client auth providers.
|
||||
func loadClient(kubeconfigPath string) (*k8s.Client, error) {
|
||||
data, err := ioutil.ReadFile(kubeconfigPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read kubeconfig: %v", err)
|
||||
}
|
||||
|
||||
// Unmarshal YAML into a Kubernetes config object.
|
||||
var config k8s.Config
|
||||
if err := yaml.Unmarshal(data, &config); err != nil {
|
||||
return nil, fmt.Errorf("unmarshal kubeconfig: %v", err)
|
||||
}
|
||||
return k8s.NewClient(&config)
|
||||
}
|
||||
```
|
||||
|
||||
### Errors
|
||||
|
||||
Errors returned by the Kubernetes API are formatted as [`unversioned.Status`][unversioned-status] objects and surfaced by clients as [`*k8s.APIError`][k8s-error]s. Programs that need to inspect error codes or failure details can use a type cast to access this information.
|
||||
|
||||
```go
|
||||
// createConfigMap creates a configmap in the client's default namespace
|
||||
// but does not return an error if a configmap of the same name already
|
||||
// exists.
|
||||
func createConfigMap(client *k8s.Client, name string, values map[string]string) error {
|
||||
cm := &v1.ConfigMap{
|
||||
Metadata: &metav1.ObjectMeta{
|
||||
Name: &name,
|
||||
Namespace: &client.Namespace,
|
||||
},
|
||||
Data: values,
|
||||
}
|
||||
|
||||
_, err := client.CoreV1().CreateConfigMap(context.TODO(), cm)
|
||||
|
||||
// If an HTTP error was returned by the API server, it will be of type
|
||||
// *k8s.APIError. This can be used to inspect the status code.
|
||||
if apiErr, ok := err.(*k8s.APIError); ok {
|
||||
// Resource already exists. Carry on.
|
||||
if apiErr.Code == http.StatusConflict {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("create configmap: %v", err)
|
||||
}
|
||||
```
|
||||
|
||||
[client-go]: https://github.com/kubernetes/client-go
|
||||
[go-proto]: https://godoc.org/github.com/golang/protobuf/proto
|
||||
[go-http2]: https://godoc.org/golang.org/x/net/http2
|
||||
[protobuf]: https://developers.google.com/protocol-buffers/
|
||||
[unversioned-status]: https://godoc.org/github.com/ericchiang/k8s/api/unversioned#Status
|
||||
[k8s-error]: https://godoc.org/github.com/ericchiang/k8s#APIError
|
||||
[config]: https://godoc.org/github.com/ericchiang/k8s#Config
|
||||
[string]: https://godoc.org/github.com/ericchiang/k8s#String
|
399
vendor/github.com/ericchiang/k8s/api/resource/generated.pb.go
generated
vendored
Normal file
399
vendor/github.com/ericchiang/k8s/api/resource/generated.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,399 @@
|
|||
// Code generated by protoc-gen-gogo.
|
||||
// source: k8s.io/kubernetes/pkg/api/resource/generated.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package resource is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/pkg/api/resource/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Quantity
|
||||
*/
|
||||
package resource
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "github.com/ericchiang/k8s/util/intstr"
|
||||
|
||||
import io "io"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
// Quantity is a fixed-point representation of a number.
|
||||
// It provides convenient marshaling/unmarshaling in JSON and YAML,
|
||||
// in addition to String() and Int64() accessors.
|
||||
//
|
||||
// The serialization format is:
|
||||
//
|
||||
// <quantity> ::= <signedNumber><suffix>
|
||||
// (Note that <suffix> may be empty, from the "" case in <decimalSI>.)
|
||||
// <digit> ::= 0 | 1 | ... | 9
|
||||
// <digits> ::= <digit> | <digit><digits>
|
||||
// <number> ::= <digits> | <digits>.<digits> | <digits>. | .<digits>
|
||||
// <sign> ::= "+" | "-"
|
||||
// <signedNumber> ::= <number> | <sign><number>
|
||||
// <suffix> ::= <binarySI> | <decimalExponent> | <decimalSI>
|
||||
// <binarySI> ::= Ki | Mi | Gi | Ti | Pi | Ei
|
||||
// (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)
|
||||
// <decimalSI> ::= m | "" | k | M | G | T | P | E
|
||||
// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
|
||||
// <decimalExponent> ::= "e" <signedNumber> | "E" <signedNumber>
|
||||
//
|
||||
// No matter which of the three exponent forms is used, no quantity may represent
|
||||
// a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal
|
||||
// places. Numbers larger or more precise will be capped or rounded up.
|
||||
// (E.g.: 0.1m will rounded up to 1m.)
|
||||
// This may be extended in the future if we require larger or smaller quantities.
|
||||
//
|
||||
// When a Quantity is parsed from a string, it will remember the type of suffix
|
||||
// it had, and will use the same type again when it is serialized.
|
||||
//
|
||||
// Before serializing, Quantity will be put in "canonical form".
|
||||
// This means that Exponent/suffix will be adjusted up or down (with a
|
||||
// corresponding increase or decrease in Mantissa) such that:
|
||||
// a. No precision is lost
|
||||
// b. No fractional digits will be emitted
|
||||
// c. The exponent (or suffix) is as large as possible.
|
||||
// The sign will be omitted unless the number is negative.
|
||||
//
|
||||
// Examples:
|
||||
// 1.5 will be serialized as "1500m"
|
||||
// 1.5Gi will be serialized as "1536Mi"
|
||||
//
|
||||
// NOTE: We reserve the right to amend this canonical format, perhaps to
|
||||
// allow 1.5 to be canonical.
|
||||
// TODO: Remove above disclaimer after all bikeshedding about format is over,
|
||||
// or after March 2015.
|
||||
//
|
||||
// Note that the quantity will NEVER be internally represented by a
|
||||
// floating point number. That is the whole point of this exercise.
|
||||
//
|
||||
// Non-canonical values will still parse as long as they are well formed,
|
||||
// but will be re-emitted in their canonical form. (So always use canonical
|
||||
// form, or don't diff.)
|
||||
//
|
||||
// This format is intended to make it difficult to use these numbers without
|
||||
// writing some sort of special handling code in the hopes that that will
|
||||
// cause implementors to also use a fixed point implementation.
|
||||
//
|
||||
// +protobuf=true
|
||||
// +protobuf.embed=string
|
||||
// +protobuf.options.marshal=false
|
||||
// +protobuf.options.(gogoproto.goproto_stringer)=false
|
||||
// +k8s:openapi-gen=true
|
||||
type Quantity struct {
|
||||
String_ *string `protobuf:"bytes,1,opt,name=string" json:"string,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Quantity) Reset() { *m = Quantity{} }
|
||||
func (m *Quantity) String() string { return proto.CompactTextString(m) }
|
||||
func (*Quantity) ProtoMessage() {}
|
||||
func (*Quantity) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
|
||||
func (m *Quantity) GetString_() string {
|
||||
if m != nil && m.String_ != nil {
|
||||
return *m.String_
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Quantity)(nil), "github.com/ericchiang.k8s.api.resource.Quantity")
|
||||
}
|
||||
func (m *Quantity) 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 *Quantity) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.String_ != nil {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(*m.String_)))
|
||||
i += copy(dAtA[i:], *m.String_)
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func encodeFixed64Generated(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
dAtA[offset+4] = uint8(v >> 32)
|
||||
dAtA[offset+5] = uint8(v >> 40)
|
||||
dAtA[offset+6] = uint8(v >> 48)
|
||||
dAtA[offset+7] = uint8(v >> 56)
|
||||
return offset + 8
|
||||
}
|
||||
func encodeFixed32Generated(dAtA []byte, offset int, v uint32) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
return offset + 4
|
||||
}
|
||||
func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
}
|
||||
func (m *Quantity) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if m.String_ != nil {
|
||||
l = len(*m.String_)
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovGenerated(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
func sozGenerated(x uint64) (n int) {
|
||||
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *Quantity) 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: Quantity: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Quantity: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field String_", 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
|
||||
}
|
||||
s := string(dAtA[iNdEx:postIndex])
|
||||
m.String_ = &s
|
||||
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
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipGenerated(dAtA[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("github.com/ericchiang/k8s/api/resource/generated.proto", fileDescriptorGenerated)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 166 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x32, 0xca, 0xb6, 0x28, 0xd6,
|
||||
0xcb, 0xcc, 0xd7, 0xcf, 0x2e, 0x4d, 0x4a, 0x2d, 0xca, 0x4b, 0x2d, 0x49, 0x2d, 0xd6, 0x2f, 0xc8,
|
||||
0x4e, 0xd7, 0x4f, 0x2c, 0xc8, 0xd4, 0x2f, 0x4a, 0x2d, 0xce, 0x2f, 0x2d, 0x4a, 0x4e, 0xd5, 0x4f,
|
||||
0x4f, 0xcd, 0x4b, 0x2d, 0x4a, 0x2c, 0x49, 0x4d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52,
|
||||
0x82, 0xe8, 0xd1, 0x43, 0xe8, 0xd1, 0x2b, 0xc8, 0x4e, 0xd7, 0x4b, 0x2c, 0xc8, 0xd4, 0x83, 0xe9,
|
||||
0x91, 0x32, 0xc4, 0x6e, 0x6e, 0x69, 0x49, 0x66, 0x8e, 0x7e, 0x66, 0x5e, 0x49, 0x71, 0x49, 0x11,
|
||||
0xba, 0xb1, 0x4a, 0x4a, 0x5c, 0x1c, 0x81, 0xa5, 0x89, 0x79, 0x25, 0x99, 0x25, 0x95, 0x42, 0x62,
|
||||
0x5c, 0x6c, 0xc5, 0x25, 0x45, 0x99, 0x79, 0xe9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x50,
|
||||
0x9e, 0x93, 0xd4, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38,
|
||||
0xe3, 0xb1, 0x1c, 0x43, 0x14, 0x07, 0xcc, 0x4a, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x81, 0x00,
|
||||
0xf7, 0xdc, 0xcb, 0x00, 0x00, 0x00,
|
||||
}
|
5614
vendor/github.com/ericchiang/k8s/api/unversioned/generated.pb.go
generated
vendored
Normal file
5614
vendor/github.com/ericchiang/k8s/api/unversioned/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
32
vendor/github.com/ericchiang/k8s/api/unversioned/time.go
generated
vendored
Normal file
32
vendor/github.com/ericchiang/k8s/api/unversioned/time.go
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
package unversioned
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
// JSON marshaling logic for the Time type. Need to make
|
||||
// third party resources JSON work.
|
||||
|
||||
func (t Time) MarshalJSON() ([]byte, error) {
|
||||
var seconds, nanos int64
|
||||
if t.Seconds != nil {
|
||||
seconds = *t.Seconds
|
||||
}
|
||||
if t.Nanos != nil {
|
||||
nanos = int64(*t.Nanos)
|
||||
}
|
||||
return json.Marshal(time.Unix(seconds, nanos))
|
||||
}
|
||||
|
||||
func (t *Time) UnmarshalJSON(p []byte) error {
|
||||
var t1 time.Time
|
||||
if err := json.Unmarshal(p, &t1); err != nil {
|
||||
return err
|
||||
}
|
||||
seconds := t1.Unix()
|
||||
nanos := int32(t1.UnixNano())
|
||||
t.Seconds = &seconds
|
||||
t.Nanos = &nanos
|
||||
return nil
|
||||
}
|
52331
vendor/github.com/ericchiang/k8s/api/v1/generated.pb.go
generated
vendored
Normal file
52331
vendor/github.com/ericchiang/k8s/api/v1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1227
vendor/github.com/ericchiang/k8s/apis/apps/v1alpha1/generated.pb.go
generated
vendored
Normal file
1227
vendor/github.com/ericchiang/k8s/apis/apps/v1alpha1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
4697
vendor/github.com/ericchiang/k8s/apis/apps/v1beta1/generated.pb.go
generated
vendored
Normal file
4697
vendor/github.com/ericchiang/k8s/apis/apps/v1beta1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1452
vendor/github.com/ericchiang/k8s/apis/authentication/v1/generated.pb.go
generated
vendored
Normal file
1452
vendor/github.com/ericchiang/k8s/apis/authentication/v1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1454
vendor/github.com/ericchiang/k8s/apis/authentication/v1beta1/generated.pb.go
generated
vendored
Normal file
1454
vendor/github.com/ericchiang/k8s/apis/authentication/v1beta1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
2759
vendor/github.com/ericchiang/k8s/apis/authorization/v1/generated.pb.go
generated
vendored
Normal file
2759
vendor/github.com/ericchiang/k8s/apis/authorization/v1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
2759
vendor/github.com/ericchiang/k8s/apis/authorization/v1beta1/generated.pb.go
generated
vendored
Normal file
2759
vendor/github.com/ericchiang/k8s/apis/authorization/v1beta1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
4162
vendor/github.com/ericchiang/k8s/apis/autoscaling/v1/generated.pb.go
generated
vendored
Normal file
4162
vendor/github.com/ericchiang/k8s/apis/autoscaling/v1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
3635
vendor/github.com/ericchiang/k8s/apis/autoscaling/v2alpha1/generated.pb.go
generated
vendored
Normal file
3635
vendor/github.com/ericchiang/k8s/apis/autoscaling/v2alpha1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1883
vendor/github.com/ericchiang/k8s/apis/batch/v1/generated.pb.go
generated
vendored
Normal file
1883
vendor/github.com/ericchiang/k8s/apis/batch/v1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1743
vendor/github.com/ericchiang/k8s/apis/batch/v2alpha1/generated.pb.go
generated
vendored
Normal file
1743
vendor/github.com/ericchiang/k8s/apis/batch/v2alpha1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1505
vendor/github.com/ericchiang/k8s/apis/certificates/v1alpha1/generated.pb.go
generated
vendored
Normal file
1505
vendor/github.com/ericchiang/k8s/apis/certificates/v1alpha1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1902
vendor/github.com/ericchiang/k8s/apis/certificates/v1beta1/generated.pb.go
generated
vendored
Normal file
1902
vendor/github.com/ericchiang/k8s/apis/certificates/v1beta1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
14382
vendor/github.com/ericchiang/k8s/apis/extensions/v1beta1/generated.pb.go
generated
vendored
Normal file
14382
vendor/github.com/ericchiang/k8s/apis/extensions/v1beta1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1169
vendor/github.com/ericchiang/k8s/apis/imagepolicy/v1alpha1/generated.pb.go
generated
vendored
Normal file
1169
vendor/github.com/ericchiang/k8s/apis/imagepolicy/v1alpha1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
8562
vendor/github.com/ericchiang/k8s/apis/meta/v1/generated.pb.go
generated
vendored
Normal file
8562
vendor/github.com/ericchiang/k8s/apis/meta/v1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
32
vendor/github.com/ericchiang/k8s/apis/meta/v1/time.go
generated
vendored
Normal file
32
vendor/github.com/ericchiang/k8s/apis/meta/v1/time.go
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
// JSON marshaling logic for the Time type. Need to make
|
||||
// third party resources JSON work.
|
||||
|
||||
func (t Time) MarshalJSON() ([]byte, error) {
|
||||
var seconds, nanos int64
|
||||
if t.Seconds != nil {
|
||||
seconds = *t.Seconds
|
||||
}
|
||||
if t.Nanos != nil {
|
||||
nanos = int64(*t.Nanos)
|
||||
}
|
||||
return json.Marshal(time.Unix(seconds, nanos))
|
||||
}
|
||||
|
||||
func (t *Time) UnmarshalJSON(p []byte) error {
|
||||
var t1 time.Time
|
||||
if err := json.Unmarshal(p, &t1); err != nil {
|
||||
return err
|
||||
}
|
||||
seconds := t1.Unix()
|
||||
nanos := int32(t1.UnixNano())
|
||||
t.Seconds = &seconds
|
||||
t.Nanos = &nanos
|
||||
return nil
|
||||
}
|
1352
vendor/github.com/ericchiang/k8s/apis/policy/v1alpha1/generated.pb.go
generated
vendored
Normal file
1352
vendor/github.com/ericchiang/k8s/apis/policy/v1alpha1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1573
vendor/github.com/ericchiang/k8s/apis/policy/v1beta1/generated.pb.go
generated
vendored
Normal file
1573
vendor/github.com/ericchiang/k8s/apis/policy/v1beta1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
3249
vendor/github.com/ericchiang/k8s/apis/rbac/v1alpha1/generated.pb.go
generated
vendored
Normal file
3249
vendor/github.com/ericchiang/k8s/apis/rbac/v1alpha1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
3247
vendor/github.com/ericchiang/k8s/apis/rbac/v1beta1/generated.pb.go
generated
vendored
Normal file
3247
vendor/github.com/ericchiang/k8s/apis/rbac/v1beta1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1016
vendor/github.com/ericchiang/k8s/apis/settings/v1alpha1/generated.pb.go
generated
vendored
Normal file
1016
vendor/github.com/ericchiang/k8s/apis/settings/v1alpha1/generated.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
777
vendor/github.com/ericchiang/k8s/apis/storage/v1/generated.pb.go
generated
vendored
Normal file
777
vendor/github.com/ericchiang/k8s/apis/storage/v1/generated.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,777 @@
|
|||
// Code generated by protoc-gen-gogo.
|
||||
// source: k8s.io/kubernetes/pkg/apis/storage/v1/generated.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package v1 is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/pkg/apis/storage/v1/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
StorageClass
|
||||
StorageClassList
|
||||
*/
|
||||
package v1
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import k8s_io_kubernetes_pkg_apis_meta_v1 "github.com/ericchiang/k8s/apis/meta/v1"
|
||||
import _ "github.com/ericchiang/k8s/runtime"
|
||||
import _ "github.com/ericchiang/k8s/runtime/schema"
|
||||
import _ "github.com/ericchiang/k8s/util/intstr"
|
||||
|
||||
import io "io"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
// StorageClass describes the parameters for a class of storage for
|
||||
// which PersistentVolumes can be dynamically provisioned.
|
||||
//
|
||||
// StorageClasses are non-namespaced; the name of the storage class
|
||||
// according to etcd is in ObjectMeta.Name.
|
||||
type StorageClass struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
Metadata *k8s_io_kubernetes_pkg_apis_meta_v1.ObjectMeta `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"`
|
||||
// Provisioner indicates the type of the provisioner.
|
||||
Provisioner *string `protobuf:"bytes,2,opt,name=provisioner" json:"provisioner,omitempty"`
|
||||
// Parameters holds the parameters for the provisioner that should
|
||||
// create volumes of this storage class.
|
||||
// +optional
|
||||
Parameters map[string]string `protobuf:"bytes,3,rep,name=parameters" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StorageClass) Reset() { *m = StorageClass{} }
|
||||
func (m *StorageClass) String() string { return proto.CompactTextString(m) }
|
||||
func (*StorageClass) ProtoMessage() {}
|
||||
func (*StorageClass) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
|
||||
func (m *StorageClass) GetMetadata() *k8s_io_kubernetes_pkg_apis_meta_v1.ObjectMeta {
|
||||
if m != nil {
|
||||
return m.Metadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *StorageClass) GetProvisioner() string {
|
||||
if m != nil && m.Provisioner != nil {
|
||||
return *m.Provisioner
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *StorageClass) GetParameters() map[string]string {
|
||||
if m != nil {
|
||||
return m.Parameters
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// StorageClassList is a collection of storage classes.
|
||||
type StorageClassList struct {
|
||||
// Standard list metadata
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
Metadata *k8s_io_kubernetes_pkg_apis_meta_v1.ListMeta `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"`
|
||||
// Items is the list of StorageClasses
|
||||
Items []*StorageClass `protobuf:"bytes,2,rep,name=items" json:"items,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StorageClassList) Reset() { *m = StorageClassList{} }
|
||||
func (m *StorageClassList) String() string { return proto.CompactTextString(m) }
|
||||
func (*StorageClassList) ProtoMessage() {}
|
||||
func (*StorageClassList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} }
|
||||
|
||||
func (m *StorageClassList) GetMetadata() *k8s_io_kubernetes_pkg_apis_meta_v1.ListMeta {
|
||||
if m != nil {
|
||||
return m.Metadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *StorageClassList) GetItems() []*StorageClass {
|
||||
if m != nil {
|
||||
return m.Items
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*StorageClass)(nil), "github.com/ericchiang.k8s.apis.storage.v1.StorageClass")
|
||||
proto.RegisterType((*StorageClassList)(nil), "github.com/ericchiang.k8s.apis.storage.v1.StorageClassList")
|
||||
}
|
||||
func (m *StorageClass) 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 *StorageClass) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Metadata != nil {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.Metadata.Size()))
|
||||
n1, err := m.Metadata.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n1
|
||||
}
|
||||
if m.Provisioner != nil {
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Provisioner)))
|
||||
i += copy(dAtA[i:], *m.Provisioner)
|
||||
}
|
||||
if len(m.Parameters) > 0 {
|
||||
for k, _ := range m.Parameters {
|
||||
dAtA[i] = 0x1a
|
||||
i++
|
||||
v := m.Parameters[k]
|
||||
mapSize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v)))
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(mapSize))
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(k)))
|
||||
i += copy(dAtA[i:], k)
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(v)))
|
||||
i += copy(dAtA[i:], v)
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *StorageClassList) 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 *StorageClassList) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Metadata != nil {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.Metadata.Size()))
|
||||
n2, err := m.Metadata.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n2
|
||||
}
|
||||
if len(m.Items) > 0 {
|
||||
for _, msg := range m.Items {
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(msg.Size()))
|
||||
n, err := msg.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func encodeFixed64Generated(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
dAtA[offset+4] = uint8(v >> 32)
|
||||
dAtA[offset+5] = uint8(v >> 40)
|
||||
dAtA[offset+6] = uint8(v >> 48)
|
||||
dAtA[offset+7] = uint8(v >> 56)
|
||||
return offset + 8
|
||||
}
|
||||
func encodeFixed32Generated(dAtA []byte, offset int, v uint32) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
return offset + 4
|
||||
}
|
||||
func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
}
|
||||
func (m *StorageClass) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if m.Metadata != nil {
|
||||
l = m.Metadata.Size()
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if m.Provisioner != nil {
|
||||
l = len(*m.Provisioner)
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if len(m.Parameters) > 0 {
|
||||
for k, v := range m.Parameters {
|
||||
_ = k
|
||||
_ = v
|
||||
mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v)))
|
||||
n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize))
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *StorageClassList) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if m.Metadata != nil {
|
||||
l = m.Metadata.Size()
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if len(m.Items) > 0 {
|
||||
for _, e := range m.Items {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovGenerated(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
func sozGenerated(x uint64) (n int) {
|
||||
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *StorageClass) 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: StorageClass: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: StorageClass: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Metadata == nil {
|
||||
m.Metadata = &k8s_io_kubernetes_pkg_apis_meta_v1.ObjectMeta{}
|
||||
}
|
||||
if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Provisioner", 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
|
||||
}
|
||||
s := string(dAtA[iNdEx:postIndex])
|
||||
m.Provisioner = &s
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Parameters", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
var keykey uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
keykey |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
var stringLenmapkey uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLenmapkey |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLenmapkey := int(stringLenmapkey)
|
||||
if intStringLenmapkey < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postStringIndexmapkey := iNdEx + intStringLenmapkey
|
||||
if postStringIndexmapkey > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
mapkey := string(dAtA[iNdEx:postStringIndexmapkey])
|
||||
iNdEx = postStringIndexmapkey
|
||||
if m.Parameters == nil {
|
||||
m.Parameters = make(map[string]string)
|
||||
}
|
||||
if iNdEx < postIndex {
|
||||
var valuekey uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
valuekey |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
var stringLenmapvalue uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLenmapvalue |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLenmapvalue := int(stringLenmapvalue)
|
||||
if intStringLenmapvalue < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postStringIndexmapvalue := iNdEx + intStringLenmapvalue
|
||||
if postStringIndexmapvalue > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue])
|
||||
iNdEx = postStringIndexmapvalue
|
||||
m.Parameters[mapkey] = mapvalue
|
||||
} else {
|
||||
var mapvalue string
|
||||
m.Parameters[mapkey] = mapvalue
|
||||
}
|
||||
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
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *StorageClassList) 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: StorageClassList: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: StorageClassList: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Metadata == nil {
|
||||
m.Metadata = &k8s_io_kubernetes_pkg_apis_meta_v1.ListMeta{}
|
||||
}
|
||||
if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Items = append(m.Items, &StorageClass{})
|
||||
if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
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
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipGenerated(dAtA[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("github.com/ericchiang/k8s/apis/storage/v1/generated.proto", fileDescriptorGenerated)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 361 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x91, 0xcf, 0x4a, 0xeb, 0x40,
|
||||
0x14, 0xc6, 0xef, 0xa4, 0x14, 0x6e, 0xa7, 0x17, 0x6e, 0x09, 0x5d, 0x84, 0x2e, 0x42, 0x28, 0x5c,
|
||||
0xe8, 0xe2, 0x7a, 0x42, 0xaa, 0x42, 0x11, 0xdc, 0x58, 0x04, 0x15, 0x45, 0x89, 0x3b, 0x77, 0xd3,
|
||||
0xf6, 0x10, 0xc7, 0x34, 0x7f, 0x98, 0x39, 0x09, 0xf4, 0x4d, 0x5c, 0xba, 0xf3, 0x55, 0x5c, 0xfa,
|
||||
0x08, 0x52, 0x5f, 0x44, 0xd2, 0x94, 0x1a, 0xda, 0x52, 0x8a, 0xbb, 0xf9, 0xf3, 0xfd, 0xbe, 0x39,
|
||||
0xdf, 0x37, 0xfc, 0x38, 0x1c, 0x68, 0x90, 0x89, 0x1b, 0x66, 0x23, 0x54, 0x31, 0x12, 0x6a, 0x37,
|
||||
0x0d, 0x03, 0x57, 0xa4, 0x52, 0xbb, 0x9a, 0x12, 0x25, 0x02, 0x74, 0x73, 0xcf, 0x0d, 0x30, 0x46,
|
||||
0x25, 0x08, 0x27, 0x90, 0xaa, 0x84, 0x12, 0xf3, 0x5f, 0x89, 0xc1, 0x37, 0x06, 0x69, 0x18, 0x40,
|
||||
0x81, 0xc1, 0x12, 0x83, 0xdc, 0xeb, 0xf4, 0x77, 0xb8, 0x47, 0x48, 0x62, 0x8b, 0x75, 0xe7, 0x60,
|
||||
0x3b, 0xa3, 0xb2, 0x98, 0x64, 0x84, 0x1b, 0xf2, 0xa3, 0xdd, 0x72, 0x3d, 0x7e, 0xc4, 0x48, 0x6c,
|
||||
0x50, 0xde, 0x76, 0x2a, 0x23, 0x39, 0x75, 0x65, 0x4c, 0x9a, 0xd4, 0x3a, 0xd2, 0x7d, 0x31, 0xf8,
|
||||
0x9f, 0xfb, 0x32, 0xda, 0x70, 0x2a, 0xb4, 0x36, 0xaf, 0xf8, 0xef, 0x22, 0xc3, 0x44, 0x90, 0xb0,
|
||||
0x98, 0xc3, 0x7a, 0xcd, 0x3e, 0xc0, 0x8e, 0x5a, 0x0a, 0x2d, 0xe4, 0x1e, 0xdc, 0x8e, 0x9e, 0x70,
|
||||
0x4c, 0x37, 0x48, 0xc2, 0x5f, 0xf1, 0xa6, 0xc3, 0x9b, 0xa9, 0x4a, 0x72, 0xa9, 0x65, 0x12, 0xa3,
|
||||
0xb2, 0x0c, 0x87, 0xf5, 0x1a, 0x7e, 0xf5, 0xc8, 0x1c, 0x73, 0x9e, 0x0a, 0x25, 0x22, 0x24, 0x54,
|
||||
0xda, 0xaa, 0x39, 0xb5, 0x5e, 0xb3, 0x3f, 0x84, 0xbd, 0xbe, 0x01, 0xaa, 0x63, 0xc3, 0xdd, 0xca,
|
||||
0xe5, 0x3c, 0x26, 0x35, 0xf3, 0x2b, 0xb6, 0x9d, 0x53, 0xfe, 0x77, 0xed, 0xda, 0x6c, 0xf1, 0x5a,
|
||||
0x88, 0xb3, 0x45, 0xc0, 0x86, 0x5f, 0x2c, 0xcd, 0x36, 0xaf, 0xe7, 0x62, 0x9a, 0xe1, 0x72, 0xca,
|
||||
0x72, 0x73, 0x62, 0x0c, 0x58, 0xf7, 0x95, 0xf1, 0x56, 0xf5, 0xad, 0x6b, 0xa9, 0xc9, 0xbc, 0xd8,
|
||||
0xa8, 0xe9, 0xff, 0x3e, 0x35, 0x15, 0xec, 0x5a, 0x49, 0x97, 0xbc, 0x2e, 0x09, 0x23, 0x6d, 0x19,
|
||||
0x8b, 0xf4, 0x87, 0x3f, 0x48, 0xef, 0x97, 0x0e, 0x67, 0xed, 0xb7, 0xb9, 0xcd, 0xde, 0xe7, 0x36,
|
||||
0xfb, 0x98, 0xdb, 0xec, 0xf9, 0xd3, 0xfe, 0xf5, 0x60, 0xe4, 0xde, 0x57, 0x00, 0x00, 0x00, 0xff,
|
||||
0xff, 0xc7, 0xf1, 0x3e, 0x97, 0x0d, 0x03, 0x00, 0x00,
|
||||
}
|
779
vendor/github.com/ericchiang/k8s/apis/storage/v1beta1/generated.pb.go
generated
vendored
Normal file
779
vendor/github.com/ericchiang/k8s/apis/storage/v1beta1/generated.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,779 @@
|
|||
// Code generated by protoc-gen-gogo.
|
||||
// source: k8s.io/kubernetes/pkg/apis/storage/v1beta1/generated.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package v1beta1 is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/pkg/apis/storage/v1beta1/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
StorageClass
|
||||
StorageClassList
|
||||
*/
|
||||
package v1beta1
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import k8s_io_kubernetes_pkg_apis_meta_v1 "github.com/ericchiang/k8s/apis/meta/v1"
|
||||
import _ "github.com/ericchiang/k8s/runtime"
|
||||
import _ "github.com/ericchiang/k8s/runtime/schema"
|
||||
import _ "github.com/ericchiang/k8s/util/intstr"
|
||||
import _ "github.com/ericchiang/k8s/api/v1"
|
||||
|
||||
import io "io"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
// StorageClass describes the parameters for a class of storage for
|
||||
// which PersistentVolumes can be dynamically provisioned.
|
||||
//
|
||||
// StorageClasses are non-namespaced; the name of the storage class
|
||||
// according to etcd is in ObjectMeta.Name.
|
||||
type StorageClass struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
Metadata *k8s_io_kubernetes_pkg_apis_meta_v1.ObjectMeta `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"`
|
||||
// Provisioner indicates the type of the provisioner.
|
||||
Provisioner *string `protobuf:"bytes,2,opt,name=provisioner" json:"provisioner,omitempty"`
|
||||
// Parameters holds the parameters for the provisioner that should
|
||||
// create volumes of this storage class.
|
||||
// +optional
|
||||
Parameters map[string]string `protobuf:"bytes,3,rep,name=parameters" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StorageClass) Reset() { *m = StorageClass{} }
|
||||
func (m *StorageClass) String() string { return proto.CompactTextString(m) }
|
||||
func (*StorageClass) ProtoMessage() {}
|
||||
func (*StorageClass) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
|
||||
func (m *StorageClass) GetMetadata() *k8s_io_kubernetes_pkg_apis_meta_v1.ObjectMeta {
|
||||
if m != nil {
|
||||
return m.Metadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *StorageClass) GetProvisioner() string {
|
||||
if m != nil && m.Provisioner != nil {
|
||||
return *m.Provisioner
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *StorageClass) GetParameters() map[string]string {
|
||||
if m != nil {
|
||||
return m.Parameters
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// StorageClassList is a collection of storage classes.
|
||||
type StorageClassList struct {
|
||||
// Standard list metadata
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
Metadata *k8s_io_kubernetes_pkg_apis_meta_v1.ListMeta `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"`
|
||||
// Items is the list of StorageClasses
|
||||
Items []*StorageClass `protobuf:"bytes,2,rep,name=items" json:"items,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StorageClassList) Reset() { *m = StorageClassList{} }
|
||||
func (m *StorageClassList) String() string { return proto.CompactTextString(m) }
|
||||
func (*StorageClassList) ProtoMessage() {}
|
||||
func (*StorageClassList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} }
|
||||
|
||||
func (m *StorageClassList) GetMetadata() *k8s_io_kubernetes_pkg_apis_meta_v1.ListMeta {
|
||||
if m != nil {
|
||||
return m.Metadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *StorageClassList) GetItems() []*StorageClass {
|
||||
if m != nil {
|
||||
return m.Items
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*StorageClass)(nil), "github.com/ericchiang.k8s.apis.storage.v1beta1.StorageClass")
|
||||
proto.RegisterType((*StorageClassList)(nil), "github.com/ericchiang.k8s.apis.storage.v1beta1.StorageClassList")
|
||||
}
|
||||
func (m *StorageClass) 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 *StorageClass) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Metadata != nil {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.Metadata.Size()))
|
||||
n1, err := m.Metadata.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n1
|
||||
}
|
||||
if m.Provisioner != nil {
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Provisioner)))
|
||||
i += copy(dAtA[i:], *m.Provisioner)
|
||||
}
|
||||
if len(m.Parameters) > 0 {
|
||||
for k, _ := range m.Parameters {
|
||||
dAtA[i] = 0x1a
|
||||
i++
|
||||
v := m.Parameters[k]
|
||||
mapSize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v)))
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(mapSize))
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(k)))
|
||||
i += copy(dAtA[i:], k)
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(v)))
|
||||
i += copy(dAtA[i:], v)
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *StorageClassList) 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 *StorageClassList) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Metadata != nil {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.Metadata.Size()))
|
||||
n2, err := m.Metadata.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n2
|
||||
}
|
||||
if len(m.Items) > 0 {
|
||||
for _, msg := range m.Items {
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(msg.Size()))
|
||||
n, err := msg.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func encodeFixed64Generated(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
dAtA[offset+4] = uint8(v >> 32)
|
||||
dAtA[offset+5] = uint8(v >> 40)
|
||||
dAtA[offset+6] = uint8(v >> 48)
|
||||
dAtA[offset+7] = uint8(v >> 56)
|
||||
return offset + 8
|
||||
}
|
||||
func encodeFixed32Generated(dAtA []byte, offset int, v uint32) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
return offset + 4
|
||||
}
|
||||
func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
}
|
||||
func (m *StorageClass) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if m.Metadata != nil {
|
||||
l = m.Metadata.Size()
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if m.Provisioner != nil {
|
||||
l = len(*m.Provisioner)
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if len(m.Parameters) > 0 {
|
||||
for k, v := range m.Parameters {
|
||||
_ = k
|
||||
_ = v
|
||||
mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v)))
|
||||
n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize))
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *StorageClassList) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if m.Metadata != nil {
|
||||
l = m.Metadata.Size()
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if len(m.Items) > 0 {
|
||||
for _, e := range m.Items {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovGenerated(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
func sozGenerated(x uint64) (n int) {
|
||||
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *StorageClass) 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: StorageClass: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: StorageClass: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Metadata == nil {
|
||||
m.Metadata = &k8s_io_kubernetes_pkg_apis_meta_v1.ObjectMeta{}
|
||||
}
|
||||
if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Provisioner", 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
|
||||
}
|
||||
s := string(dAtA[iNdEx:postIndex])
|
||||
m.Provisioner = &s
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Parameters", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
var keykey uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
keykey |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
var stringLenmapkey uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLenmapkey |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLenmapkey := int(stringLenmapkey)
|
||||
if intStringLenmapkey < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postStringIndexmapkey := iNdEx + intStringLenmapkey
|
||||
if postStringIndexmapkey > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
mapkey := string(dAtA[iNdEx:postStringIndexmapkey])
|
||||
iNdEx = postStringIndexmapkey
|
||||
if m.Parameters == nil {
|
||||
m.Parameters = make(map[string]string)
|
||||
}
|
||||
if iNdEx < postIndex {
|
||||
var valuekey uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
valuekey |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
var stringLenmapvalue uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLenmapvalue |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLenmapvalue := int(stringLenmapvalue)
|
||||
if intStringLenmapvalue < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postStringIndexmapvalue := iNdEx + intStringLenmapvalue
|
||||
if postStringIndexmapvalue > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue])
|
||||
iNdEx = postStringIndexmapvalue
|
||||
m.Parameters[mapkey] = mapvalue
|
||||
} else {
|
||||
var mapvalue string
|
||||
m.Parameters[mapkey] = mapvalue
|
||||
}
|
||||
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
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *StorageClassList) 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: StorageClassList: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: StorageClassList: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Metadata == nil {
|
||||
m.Metadata = &k8s_io_kubernetes_pkg_apis_meta_v1.ListMeta{}
|
||||
}
|
||||
if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Items = append(m.Items, &StorageClass{})
|
||||
if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
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
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipGenerated(dAtA[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("github.com/ericchiang/k8s/apis/storage/v1beta1/generated.proto", fileDescriptorGenerated)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 373 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x91, 0xcd, 0x6a, 0xdb, 0x40,
|
||||
0x14, 0x85, 0x3b, 0x32, 0xa6, 0xf5, 0xb8, 0x50, 0x23, 0xba, 0x50, 0xbd, 0x10, 0xc2, 0x2b, 0x53,
|
||||
0xdc, 0x19, 0x64, 0xba, 0x30, 0x86, 0x6e, 0x1a, 0x02, 0x26, 0xe4, 0x0f, 0x65, 0x97, 0xdd, 0xd8,
|
||||
0xbe, 0xc8, 0x13, 0x59, 0x3f, 0xcc, 0x5c, 0x09, 0xfc, 0x26, 0x79, 0x81, 0xec, 0xf2, 0x20, 0x59,
|
||||
0xe6, 0x11, 0x82, 0xf3, 0x22, 0x41, 0x96, 0x70, 0x84, 0xe5, 0x18, 0x93, 0x9d, 0x34, 0x73, 0xbe,
|
||||
0x73, 0xef, 0x39, 0x43, 0xc7, 0xc1, 0x48, 0x33, 0x19, 0xf3, 0x20, 0x9d, 0x82, 0x8a, 0x00, 0x41,
|
||||
0xf3, 0x24, 0xf0, 0xb9, 0x48, 0xa4, 0xe6, 0x1a, 0x63, 0x25, 0x7c, 0xe0, 0x99, 0x3b, 0x05, 0x14,
|
||||
0x2e, 0xf7, 0x21, 0x02, 0x25, 0x10, 0xe6, 0x2c, 0x51, 0x31, 0xc6, 0xe6, 0xef, 0x82, 0x65, 0xef,
|
||||
0x2c, 0x4b, 0x02, 0x9f, 0xe5, 0x2c, 0x2b, 0x59, 0x56, 0xb2, 0xdd, 0xe1, 0x81, 0x39, 0x21, 0xa0,
|
||||
0xe0, 0x59, 0xcd, 0xbf, 0xfb, 0x67, 0x3f, 0xa3, 0xd2, 0x08, 0x65, 0x08, 0x35, 0xf9, 0xdf, 0xc3,
|
||||
0x72, 0x3d, 0x5b, 0x40, 0x28, 0x6a, 0x94, 0xbb, 0x9f, 0x4a, 0x51, 0x2e, 0xb9, 0x8c, 0x50, 0xa3,
|
||||
0xaa, 0x21, 0x83, 0x0f, 0xb3, 0xec, 0x49, 0xd1, 0x7b, 0x30, 0xe8, 0xf7, 0x9b, 0xa2, 0x8d, 0x93,
|
||||
0xa5, 0xd0, 0xda, 0x3c, 0xa3, 0xdf, 0xf2, 0xc4, 0x73, 0x81, 0xc2, 0x22, 0x0e, 0xe9, 0xb7, 0x87,
|
||||
0x8c, 0x1d, 0x68, 0x32, 0xd7, 0xb2, 0xcc, 0x65, 0x57, 0xd3, 0x3b, 0x98, 0xe1, 0x05, 0xa0, 0xf0,
|
||||
0xb6, 0xbc, 0xe9, 0xd0, 0x76, 0xa2, 0xe2, 0x4c, 0x6a, 0x19, 0x47, 0xa0, 0x2c, 0xc3, 0x21, 0xfd,
|
||||
0x96, 0x57, 0x3d, 0x32, 0x17, 0x94, 0x26, 0x42, 0x89, 0x10, 0x10, 0x94, 0xb6, 0x1a, 0x4e, 0xa3,
|
||||
0xdf, 0x1e, 0x4e, 0xd8, 0xf1, 0x2f, 0xc7, 0xaa, 0xbb, 0xb3, 0xeb, 0xad, 0xd5, 0x69, 0x84, 0x6a,
|
||||
0xe5, 0x55, 0xbc, 0xbb, 0xff, 0xe8, 0x8f, 0x9d, 0x6b, 0xb3, 0x43, 0x1b, 0x01, 0xac, 0x36, 0x29,
|
||||
0x5b, 0x5e, 0xfe, 0x69, 0xfe, 0xa4, 0xcd, 0x4c, 0x2c, 0x53, 0x28, 0x57, 0x2d, 0x7e, 0xc6, 0xc6,
|
||||
0x88, 0xf4, 0x1e, 0x09, 0xed, 0x54, 0x67, 0x9d, 0x4b, 0x8d, 0xe6, 0xa4, 0xd6, 0xd5, 0xe0, 0x98,
|
||||
0xae, 0x72, 0x76, 0xa7, 0xa9, 0x4b, 0xda, 0x94, 0x08, 0xa1, 0xb6, 0x8c, 0x4d, 0x05, 0xa3, 0xcf,
|
||||
0x56, 0xe0, 0x15, 0x36, 0xff, 0x7f, 0x3d, 0xad, 0x6d, 0xf2, 0xbc, 0xb6, 0xc9, 0xcb, 0xda, 0x26,
|
||||
0xf7, 0xaf, 0xf6, 0x97, 0xdb, 0xaf, 0xa5, 0xfc, 0x2d, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x5c, 0x08,
|
||||
0xd1, 0x54, 0x03, 0x00, 0x00,
|
||||
}
|
621
vendor/github.com/ericchiang/k8s/client.go
generated
vendored
Normal file
621
vendor/github.com/ericchiang/k8s/client.go
generated
vendored
Normal file
|
@ -0,0 +1,621 @@
|
|||
/*
|
||||
Package k8s implements a Kubernetes client.
|
||||
|
||||
c, err := k8s.NewInClusterClient()
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
extensions := c.ExtensionsV1Beta1()
|
||||
|
||||
ingresses, err := extensions.ListIngresses(ctx, c.Namespace)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
*/
|
||||
package k8s
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/http2"
|
||||
|
||||
"github.com/ericchiang/k8s/api/unversioned"
|
||||
"github.com/ericchiang/k8s/runtime"
|
||||
"github.com/ericchiang/k8s/watch/versioned"
|
||||
"github.com/golang/protobuf/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
// AllNamespaces is given to list and watch operations to signify that the code should
|
||||
// list or watch resources in all namespaces.
|
||||
AllNamespaces = allNamespaces
|
||||
// Actual definition is private in case we want to change it later.
|
||||
allNamespaces = ""
|
||||
|
||||
namespaceDefault = "default"
|
||||
)
|
||||
|
||||
// String returns a pointer to a string. Useful for creating API objects
|
||||
// that take pointers instead of literals.
|
||||
//
|
||||
// cm := &v1.ConfigMap{
|
||||
// Metadata: &v1.ObjectMeta{
|
||||
// Name: k8s.String("myconfigmap"),
|
||||
// Namespace: k8s.String("default"),
|
||||
// },
|
||||
// Data: map[string]string{
|
||||
// "foo": "bar",
|
||||
// },
|
||||
// }
|
||||
//
|
||||
func String(s string) *string { return &s }
|
||||
|
||||
// Int is a convenience for converting an int literal to a pointer to an int.
|
||||
func Int(i int) *int { return &i }
|
||||
|
||||
// Int32 is a convenience for converting an int32 literal to a pointer to an int32.
|
||||
func Int32(i int32) *int32 { return &i }
|
||||
|
||||
// Bool is a convenience for converting a bool literal to a pointer to a bool.
|
||||
func Bool(b bool) *bool { return &b }
|
||||
|
||||
const (
|
||||
// Types for watch events.
|
||||
EventAdded = "ADDED"
|
||||
EventDeleted = "DELETED"
|
||||
EventModified = "MODIFIED"
|
||||
EventError = "ERROR"
|
||||
)
|
||||
|
||||
// Client is a Kuberntes client.
|
||||
type Client struct {
|
||||
// The URL of the API server.
|
||||
Endpoint string
|
||||
|
||||
// Default namespaces for objects that don't supply a namespace in
|
||||
// their object metadata.
|
||||
Namespace string
|
||||
|
||||
// SetHeaders provides a hook for modifying the HTTP headers of all requests.
|
||||
//
|
||||
// client, err := k8s.NewClient(config)
|
||||
// if err != nil {
|
||||
// // handle error
|
||||
// }
|
||||
// client.SetHeaders = func(h http.Header) error {
|
||||
// h.Set("Authorization", "Bearer "+mytoken)
|
||||
// return nil
|
||||
// }
|
||||
//
|
||||
SetHeaders func(h http.Header) error
|
||||
|
||||
Client *http.Client
|
||||
}
|
||||
|
||||
func (c *Client) newRequest(ctx context.Context, verb, url string, body io.Reader) (*http.Request, error) {
|
||||
req, err := http.NewRequest(verb, url, body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if c.SetHeaders != nil {
|
||||
if err := c.SetHeaders(req.Header); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return req.WithContext(ctx), nil
|
||||
}
|
||||
|
||||
// Option represents optional call parameters, such as label selectors.
|
||||
type Option interface {
|
||||
queryParam() (key, val string)
|
||||
}
|
||||
|
||||
type queryParam struct {
|
||||
paramName string
|
||||
paramValue string
|
||||
}
|
||||
|
||||
func (o queryParam) queryParam() (string, string) {
|
||||
return o.paramName, o.paramValue
|
||||
}
|
||||
|
||||
// QueryParam can be used to manually set a URL query parameter by name.
|
||||
func QueryParam(name, value string) Option {
|
||||
return queryParam{
|
||||
paramName: name,
|
||||
paramValue: value,
|
||||
}
|
||||
}
|
||||
|
||||
type resourceVersionOption string
|
||||
|
||||
func (r resourceVersionOption) queryParam() (string, string) {
|
||||
return "resourceVersion", string(r)
|
||||
}
|
||||
|
||||
// ResourceVersion causes watch operations to only show changes since
|
||||
// a particular version of a resource.
|
||||
func ResourceVersion(resourceVersion string) Option {
|
||||
return resourceVersionOption(resourceVersion)
|
||||
}
|
||||
|
||||
type timeoutSeconds string
|
||||
|
||||
func (t timeoutSeconds) queryParam() (string, string) {
|
||||
return "timeoutSeconds", string(t)
|
||||
}
|
||||
|
||||
// Timeout declares the timeout for list and watch operations. Timeout
|
||||
// is only accurate to the second.
|
||||
func Timeout(d time.Duration) Option {
|
||||
return timeoutSeconds(strconv.FormatInt(int64(d/time.Second), 10))
|
||||
}
|
||||
|
||||
// NewClient initializes a client from a client config.
|
||||
func NewClient(config *Config) (*Client, error) {
|
||||
if len(config.Contexts) == 0 {
|
||||
if config.CurrentContext != "" {
|
||||
return nil, fmt.Errorf("no contexts with name %q", config.CurrentContext)
|
||||
}
|
||||
|
||||
if n := len(config.Clusters); n == 0 {
|
||||
return nil, errors.New("no clusters provided")
|
||||
} else if n > 1 {
|
||||
return nil, errors.New("multiple clusters but no current context")
|
||||
}
|
||||
if n := len(config.AuthInfos); n == 0 {
|
||||
return nil, errors.New("no users provided")
|
||||
} else if n > 1 {
|
||||
return nil, errors.New("multiple users but no current context")
|
||||
}
|
||||
|
||||
return newClient(config.Clusters[0].Cluster, config.AuthInfos[0].AuthInfo, namespaceDefault)
|
||||
}
|
||||
|
||||
var ctx Context
|
||||
if config.CurrentContext == "" {
|
||||
if n := len(config.Contexts); n == 0 {
|
||||
return nil, errors.New("no contexts provided")
|
||||
} else if n > 1 {
|
||||
return nil, errors.New("multiple contexts but no current context")
|
||||
}
|
||||
ctx = config.Contexts[0].Context
|
||||
} else {
|
||||
for _, c := range config.Contexts {
|
||||
if c.Name == config.CurrentContext {
|
||||
ctx = c.Context
|
||||
goto configFound
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("no config named %q", config.CurrentContext)
|
||||
configFound:
|
||||
}
|
||||
|
||||
if ctx.Cluster == "" {
|
||||
return nil, fmt.Errorf("context doesn't have a cluster")
|
||||
}
|
||||
if ctx.AuthInfo == "" {
|
||||
return nil, fmt.Errorf("context doesn't have a user")
|
||||
}
|
||||
var (
|
||||
user AuthInfo
|
||||
cluster Cluster
|
||||
)
|
||||
|
||||
for _, u := range config.AuthInfos {
|
||||
if u.Name == ctx.AuthInfo {
|
||||
user = u.AuthInfo
|
||||
goto userFound
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("no user named %q", ctx.AuthInfo)
|
||||
userFound:
|
||||
|
||||
for _, c := range config.Clusters {
|
||||
if c.Name == ctx.Cluster {
|
||||
cluster = c.Cluster
|
||||
goto clusterFound
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("no cluster named %q", ctx.Cluster)
|
||||
clusterFound:
|
||||
|
||||
namespace := ctx.Namespace
|
||||
if namespace == "" {
|
||||
namespace = namespaceDefault
|
||||
}
|
||||
|
||||
return newClient(cluster, user, namespace)
|
||||
}
|
||||
|
||||
// NewInClusterClient returns a client that uses the service account bearer token mounted
|
||||
// into Kubernetes pods.
|
||||
func NewInClusterClient() (*Client, error) {
|
||||
host, port := os.Getenv("KUBERNETES_SERVICE_HOST"), os.Getenv("KUBERNETES_SERVICE_PORT")
|
||||
if len(host) == 0 || len(port) == 0 {
|
||||
return nil, errors.New("unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined")
|
||||
}
|
||||
namespace, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cluster := Cluster{
|
||||
Server: "https://" + host + ":" + port,
|
||||
CertificateAuthority: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt",
|
||||
}
|
||||
user := AuthInfo{TokenFile: "/var/run/secrets/kubernetes.io/serviceaccount/token"}
|
||||
return newClient(cluster, user, string(namespace))
|
||||
}
|
||||
|
||||
func load(filepath string, data []byte) (out []byte, err error) {
|
||||
if filepath != "" {
|
||||
data, err = ioutil.ReadFile(filepath)
|
||||
}
|
||||
return data, err
|
||||
}
|
||||
|
||||
func newClient(cluster Cluster, user AuthInfo, namespace string) (*Client, error) {
|
||||
if cluster.Server == "" {
|
||||
// NOTE: kubectl defaults to localhost:8080, but it's probably better to just
|
||||
// be strict.
|
||||
return nil, fmt.Errorf("no cluster endpoint provided")
|
||||
}
|
||||
|
||||
ca, err := load(cluster.CertificateAuthority, cluster.CertificateAuthorityData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("loading certificate authority: %v", err)
|
||||
}
|
||||
|
||||
clientCert, err := load(user.ClientCertificate, user.ClientCertificateData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("load client cert: %v", err)
|
||||
}
|
||||
clientKey, err := load(user.ClientKey, user.ClientKeyData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("load client cert: %v", err)
|
||||
}
|
||||
|
||||
// See https://github.com/gtank/cryptopasta
|
||||
tlsConfig := &tls.Config{
|
||||
MinVersion: tls.VersionTLS12,
|
||||
InsecureSkipVerify: cluster.InsecureSkipTLSVerify,
|
||||
}
|
||||
|
||||
if len(ca) != 0 {
|
||||
tlsConfig.RootCAs = x509.NewCertPool()
|
||||
if !tlsConfig.RootCAs.AppendCertsFromPEM(ca) {
|
||||
return nil, errors.New("certificate authority doesn't contain any certificates")
|
||||
}
|
||||
}
|
||||
if len(clientCert) != 0 {
|
||||
cert, err := tls.X509KeyPair(clientCert, clientKey)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid client cert and key pair: %v", err)
|
||||
}
|
||||
tlsConfig.Certificates = []tls.Certificate{cert}
|
||||
}
|
||||
|
||||
token := user.Token
|
||||
if user.TokenFile != "" {
|
||||
data, err := ioutil.ReadFile(user.TokenFile)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("load token file: %v", err)
|
||||
}
|
||||
token = string(data)
|
||||
}
|
||||
|
||||
transport := &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).DialContext,
|
||||
TLSClientConfig: tlsConfig,
|
||||
MaxIdleConns: 100,
|
||||
IdleConnTimeout: 90 * time.Second,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
ExpectContinueTimeout: 1 * time.Second,
|
||||
}
|
||||
if err := http2.ConfigureTransport(transport); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client := &Client{
|
||||
Endpoint: cluster.Server,
|
||||
Namespace: namespace,
|
||||
Client: &http.Client{
|
||||
Transport: transport,
|
||||
},
|
||||
}
|
||||
|
||||
if token != "" {
|
||||
client.SetHeaders = func(h http.Header) error {
|
||||
h.Set("Authorization", "Bearer "+token)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
if user.Username != "" && user.Password != "" {
|
||||
auth := user.Username + ":" + user.Password
|
||||
auth = "Basic " + base64.StdEncoding.EncodeToString([]byte(auth))
|
||||
client.SetHeaders = func(h http.Header) error {
|
||||
h.Set("Authorization", auth)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// APIError is an error from a unexpected status code.
|
||||
type APIError struct {
|
||||
// The status object returned by the Kubernetes API,
|
||||
Status *unversioned.Status
|
||||
|
||||
// Status code returned by the HTTP request.
|
||||
//
|
||||
// NOTE: For some reason the value set in Status.Code
|
||||
// doesn't correspond to the HTTP status code. Possibly
|
||||
// a bug?
|
||||
Code int
|
||||
}
|
||||
|
||||
func (e *APIError) Error() string {
|
||||
if e.Status != nil && e.Status.Message != nil && e.Status.Status != nil {
|
||||
return fmt.Sprintf("kubernetes api: %s %d %s", *e.Status.Status, e.Code, *e.Status.Message)
|
||||
}
|
||||
return fmt.Sprintf("%#v", e)
|
||||
}
|
||||
|
||||
func checkStatusCode(c *codec, statusCode int, body []byte) error {
|
||||
if statusCode/100 == 2 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return newAPIError(c, statusCode, body)
|
||||
}
|
||||
|
||||
func newAPIError(c *codec, statusCode int, body []byte) error {
|
||||
status := new(unversioned.Status)
|
||||
if err := c.unmarshal(body, status); err != nil {
|
||||
return fmt.Errorf("decode error status %d: %v", statusCode, err)
|
||||
}
|
||||
return &APIError{status, statusCode}
|
||||
}
|
||||
|
||||
func (c *Client) client() *http.Client {
|
||||
if c.Client == nil {
|
||||
return http.DefaultClient
|
||||
}
|
||||
return c.Client
|
||||
}
|
||||
|
||||
// The following methods hold the logic for interacting with the Kubernetes API. Generated
|
||||
// clients are thin wrappers on top of these methods.
|
||||
//
|
||||
// This client implements specs in the "API Conventions" developer document, which can be
|
||||
// found here:
|
||||
//
|
||||
// https://github.com/kubernetes/kubernetes/blob/master/docs/devel/api-conventions.md
|
||||
|
||||
func (c *Client) urlFor(apiGroup, apiVersion, namespace, resource, name string, options ...Option) string {
|
||||
basePath := "apis/"
|
||||
if apiGroup == "" {
|
||||
basePath = "api/"
|
||||
}
|
||||
|
||||
var p string
|
||||
if namespace != "" {
|
||||
p = path.Join(basePath, apiGroup, apiVersion, "namespaces", namespace, resource, name)
|
||||
} else {
|
||||
p = path.Join(basePath, apiGroup, apiVersion, resource, name)
|
||||
}
|
||||
endpoint := ""
|
||||
if strings.HasSuffix(c.Endpoint, "/") {
|
||||
endpoint = c.Endpoint + p
|
||||
} else {
|
||||
endpoint = c.Endpoint + "/" + p
|
||||
}
|
||||
if len(options) == 0 {
|
||||
return endpoint
|
||||
}
|
||||
|
||||
v := url.Values{}
|
||||
for _, option := range options {
|
||||
key, val := option.queryParam()
|
||||
v.Set(key, val)
|
||||
}
|
||||
return endpoint + "?" + v.Encode()
|
||||
}
|
||||
|
||||
func (c *Client) urlForPath(path string) string {
|
||||
if strings.HasPrefix(path, "/") {
|
||||
path = path[1:]
|
||||
}
|
||||
if strings.HasSuffix(c.Endpoint, "/") {
|
||||
return c.Endpoint + path
|
||||
}
|
||||
return c.Endpoint + "/" + path
|
||||
}
|
||||
|
||||
func (c *Client) create(ctx context.Context, codec *codec, verb, url string, req, resp interface{}) error {
|
||||
body, err := codec.marshal(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
r, err := c.newRequest(ctx, verb, url, bytes.NewReader(body))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
r.Header.Set("Content-Type", codec.contentType)
|
||||
r.Header.Set("Accept", codec.contentType)
|
||||
|
||||
re, err := c.client().Do(r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer re.Body.Close()
|
||||
|
||||
respBody, err := ioutil.ReadAll(re.Body)
|
||||
if err != nil {
|
||||
return fmt.Errorf("read body: %v", err)
|
||||
}
|
||||
|
||||
if err := checkStatusCode(codec, re.StatusCode, respBody); err != nil {
|
||||
return err
|
||||
}
|
||||
return codec.unmarshal(respBody, resp)
|
||||
}
|
||||
|
||||
func (c *Client) delete(ctx context.Context, codec *codec, url string) error {
|
||||
r, err := c.newRequest(ctx, "DELETE", url, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
r.Header.Set("Accept", codec.contentType)
|
||||
|
||||
re, err := c.client().Do(r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer re.Body.Close()
|
||||
|
||||
respBody, err := ioutil.ReadAll(re.Body)
|
||||
if err != nil {
|
||||
return fmt.Errorf("read body: %v", err)
|
||||
}
|
||||
|
||||
if err := checkStatusCode(codec, re.StatusCode, respBody); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// get can be used to either get or list a given resource.
|
||||
func (c *Client) get(ctx context.Context, codec *codec, url string, resp interface{}) error {
|
||||
r, err := c.newRequest(ctx, "GET", url, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
r.Header.Set("Accept", codec.contentType)
|
||||
re, err := c.client().Do(r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer re.Body.Close()
|
||||
|
||||
respBody, err := ioutil.ReadAll(re.Body)
|
||||
if err != nil {
|
||||
return fmt.Errorf("read body: %v", err)
|
||||
}
|
||||
|
||||
if err := checkStatusCode(codec, re.StatusCode, respBody); err != nil {
|
||||
return err
|
||||
}
|
||||
return codec.unmarshal(respBody, resp)
|
||||
}
|
||||
|
||||
var unknownPrefix = []byte{0x6b, 0x38, 0x73, 0x00}
|
||||
|
||||
func parseUnknown(b []byte) (*runtime.Unknown, error) {
|
||||
if !bytes.HasPrefix(b, unknownPrefix) {
|
||||
return nil, errors.New("bytes did not start with expected prefix")
|
||||
}
|
||||
|
||||
var u runtime.Unknown
|
||||
if err := proto.Unmarshal(b[len(unknownPrefix):], &u); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &u, nil
|
||||
}
|
||||
|
||||
type event struct {
|
||||
event *versioned.Event
|
||||
unknown *runtime.Unknown
|
||||
}
|
||||
|
||||
type watcher struct {
|
||||
r io.ReadCloser
|
||||
}
|
||||
|
||||
func (w *watcher) Close() error {
|
||||
return w.r.Close()
|
||||
}
|
||||
|
||||
// Decode the next event from a watch stream.
|
||||
//
|
||||
// See: https://github.com/kubernetes/community/blob/master/contributors/design-proposals/protobuf.md#streaming-wire-format
|
||||
func (w *watcher) next() (*versioned.Event, *runtime.Unknown, error) {
|
||||
length := make([]byte, 4)
|
||||
if _, err := io.ReadFull(w.r, length); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
body := make([]byte, int(binary.BigEndian.Uint32(length)))
|
||||
if _, err := io.ReadFull(w.r, body); err != nil {
|
||||
return nil, nil, fmt.Errorf("read frame body: %v", err)
|
||||
}
|
||||
|
||||
var event versioned.Event
|
||||
if err := proto.Unmarshal(body, &event); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
if event.Object == nil {
|
||||
return nil, nil, fmt.Errorf("event had no underlying object")
|
||||
}
|
||||
|
||||
unknown, err := parseUnknown(event.Object.Raw)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return &event, unknown, nil
|
||||
}
|
||||
|
||||
func (c *Client) watch(ctx context.Context, url string) (*watcher, error) {
|
||||
if strings.Contains(url, "?") {
|
||||
url = url + "&watch=true"
|
||||
} else {
|
||||
url = url + "?watch=true"
|
||||
}
|
||||
r, err := c.newRequest(ctx, "GET", url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
r.Header.Set("Accept", "application/vnd.kubernetes.protobuf;type=watch")
|
||||
resp, err := c.client().Do(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.StatusCode/100 != 2 {
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
resp.Body.Close()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, newAPIError(pbCodec, resp.StatusCode, body)
|
||||
}
|
||||
|
||||
w := &watcher{resp.Body}
|
||||
return w, nil
|
||||
}
|
83
vendor/github.com/ericchiang/k8s/codec.go
generated
vendored
Normal file
83
vendor/github.com/ericchiang/k8s/codec.go
generated
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
package k8s
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ericchiang/k8s/runtime"
|
||||
"github.com/golang/protobuf/proto"
|
||||
)
|
||||
|
||||
type codec struct {
|
||||
contentType string
|
||||
marshal func(interface{}) ([]byte, error)
|
||||
unmarshal func([]byte, interface{}) error
|
||||
}
|
||||
|
||||
var (
|
||||
// Kubernetes implements its own custom protobuf format to allow clients (and possibly
|
||||
// servers) to use either JSON or protocol buffers. The protocol introduces a custom content
|
||||
// type and magic bytes to signal the use of protobufs, and wraps each object with API group,
|
||||
// version and resource data.
|
||||
//
|
||||
// The protocol spec which this client implements can be found here:
|
||||
//
|
||||
// https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/protobuf.md
|
||||
//
|
||||
pbCodec = &codec{
|
||||
contentType: "application/vnd.kubernetes.protobuf",
|
||||
marshal: marshalPB,
|
||||
unmarshal: unmarshalPB,
|
||||
}
|
||||
jsonCodec = &codec{
|
||||
contentType: "application/json",
|
||||
marshal: json.Marshal,
|
||||
unmarshal: json.Unmarshal,
|
||||
}
|
||||
)
|
||||
|
||||
var magicBytes = []byte{0x6b, 0x38, 0x73, 0x00}
|
||||
|
||||
func unmarshalPB(b []byte, obj interface{}) error {
|
||||
message, ok := obj.(proto.Message)
|
||||
if !ok {
|
||||
return fmt.Errorf("expected obj of type proto.Message, got %T", obj)
|
||||
}
|
||||
if len(b) < len(magicBytes) {
|
||||
return errors.New("payload is not a kubernetes protobuf object")
|
||||
}
|
||||
if !bytes.Equal(b[:len(magicBytes)], magicBytes) {
|
||||
return errors.New("payload is not a kubernetes protobuf object")
|
||||
}
|
||||
|
||||
u := new(runtime.Unknown)
|
||||
if err := u.Unmarshal(b[len(magicBytes):]); err != nil {
|
||||
return fmt.Errorf("unmarshal unknown: %v", err)
|
||||
}
|
||||
return proto.Unmarshal(u.Raw, message)
|
||||
}
|
||||
|
||||
func marshalPB(obj interface{}) ([]byte, error) {
|
||||
message, ok := obj.(proto.Message)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("expected obj of type proto.Message, got %T", obj)
|
||||
}
|
||||
payload, err := proto.Marshal(message)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// The URL path informs the API server what the API group, version, and resource
|
||||
// of the object. We don't need to specify it here to talk to the API server.
|
||||
body, err := (&runtime.Unknown{Raw: payload}).Marshal()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
d := make([]byte, len(magicBytes)+len(body))
|
||||
copy(d[:len(magicBytes)], magicBytes)
|
||||
copy(d[len(magicBytes):], body)
|
||||
return d, nil
|
||||
}
|
170
vendor/github.com/ericchiang/k8s/config.go
generated
vendored
Normal file
170
vendor/github.com/ericchiang/k8s/config.go
generated
vendored
Normal file
|
@ -0,0 +1,170 @@
|
|||
/*
|
||||
Copyright 2014 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package k8s
|
||||
|
||||
import (
|
||||
"github.com/ericchiang/k8s/runtime"
|
||||
)
|
||||
|
||||
// Where possible, json tags match the cli argument names.
|
||||
// Top level config objects and all values required for proper functioning are not "omitempty". Any truly optional piece of config is allowed to be omitted.
|
||||
|
||||
// Config holds the information needed to build connect to remote kubernetes clusters as a given user
|
||||
type Config struct {
|
||||
// Legacy field from pkg/api/types.go TypeMeta.
|
||||
// TODO(jlowdermilk): remove this after eliminating downstream dependencies.
|
||||
// +optional
|
||||
Kind string `json:"kind,omitempty"`
|
||||
// DEPRECATED: APIVersion is the preferred api version for communicating with the kubernetes cluster (v1, v2, etc).
|
||||
// Because a cluster can run multiple API groups and potentially multiple versions of each, it no longer makes sense to specify
|
||||
// a single value for the cluster version.
|
||||
// This field isn't really needed anyway, so we are deprecating it without replacement.
|
||||
// It will be ignored if it is present.
|
||||
// +optional
|
||||
APIVersion string `json:"apiVersion,omitempty"`
|
||||
// Preferences holds general information to be use for cli interactions
|
||||
Preferences Preferences `json:"preferences"`
|
||||
// Clusters is a map of referencable names to cluster configs
|
||||
Clusters []NamedCluster `json:"clusters"`
|
||||
// AuthInfos is a map of referencable names to user configs
|
||||
AuthInfos []NamedAuthInfo `json:"users"`
|
||||
// Contexts is a map of referencable names to context configs
|
||||
Contexts []NamedContext `json:"contexts"`
|
||||
// CurrentContext is the name of the context that you would like to use by default
|
||||
CurrentContext string `json:"current-context"`
|
||||
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
|
||||
// +optional
|
||||
Extensions []NamedExtension `json:"extensions,omitempty"`
|
||||
}
|
||||
|
||||
type Preferences struct {
|
||||
// +optional
|
||||
Colors bool `json:"colors,omitempty"`
|
||||
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
|
||||
// +optional
|
||||
Extensions []NamedExtension `json:"extensions,omitempty"`
|
||||
}
|
||||
|
||||
// Cluster contains information about how to communicate with a kubernetes cluster
|
||||
type Cluster struct {
|
||||
// Server is the address of the kubernetes cluster (https://hostname:port).
|
||||
Server string `json:"server"`
|
||||
// APIVersion is the preferred api version for communicating with the kubernetes cluster (v1, v2, etc).
|
||||
// +optional
|
||||
APIVersion string `json:"api-version,omitempty"`
|
||||
// InsecureSkipTLSVerify skips the validity check for the server's certificate. This will make your HTTPS connections insecure.
|
||||
// +optional
|
||||
InsecureSkipTLSVerify bool `json:"insecure-skip-tls-verify,omitempty"`
|
||||
// CertificateAuthority is the path to a cert file for the certificate authority.
|
||||
// +optional
|
||||
CertificateAuthority string `json:"certificate-authority,omitempty"`
|
||||
// CertificateAuthorityData contains PEM-encoded certificate authority certificates. Overrides CertificateAuthority
|
||||
// +optional
|
||||
CertificateAuthorityData []byte `json:"certificate-authority-data,omitempty"`
|
||||
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
|
||||
// +optional
|
||||
Extensions []NamedExtension `json:"extensions,omitempty"`
|
||||
}
|
||||
|
||||
// AuthInfo contains information that describes identity information. This is use to tell the kubernetes cluster who you are.
|
||||
type AuthInfo struct {
|
||||
// ClientCertificate is the path to a client cert file for TLS.
|
||||
// +optional
|
||||
ClientCertificate string `json:"client-certificate,omitempty"`
|
||||
// ClientCertificateData contains PEM-encoded data from a client cert file for TLS. Overrides ClientCertificate
|
||||
// +optional
|
||||
ClientCertificateData []byte `json:"client-certificate-data,omitempty"`
|
||||
// ClientKey is the path to a client key file for TLS.
|
||||
// +optional
|
||||
ClientKey string `json:"client-key,omitempty"`
|
||||
// ClientKeyData contains PEM-encoded data from a client key file for TLS. Overrides ClientKey
|
||||
// +optional
|
||||
ClientKeyData []byte `json:"client-key-data,omitempty"`
|
||||
// Token is the bearer token for authentication to the kubernetes cluster.
|
||||
// +optional
|
||||
Token string `json:"token,omitempty"`
|
||||
// TokenFile is a pointer to a file that contains a bearer token (as described above). If both Token and TokenFile are present, Token takes precedence.
|
||||
// +optional
|
||||
TokenFile string `json:"tokenFile,omitempty"`
|
||||
// Impersonate is the username to imperonate. The name matches the flag.
|
||||
// +optional
|
||||
Impersonate string `json:"as,omitempty"`
|
||||
// Username is the username for basic authentication to the kubernetes cluster.
|
||||
// +optional
|
||||
Username string `json:"username,omitempty"`
|
||||
// Password is the password for basic authentication to the kubernetes cluster.
|
||||
// +optional
|
||||
Password string `json:"password,omitempty"`
|
||||
// AuthProvider specifies a custom authentication plugin for the kubernetes cluster.
|
||||
// +optional
|
||||
AuthProvider *AuthProviderConfig `json:"auth-provider,omitempty"`
|
||||
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
|
||||
// +optional
|
||||
Extensions []NamedExtension `json:"extensions,omitempty"`
|
||||
}
|
||||
|
||||
// Context is a tuple of references to a cluster (how do I communicate with a kubernetes cluster), a user (how do I identify myself), and a namespace (what subset of resources do I want to work with)
|
||||
type Context struct {
|
||||
// Cluster is the name of the cluster for this context
|
||||
Cluster string `json:"cluster"`
|
||||
// AuthInfo is the name of the authInfo for this context
|
||||
AuthInfo string `json:"user"`
|
||||
// Namespace is the default namespace to use on unspecified requests
|
||||
// +optional
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
|
||||
// +optional
|
||||
Extensions []NamedExtension `json:"extensions,omitempty"`
|
||||
}
|
||||
|
||||
// NamedCluster relates nicknames to cluster information
|
||||
type NamedCluster struct {
|
||||
// Name is the nickname for this Cluster
|
||||
Name string `json:"name"`
|
||||
// Cluster holds the cluster information
|
||||
Cluster Cluster `json:"cluster"`
|
||||
}
|
||||
|
||||
// NamedContext relates nicknames to context information
|
||||
type NamedContext struct {
|
||||
// Name is the nickname for this Context
|
||||
Name string `json:"name"`
|
||||
// Context holds the context information
|
||||
Context Context `json:"context"`
|
||||
}
|
||||
|
||||
// NamedAuthInfo relates nicknames to auth information
|
||||
type NamedAuthInfo struct {
|
||||
// Name is the nickname for this AuthInfo
|
||||
Name string `json:"name"`
|
||||
// AuthInfo holds the auth information
|
||||
AuthInfo AuthInfo `json:"user"`
|
||||
}
|
||||
|
||||
// NamedExtension relates nicknames to extension information
|
||||
type NamedExtension struct {
|
||||
// Name is the nickname for this Extension
|
||||
Name string `json:"name"`
|
||||
// Extension holds the extension information
|
||||
Extension runtime.RawExtension `json:"extension"`
|
||||
}
|
||||
|
||||
// AuthProviderConfig holds the configuration for a specified auth provider.
|
||||
type AuthProviderConfig struct {
|
||||
Name string `json:"name"`
|
||||
Config map[string]string `json:"config"`
|
||||
}
|
63
vendor/github.com/ericchiang/k8s/discovery.go
generated
vendored
Normal file
63
vendor/github.com/ericchiang/k8s/discovery.go
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
package k8s
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
|
||||
"github.com/ericchiang/k8s/api/unversioned"
|
||||
)
|
||||
|
||||
type Version struct {
|
||||
Major string `json:"major"`
|
||||
Minor string `json:"minor"`
|
||||
GitVersion string `json:"gitVersion"`
|
||||
GitCommit string `json:"gitCommit"`
|
||||
GitTreeState string `json:"gitTreeState"`
|
||||
BuildDate string `json:"buildDate"`
|
||||
GoVersion string `json:"goVersion"`
|
||||
Compiler string `json:"compiler"`
|
||||
Platform string `json:"platform"`
|
||||
}
|
||||
|
||||
func (c *Client) Discovery() *Discovery {
|
||||
return &Discovery{c}
|
||||
}
|
||||
|
||||
// Discovery is a client used to determine the API version and supported
|
||||
// resources of the server.
|
||||
type Discovery struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
func (d *Discovery) Version(ctx context.Context) (*Version, error) {
|
||||
var v Version
|
||||
if err := d.client.get(ctx, jsonCodec, d.client.urlForPath("version"), &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v, nil
|
||||
}
|
||||
|
||||
func (d *Discovery) APIGroups(ctx context.Context) (*unversioned.APIGroupList, error) {
|
||||
var groups unversioned.APIGroupList
|
||||
if err := d.client.get(ctx, pbCodec, d.client.urlForPath("apis"), &groups); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &groups, nil
|
||||
}
|
||||
|
||||
func (d *Discovery) APIGroup(ctx context.Context, name string) (*unversioned.APIGroup, error) {
|
||||
var group unversioned.APIGroup
|
||||
if err := d.client.get(ctx, pbCodec, d.client.urlForPath(path.Join("apis", name)), &group); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &group, nil
|
||||
}
|
||||
|
||||
func (d *Discovery) APIResources(ctx context.Context, groupName, groupVersion string) (*unversioned.APIResourceList, error) {
|
||||
var list unversioned.APIResourceList
|
||||
if err := d.client.get(ctx, pbCodec, d.client.urlForPath(path.Join("apis", groupName, groupVersion)), &list); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &list, nil
|
||||
|
||||
}
|
110
vendor/github.com/ericchiang/k8s/gen.sh
generated
vendored
Executable file
110
vendor/github.com/ericchiang/k8s/gen.sh
generated
vendored
Executable file
|
@ -0,0 +1,110 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
# Clean up any existing build.
|
||||
rm -rf assets/k8s.io
|
||||
mkdir -p assets/k8s.io/kubernetes
|
||||
|
||||
VERSIONS=( "1.4.7" "1.5.1" "1.6.0-rc.1" )
|
||||
|
||||
for VERSION in ${VERSIONS[@]}; do
|
||||
if [ ! -f assets/v${VERSION}.zip ]; then
|
||||
wget https://github.com/kubernetes/kubernetes/archive/v${VERSION}.zip -O assets/v${VERSION}.zip
|
||||
fi
|
||||
|
||||
# Copy source tree to assets/k8s.io/kubernetes. Newer versions overwrite existing ones.
|
||||
unzip -q assets/v${VERSION}.zip -d assets/
|
||||
cp -r assets/kubernetes-${VERSION}/* assets/k8s.io/kubernetes
|
||||
rm -rf assets/kubernetes-${VERSION}
|
||||
done
|
||||
|
||||
# Rewrite API machinery files to their equivalent.
|
||||
apimachinery=assets/k8s.io/kubernetes/staging/src/k8s.io/apimachinery/
|
||||
for file in $( find $apimachinery -type f -name '*.proto' ); do
|
||||
path=assets/k8s.io/kubernetes/${file#$apimachinery}
|
||||
mkdir -p $(dirname $path)
|
||||
mv $file $path
|
||||
done
|
||||
|
||||
# Remove any existing generated code.
|
||||
rm -rf api apis config.go runtime util types.go watch
|
||||
|
||||
# Generate Go code from proto definitions.
|
||||
PKG=$PWD
|
||||
cd assets
|
||||
|
||||
protobuf=$( find k8s.io/kubernetes/pkg/{api,apis,util,runtime,watch} -name '*.proto' )
|
||||
|
||||
# Remote this ununused import:
|
||||
# https://github.com/kubernetes/kubernetes/blob/v1.6.0-rc.1/pkg/api/v1/generated.proto#L29
|
||||
sed -i '/"k8s\.io\/apiserver\/pkg\/apis\/example\/v1\/generated.proto"/d' $protobuf
|
||||
|
||||
# Rewrite all of the API machineary out of staging.
|
||||
sed -i 's|"k8s.io/apimachinery/|"k8s.io/kubernetes/|g' $protobuf
|
||||
sed -i 's/k8s\.io.apimachinery/k8s\.io.kubernetes/g' $protobuf
|
||||
|
||||
for file in $protobuf; do
|
||||
echo $file
|
||||
# Generate protoc definitions at the base of this repo.
|
||||
protoc --gofast_out=$PKG $file
|
||||
done
|
||||
|
||||
cd -
|
||||
|
||||
mv k8s.io/kubernetes/pkg/* .
|
||||
rm -rf k8s.io
|
||||
|
||||
# Copy kubeconfig structs.
|
||||
client_dir="client/unversioned/clientcmd/api/v1"
|
||||
cp assets/k8s.io/kubernetes/pkg/${client_dir}/types.go config.go
|
||||
sed -i 's|package v1|package k8s|g' config.go
|
||||
|
||||
# Rewrite imports for the generated fiels.
|
||||
sed -i 's|"k8s.io/kubernetes/pkg|"github.com/ericchiang/k8s|g' $( find {api,apis,config.go,util,runtime,watch} -name '*.go' )
|
||||
sed -i 's|"k8s.io.kubernetes.pkg.|"github.com/ericchiang.k8s.|g' $( find {api,apis,config.go,util,runtime,watch} -name '*.go' )
|
||||
|
||||
# Clean up assets.
|
||||
rm -rf assets/k8s.io
|
||||
|
||||
# Generate HTTP clients from Go structs.
|
||||
go run gen.go
|
||||
|
||||
# Fix JSON marshaling for types need by third party resources.
|
||||
cat << EOF >> api/unversioned/time.go
|
||||
package unversioned
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
// JSON marshaling logic for the Time type. Need to make
|
||||
// third party resources JSON work.
|
||||
|
||||
func (t Time) MarshalJSON() ([]byte, error) {
|
||||
var seconds, nanos int64
|
||||
if t.Seconds != nil {
|
||||
seconds = *t.Seconds
|
||||
}
|
||||
if t.Nanos != nil {
|
||||
nanos = int64(*t.Nanos)
|
||||
}
|
||||
return json.Marshal(time.Unix(seconds, nanos))
|
||||
}
|
||||
|
||||
func (t *Time) UnmarshalJSON(p []byte) error {
|
||||
var t1 time.Time
|
||||
if err := json.Unmarshal(p, &t1); err != nil {
|
||||
return err
|
||||
}
|
||||
seconds := t1.Unix()
|
||||
nanos := int32(t1.UnixNano())
|
||||
t.Seconds = &seconds
|
||||
t.Nanos = &nanos
|
||||
return nil
|
||||
}
|
||||
EOF
|
||||
gofmt -w api/unversioned/time.go
|
||||
cp api/unversioned/time.go apis/meta/v1
|
||||
sed -i 's|package unversioned|package v1|g' apis/meta/v1/time.go
|
93
vendor/github.com/ericchiang/k8s/labels.go
generated
vendored
Normal file
93
vendor/github.com/ericchiang/k8s/labels.go
generated
vendored
Normal file
|
@ -0,0 +1,93 @@
|
|||
package k8s
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
qnameCharFmt string = "[A-Za-z0-9]"
|
||||
qnameExtCharFmt string = "[-A-Za-z0-9_./]"
|
||||
qualifiedNameFmt string = "(" + qnameCharFmt + qnameExtCharFmt + "*)?" + qnameCharFmt
|
||||
qualifiedNameMaxLength int = 63
|
||||
labelValueFmt string = "(" + qualifiedNameFmt + ")?"
|
||||
)
|
||||
|
||||
var labelValueRegexp = regexp.MustCompile("^" + labelValueFmt + "$")
|
||||
|
||||
// LabelSelector represents a Kubernetes label selector.
|
||||
//
|
||||
// Any values that don't conform to Kubernetes label value restrictions
|
||||
// will be silently dropped.
|
||||
//
|
||||
// l := new(k8s.LabelSelector)
|
||||
// l.Eq("component", "frontend")
|
||||
// l.In("type", "prod", "staging")
|
||||
//
|
||||
type LabelSelector struct {
|
||||
stmts []string
|
||||
}
|
||||
|
||||
type labelSelectorOption string
|
||||
|
||||
func (l labelSelectorOption) queryParam() (string, string) {
|
||||
return "labelSelector", string(l)
|
||||
}
|
||||
|
||||
func (l *LabelSelector) Selector() Option {
|
||||
return labelSelectorOption(l.encode())
|
||||
}
|
||||
|
||||
func (l *LabelSelector) encode() string {
|
||||
return strings.Join(l.stmts, ",")
|
||||
}
|
||||
|
||||
func validLabelValue(s string) bool {
|
||||
if len(s) > 63 || len(s) == 0 {
|
||||
return false
|
||||
}
|
||||
return labelValueRegexp.MatchString(s)
|
||||
}
|
||||
|
||||
// Eq selects labels which have the key and the key has the provide value.
|
||||
func (l *LabelSelector) Eq(key, val string) {
|
||||
if !validLabelValue(key) || !validLabelValue(val) {
|
||||
return
|
||||
}
|
||||
l.stmts = append(l.stmts, key+"="+val)
|
||||
}
|
||||
|
||||
// NotEq selects labels where the key is present and has a different value
|
||||
// than the value provided.
|
||||
func (l *LabelSelector) NotEq(key, val string) {
|
||||
if !validLabelValue(key) || !validLabelValue(val) {
|
||||
return
|
||||
}
|
||||
l.stmts = append(l.stmts, key+"!="+val)
|
||||
}
|
||||
|
||||
// In selects labels which have the key and the key has one of the provided values.
|
||||
func (l *LabelSelector) In(key string, vals ...string) {
|
||||
if !validLabelValue(key) || len(vals) == 0 {
|
||||
return
|
||||
}
|
||||
for _, val := range vals {
|
||||
if !validLabelValue(val) {
|
||||
return
|
||||
}
|
||||
}
|
||||
l.stmts = append(l.stmts, key+" in ("+strings.Join(vals, ", ")+")")
|
||||
}
|
||||
|
||||
// NotIn selects labels which have the key and the key is not one of the provided values.
|
||||
func (l *LabelSelector) NotIn(key string, vals ...string) {
|
||||
if !validLabelValue(key) || len(vals) == 0 {
|
||||
return
|
||||
}
|
||||
for _, val := range vals {
|
||||
if !validLabelValue(val) {
|
||||
return
|
||||
}
|
||||
}
|
||||
l.stmts = append(l.stmts, key+" notin ("+strings.Join(vals, ", ")+")")
|
||||
}
|
905
vendor/github.com/ericchiang/k8s/runtime/generated.pb.go
generated
vendored
Normal file
905
vendor/github.com/ericchiang/k8s/runtime/generated.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,905 @@
|
|||
// Code generated by protoc-gen-gogo.
|
||||
// source: k8s.io/kubernetes/pkg/runtime/generated.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package runtime is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/pkg/runtime/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
RawExtension
|
||||
TypeMeta
|
||||
Unknown
|
||||
*/
|
||||
package runtime
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "github.com/ericchiang/k8s/util/intstr"
|
||||
|
||||
import io "io"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
// RawExtension is used to hold extensions in external versions.
|
||||
//
|
||||
// To use this, make a field which has RawExtension as its type in your external, versioned
|
||||
// struct, and Object in your internal struct. You also need to register your
|
||||
// various plugin types.
|
||||
//
|
||||
// // Internal package:
|
||||
// type MyAPIObject struct {
|
||||
// runtime.TypeMeta `json:",inline"`
|
||||
// MyPlugin runtime.Object `json:"myPlugin"`
|
||||
// }
|
||||
// type PluginA struct {
|
||||
// AOption string `json:"aOption"`
|
||||
// }
|
||||
//
|
||||
// // External package:
|
||||
// type MyAPIObject struct {
|
||||
// runtime.TypeMeta `json:",inline"`
|
||||
// MyPlugin runtime.RawExtension `json:"myPlugin"`
|
||||
// }
|
||||
// type PluginA struct {
|
||||
// AOption string `json:"aOption"`
|
||||
// }
|
||||
//
|
||||
// // On the wire, the JSON will look something like this:
|
||||
// {
|
||||
// "kind":"MyAPIObject",
|
||||
// "apiVersion":"v1",
|
||||
// "myPlugin": {
|
||||
// "kind":"PluginA",
|
||||
// "aOption":"foo",
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// So what happens? Decode first uses json or yaml to unmarshal the serialized data into
|
||||
// your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked.
|
||||
// The next step is to copy (using pkg/conversion) into the internal struct. The runtime
|
||||
// package's DefaultScheme has conversion functions installed which will unpack the
|
||||
// JSON stored in RawExtension, turning it into the correct object type, and storing it
|
||||
// in the Object. (TODO: In the case where the object is of an unknown type, a
|
||||
// runtime.Unknown object will be created and stored.)
|
||||
//
|
||||
// +k8s:deepcopy-gen=true
|
||||
// +protobuf=true
|
||||
// +k8s:openapi-gen=true
|
||||
type RawExtension struct {
|
||||
// Raw is the underlying serialization of this object.
|
||||
//
|
||||
// TODO: Determine how to detect ContentType and ContentEncoding of 'Raw' data.
|
||||
Raw []byte `protobuf:"bytes,1,opt,name=raw" json:"raw,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *RawExtension) Reset() { *m = RawExtension{} }
|
||||
func (m *RawExtension) String() string { return proto.CompactTextString(m) }
|
||||
func (*RawExtension) ProtoMessage() {}
|
||||
func (*RawExtension) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
|
||||
func (m *RawExtension) GetRaw() []byte {
|
||||
if m != nil {
|
||||
return m.Raw
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// TypeMeta is shared by all top level objects. The proper way to use it is to inline it in your type,
|
||||
// like this:
|
||||
// type MyAwesomeAPIObject struct {
|
||||
// runtime.TypeMeta `json:",inline"`
|
||||
// ... // other fields
|
||||
// }
|
||||
// func (obj *MyAwesomeAPIObject) SetGroupVersionKind(gvk *metav1.GroupVersionKind) { metav1.UpdateTypeMeta(obj,gvk) }; GroupVersionKind() *GroupVersionKind
|
||||
//
|
||||
// TypeMeta is provided here for convenience. You may use it directly from this package or define
|
||||
// your own with the same fields.
|
||||
//
|
||||
// +k8s:deepcopy-gen=true
|
||||
// +protobuf=true
|
||||
// +k8s:openapi-gen=true
|
||||
type TypeMeta struct {
|
||||
// +optional
|
||||
ApiVersion *string `protobuf:"bytes,1,opt,name=apiVersion" json:"apiVersion,omitempty"`
|
||||
// +optional
|
||||
Kind *string `protobuf:"bytes,2,opt,name=kind" json:"kind,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *TypeMeta) Reset() { *m = TypeMeta{} }
|
||||
func (m *TypeMeta) String() string { return proto.CompactTextString(m) }
|
||||
func (*TypeMeta) ProtoMessage() {}
|
||||
func (*TypeMeta) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} }
|
||||
|
||||
func (m *TypeMeta) GetApiVersion() string {
|
||||
if m != nil && m.ApiVersion != nil {
|
||||
return *m.ApiVersion
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *TypeMeta) GetKind() string {
|
||||
if m != nil && m.Kind != nil {
|
||||
return *m.Kind
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Unknown allows api objects with unknown types to be passed-through. This can be used
|
||||
// to deal with the API objects from a plug-in. Unknown objects still have functioning
|
||||
// TypeMeta features-- kind, version, etc.
|
||||
// TODO: Make this object have easy access to field based accessors and settors for
|
||||
// metadata and field mutatation.
|
||||
//
|
||||
// +k8s:deepcopy-gen=true
|
||||
// +protobuf=true
|
||||
// +k8s:openapi-gen=true
|
||||
type Unknown struct {
|
||||
TypeMeta *TypeMeta `protobuf:"bytes,1,opt,name=typeMeta" json:"typeMeta,omitempty"`
|
||||
// Raw will hold the complete serialized object which couldn't be matched
|
||||
// with a registered type. Most likely, nothing should be done with this
|
||||
// except for passing it through the system.
|
||||
Raw []byte `protobuf:"bytes,2,opt,name=raw" json:"raw,omitempty"`
|
||||
// ContentEncoding is encoding used to encode 'Raw' data.
|
||||
// Unspecified means no encoding.
|
||||
ContentEncoding *string `protobuf:"bytes,3,opt,name=contentEncoding" json:"contentEncoding,omitempty"`
|
||||
// ContentType is serialization method used to serialize 'Raw'.
|
||||
// Unspecified means ContentTypeJSON.
|
||||
ContentType *string `protobuf:"bytes,4,opt,name=contentType" json:"contentType,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Unknown) Reset() { *m = Unknown{} }
|
||||
func (m *Unknown) String() string { return proto.CompactTextString(m) }
|
||||
func (*Unknown) ProtoMessage() {}
|
||||
func (*Unknown) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} }
|
||||
|
||||
func (m *Unknown) GetTypeMeta() *TypeMeta {
|
||||
if m != nil {
|
||||
return m.TypeMeta
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Unknown) GetRaw() []byte {
|
||||
if m != nil {
|
||||
return m.Raw
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Unknown) GetContentEncoding() string {
|
||||
if m != nil && m.ContentEncoding != nil {
|
||||
return *m.ContentEncoding
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Unknown) GetContentType() string {
|
||||
if m != nil && m.ContentType != nil {
|
||||
return *m.ContentType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*RawExtension)(nil), "github.com/ericchiang.k8s.runtime.RawExtension")
|
||||
proto.RegisterType((*TypeMeta)(nil), "github.com/ericchiang.k8s.runtime.TypeMeta")
|
||||
proto.RegisterType((*Unknown)(nil), "github.com/ericchiang.k8s.runtime.Unknown")
|
||||
}
|
||||
func (m *RawExtension) 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 *RawExtension) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Raw != nil {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Raw)))
|
||||
i += copy(dAtA[i:], m.Raw)
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *TypeMeta) 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 *TypeMeta) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.ApiVersion != nil {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ApiVersion)))
|
||||
i += copy(dAtA[i:], *m.ApiVersion)
|
||||
}
|
||||
if m.Kind != nil {
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Kind)))
|
||||
i += copy(dAtA[i:], *m.Kind)
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *Unknown) 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 *Unknown) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.TypeMeta != nil {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.TypeMeta.Size()))
|
||||
n1, err := m.TypeMeta.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n1
|
||||
}
|
||||
if m.Raw != nil {
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Raw)))
|
||||
i += copy(dAtA[i:], m.Raw)
|
||||
}
|
||||
if m.ContentEncoding != nil {
|
||||
dAtA[i] = 0x1a
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ContentEncoding)))
|
||||
i += copy(dAtA[i:], *m.ContentEncoding)
|
||||
}
|
||||
if m.ContentType != nil {
|
||||
dAtA[i] = 0x22
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ContentType)))
|
||||
i += copy(dAtA[i:], *m.ContentType)
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func encodeFixed64Generated(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
dAtA[offset+4] = uint8(v >> 32)
|
||||
dAtA[offset+5] = uint8(v >> 40)
|
||||
dAtA[offset+6] = uint8(v >> 48)
|
||||
dAtA[offset+7] = uint8(v >> 56)
|
||||
return offset + 8
|
||||
}
|
||||
func encodeFixed32Generated(dAtA []byte, offset int, v uint32) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
return offset + 4
|
||||
}
|
||||
func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
}
|
||||
func (m *RawExtension) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if m.Raw != nil {
|
||||
l = len(m.Raw)
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *TypeMeta) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if m.ApiVersion != nil {
|
||||
l = len(*m.ApiVersion)
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if m.Kind != nil {
|
||||
l = len(*m.Kind)
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *Unknown) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if m.TypeMeta != nil {
|
||||
l = m.TypeMeta.Size()
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if m.Raw != nil {
|
||||
l = len(m.Raw)
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if m.ContentEncoding != nil {
|
||||
l = len(*m.ContentEncoding)
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if m.ContentType != nil {
|
||||
l = len(*m.ContentType)
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovGenerated(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
func sozGenerated(x uint64) (n int) {
|
||||
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *RawExtension) 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: RawExtension: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: RawExtension: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Raw = append(m.Raw[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Raw == nil {
|
||||
m.Raw = []byte{}
|
||||
}
|
||||
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
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *TypeMeta) 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: TypeMeta: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: TypeMeta: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ApiVersion", 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
|
||||
}
|
||||
s := string(dAtA[iNdEx:postIndex])
|
||||
m.ApiVersion = &s
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Kind", 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
|
||||
}
|
||||
s := string(dAtA[iNdEx:postIndex])
|
||||
m.Kind = &s
|
||||
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
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Unknown) 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: Unknown: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Unknown: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field TypeMeta", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.TypeMeta == nil {
|
||||
m.TypeMeta = &TypeMeta{}
|
||||
}
|
||||
if err := m.TypeMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Raw = append(m.Raw[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Raw == nil {
|
||||
m.Raw = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ContentEncoding", 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
|
||||
}
|
||||
s := string(dAtA[iNdEx:postIndex])
|
||||
m.ContentEncoding = &s
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ContentType", 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
|
||||
}
|
||||
s := string(dAtA[iNdEx:postIndex])
|
||||
m.ContentType = &s
|
||||
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
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipGenerated(dAtA[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("github.com/ericchiang/k8s/runtime/generated.proto", fileDescriptorGenerated)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 275 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x8f, 0xc1, 0x4a, 0xc3, 0x40,
|
||||
0x10, 0x86, 0xdd, 0xb6, 0xd0, 0x3a, 0x2d, 0x28, 0x7b, 0x8a, 0x82, 0x21, 0xe4, 0x62, 0x2f, 0x6e,
|
||||
0xd0, 0x93, 0x27, 0x0f, 0x4a, 0x8f, 0x5e, 0x82, 0x7a, 0xf0, 0x16, 0x9b, 0x21, 0x2c, 0xab, 0xb3,
|
||||
0x61, 0x33, 0x21, 0xfa, 0x26, 0x3e, 0x84, 0x0f, 0xe2, 0xd1, 0x47, 0x90, 0xf8, 0x22, 0x92, 0x35,
|
||||
0xad, 0xa5, 0x88, 0xb7, 0xe1, 0xdf, 0x6f, 0xfe, 0xfd, 0x06, 0x4e, 0xcc, 0x79, 0xa5, 0xb4, 0x4d,
|
||||
0x4c, 0xfd, 0x80, 0x8e, 0x90, 0xb1, 0x4a, 0x4a, 0x53, 0x24, 0xae, 0x26, 0xd6, 0x4f, 0x98, 0x14,
|
||||
0x48, 0xe8, 0x32, 0xc6, 0x5c, 0x95, 0xce, 0xb2, 0x95, 0x47, 0x3f, 0xb8, 0xfa, 0xc5, 0x55, 0x69,
|
||||
0x0a, 0xd5, 0xe3, 0x87, 0xa7, 0x7f, 0xb7, 0xd5, 0xac, 0x1f, 0x13, 0x4d, 0x5c, 0xb1, 0xdb, 0x6e,
|
||||
0x8c, 0x23, 0x98, 0xa5, 0x59, 0xb3, 0x78, 0x66, 0xa4, 0x4a, 0x5b, 0x92, 0xfb, 0x30, 0x74, 0x59,
|
||||
0x13, 0x88, 0x48, 0xcc, 0x67, 0x69, 0x37, 0xc6, 0x17, 0x30, 0xb9, 0x79, 0x29, 0xf1, 0x1a, 0x39,
|
||||
0x93, 0x21, 0x40, 0x56, 0xea, 0x3b, 0x74, 0x1d, 0xeb, 0xa1, 0xdd, 0x74, 0x23, 0x91, 0x12, 0x46,
|
||||
0x46, 0x53, 0x1e, 0x0c, 0xfc, 0x8b, 0x9f, 0xe3, 0x37, 0x01, 0xe3, 0x5b, 0x32, 0x64, 0x1b, 0x92,
|
||||
0x57, 0x30, 0xe1, 0xbe, 0xcb, 0x6f, 0x4f, 0xcf, 0x8e, 0xd5, 0xbf, 0x27, 0xa9, 0xd5, 0xd7, 0xe9,
|
||||
0x7a, 0x71, 0xa5, 0x38, 0x58, 0x2b, 0xca, 0x39, 0xec, 0x2d, 0x2d, 0x31, 0x12, 0x2f, 0x68, 0x69,
|
||||
0x73, 0x4d, 0x45, 0x30, 0xf4, 0x06, 0xdb, 0xb1, 0x8c, 0x60, 0xda, 0x47, 0x5d, 0x71, 0x30, 0xf2,
|
||||
0xd4, 0x66, 0x74, 0x79, 0xf0, 0xde, 0x86, 0xe2, 0xa3, 0x0d, 0xc5, 0x67, 0x1b, 0x8a, 0xd7, 0xaf,
|
||||
0x70, 0xe7, 0x7e, 0xdc, 0xbb, 0x7c, 0x07, 0x00, 0x00, 0xff, 0xff, 0x56, 0xe9, 0xf9, 0xae, 0xad,
|
||||
0x01, 0x00, 0x00,
|
||||
}
|
46
vendor/github.com/ericchiang/k8s/runtime/schema/generated.pb.go
generated
vendored
Normal file
46
vendor/github.com/ericchiang/k8s/runtime/schema/generated.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Code generated by protoc-gen-gogo.
|
||||
// source: k8s.io/kubernetes/pkg/runtime/schema/generated.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package schema is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/pkg/runtime/schema/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
*/
|
||||
package schema
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "github.com/ericchiang/k8s/util/intstr"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("github.com/ericchiang/k8s/runtime/schema/generated.proto", fileDescriptorGenerated)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 136 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x32, 0xc9, 0xb6, 0x28, 0xd6,
|
||||
0xcb, 0xcc, 0xd7, 0xcf, 0x2e, 0x4d, 0x4a, 0x2d, 0xca, 0x4b, 0x2d, 0x49, 0x2d, 0xd6, 0x2f, 0xc8,
|
||||
0x4e, 0xd7, 0x2f, 0x2a, 0xcd, 0x2b, 0xc9, 0xcc, 0x4d, 0xd5, 0x2f, 0x4e, 0xce, 0x48, 0xcd, 0x4d,
|
||||
0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0x4a, 0x2c, 0x49, 0x4d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9,
|
||||
0x17, 0x52, 0x81, 0xe8, 0xd2, 0x43, 0xe8, 0xd2, 0x2b, 0xc8, 0x4e, 0xd7, 0x83, 0xea, 0xd2, 0x83,
|
||||
0xe8, 0x92, 0x32, 0xc4, 0x6e, 0x76, 0x69, 0x49, 0x66, 0x8e, 0x7e, 0x66, 0x5e, 0x49, 0x71, 0x49,
|
||||
0x11, 0xba, 0xc1, 0x4e, 0x12, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91,
|
||||
0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x6c, 0x10, 0xc3, 0x00, 0x01, 0x00, 0x00, 0xff, 0xff,
|
||||
0xea, 0x33, 0x0e, 0xbb, 0xa9, 0x00, 0x00, 0x00,
|
||||
}
|
163
vendor/github.com/ericchiang/k8s/tprs.go
generated
vendored
Normal file
163
vendor/github.com/ericchiang/k8s/tprs.go
generated
vendored
Normal file
|
@ -0,0 +1,163 @@
|
|||
package k8s
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/ericchiang/k8s/api/v1"
|
||||
metav1 "github.com/ericchiang/k8s/apis/meta/v1"
|
||||
)
|
||||
|
||||
// ThirdPartyResources is a client used for interacting with user
|
||||
// defined API groups. It uses JSON encoding instead of protobufs
|
||||
// which are unsupported for these APIs.
|
||||
//
|
||||
// Users are expected to define their own third party resources.
|
||||
//
|
||||
// const metricsResource = "metrics"
|
||||
//
|
||||
// // First, define a third party resources with TypeMeta
|
||||
// // and ObjectMeta fields.
|
||||
// type Metric struct {
|
||||
// *unversioned.TypeMeta `json:",inline"`
|
||||
// *v1.ObjectMeta `json:"metadata,omitempty"`
|
||||
//
|
||||
// Timestamp time.Time `json:"timestamp"`
|
||||
// Value []byte `json:"value"`
|
||||
// }
|
||||
//
|
||||
// // Define a list wrapper.
|
||||
// type MetricsList struct {
|
||||
// *unversioned.TypeMeta `json:",inline"`
|
||||
// *unversioned.ListMeta `json:"metadata,omitempty"`
|
||||
//
|
||||
// Items []Metric `json:"items"`
|
||||
// }
|
||||
//
|
||||
// Register the new resource by creating a ThirdPartyResource type.
|
||||
//
|
||||
// // Create a ThirdPartyResource
|
||||
// tpr := &v1beta1.ThirdPartyResource{
|
||||
// Metadata: &v1.ObjectMeta{
|
||||
// Name: k8s.String("metric.metrics.example.com"),
|
||||
// },
|
||||
// Description: k8s.String("A custom third party resource"),
|
||||
// Versions: []*v1beta1.APIVersion{
|
||||
// {Name: k8s.String("v1")},
|
||||
// },
|
||||
// }
|
||||
// _, err := client.ExtensionsV1Beta1().CreateThirdPartyResource(ctx, trp)
|
||||
// if err != nil {
|
||||
// // handle error
|
||||
// }
|
||||
//
|
||||
// After creating the resource type, create a ThirdPartyResources client then
|
||||
// use interact with it like any other API group. For example to create a third
|
||||
// party resource:
|
||||
//
|
||||
// metricsClient := client.ThirdPartyResources("metrics.example.com", "v1")
|
||||
//
|
||||
// metric := &Metric{
|
||||
// ObjectMeta: &v1.ObjectMeta{
|
||||
// Name: k8s.String("foo"),
|
||||
// },
|
||||
// Timestamp: time.Now(),
|
||||
// Value: 42,
|
||||
// }
|
||||
//
|
||||
// err = metricsClient.Create(ctx, metricsResource, client.Namespace, metric, metric)
|
||||
// if err != nil {
|
||||
// // handle error
|
||||
// }
|
||||
//
|
||||
// List a set of third party resources:
|
||||
//
|
||||
// var metrics MetricsList
|
||||
// metricsClient.List(ctx, metricsResource, &metrics)
|
||||
//
|
||||
// Or delete:
|
||||
//
|
||||
// tprClient.Delete(ctx, metricsResource, client.Namespace, *metric.Name)
|
||||
//
|
||||
type ThirdPartyResources struct {
|
||||
c *Client
|
||||
|
||||
apiGroup string
|
||||
apiVersion string
|
||||
}
|
||||
|
||||
// ThirdPartyResources returns a client for interacting with a ThirdPartyResource
|
||||
// API group.
|
||||
func (c *Client) ThirdPartyResources(apiGroup, apiVersion string) *ThirdPartyResources {
|
||||
return &ThirdPartyResources{c, apiGroup, apiVersion}
|
||||
}
|
||||
|
||||
func checkResource(apiGroup, apiVersion, resource, namespace, name string) error {
|
||||
if apiGroup == "" {
|
||||
return errors.New("no api group provided")
|
||||
}
|
||||
if apiVersion == "" {
|
||||
return errors.New("no api version provided")
|
||||
}
|
||||
if resource == "" {
|
||||
return errors.New("no resource version provided")
|
||||
}
|
||||
if name == "" {
|
||||
return errors.New("no resource name provided")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// object and after16Object are used by go/types to detect types that are likely
|
||||
// to be Kubernetes resources. Types that implement this resources are likely
|
||||
// resource.
|
||||
//
|
||||
// They're defined here but only used in gen.go.
|
||||
type object interface {
|
||||
GetMetadata() *v1.ObjectMeta
|
||||
}
|
||||
|
||||
// after16Object uses the new ObjectMeta's home.
|
||||
type after16Object interface {
|
||||
GetMetadata() *metav1.ObjectMeta
|
||||
}
|
||||
|
||||
func (t *ThirdPartyResources) Create(ctx context.Context, resource, namespace string, req, resp interface{}) error {
|
||||
if err := checkResource(t.apiGroup, t.apiVersion, resource, namespace, "not required"); err != nil {
|
||||
return err
|
||||
}
|
||||
url := t.c.urlFor(t.apiGroup, t.apiVersion, namespace, resource, "")
|
||||
return t.c.create(ctx, jsonCodec, "POST", url, req, resp)
|
||||
}
|
||||
|
||||
func (t *ThirdPartyResources) Update(ctx context.Context, resource, namespace, name string, req, resp interface{}) error {
|
||||
if err := checkResource(t.apiGroup, t.apiVersion, resource, namespace, "not required"); err != nil {
|
||||
return err
|
||||
}
|
||||
url := t.c.urlFor(t.apiGroup, t.apiVersion, namespace, resource, name)
|
||||
return t.c.create(ctx, jsonCodec, "PUT", url, req, resp)
|
||||
}
|
||||
|
||||
func (t *ThirdPartyResources) Get(ctx context.Context, resource, namespace, name string, resp interface{}) error {
|
||||
if err := checkResource(t.apiGroup, t.apiVersion, resource, namespace, name); err != nil {
|
||||
return err
|
||||
}
|
||||
url := t.c.urlFor(t.apiGroup, t.apiVersion, namespace, resource, name)
|
||||
return t.c.get(ctx, jsonCodec, url, resp)
|
||||
}
|
||||
|
||||
func (t *ThirdPartyResources) Delete(ctx context.Context, resource, namespace, name string) error {
|
||||
if err := checkResource(t.apiGroup, t.apiVersion, resource, namespace, name); err != nil {
|
||||
return err
|
||||
}
|
||||
url := t.c.urlFor(t.apiGroup, t.apiVersion, namespace, resource, name)
|
||||
return t.c.delete(ctx, jsonCodec, url)
|
||||
}
|
||||
|
||||
func (t *ThirdPartyResources) List(ctx context.Context, resource, namespace string, resp interface{}) error {
|
||||
if err := checkResource(t.apiGroup, t.apiVersion, resource, namespace, "name not required"); err != nil {
|
||||
return err
|
||||
}
|
||||
url := t.c.urlFor(t.apiGroup, t.apiVersion, namespace, resource, "")
|
||||
return t.c.get(ctx, jsonCodec, url, resp)
|
||||
}
|
7091
vendor/github.com/ericchiang/k8s/types.go
generated
vendored
Normal file
7091
vendor/github.com/ericchiang/k8s/types.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
418
vendor/github.com/ericchiang/k8s/util/intstr/generated.pb.go
generated
vendored
Normal file
418
vendor/github.com/ericchiang/k8s/util/intstr/generated.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,418 @@
|
|||
// Code generated by protoc-gen-gogo.
|
||||
// source: k8s.io/kubernetes/pkg/util/intstr/generated.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package intstr is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/pkg/util/intstr/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
IntOrString
|
||||
*/
|
||||
package intstr
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
import io "io"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
// IntOrString is a type that can hold an int32 or a string. When used in
|
||||
// JSON or YAML marshalling and unmarshalling, it produces or consumes the
|
||||
// inner type. This allows you to have, for example, a JSON field that can
|
||||
// accept a name or number.
|
||||
// TODO: Rename to Int32OrString
|
||||
//
|
||||
// +protobuf=true
|
||||
// +protobuf.options.(gogoproto.goproto_stringer)=false
|
||||
// +k8s:openapi-gen=true
|
||||
type IntOrString struct {
|
||||
Type *int64 `protobuf:"varint,1,opt,name=type" json:"type,omitempty"`
|
||||
IntVal *int32 `protobuf:"varint,2,opt,name=intVal" json:"intVal,omitempty"`
|
||||
StrVal *string `protobuf:"bytes,3,opt,name=strVal" json:"strVal,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *IntOrString) Reset() { *m = IntOrString{} }
|
||||
func (m *IntOrString) String() string { return proto.CompactTextString(m) }
|
||||
func (*IntOrString) ProtoMessage() {}
|
||||
func (*IntOrString) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
|
||||
func (m *IntOrString) GetType() int64 {
|
||||
if m != nil && m.Type != nil {
|
||||
return *m.Type
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *IntOrString) GetIntVal() int32 {
|
||||
if m != nil && m.IntVal != nil {
|
||||
return *m.IntVal
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *IntOrString) GetStrVal() string {
|
||||
if m != nil && m.StrVal != nil {
|
||||
return *m.StrVal
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*IntOrString)(nil), "github.com/ericchiang.k8s.util.intstr.IntOrString")
|
||||
}
|
||||
func (m *IntOrString) 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 *IntOrString) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Type != nil {
|
||||
dAtA[i] = 0x8
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(*m.Type))
|
||||
}
|
||||
if m.IntVal != nil {
|
||||
dAtA[i] = 0x10
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(*m.IntVal))
|
||||
}
|
||||
if m.StrVal != nil {
|
||||
dAtA[i] = 0x1a
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(*m.StrVal)))
|
||||
i += copy(dAtA[i:], *m.StrVal)
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func encodeFixed64Generated(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
dAtA[offset+4] = uint8(v >> 32)
|
||||
dAtA[offset+5] = uint8(v >> 40)
|
||||
dAtA[offset+6] = uint8(v >> 48)
|
||||
dAtA[offset+7] = uint8(v >> 56)
|
||||
return offset + 8
|
||||
}
|
||||
func encodeFixed32Generated(dAtA []byte, offset int, v uint32) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
return offset + 4
|
||||
}
|
||||
func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
}
|
||||
func (m *IntOrString) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if m.Type != nil {
|
||||
n += 1 + sovGenerated(uint64(*m.Type))
|
||||
}
|
||||
if m.IntVal != nil {
|
||||
n += 1 + sovGenerated(uint64(*m.IntVal))
|
||||
}
|
||||
if m.StrVal != nil {
|
||||
l = len(*m.StrVal)
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovGenerated(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
func sozGenerated(x uint64) (n int) {
|
||||
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *IntOrString) 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: IntOrString: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: IntOrString: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
|
||||
}
|
||||
var v int64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
v |= (int64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
m.Type = &v
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field IntVal", wireType)
|
||||
}
|
||||
var v int32
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
v |= (int32(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
m.IntVal = &v
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field StrVal", 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
|
||||
}
|
||||
s := string(dAtA[iNdEx:postIndex])
|
||||
m.StrVal = &s
|
||||
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
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipGenerated(dAtA[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("github.com/ericchiang/k8s/util/intstr/generated.proto", fileDescriptorGenerated)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 180 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x32, 0xcc, 0xb6, 0x28, 0xd6,
|
||||
0xcb, 0xcc, 0xd7, 0xcf, 0x2e, 0x4d, 0x4a, 0x2d, 0xca, 0x4b, 0x2d, 0x49, 0x2d, 0xd6, 0x2f, 0xc8,
|
||||
0x4e, 0xd7, 0x2f, 0x2d, 0xc9, 0xcc, 0xd1, 0xcf, 0xcc, 0x2b, 0x29, 0x2e, 0x29, 0xd2, 0x4f, 0x4f,
|
||||
0xcd, 0x4b, 0x2d, 0x4a, 0x2c, 0x49, 0x4d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x84,
|
||||
0x68, 0xd1, 0x43, 0x68, 0xd1, 0x2b, 0xc8, 0x4e, 0xd7, 0x03, 0x69, 0xd1, 0x83, 0x68, 0x51, 0x0a,
|
||||
0xe4, 0xe2, 0xf6, 0xcc, 0x2b, 0xf1, 0x2f, 0x0a, 0x2e, 0x29, 0xca, 0xcc, 0x4b, 0x17, 0x12, 0xe2,
|
||||
0x62, 0x29, 0xa9, 0x2c, 0x48, 0x95, 0x60, 0x54, 0x60, 0xd4, 0x60, 0x0e, 0x02, 0xb3, 0x85, 0xc4,
|
||||
0xb8, 0xd8, 0x32, 0xf3, 0x4a, 0xc2, 0x12, 0x73, 0x24, 0x98, 0x14, 0x18, 0x35, 0x58, 0x83, 0xa0,
|
||||
0x3c, 0x90, 0x78, 0x71, 0x49, 0x11, 0x48, 0x9c, 0x59, 0x81, 0x51, 0x83, 0x33, 0x08, 0xca, 0x73,
|
||||
0x92, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x67, 0x3c,
|
||||
0x96, 0x63, 0x88, 0x62, 0x83, 0x58, 0x06, 0x08, 0x00, 0x00, 0xff, 0xff, 0xcd, 0x20, 0xf2, 0x02,
|
||||
0xc3, 0x00, 0x00, 0x00,
|
||||
}
|
405
vendor/github.com/ericchiang/k8s/watch/versioned/generated.pb.go
generated
vendored
Normal file
405
vendor/github.com/ericchiang/k8s/watch/versioned/generated.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,405 @@
|
|||
// Code generated by protoc-gen-gogo.
|
||||
// source: k8s.io/kubernetes/pkg/watch/versioned/generated.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package versioned is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/pkg/watch/versioned/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Event
|
||||
*/
|
||||
package versioned
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import k8s_io_kubernetes_pkg_runtime "github.com/ericchiang/k8s/runtime"
|
||||
import _ "github.com/ericchiang/k8s/util/intstr"
|
||||
|
||||
import io "io"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
// Event represents a single event to a watched resource.
|
||||
//
|
||||
// +protobuf=true
|
||||
// +k8s:openapi-gen=true
|
||||
type Event struct {
|
||||
Type *string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
|
||||
// Object is:
|
||||
// * If Type is Added or Modified: the new state of the object.
|
||||
// * If Type is Deleted: the state of the object immediately before deletion.
|
||||
// * If Type is Error: *api.Status is recommended; other types may make sense
|
||||
// depending on context.
|
||||
Object *k8s_io_kubernetes_pkg_runtime.RawExtension `protobuf:"bytes,2,opt,name=object" json:"object,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Event) Reset() { *m = Event{} }
|
||||
func (m *Event) String() string { return proto.CompactTextString(m) }
|
||||
func (*Event) ProtoMessage() {}
|
||||
func (*Event) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
|
||||
|
||||
func (m *Event) GetType() string {
|
||||
if m != nil && m.Type != nil {
|
||||
return *m.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Event) GetObject() *k8s_io_kubernetes_pkg_runtime.RawExtension {
|
||||
if m != nil {
|
||||
return m.Object
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Event)(nil), "github.com/ericchiang.k8s.watch.versioned.Event")
|
||||
}
|
||||
func (m *Event) 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 *Event) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Type != nil {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Type)))
|
||||
i += copy(dAtA[i:], *m.Type)
|
||||
}
|
||||
if m.Object != nil {
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintGenerated(dAtA, i, uint64(m.Object.Size()))
|
||||
n1, err := m.Object.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n1
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func encodeFixed64Generated(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
dAtA[offset+4] = uint8(v >> 32)
|
||||
dAtA[offset+5] = uint8(v >> 40)
|
||||
dAtA[offset+6] = uint8(v >> 48)
|
||||
dAtA[offset+7] = uint8(v >> 56)
|
||||
return offset + 8
|
||||
}
|
||||
func encodeFixed32Generated(dAtA []byte, offset int, v uint32) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
return offset + 4
|
||||
}
|
||||
func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
}
|
||||
func (m *Event) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if m.Type != nil {
|
||||
l = len(*m.Type)
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if m.Object != nil {
|
||||
l = m.Object.Size()
|
||||
n += 1 + l + sovGenerated(uint64(l))
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovGenerated(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
func sozGenerated(x uint64) (n int) {
|
||||
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *Event) 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: Event: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Event: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Type", 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
|
||||
}
|
||||
s := string(dAtA[iNdEx:postIndex])
|
||||
m.Type = &s
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenerated
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Object == nil {
|
||||
m.Object = &k8s_io_kubernetes_pkg_runtime.RawExtension{}
|
||||
}
|
||||
if err := m.Object.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
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
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipGenerated(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthGenerated
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenerated
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipGenerated(dAtA[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("github.com/ericchiang/k8s/watch/versioned/generated.proto", fileDescriptorGenerated)
|
||||
}
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 214 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x32, 0xcd, 0xb6, 0x28, 0xd6,
|
||||
0xcb, 0xcc, 0xd7, 0xcf, 0x2e, 0x4d, 0x4a, 0x2d, 0xca, 0x4b, 0x2d, 0x49, 0x2d, 0xd6, 0x2f, 0xc8,
|
||||
0x4e, 0xd7, 0x2f, 0x4f, 0x2c, 0x49, 0xce, 0xd0, 0x2f, 0x4b, 0x2d, 0x2a, 0xce, 0xcc, 0xcf, 0x4b,
|
||||
0x4d, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0x4a, 0x2c, 0x49, 0x4d, 0xd1, 0x2b, 0x28, 0xca, 0x2f,
|
||||
0xc9, 0x17, 0x52, 0x85, 0x68, 0xd3, 0x43, 0x68, 0xd3, 0x2b, 0xc8, 0x4e, 0xd7, 0x03, 0x6b, 0xd3,
|
||||
0x83, 0x6b, 0x93, 0xd2, 0xc5, 0x6e, 0x7a, 0x51, 0x69, 0x5e, 0x49, 0x66, 0x6e, 0x2a, 0xba, 0xa9,
|
||||
0x52, 0x86, 0xd8, 0x95, 0x97, 0x96, 0x64, 0xe6, 0xe8, 0x67, 0xe6, 0x95, 0x14, 0x97, 0x14, 0xa1,
|
||||
0x6b, 0x51, 0x4a, 0xe0, 0x62, 0x75, 0x2d, 0x4b, 0xcd, 0x2b, 0x11, 0x12, 0xe2, 0x62, 0x29, 0xa9,
|
||||
0x2c, 0x48, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x02, 0xb3, 0x85, 0x9c, 0xb9, 0xd8, 0xf2,
|
||||
0x93, 0xb2, 0x52, 0x93, 0x4b, 0x24, 0x98, 0x14, 0x18, 0x35, 0xb8, 0x8d, 0xb4, 0xf5, 0xb0, 0x3b,
|
||||
0x1b, 0xea, 0x1e, 0xbd, 0xa0, 0xc4, 0x72, 0xd7, 0x8a, 0x92, 0xd4, 0x3c, 0x90, 0xeb, 0x83, 0xa0,
|
||||
0x5a, 0x9d, 0xa4, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6,
|
||||
0x19, 0x8f, 0xe5, 0x18, 0xa2, 0x38, 0xe1, 0x1e, 0x04, 0x04, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x05,
|
||||
0x8c, 0x51, 0x3f, 0x01, 0x00, 0x00,
|
||||
}
|
186
vendor/vendor.json
vendored
186
vendor/vendor.json
vendored
|
@ -26,6 +26,12 @@
|
|||
"revision": "2ee87856327ba09384cabd113bc6b5d174e9ec0f",
|
||||
"revisionTime": "2017-07-27T06:48:18Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "hTThB1Cw2ue02RD5Oig4eu1Dkzk=",
|
||||
"path": "github.com/cenkalti/backoff",
|
||||
"revision": "309aa717adbf351e92864cbedf9cca0b769a4b5a",
|
||||
"revisionTime": "2017-10-07T11:45:50Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "mrz/kicZiUaHxkyfvC/DyQcr8Do=",
|
||||
"path": "github.com/davecgh/go-spew/spew",
|
||||
|
@ -50,6 +56,186 @@
|
|||
"revision": "2dd44038f0b95ae693b266c5f87593b5d2fdd78d",
|
||||
"revisionTime": "2017-11-14T06:30:09Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "ybHQVU2668BUAdpGWdSsTASWvCI=",
|
||||
"path": "github.com/ericchiang/k8s",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "uQuMoUlS7hAWsB+Mwr/1B7+35BU=",
|
||||
"path": "github.com/ericchiang/k8s/api/resource",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "XN1tbPrI03O0ishnZyfkWtTnrcQ=",
|
||||
"path": "github.com/ericchiang/k8s/api/unversioned",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "yfTg3/Qn7KiizNJ39JmPBFi9YDQ=",
|
||||
"path": "github.com/ericchiang/k8s/api/v1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "uw/3eB6WiVCSrQZS9ZZs/1kyu1I=",
|
||||
"path": "github.com/ericchiang/k8s/apis/apps/v1alpha1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "GPnvYx9Uxhpwmv01iygWR6+naTI=",
|
||||
"path": "github.com/ericchiang/k8s/apis/apps/v1beta1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "Jjw5tBYv4k+Es+qPp03rnzyzRWA=",
|
||||
"path": "github.com/ericchiang/k8s/apis/authentication/v1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "uR4S43Wc80fhS0vMDE3Z3hFg7J8=",
|
||||
"path": "github.com/ericchiang/k8s/apis/authentication/v1beta1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "aM2KSDZbHn8jJomPPeG6LKpMwhs=",
|
||||
"path": "github.com/ericchiang/k8s/apis/authorization/v1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "4yWZvduAw2JNdHd1cXjTJBUy0lw=",
|
||||
"path": "github.com/ericchiang/k8s/apis/authorization/v1beta1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "1nMeCVQImIo1CpRRyOYMIqLoPBc=",
|
||||
"path": "github.com/ericchiang/k8s/apis/autoscaling/v1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "kUXiQQA99K7zquvG9es3yauVjYw=",
|
||||
"path": "github.com/ericchiang/k8s/apis/autoscaling/v2alpha1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "vMWsdmHlmaAQZIT0c26dwxe9pDw=",
|
||||
"path": "github.com/ericchiang/k8s/apis/batch/v1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "bqaX0T9jycmp9ao1Ov41dfPn0Ng=",
|
||||
"path": "github.com/ericchiang/k8s/apis/batch/v2alpha1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "9GRVPI+Tf4RrlX2aveUGEUHKIrM=",
|
||||
"path": "github.com/ericchiang/k8s/apis/certificates/v1alpha1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "k1dF56GRoEg6rooFKO7UvEJvBcE=",
|
||||
"path": "github.com/ericchiang/k8s/apis/certificates/v1beta1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "4pDHINIk6BdPBYWGF20IwHNCg2Q=",
|
||||
"path": "github.com/ericchiang/k8s/apis/extensions/v1beta1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "NAL7OeKSEzTOoXHBFnC1B1VmBVs=",
|
||||
"path": "github.com/ericchiang/k8s/apis/imagepolicy/v1alpha1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "Vg1/xjzLJHZlvuheWC4abghACwQ=",
|
||||
"path": "github.com/ericchiang/k8s/apis/meta/v1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "wYSNb+W2L5gJlGO8n6mGOGft8R8=",
|
||||
"path": "github.com/ericchiang/k8s/apis/policy/v1alpha1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "ioJ28pdUN6fDkOp8dT+Tg3HSqmk=",
|
||||
"path": "github.com/ericchiang/k8s/apis/policy/v1beta1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "UErnBsjjtmg3oYjLYU1S80oi3sk=",
|
||||
"path": "github.com/ericchiang/k8s/apis/rbac/v1alpha1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "Xl+Tm8ZOz0cMOrfLaQvu/lsWObU=",
|
||||
"path": "github.com/ericchiang/k8s/apis/rbac/v1beta1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "YyZyaF0k2NAQAZvsCOVdhAkfVU0=",
|
||||
"path": "github.com/ericchiang/k8s/apis/settings/v1alpha1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "vUc3mf0rE7CQ3B52wfrMDyspLgA=",
|
||||
"path": "github.com/ericchiang/k8s/apis/storage/v1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "7/oj1z0vG1pvRza+UuKQ6txdleI=",
|
||||
"path": "github.com/ericchiang/k8s/apis/storage/v1beta1",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "mm5iTFmLQ6h98DKgiUuTCpHP9H4=",
|
||||
"path": "github.com/ericchiang/k8s/runtime",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "Kk1UDqUx2Pr1LyvIIgcJBApTlCk=",
|
||||
"path": "github.com/ericchiang/k8s/runtime/schema",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "LoxBND74egHIasOX6z98FeeW0zI=",
|
||||
"path": "github.com/ericchiang/k8s/util/intstr",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "fobEKiMk5D7IGvCSwh4HdG1o98c=",
|
||||
"path": "github.com/ericchiang/k8s/watch/versioned",
|
||||
"revision": "e6ee318e52e6b7faeeb8da10ac58a22342b5caa9",
|
||||
"revisionTime": "2017-11-20T20:51:40Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "ImX1uv6O09ggFeBPUJJ2nu7MPSA=",
|
||||
"path": "github.com/ghodss/yaml",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue