Merge pull request #15488 from caesarxuchao/experimental-extensions-client

Move from "Experimental" to "Extensions"
This commit is contained in:
Dawn Chen 2015-10-13 16:54:37 -07:00
commit 0e0ae670ad
31 changed files with 127 additions and 127 deletions

View File

@ -136,7 +136,7 @@ func startComponents(firstManifestURL, secondManifestURL string) (string, string
// TODO: caesarxuchao: hacky way to specify version of Experimental client.
// 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.NewExtensionsOrDie(&client.Config{Host: apiServer.URL, Version: testapi.Extensions.GroupAndVersion()})
storageVersions := make(map[string]string)
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()})
// TODO: caesarxuchao: hacky way to specify version of Experimental client.
// 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.NewExtensionsOrDie(&client.Config{Host: apiServerURL, Version: testapi.Extensions.GroupAndVersion()})
// Run tests in parallel
testFuncs := []testFunc{

View File

@ -122,7 +122,7 @@ Documentation for other releases can be found at
2. Spelling the URL:
The URL is in the form of prefix/group/version/. The prefix is hard-coded in the client/unversioned.Config (see [here](../../pkg/client/unversioned/experimental.go#L101)). The client should be able to figure out `group` and `version` using the RESTMapper. For a third-party client which does not have access to the RESTMapper, it should discover the mapping of `group`, `version` and `kind` by querying the server as described in point 2 of #server-side-implementation.
The URL is in the form of prefix/group/version/. The prefix is hard-coded in the client/unversioned.Config. The client should be able to figure out `group` and `version` using the RESTMapper. For a third-party client which does not have access to the RESTMapper, it should discover the mapping of `group`, `version` and `kind` by querying the server as described in point 2 of #server-side-implementation.
3. kubectl:

View File

@ -51,7 +51,7 @@ type Interface interface {
PersistentVolumeClaimsNamespacer
ComponentStatusesInterface
SwaggerSchemaInterface
Experimental() ExperimentalInterface
Extensions() ExtensionsInterface
}
func (c *Client) ReplicationControllers(namespace string) ReplicationControllerInterface {
@ -128,7 +128,7 @@ type APIStatus interface {
// Client is the implementation of a Kubernetes client.
type Client struct {
*RESTClient
*ExperimentalClient
*ExtensionsClient
}
// ServerVersion retrieves and parses the server's version.
@ -243,6 +243,6 @@ func IsTimeout(err error) bool {
return false
}
func (c *Client) Experimental() ExperimentalInterface {
return c.ExperimentalClient
func (c *Client) Extensions() ExtensionsInterface {
return c.ExtensionsClient
}

View File

@ -95,7 +95,7 @@ func (c *testClient) Setup(t *testing.T) *testClient {
if len(version) == 0 {
version = testapi.Extensions.Version()
}
c.ExperimentalClient = NewExperimentalOrDie(&Config{
c.ExtensionsClient = NewExtensionsOrDie(&Config{
Host: c.server.URL,
Version: version,
})

View File

@ -48,7 +48,7 @@ func ControllerHasDesiredReplicas(c Interface, controller *api.ReplicationContro
func JobHasDesiredParallelism(c Interface, job *extensions.Job) wait.ConditionFunc {
return func() (bool, error) {
job, err := c.Experimental().Jobs(job.Namespace).Get(job.Name)
job, err := c.Extensions().Jobs(job.Namespace).Get(job.Name)
if err != nil {
return false, err
}

View File

@ -40,11 +40,11 @@ type DaemonSetInterface interface {
// daemonSets implements DaemonsSetsNamespacer interface
type daemonSets struct {
r *ExperimentalClient
r *ExtensionsClient
ns string
}
func newDaemonSets(c *ExperimentalClient, namespace string) *daemonSets {
func newDaemonSets(c *ExtensionsClient, namespace string) *daemonSets {
return &daemonSets{c, namespace}
}

View File

@ -55,7 +55,7 @@ func TestListDaemonSets(t *testing.T) {
},
},
}
receivedDSs, err := c.Setup(t).Experimental().DaemonSets(ns).List(labels.Everything())
receivedDSs, err := c.Setup(t).Extensions().DaemonSets(ns).List(labels.Everything())
c.Validate(t, receivedDSs, err)
}
@ -80,14 +80,14 @@ func TestGetDaemonSet(t *testing.T) {
},
},
}
receivedDaemonSet, err := c.Setup(t).Experimental().DaemonSets(ns).Get("foo")
receivedDaemonSet, err := c.Setup(t).Extensions().DaemonSets(ns).Get("foo")
c.Validate(t, receivedDaemonSet, err)
}
func TestGetDaemonSetWithNoName(t *testing.T) {
ns := api.NamespaceDefault
c := &testClient{Error: true}
receivedPod, err := c.Setup(t).Experimental().DaemonSets(ns).Get("")
receivedPod, err := c.Setup(t).Extensions().DaemonSets(ns).Get("")
if (err != nil) && (err.Error() != nameRequiredError) {
t.Errorf("Expected error: %v, but got %v", nameRequiredError, err)
}
@ -118,7 +118,7 @@ func TestUpdateDaemonSet(t *testing.T) {
},
},
}
receivedDaemonSet, err := c.Setup(t).Experimental().DaemonSets(ns).Update(requestDaemonSet)
receivedDaemonSet, err := c.Setup(t).Extensions().DaemonSets(ns).Update(requestDaemonSet)
c.Validate(t, receivedDaemonSet, err)
}
@ -146,7 +146,7 @@ func TestUpdateDaemonSetUpdateStatus(t *testing.T) {
},
},
}
receivedDaemonSet, err := c.Setup(t).Experimental().DaemonSets(ns).UpdateStatus(requestDaemonSet)
receivedDaemonSet, err := c.Setup(t).Extensions().DaemonSets(ns).UpdateStatus(requestDaemonSet)
c.Validate(t, receivedDaemonSet, err)
}
@ -156,7 +156,7 @@ func TestDeleteDaemon(t *testing.T) {
Request: testRequest{Method: "DELETE", Path: testapi.Extensions.ResourcePath(getDSResourceName(), ns, "foo"), Query: buildQueryValues(nil)},
Response: Response{StatusCode: 200},
}
err := c.Setup(t).Experimental().DaemonSets(ns).Delete("foo")
err := c.Setup(t).Extensions().DaemonSets(ns).Delete("foo")
c.Validate(t, nil, err)
}
@ -183,6 +183,6 @@ func TestCreateDaemonSet(t *testing.T) {
},
},
}
receivedDaemonSet, err := c.Setup(t).Experimental().DaemonSets(ns).Create(requestDaemonSet)
receivedDaemonSet, err := c.Setup(t).Extensions().DaemonSets(ns).Create(requestDaemonSet)
c.Validate(t, receivedDaemonSet, err)
}

