mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
grep sed ExperimentalClient
This commit is contained in:
parent
9aa163aa88
commit
9a812bd0c5
@ -136,7 +136,7 @@ func startComponents(firstManifestURL, secondManifestURL string) (string, string
|
|||||||
|
|
||||||
// TODO: caesarxuchao: hacky way to specify version of Experimental client.
|
// TODO: caesarxuchao: hacky way to specify version of Experimental client.
|
||||||
// We will fix this by supporting multiple group versions in Config
|
// We will fix this by supporting multiple group versions in Config
|
||||||
cl.ExperimentalClient = client.NewExperimentalOrDie(&client.Config{Host: apiServer.URL, Version: testapi.Extensions.GroupAndVersion()})
|
cl.ExtensionsClient = client.NewExperimentalOrDie(&client.Config{Host: apiServer.URL, Version: testapi.Extensions.GroupAndVersion()})
|
||||||
|
|
||||||
storageVersions := make(map[string]string)
|
storageVersions := make(map[string]string)
|
||||||
etcdStorage, err := master.NewEtcdStorage(etcdClient, latest.GroupOrDie("").InterfacesFor, testapi.Default.GroupAndVersion(), etcdtest.PathPrefix())
|
etcdStorage, err := master.NewEtcdStorage(etcdClient, latest.GroupOrDie("").InterfacesFor, testapi.Default.GroupAndVersion(), etcdtest.PathPrefix())
|
||||||
@ -986,7 +986,7 @@ func main() {
|
|||||||
kubeClient := client.NewOrDie(&client.Config{Host: apiServerURL, Version: testapi.Default.GroupAndVersion()})
|
kubeClient := client.NewOrDie(&client.Config{Host: apiServerURL, Version: testapi.Default.GroupAndVersion()})
|
||||||
// TODO: caesarxuchao: hacky way to specify version of Experimental client.
|
// TODO: caesarxuchao: hacky way to specify version of Experimental client.
|
||||||
// We will fix this by supporting multiple group versions in Config
|
// We will fix this by supporting multiple group versions in Config
|
||||||
kubeClient.ExperimentalClient = client.NewExperimentalOrDie(&client.Config{Host: apiServerURL, Version: testapi.Extensions.GroupAndVersion()})
|
kubeClient.ExtensionsClient = client.NewExperimentalOrDie(&client.Config{Host: apiServerURL, Version: testapi.Extensions.GroupAndVersion()})
|
||||||
|
|
||||||
// Run tests in parallel
|
// Run tests in parallel
|
||||||
testFuncs := []testFunc{
|
testFuncs := []testFunc{
|
||||||
|
@ -128,7 +128,7 @@ type APIStatus interface {
|
|||||||
// Client is the implementation of a Kubernetes client.
|
// Client is the implementation of a Kubernetes client.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
*RESTClient
|
*RESTClient
|
||||||
*ExperimentalClient
|
*ExtensionsClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServerVersion retrieves and parses the server's version.
|
// ServerVersion retrieves and parses the server's version.
|
||||||
@ -244,5 +244,5 @@ func IsTimeout(err error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Experimental() ExtensionsInterface {
|
func (c *Client) Experimental() ExtensionsInterface {
|
||||||
return c.ExperimentalClient
|
return c.ExtensionsClient
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ func (c *testClient) Setup(t *testing.T) *testClient {
|
|||||||
if len(version) == 0 {
|
if len(version) == 0 {
|
||||||
version = testapi.Extensions.Version()
|
version = testapi.Extensions.Version()
|
||||||
}
|
}
|
||||||
c.ExperimentalClient = NewExperimentalOrDie(&Config{
|
c.ExtensionsClient = NewExperimentalOrDie(&Config{
|
||||||
Host: c.server.URL,
|
Host: c.server.URL,
|
||||||
Version: version,
|
Version: version,
|
||||||
})
|
})
|
||||||
|
@ -40,11 +40,11 @@ type DaemonSetInterface interface {
|
|||||||
|
|
||||||
// daemonSets implements DaemonsSetsNamespacer interface
|
// daemonSets implements DaemonsSetsNamespacer interface
|
||||||
type daemonSets struct {
|
type daemonSets struct {
|
||||||
r *ExperimentalClient
|
r *ExtensionsClient
|
||||||
ns string
|
ns string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDaemonSets(c *ExperimentalClient, namespace string) *daemonSets {
|
func newDaemonSets(c *ExtensionsClient, namespace string) *daemonSets {
|
||||||
return &daemonSets{c, namespace}
|
return &daemonSets{c, namespace}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,12 +41,12 @@ type DeploymentInterface interface {
|
|||||||
|
|
||||||
// deployments implements DeploymentInterface
|
// deployments implements DeploymentInterface
|
||||||
type deployments struct {
|
type deployments struct {
|
||||||
client *ExperimentalClient
|
client *ExtensionsClient
|
||||||
ns string
|
ns string
|
||||||
}
|
}
|
||||||
|
|
||||||
// newDeployments returns a Deployments
|
// newDeployments returns a Deployments
|
||||||
func newDeployments(c *ExperimentalClient, namespace string) *deployments {
|
func newDeployments(c *ExtensionsClient, namespace string) *deployments {
|
||||||
return &deployments{
|
return &deployments{
|
||||||
client: c,
|
client: c,
|
||||||
ns: namespace,
|
ns: namespace,
|
||||||
|
@ -147,14 +147,14 @@ func New(c *Config) (*Client, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if _, err := latest.Group("extensions"); err != nil {
|
if _, err := latest.Group("extensions"); err != nil {
|
||||||
return &Client{RESTClient: client, ExperimentalClient: nil}, nil
|
return &Client{RESTClient: client, ExtensionsClient: nil}, nil
|
||||||
}
|
}
|
||||||
experimentalConfig := *c
|
experimentalConfig := *c
|
||||||
experimentalClient, err := NewExperimental(&experimentalConfig)
|
experimentalClient, err := NewExperimental(&experimentalConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &Client{RESTClient: client, ExperimentalClient: experimentalClient}, nil
|
return &Client{RESTClient: client, ExtensionsClient: experimentalClient}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MatchesServerVersion queries the server to compares the build version
|
// MatchesServerVersion queries the server to compares the build version
|
||||||
|
@ -42,12 +42,12 @@ type HorizontalPodAutoscalerInterface interface {
|
|||||||
|
|
||||||
// horizontalPodAutoscalers implements HorizontalPodAutoscalersNamespacer interface
|
// horizontalPodAutoscalers implements HorizontalPodAutoscalersNamespacer interface
|
||||||
type horizontalPodAutoscalers struct {
|
type horizontalPodAutoscalers struct {
|
||||||
client *ExperimentalClient
|
client *ExtensionsClient
|
||||||
ns string
|
ns string
|
||||||
}
|
}
|
||||||
|
|
||||||
// newHorizontalPodAutoscalers returns a horizontalPodAutoscalers
|
// newHorizontalPodAutoscalers returns a horizontalPodAutoscalers
|
||||||
func newHorizontalPodAutoscalers(c *ExperimentalClient, namespace string) *horizontalPodAutoscalers {
|
func newHorizontalPodAutoscalers(c *ExtensionsClient, namespace string) *horizontalPodAutoscalers {
|
||||||
return &horizontalPodAutoscalers{
|
return &horizontalPodAutoscalers{
|
||||||
client: c,
|
client: c,
|
||||||
ns: namespace,
|
ns: namespace,
|
||||||
|
@ -42,12 +42,12 @@ type IngressInterface interface {
|
|||||||
|
|
||||||
// ingress implements IngressNamespacer interface
|
// ingress implements IngressNamespacer interface
|
||||||
type ingress struct {
|
type ingress struct {
|
||||||
r *ExperimentalClient
|
r *ExtensionsClient
|
||||||
ns string
|
ns string
|
||||||
}
|
}
|
||||||
|
|
||||||
// newIngress returns a ingress
|
// newIngress returns a ingress
|
||||||
func newIngress(c *ExperimentalClient, namespace string) *ingress {
|
func newIngress(c *ExtensionsClient, namespace string) *ingress {
|
||||||
return &ingress{c, namespace}
|
return &ingress{c, namespace}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,12 +43,12 @@ type JobInterface interface {
|
|||||||
|
|
||||||
// jobs implements JobsNamespacer interface
|
// jobs implements JobsNamespacer interface
|
||||||
type jobs struct {
|
type jobs struct {
|
||||||
r *ExperimentalClient
|
r *ExtensionsClient
|
||||||
ns string
|
ns string
|
||||||
}
|
}
|
||||||
|
|
||||||
// newJobs returns a jobs
|
// newJobs returns a jobs
|
||||||
func newJobs(c *ExperimentalClient, namespace string) *jobs {
|
func newJobs(c *ExtensionsClient, namespace string) *jobs {
|
||||||
return &jobs{c, namespace}
|
return &jobs{c, namespace}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,12 +33,12 @@ type ScaleInterface interface {
|
|||||||
|
|
||||||
// horizontalPodAutoscalers implements HorizontalPodAutoscalersNamespacer interface
|
// horizontalPodAutoscalers implements HorizontalPodAutoscalersNamespacer interface
|
||||||
type scales struct {
|
type scales struct {
|
||||||
client *ExperimentalClient
|
client *ExtensionsClient
|
||||||
ns string
|
ns string
|
||||||
}
|
}
|
||||||
|
|
||||||
// newHorizontalPodAutoscalers returns a horizontalPodAutoscalers
|
// newHorizontalPodAutoscalers returns a horizontalPodAutoscalers
|
||||||
func newScales(c *ExperimentalClient, namespace string) *scales {
|
func newScales(c *ExtensionsClient, namespace string) *scales {
|
||||||
return &scales{
|
return &scales{
|
||||||
client: c,
|
client: c,
|
||||||
ns: namespace,
|
ns: namespace,
|
||||||
|
@ -143,7 +143,7 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
|
|||||||
case "":
|
case "":
|
||||||
return client.RESTClient, nil
|
return client.RESTClient, nil
|
||||||
case "extensions":
|
case "extensions":
|
||||||
return client.ExperimentalClient.RESTClient, nil
|
return client.ExtensionsClient.RESTClient, nil
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("unable to get RESTClient for resource '%s'", mapping.Resource)
|
return nil, fmt.Errorf("unable to get RESTClient for resource '%s'", mapping.Resource)
|
||||||
},
|
},
|
||||||
@ -407,10 +407,10 @@ func (c *clientSwaggerSchema) ValidateBytes(data []byte) error {
|
|||||||
return fmt.Errorf("could not find api group for %s: %v", kind, err)
|
return fmt.Errorf("could not find api group for %s: %v", kind, err)
|
||||||
}
|
}
|
||||||
if group == "extensions" {
|
if group == "extensions" {
|
||||||
if c.c.ExperimentalClient == nil {
|
if c.c.ExtensionsClient == nil {
|
||||||
return errors.New("unable to validate: no experimental client")
|
return errors.New("unable to validate: no experimental client")
|
||||||
}
|
}
|
||||||
return getSchemaAndValidate(c.c.ExperimentalClient.RESTClient, data, "apis/", version, c.cacheDir)
|
return getSchemaAndValidate(c.c.ExtensionsClient.RESTClient, data, "apis/", version, c.cacheDir)
|
||||||
}
|
}
|
||||||
return getSchemaAndValidate(c.c.RESTClient, data, "api", version, c.cacheDir)
|
return getSchemaAndValidate(c.c.RESTClient, data, "api", version, c.cacheDir)
|
||||||
}
|
}
|
||||||
|
@ -78,12 +78,12 @@ func (c *ErrorJobClient) Jobs(namespace string) client.JobInterface {
|
|||||||
return &ErrorJobs{testclient.FakeJobs{Fake: &c.FakeExperimental, Namespace: namespace}, c.invalid}
|
return &ErrorJobs{testclient.FakeJobs{Fake: &c.FakeExperimental, Namespace: namespace}, c.invalid}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ErrorExperimentalClient struct {
|
type ErrorExtensionsClient struct {
|
||||||
testclient.Fake
|
testclient.Fake
|
||||||
invalid bool
|
invalid bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ErrorExperimentalClient) Experimental() client.ExtensionsInterface {
|
func (c *ErrorExtensionsClient) Experimental() client.ExtensionsInterface {
|
||||||
return &ErrorJobClient{testclient.FakeExperimental{&c.Fake}, c.invalid}
|
return &ErrorJobClient{testclient.FakeExperimental{&c.Fake}, c.invalid}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,7 +287,7 @@ func TestValidateReplicationController(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJobScaleRetry(t *testing.T) {
|
func TestJobScaleRetry(t *testing.T) {
|
||||||
fake := &ErrorExperimentalClient{Fake: testclient.Fake{}, invalid: false}
|
fake := &ErrorExtensionsClient{Fake: testclient.Fake{}, invalid: false}
|
||||||
scaler := JobScaler{fake}
|
scaler := JobScaler{fake}
|
||||||
preconditions := ScalePrecondition{-1, ""}
|
preconditions := ScalePrecondition{-1, ""}
|
||||||
count := uint(3)
|
count := uint(3)
|
||||||
@ -331,7 +331,7 @@ func TestJobScale(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJobScaleInvalid(t *testing.T) {
|
func TestJobScaleInvalid(t *testing.T) {
|
||||||
fake := &ErrorExperimentalClient{Fake: testclient.Fake{}, invalid: true}
|
fake := &ErrorExtensionsClient{Fake: testclient.Fake{}, invalid: true}
|
||||||
scaler := JobScaler{fake}
|
scaler := JobScaler{fake}
|
||||||
preconditions := ScalePrecondition{-1, ""}
|
preconditions := ScalePrecondition{-1, ""}
|
||||||
count := uint(3)
|
count := uint(3)
|
||||||
|
Loading…
Reference in New Issue
Block a user