mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-31 05:40:42 +00:00 
			
		
		
		
	Add deployments to federation apiserver
This commit is contained in:
		| @@ -25,23 +25,29 @@ import ( | ||||
| 	_ "k8s.io/kubernetes/pkg/apis/extensions/install" | ||||
| 	"k8s.io/kubernetes/pkg/genericapiserver" | ||||
| 	daemonsetetcd "k8s.io/kubernetes/pkg/registry/extensions/daemonset/etcd" | ||||
| 	deploymentetcd "k8s.io/kubernetes/pkg/registry/extensions/deployment/etcd" | ||||
| 	ingressetcd "k8s.io/kubernetes/pkg/registry/extensions/ingress/etcd" | ||||
| 	replicasetetcd "k8s.io/kubernetes/pkg/registry/extensions/replicaset/etcd" | ||||
| ) | ||||
|  | ||||
| func installExtensionsAPIs(g *genericapiserver.GenericAPIServer, restOptionsFactory restOptionsFactory) { | ||||
| 	replicaSetStorage := replicasetetcd.NewStorage(restOptionsFactory.NewFor(extensions.Resource("replicasets"))) | ||||
| 	deploymentStorage := deploymentetcd.NewStorage(restOptionsFactory.NewFor(extensions.Resource("deployments"))) | ||||
| 	ingressStorage, ingressStatusStorage := ingressetcd.NewREST(restOptionsFactory.NewFor(extensions.Resource("ingresses"))) | ||||
| 	daemonSetStorage, daemonSetStatusStorage := daemonsetetcd.NewREST(restOptionsFactory.NewFor(extensions.Resource("daemonsets"))) | ||||
|  | ||||
| 	extensionsResources := map[string]rest.Storage{ | ||||
| 		"replicasets":        replicaSetStorage.ReplicaSet, | ||||
| 		"replicasets/status": replicaSetStorage.Status, | ||||
| 		"replicasets/scale":  replicaSetStorage.Scale, | ||||
| 		"ingresses":          ingressStorage, | ||||
| 		"ingresses/status":   ingressStatusStorage, | ||||
| 		"daemonsets":         daemonSetStorage, | ||||
| 		"daemonsets/status":  daemonSetStatusStorage, | ||||
| 		"replicasets":          replicaSetStorage.ReplicaSet, | ||||
| 		"replicasets/status":   replicaSetStorage.Status, | ||||
| 		"replicasets/scale":    replicaSetStorage.Scale, | ||||
| 		"ingresses":            ingressStorage, | ||||
| 		"ingresses/status":     ingressStatusStorage, | ||||
| 		"daemonsets":           daemonSetStorage, | ||||
| 		"daemonsets/status":    daemonSetStatusStorage, | ||||
| 		"deployments":          deploymentStorage.Deployment, | ||||
| 		"deployments/status":   deploymentStorage.Status, | ||||
| 		"deployments/scale":    deploymentStorage.Scale, | ||||
| 		"deployments/rollback": deploymentStorage.Rollback, | ||||
| 	} | ||||
| 	extensionsGroupMeta := registered.GroupOrDie(extensions.GroupName) | ||||
| 	apiGroupInfo := genericapiserver.APIGroupInfo{ | ||||
|   | ||||
| @@ -330,8 +330,8 @@ func testExtensionsResourceList(t *testing.T) { | ||||
| 	// empty APIVersion for extensions group | ||||
| 	assert.Equal(t, "", apiResourceList.APIVersion) | ||||
| 	assert.Equal(t, ext_v1b1.SchemeGroupVersion.String(), apiResourceList.GroupVersion) | ||||
| 	// Assert that there are exactly 5 resources. | ||||
| 	assert.Equal(t, 7, len(apiResourceList.APIResources)) | ||||
| 	// Assert that there are exactly 11 resources. | ||||
| 	assert.Equal(t, 11, len(apiResourceList.APIResources)) | ||||
|  | ||||
| 	// Verify replicasets. | ||||
| 	found := findResource(apiResourceList.APIResources, "replicasets") | ||||
| @@ -359,4 +359,16 @@ func testExtensionsResourceList(t *testing.T) { | ||||
| 	found = findResource(apiResourceList.APIResources, "daemonsets/status") | ||||
| 	assert.NotNil(t, found) | ||||
| 	assert.True(t, found.Namespaced) | ||||
|  | ||||
| 	// Verify deployments. | ||||
| 	found = findResource(apiResourceList.APIResources, "deployments") | ||||
| 	assert.NotNil(t, found) | ||||
| 	assert.True(t, found.Namespaced) | ||||
| 	found = findResource(apiResourceList.APIResources, "deployments/status") | ||||
| 	assert.NotNil(t, found) | ||||
| 	assert.True(t, found.Namespaced) | ||||
| 	found = findResource(apiResourceList.APIResources, "deployments/scale") | ||||
| 	assert.NotNil(t, found) | ||||
| 	assert.True(t, found.Namespaced) | ||||
| 	found = findResource(apiResourceList.APIResources, "deployments/rollback") | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user