View File

@ -41,12 +41,12 @@ type DeploymentInterface interface {
// deployments implements DeploymentInterface
type deployments struct {
client *ExperimentalClient
client *ExtensionsClient
ns string
}
// newDeployments returns a Deployments
func newDeployments(c *ExperimentalClient, namespace string) *deployments {
func newDeployments(c *ExtensionsClient, namespace string) *deployments {
return &deployments{
client: c,
ns: namespace,

View File

@ -28,9 +28,9 @@ import (
// Interface holds the experimental methods for clients of Kubernetes
// to allow mock testing.
// Experimental features are not supported and may be changed or removed in
// Features of Extensions group are not supported and may be changed or removed in
// incompatible ways at any time.
type ExperimentalInterface interface {
type ExtensionsInterface interface {
VersionInterface
HorizontalPodAutoscalersNamespacer
ScaleNamespacer
@ -40,15 +40,15 @@ type ExperimentalInterface interface {
IngressNamespacer
}
// ExperimentalClient is used to interact with experimental Kubernetes features.
// Experimental features are not supported and may be changed or removed in
// ExtensionsClient is used to interact with experimental Kubernetes features.
// Features of Extensions group are not supported and may be changed or removed in
// incompatible ways at any time.
type ExperimentalClient struct {
type ExtensionsClient struct {
*RESTClient
}
// ServerVersion retrieves and parses the server's version.
func (c *ExperimentalClient) ServerVersion() (*version.Info, error) {
func (c *ExtensionsClient) ServerVersion() (*version.Info, error) {
body, err := c.Get().AbsPath("/version").Do().Raw()
if err != nil {
return nil, err
@ -63,7 +63,7 @@ func (c *ExperimentalClient) ServerVersion() (*version.Info, error) {
// ServerAPIVersions retrieves and parses the list of experimental API versions the
// server supports.
func (c *ExperimentalClient) ServerAPIVersions() (*unversioned.APIVersions, error) {
func (c *ExtensionsClient) ServerAPIVersions() (*unversioned.APIVersions, error) {
body, err := c.Get().UnversionedPath("").Do().Raw()
if err != nil {
return nil, err
@ -76,59 +76,59 @@ func (c *ExperimentalClient) ServerAPIVersions() (*unversioned.APIVersions, erro
return &v, nil
}
func (c *ExperimentalClient) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface {
func (c *ExtensionsClient) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface {
return newHorizontalPodAutoscalers(c, namespace)
}
func (c *ExperimentalClient) Scales(namespace string) ScaleInterface {
func (c *ExtensionsClient) Scales(namespace string) ScaleInterface {
return newScales(c, namespace)
}
func (c *ExperimentalClient) DaemonSets(namespace string) DaemonSetInterface {
func (c *ExtensionsClient) DaemonSets(namespace string) DaemonSetInterface {
return newDaemonSets(c, namespace)
}
func (c *ExperimentalClient) Deployments(namespace string) DeploymentInterface {
func (c *ExtensionsClient) Deployments(namespace string) DeploymentInterface {
return newDeployments(c, namespace)
}
func (c *ExperimentalClient) Jobs(namespace string) JobInterface {
func (c *ExtensionsClient) Jobs(namespace string) JobInterface {
return newJobs(c, namespace)
}
func (c *ExperimentalClient) Ingress(namespace string) IngressInterface {
func (c *ExtensionsClient) Ingress(namespace string) IngressInterface {
return newIngress(c, namespace)
}
// NewExperimental creates a new ExperimentalClient for the given config. This client
// NewExtensions creates a new ExtensionsClient for the given config. This client
// provides access to experimental Kubernetes features.
// Experimental features are not supported and may be changed or removed in
// Features of Extensions group are not supported and may be changed or removed in
// incompatible ways at any time.
func NewExperimental(c *Config) (*ExperimentalClient, error) {
func NewExtensions(c *Config) (*ExtensionsClient, error) {
config := *c
if err := setExperimentalDefaults(&config); err != nil {
if err := setExtensionsDefaults(&config); err != nil {
return nil, err
}
client, err := RESTClientFor(&config)
if err != nil {
return nil, err
}
return &ExperimentalClient{client}, nil
return &ExtensionsClient{client}, nil
}
// NewExperimentalOrDie creates a new ExperimentalClient for the given config and
// NewExtensionsOrDie creates a new ExtensionsClient for the given config and
// panics if there is an error in the config.
// Experimental features are not supported and may be changed or removed in
// Features of Extensions group are not supported and may be changed or removed in
// incompatible ways at any time.
func NewExperimentalOrDie(c *Config) *ExperimentalClient {
client, err := NewExperimental(c)
func NewExtensionsOrDie(c *Config) *ExtensionsClient {
client, err := NewExtensions(c)
if err != nil {
panic(err)
}
return client
}
func setExperimentalDefaults(config *Config) error {
func setExtensionsDefaults(config *Config) error {
// if experimental group is not registered, return an error
g, err := latest.Group("extensions")
if err != nil {
@ -145,7 +145,7 @@ func setExperimentalDefaults(config *Config) error {
versionInterfaces, err := g.InterfacesFor(config.Version)
if err != nil {
return fmt.Errorf("Experimental API version '%s' is not recognized (valid values: %s)",
return fmt.Errorf("Extensions API version '%s' is not recognized (valid values: %s)",
config.Version, strings.Join(latest.GroupOrDie("extensions").Versions, ", "))
}
config.Codec = versionInterfaces.Codec

View File

@ -147,14 +147,14 @@ func New(c *Config) (*Client, error) {
}
if _, err := latest.Group("extensions"); err != nil {
return &Client{RESTClient: client, ExperimentalClient: nil}, nil
return &Client{RESTClient: client, ExtensionsClient: nil}, nil
}
experimentalConfig := *c
experimentalClient, err := NewExperimental(&experimentalConfig)
experimentalClient, err := NewExtensions(&experimentalConfig)
if err != nil {
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

View File

@ -42,12 +42,12 @@ type HorizontalPodAutoscalerInterface interface {
// horizontalPodAutoscalers implements HorizontalPodAutoscalersNamespacer interface
type horizontalPodAutoscalers struct {
client *ExperimentalClient
client *ExtensionsClient
ns string
}
// newHorizontalPodAutoscalers returns a horizontalPodAutoscalers
func newHorizontalPodAutoscalers(c *ExperimentalClient, namespace string) *horizontalPodAutoscalers {
func newHorizontalPodAutoscalers(c *ExtensionsClient, namespace string) *horizontalPodAutoscalers {
return &horizontalPodAutoscalers{
client: c,
ns: namespace,

View File

@ -49,7 +49,7 @@ func TestHorizontalPodAutoscalerCreate(t *testing.T) {
Response: Response{StatusCode: 200, Body: &horizontalPodAutoscaler},
}
response, err := c.Setup(t).Experimental().HorizontalPodAutoscalers(ns).Create(&horizontalPodAutoscaler)
response, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(ns).Create(&horizontalPodAutoscaler)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@ -74,7 +74,7 @@ func TestHorizontalPodAutoscalerGet(t *testing.T) {
Response: Response{StatusCode: 200, Body: horizontalPodAutoscaler},
}
response, err := c.Setup(t).Experimental().HorizontalPodAutoscalers(ns).Get("abc")
response, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(ns).Get("abc")
c.Validate(t, response, err)
}
@ -99,7 +99,7 @@ func TestHorizontalPodAutoscalerList(t *testing.T) {
},
Response: Response{StatusCode: 200, Body: horizontalPodAutoscalerList},
}
response, err := c.Setup(t).Experimental().HorizontalPodAutoscalers(ns).List(labels.Everything(), fields.Everything())
response, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(ns).List(labels.Everything(), fields.Everything())
c.Validate(t, response, err)
}
@ -116,7 +116,7 @@ func TestHorizontalPodAutoscalerUpdate(t *testing.T) {
Request: testRequest{Method: "PUT", Path: testapi.Extensions.ResourcePath(getHorizontalPodAutoscalersResoureName(), ns, "abc"), Query: buildQueryValues(nil)},
Response: Response{StatusCode: 200, Body: horizontalPodAutoscaler},
}
response, err := c.Setup(t).Experimental().HorizontalPodAutoscalers(ns).Update(horizontalPodAutoscaler)
response, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(ns).Update(horizontalPodAutoscaler)
c.Validate(t, response, err)
}
@ -133,7 +133,7 @@ func TestHorizontalPodAutoscalerUpdateStatus(t *testing.T) {
Request: testRequest{Method: "PUT", Path: testapi.Extensions.ResourcePath(getHorizontalPodAutoscalersResoureName(), ns, "abc") + "/status", Query: buildQueryValues(nil)},
Response: Response{StatusCode: 200, Body: horizontalPodAutoscaler},
}
response, err := c.Setup(t).Experimental().HorizontalPodAutoscalers(ns).UpdateStatus(horizontalPodAutoscaler)
response, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(ns).UpdateStatus(horizontalPodAutoscaler)
c.Validate(t, response, err)
}
@ -143,7 +143,7 @@ func TestHorizontalPodAutoscalerDelete(t *testing.T) {
Request: testRequest{Method: "DELETE", Path: testapi.Extensions.ResourcePath(getHorizontalPodAutoscalersResoureName(), ns, "foo"), Query: buildQueryValues(nil)},
Response: Response{StatusCode: 200},
}
err := c.Setup(t).Experimental().HorizontalPodAutoscalers(ns).Delete("foo", nil)
err := c.Setup(t).Extensions().HorizontalPodAutoscalers(ns).Delete("foo", nil)
c.Validate(t, nil, err)
}
@ -155,6 +155,6 @@ func TestHorizontalPodAutoscalerWatch(t *testing.T) {
Query: url.Values{"resourceVersion": []string{}}},
Response: Response{StatusCode: 200},
}
_, err := c.Setup(t).Experimental().HorizontalPodAutoscalers(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), "")
_, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), "")
c.Validate(t, nil, err)
}

View File

@ -42,12 +42,12 @@ type IngressInterface interface {
// ingress implements IngressNamespacer interface
type ingress struct {
r *ExperimentalClient
r *ExtensionsClient
ns string
}
// newIngress returns a ingress
func newIngress(c *ExperimentalClient, namespace string) *ingress {
func newIngress(c *ExtensionsClient, namespace string) *ingress {
return &ingress{c, namespace}
}

View File

@ -56,7 +56,7 @@ func TestListIngress(t *testing.T) {
},
},
}
receivedIngressList, err := c.Setup(t).Experimental().Ingress(ns).List(labels.Everything(), fields.Everything())
receivedIngressList, err := c.Setup(t).Extensions().Ingress(ns).List(labels.Everything(), fields.Everything())
c.Validate(t, receivedIngressList, err)
}
@ -84,14 +84,14 @@ func TestGetIngress(t *testing.T) {
},
},
}
receivedIngress, err := c.Setup(t).Experimental().Ingress(ns).Get("foo")
receivedIngress, err := c.Setup(t).Extensions().Ingress(ns).Get("foo")
c.Validate(t, receivedIngress, err)
}
func TestGetIngressWithNoName(t *testing.T) {
ns := api.NamespaceDefault
c := &testClient{Error: true}
receivedIngress, err := c.Setup(t).Experimental().Ingress(ns).Get("")
receivedIngress, err := c.Setup(t).Extensions().Ingress(ns).Get("")
if (err != nil) && (err.Error() != nameRequiredError) {
t.Errorf("Expected error: %v, but got %v", nameRequiredError, err)
}
@ -130,7 +130,7 @@ func TestUpdateIngress(t *testing.T) {
},
},
}
receivedIngress, err := c.Setup(t).Experimental().Ingress(ns).Update(requestIngress)
receivedIngress, err := c.Setup(t).Extensions().Ingress(ns).Update(requestIngress)
c.Validate(t, receivedIngress, err)
}
@ -176,7 +176,7 @@ func TestUpdateIngressStatus(t *testing.T) {
},
},
}
receivedIngress, err := c.Setup(t).Experimental().Ingress(ns).UpdateStatus(requestIngress)
receivedIngress, err := c.Setup(t).Extensions().Ingress(ns).UpdateStatus(requestIngress)
c.Validate(t, receivedIngress, err)
}
@ -190,7 +190,7 @@ func TestDeleteIngress(t *testing.T) {
},
Response: Response{StatusCode: 200},
}
err := c.Setup(t).Experimental().Ingress(ns).Delete("foo", nil)
err := c.Setup(t).Extensions().Ingress(ns).Delete("foo", nil)
c.Validate(t, nil, err)
}
@ -225,6 +225,6 @@ func TestCreateIngress(t *testing.T) {
},
},
}
receivedIngress, err := c.Setup(t).Experimental().Ingress(ns).Create(requestIngress)
receivedIngress, err := c.Setup(t).Extensions().Ingress(ns).Create(requestIngress)
c.Validate(t, receivedIngress, err)
}

View File

@ -43,12 +43,12 @@ type JobInterface interface {
// jobs implements JobsNamespacer interface
type jobs struct {
r *ExperimentalClient
r *ExtensionsClient
ns string
}
// newJobs returns a jobs
func newJobs(c *ExperimentalClient, namespace string) *jobs {
func newJobs(c *ExtensionsClient, namespace string) *jobs {
return &jobs{c, namespace}
}

View File

@ -56,7 +56,7 @@ func TestListJobs(t *testing.T) {
},
},
}
receivedJobList, err := c.Setup(t).Experimental().Jobs(ns).List(labels.Everything(), fields.Everything())
receivedJobList, err := c.Setup(t).Extensions().Jobs(ns).List(labels.Everything(), fields.Everything())
c.Validate(t, receivedJobList, err)
}
@ -84,14 +84,14 @@ func TestGetJob(t *testing.T) {
},
},
}
receivedJob, err := c.Setup(t).Experimental().Jobs(ns).Get("foo")
receivedJob, err := c.Setup(t).Extensions().Jobs(ns).Get("foo")
c.Validate(t, receivedJob, err)
}
func TestGetJobWithNoName(t *testing.T) {
ns := api.NamespaceDefault
c := &testClient{Error: true}
receivedJob, err := c.Setup(t).Experimental().Jobs(ns).Get("")
receivedJob, err := c.Setup(t).Extensions().Jobs(ns).Get("")
if (err != nil) && (err.Error() != nameRequiredError) {
t.Errorf("Expected error: %v, but got %v", nameRequiredError, err)
}
@ -130,7 +130,7 @@ func TestUpdateJob(t *testing.T) {
},
},
}
receivedJob, err := c.Setup(t).Experimental().Jobs(ns).Update(requestJob)
receivedJob, err := c.Setup(t).Extensions().Jobs(ns).Update(requestJob)
c.Validate(t, receivedJob, err)
}
@ -168,7 +168,7 @@ func TestUpdateJobStatus(t *testing.T) {
},
},
}
receivedJob, err := c.Setup(t).Experimental().Jobs(ns).UpdateStatus(requestJob)
receivedJob, err := c.Setup(t).Extensions().Jobs(ns).UpdateStatus(requestJob)
c.Validate(t, receivedJob, err)
}
@ -182,7 +182,7 @@ func TestDeleteJob(t *testing.T) {
},
Response: Response{StatusCode: 200},
}
err := c.Setup(t).Experimental().Jobs(ns).Delete("foo", nil)
err := c.Setup(t).Extensions().Jobs(ns).Delete("foo", nil)
c.Validate(t, nil, err)
}
@ -217,6 +217,6 @@ func TestCreateJob(t *testing.T) {
},
},
}
receivedJob, err := c.Setup(t).Experimental().Jobs(ns).Create(requestJob)
receivedJob, err := c.Setup(t).Extensions().Jobs(ns).Create(requestJob)
c.Validate(t, receivedJob, err)
}

View File

@ -33,12 +33,12 @@ type ScaleInterface interface {
// horizontalPodAutoscalers implements HorizontalPodAutoscalersNamespacer interface
type scales struct {
client *ExperimentalClient
client *ExtensionsClient
ns string
}
// newHorizontalPodAutoscalers returns a horizontalPodAutoscalers
func newScales(c *ExperimentalClient, namespace string) *scales {
func newScales(c *ExtensionsClient, namespace string) *scales {
return &scales{
client: c,
ns: namespace,

View File

@ -268,7 +268,7 @@ func (c *Fake) Namespaces() client.NamespaceInterface {
return &FakeNamespaces{Fake: c}
}
func (c *Fake) Experimental() client.ExperimentalInterface {
func (c *Fake) Extensions() client.ExtensionsInterface {
return &FakeExperimental{c}
}

View File

@ -97,10 +97,10 @@ func NewDaemonSetsController(kubeClient client.Interface, resyncPeriod controlle
dsc.dsStore.Store, dsc.dsController = framework.NewInformer(
&cache.ListWatch{
ListFunc: func() (runtime.Object, error) {
return dsc.kubeClient.Experimental().DaemonSets(api.NamespaceAll).List(labels.Everything())
return dsc.kubeClient.Extensions().DaemonSets(api.NamespaceAll).List(labels.Everything())
},
WatchFunc: func(rv string) (watch.Interface, error) {
return dsc.kubeClient.Experimental().DaemonSets(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), rv)
return dsc.kubeClient.Extensions().DaemonSets(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), rv)
},
},
&extensions.DaemonSet{},
@ -460,7 +460,7 @@ func (dsc *DaemonSetsController) updateDaemonSetStatus(ds *extensions.DaemonSet)
}
}
err = storeDaemonSetStatus(dsc.kubeClient.Experimental().DaemonSets(ds.Namespace), ds, desiredNumberScheduled, currentNumberScheduled, numberMisscheduled)
err = storeDaemonSetStatus(dsc.kubeClient.Extensions().DaemonSets(ds.Namespace), ds, desiredNumberScheduled, currentNumberScheduled, numberMisscheduled)
if err != nil {
glog.Errorf("Error storing status for daemon set %+v: %v", ds, err)
}

View File

@ -34,7 +34,7 @@ import (
type DeploymentController struct {
client client.Interface
expClient client.ExperimentalInterface
expClient client.ExtensionsInterface
eventRecorder record.EventRecorder
}
@ -45,7 +45,7 @@ func New(client client.Interface) *DeploymentController {
return &DeploymentController{
client: client,
expClient: client.Experimental(),
expClient: client.Extensions(),
eventRecorder: eventBroadcaster.NewRecorder(api.EventSource{Component: "deployment-controller"}),
}
}
@ -275,5 +275,5 @@ func (d *DeploymentController) scaleRC(rc *api.ReplicationController, newScale i
func (d *DeploymentController) updateDeployment(deployment *extensions.Deployment) (*extensions.Deployment, error) {
// TODO: Using client for now, update to use store when it is ready.
return d.client.Experimental().Deployments(deployment.ObjectMeta.Namespace).Update(deployment)
return d.client.Extensions().Deployments(deployment.ObjectMeta.Namespace).Update(deployment)
}

View File

@ -86,10 +86,10 @@ func NewJobController(kubeClient client.Interface, resyncPeriod controller.Resyn
jm.jobStore.Store, jm.jobController = framework.NewInformer(
&cache.ListWatch{
ListFunc: func() (runtime.Object, error) {
return jm.kubeClient.Experimental().Jobs(api.NamespaceAll).List(labels.Everything(), fields.Everything())
return jm.kubeClient.Extensions().Jobs(api.NamespaceAll).List(labels.Everything(), fields.Everything())
},
WatchFunc: func(rv string) (watch.Interface, error) {
return jm.kubeClient.Experimental().Jobs(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), rv)
return jm.kubeClient.Extensions().Jobs(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), rv)
},
},
&extensions.Job{},
@ -431,7 +431,7 @@ func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *ex
}
func (jm *JobController) updateJobStatus(job *extensions.Job) error {
_, err := jm.kubeClient.Experimental().Jobs(job.Namespace).UpdateStatus(job)
_, err := jm.kubeClient.Extensions().Jobs(job.Namespace).UpdateStatus(job)
return err
}

View File

@ -194,23 +194,23 @@ func deleteAllContent(kubeClient client.Interface, experimentalMode bool, namesp
}
// If experimental mode, delete all experimental resources for the namespace.
if experimentalMode {
err = deleteHorizontalPodAutoscalers(kubeClient.Experimental(), namespace)
err = deleteHorizontalPodAutoscalers(kubeClient.Extensions(), namespace)
if err != nil {
return estimate, err
}
err = deleteDaemonSets(kubeClient.Experimental(), namespace)
err = deleteDaemonSets(kubeClient.Extensions(), namespace)
if err != nil {
return estimate, err
}
err = deleteJobs(kubeClient.Experimental(), namespace)
err = deleteJobs(kubeClient.Extensions(), namespace)
if err != nil {
return estimate, err
}
err = deleteDeployments(kubeClient.Experimental(), namespace)
err = deleteDeployments(kubeClient.Extensions(), namespace)
if err != nil {
return estimate, err
}
err = deleteIngress(kubeClient.Experimental(), namespace)
err = deleteIngress(kubeClient.Extensions(), namespace)
if err != nil {
return estimate, err
}
@ -446,7 +446,7 @@ func deletePersistentVolumeClaims(kubeClient client.Interface, ns string) error
return nil
}
func deleteHorizontalPodAutoscalers(expClient client.ExperimentalInterface, ns string) error {
func deleteHorizontalPodAutoscalers(expClient client.ExtensionsInterface, ns string) error {
items, err := expClient.HorizontalPodAutoscalers(ns).List(labels.Everything(), fields.Everything())
if err != nil {
return err
@ -460,7 +460,7 @@ func deleteHorizontalPodAutoscalers(expClient client.ExperimentalInterface, ns s
return nil
}
func deleteDaemonSets(expClient client.ExperimentalInterface, ns string) error {
func deleteDaemonSets(expClient client.ExtensionsInterface, ns string) error {
items, err := expClient.DaemonSets(ns).List(labels.Everything())
if err != nil {
return err
@ -474,7 +474,7 @@ func deleteDaemonSets(expClient client.ExperimentalInterface, ns string) error {
return nil
}
func deleteJobs(expClient client.ExperimentalInterface, ns string) error {
func deleteJobs(expClient client.ExtensionsInterface, ns string) error {
items, err := expClient.Jobs(ns).List(labels.Everything(), fields.Everything())
if err != nil {
return err
@ -488,7 +488,7 @@ func deleteJobs(expClient client.ExperimentalInterface, ns string) error {
return nil
}
func deleteDeployments(expClient client.ExperimentalInterface, ns string) error {
func deleteDeployments(expClient client.ExtensionsInterface, ns string) error {
items, err := expClient.Deployments(ns).List(labels.Everything(), fields.Everything())
if err != nil {
return err
@ -502,7 +502,7 @@ func deleteDeployments(expClient client.ExperimentalInterface, ns string) error
return nil
}
func deleteIngress(expClient client.ExperimentalInterface, ns string) error {
func deleteIngress(expClient client.ExtensionsInterface, ns string) error {
items, err := expClient.Ingress(ns).List(labels.Everything(), fields.Everything())
if err != nil {
return err

View File

@ -71,7 +71,7 @@ func (a *HorizontalController) Run(syncPeriod time.Duration) {
func (a *HorizontalController) reconcileAutoscaler(hpa extensions.HorizontalPodAutoscaler) error {
reference := fmt.Sprintf("%s/%s/%s", hpa.Spec.ScaleRef.Kind, hpa.Spec.ScaleRef.Namespace, hpa.Spec.ScaleRef.Name)
scale, err := a.client.Experimental().Scales(hpa.Spec.ScaleRef.Namespace).Get(hpa.Spec.ScaleRef.Kind, hpa.Spec.ScaleRef.Name)
scale, err := a.client.Extensions().Scales(hpa.Spec.ScaleRef.Namespace).Get(hpa.Spec.ScaleRef.Kind, hpa.Spec.ScaleRef.Name)
if err != nil {
a.eventRecorder.Event(&hpa, "FailedGetScale", err.Error())
return fmt.Errorf("failed to query scale subresource for %s: %v", reference, err)
@ -125,7 +125,7 @@ func (a *HorizontalController) reconcileAutoscaler(hpa extensions.HorizontalPodA
if rescale {
scale.Spec.Replicas = desiredReplicas
_, err = a.client.Experimental().Scales(hpa.Namespace).Update(hpa.Spec.ScaleRef.Kind, scale)
_, err = a.client.Extensions().Scales(hpa.Namespace).Update(hpa.Spec.ScaleRef.Kind, scale)
if err != nil {
a.eventRecorder.Eventf(&hpa, "FailedRescale", "New size: %d; error: %v", desiredReplicas, err.Error())
return fmt.Errorf("failed to rescale %s: %v", reference, err)
@ -147,7 +147,7 @@ func (a *HorizontalController) reconcileAutoscaler(hpa extensions.HorizontalPodA
hpa.Status.LastScaleTimestamp = &now
}
_, err = a.client.Experimental().HorizontalPodAutoscalers(hpa.Namespace).UpdateStatus(&hpa)
_, err = a.client.Extensions().HorizontalPodAutoscalers(hpa.Namespace).UpdateStatus(&hpa)
if err != nil {
a.eventRecorder.Event(&hpa, "FailedUpdateStatus", err.Error())
return fmt.Errorf("failed to update status for %s: %v", hpa.Name, err)
@ -157,7 +157,7 @@ func (a *HorizontalController) reconcileAutoscaler(hpa extensions.HorizontalPodA
func (a *HorizontalController) reconcileAutoscalers() error {
ns := api.NamespaceAll
list, err := a.client.Experimental().HorizontalPodAutoscalers(ns).List(labels.Everything(), fields.Everything())
list, err := a.client.Extensions().HorizontalPodAutoscalers(ns).List(labels.Everything(), fields.Everything())
if err != nil {
return fmt.Errorf("error listing nodes: %v", err)
}

View File

@ -58,7 +58,7 @@ func RunApiVersions(f *cmdutil.Factory, w io.Writer) error {
}
var expAPIVersions *unversioned.APIVersions
expAPIVersions, err = client.Experimental().ServerAPIVersions()
expAPIVersions, err = client.Extensions().ServerAPIVersions()
fmt.Fprintf(w, "Available Server Api Versions: %#v\n", *apiVersions)
if err == nil {

View File

@ -143,7 +143,7 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
case "":
return client.RESTClient, nil
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)
},
@ -407,10 +407,10 @@ func (c *clientSwaggerSchema) ValidateBytes(data []byte) error {
return fmt.Errorf("could not find api group for %s: %v", kind, err)
}
if group == "extensions" {
if c.c.ExperimentalClient == nil {
if c.c.ExtensionsClient == nil {
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)
}

View File

@ -870,7 +870,7 @@ type JobDescriber struct {
}
func (d *JobDescriber) Describe(namespace, name string) (string, error) {
job, err := d.client.Experimental().Jobs(namespace).Get(name)
job, err := d.client.Extensions().Jobs(namespace).Get(name)
if err != nil {
return "", err
}
@ -910,7 +910,7 @@ type DaemonSetDescriber struct {
}
func (d *DaemonSetDescriber) Describe(namespace, name string) (string, error) {
dc := d.Experimental().DaemonSets(namespace)
dc := d.Extensions().DaemonSets(namespace)
pc := d.Pods(namespace)
daemon, err := dc.Get(name)
@ -1241,7 +1241,7 @@ type HorizontalPodAutoscalerDescriber struct {
}
func (d *HorizontalPodAutoscalerDescriber) Describe(namespace, name string) (string, error) {
hpa, err := d.client.Experimental().HorizontalPodAutoscalers(namespace).Get(name)
hpa, err := d.client.Extensions().HorizontalPodAutoscalers(namespace).Get(name)
if err != nil {
return "", err
}
@ -1407,7 +1407,7 @@ type DeploymentDescriber struct {
}
func (dd *DeploymentDescriber) Describe(namespace, name string) (string, error) {
d, err := dd.Experimental().Deployments(namespace).Get(name)
d, err := dd.Extensions().Deployments(namespace).Get(name)
if err != nil {
return "", err
}

View File

@ -202,7 +202,7 @@ func (scaler *ReplicationControllerScaler) Scale(namespace, name string, newSize
// ScaleSimple is responsible for updating job's parallelism.
func (scaler *JobScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) error {
job, err := scaler.c.Experimental().Jobs(namespace).Get(name)
job, err := scaler.c.Extensions().Jobs(namespace).Get(name)
if err != nil {
return ControllerScaleError{ControllerScaleGetFailure, "Unknown", err}
}
@ -213,7 +213,7 @@ func (scaler *JobScaler) ScaleSimple(namespace, name string, preconditions *Scal
}
parallelism := int(newSize)
job.Spec.Parallelism = &parallelism
if _, err := scaler.c.Experimental().Jobs(namespace).Update(job); err != nil {
if _, err := scaler.c.Extensions().Jobs(namespace).Update(job); err != nil {
if errors.IsInvalid(err) {
return ControllerScaleError{ControllerScaleUpdateInvalidFailure, job.ResourceVersion, err}
}
@ -239,7 +239,7 @@ func (scaler *JobScaler) Scale(namespace, name string, newSize uint, preconditio
return err
}
if waitForReplicas != nil {
job, err := scaler.c.Experimental().Jobs(namespace).Get(name)
job, err := scaler.c.Extensions().Jobs(namespace).Get(name)
if err != nil {
return err
}

View File

@ -78,12 +78,12 @@ func (c *ErrorJobClient) Jobs(namespace string) client.JobInterface {
return &ErrorJobs{testclient.FakeJobs{Fake: &c.FakeExperimental, Namespace: namespace}, c.invalid}
}
type ErrorExperimentalClient struct {
type ErrorExtensionsClient struct {
testclient.Fake
invalid bool
}
func (c *ErrorExperimentalClient) Experimental() client.ExperimentalInterface {
func (c *ErrorExtensionsClient) Extensions() client.ExtensionsInterface {
return &ErrorJobClient{testclient.FakeExperimental{&c.Fake}, c.invalid}
}
@ -287,7 +287,7 @@ func TestValidateReplicationController(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}
preconditions := ScalePrecondition{-1, ""}
count := uint(3)
@ -331,7 +331,7 @@ func TestJobScale(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}
preconditions := ScalePrecondition{-1, ""}
count := uint(3)

View File

@ -182,7 +182,7 @@ func (reaper *ReplicationControllerReaper) Stop(namespace, name string, timeout
}
func (reaper *DaemonSetReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) (string, error) {
ds, err := reaper.Experimental().DaemonSets(namespace).Get(name)
ds, err := reaper.Extensions().DaemonSets(namespace).Get(name)
if err != nil {
return "", err
}
@ -197,13 +197,13 @@ func (reaper *DaemonSetReaper) Stop(namespace, name string, timeout time.Duratio
// force update to avoid version conflict
ds.ResourceVersion = ""
if ds, err = reaper.Experimental().DaemonSets(namespace).Update(ds); err != nil {
if ds, err = reaper.Extensions().DaemonSets(namespace).Update(ds); err != nil {
return "", err
}
// Wait for the daemon set controller to kill all the daemon pods.
if err := wait.Poll(reaper.pollInterval, reaper.timeout, func() (bool, error) {
updatedDS, err := reaper.Experimental().DaemonSets(namespace).Get(name)
updatedDS, err := reaper.Extensions().DaemonSets(namespace).Get(name)
if err != nil {
return false, nil
}
@ -212,14 +212,14 @@ func (reaper *DaemonSetReaper) Stop(namespace, name string, timeout time.Duratio
return "", err
}
if err := reaper.Experimental().DaemonSets(namespace).Delete(name); err != nil {
if err := reaper.Extensions().DaemonSets(namespace).Delete(name); err != nil {
return "", err
}
return fmt.Sprintf("%s stopped", name), nil
}
func (reaper *JobReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *api.DeleteOptions) (string, error) {
jobs := reaper.Experimental().Jobs(namespace)
jobs := reaper.Extensions().Jobs(namespace)
scaler, err := ScalerFor("Job", *reaper)
if err != nil {
return "", err

View File

@ -169,7 +169,7 @@ func createCPUHorizontalPodAutoscaler(rc *ResourceConsumer, cpu string) {
Target: extensions.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse(cpu)},
},
}
_, errHPA := rc.framework.Client.Experimental().HorizontalPodAutoscalers(rc.framework.Namespace.Name).Create(hpa)
_, errHPA := rc.framework.Client.Extensions().HorizontalPodAutoscalers(rc.framework.Namespace.Name).Create(hpa)
expectNoError(errHPA)
}
@ -192,6 +192,6 @@ func createMemoryHorizontalPodAutoscaler(rc *ResourceConsumer, memory string) {
Target: extensions.ResourceConsumption{Resource: api.ResourceMemory, Quantity: resource.MustParse(memory + "M")},
},
}
_, errHPA := rc.framework.Client.Experimental().HorizontalPodAutoscalers(rc.framework.Namespace.Name).Create(hpa)
_, errHPA := rc.framework.Client.Extensions().HorizontalPodAutoscalers(rc.framework.Namespace.Name).Create(hpa)
expectNoError(errHPA)
}

View File

@ -97,7 +97,7 @@ var _ = Describe("Job", func() {
By("Ensuring job shows many failures")
err = wait.Poll(poll, jobTimeout, func() (bool, error) {
curr, err := f.Client.Experimental().Jobs(f.Namespace.Name).Get(job.Name)
curr, err := f.Client.Extensions().Jobs(f.Namespace.Name).Get(job.Name)
if err != nil {
return false, err
}
@ -176,7 +176,7 @@ var _ = Describe("Job", func() {
Expect(err).NotTo(HaveOccurred())
By("Ensuring job was deleted")
_, err = f.Client.Experimental().Jobs(f.Namespace.Name).Get(job.Name)
_, err = f.Client.Extensions().Jobs(f.Namespace.Name).Get(job.Name)
Expect(err).To(HaveOccurred())
Expect(errors.IsNotFound(err)).To(BeTrue())
})
@ -224,11 +224,11 @@ func newTestJob(behavior, name string, rPol api.RestartPolicy, parallelism, comp
}
func createJob(c *client.Client, ns string, job *extensions.Job) (*extensions.Job, error) {
return c.Experimental().Jobs(ns).Create(job)
return c.Extensions().Jobs(ns).Create(job)
}
func deleteJob(c *client.Client, ns, name string) error {
return c.Experimental().Jobs(ns).Delete(name, api.NewDeleteOptions(0))
return c.Extensions().Jobs(ns).Delete(name, api.NewDeleteOptions(0))
}
// Wait for all pods to become Running. Only use when pods will run for a long time, or it will be racy.
@ -252,7 +252,7 @@ func waitForAllPodsRunning(c *client.Client, ns, jobName string, parallelism int
// Wait for job to reach completions.
func waitForJobFinish(c *client.Client, ns, jobName string, completions int) error {
return wait.Poll(poll, jobTimeout, func() (bool, error) {
curr, err := c.Experimental().Jobs(ns).Get(jobName)
curr, err := c.Extensions().Jobs(ns).Get(jobName)
if err != nil {
return false, err
}