Skip to content

Commit

Permalink
Merge pull request #21964 from danwinship/drop-old-network-api
Browse files Browse the repository at this point in the history
Remove the rest of the pre-CRD network API support
  • Loading branch information
openshift-merge-robot committed Jun 3, 2019
2 parents 3d6ff53 + c6c5fa4 commit 94f86f9
Show file tree
Hide file tree
Showing 39 changed files with 161 additions and 2,822 deletions.
2 changes: 0 additions & 2 deletions examples/examples_test.go
Expand Up @@ -22,7 +22,6 @@ import (
appsapi "github.com/openshift/origin/pkg/apps/apis/apps"
buildapi "github.com/openshift/origin/pkg/build/apis/build"
imageapi "github.com/openshift/origin/pkg/image/apis/image"
networkapi "github.com/openshift/origin/pkg/network/apis/network"
routeapi "github.com/openshift/origin/pkg/route/apis/route"
templateapi "github.com/openshift/origin/pkg/template/apis/template"

Expand Down Expand Up @@ -120,7 +119,6 @@ func TestExampleObjectSchemas(t *testing.T) {
"test-service-with-finalizer": &kapi.Service{},
"test-buildcli": &kapi.List{},
"test-buildcli-beta2": &kapi.List{},
"test-egress-network-policy": &networkapi.EgressNetworkPolicy{},
},
"../test/templates/testdata": {
"crunchydata-pod": nil, // Explicitly fails validation, but should pass transformation
Expand Down
16 changes: 0 additions & 16 deletions hack/import-restrictions.json
Expand Up @@ -39,7 +39,6 @@
"github.com/openshift/origin/pkg/apps/apiserver",
"github.com/openshift/origin/pkg/build/apiserver",
"github.com/openshift/origin/pkg/image/apiserver",
"github.com/openshift/origin/pkg/network/apiserver",
"github.com/openshift/origin/pkg/oauth/apiserver",
"github.com/openshift/origin/pkg/project/apiserver",
"github.com/openshift/origin/pkg/quota/apiserver",
Expand All @@ -55,7 +54,6 @@
"github.com/openshift/origin/pkg/apps/apiserver",
"github.com/openshift/origin/pkg/build/apiserver",
"github.com/openshift/origin/pkg/image/apiserver",
"github.com/openshift/origin/pkg/network/apiserver",
"github.com/openshift/origin/pkg/oauth/apiserver",
"github.com/openshift/origin/pkg/project/apiserver",
"github.com/openshift/origin/pkg/quota/apiserver",
Expand Down Expand Up @@ -86,7 +84,6 @@
"github.com/openshift/origin/pkg/apps/apiserver",
"github.com/openshift/origin/pkg/build/apiserver",
"github.com/openshift/origin/pkg/image/apiserver",
"github.com/openshift/origin/pkg/network/apiserver",
"github.com/openshift/origin/pkg/oauth/apiserver",
"github.com/openshift/origin/pkg/project/apiserver",
"github.com/openshift/origin/pkg/quota/apiserver",
Expand Down Expand Up @@ -241,19 +238,6 @@
]
},

{
"checkedPackages": [
"github.com/openshift/origin/pkg/network/apis/network",
"github.com/openshift/origin/pkg/network/apis/network/v1"
],
"allowedImportPackageRoots": [
"vendor/k8s.io/apimachinery",
"vendor/k8s.io/api",
"vendor/github.com/openshift/api"
],
"allowedImportPackages": []
},

{
"checkedPackages": [
"github.com/openshift/origin/pkg/oauth/apis/oauth",
Expand Down
1 change: 0 additions & 1 deletion hack/update-generated-conversions.sh
Expand Up @@ -18,7 +18,6 @@ ALL_FQ_APIS=(
github.com/openshift/origin/pkg/build/apis/build/v1
github.com/openshift/origin/pkg/cmd/server/apis/config/v1
github.com/openshift/origin/pkg/image/apis/image/v1
github.com/openshift/origin/pkg/network/apis/network/v1
github.com/openshift/origin/pkg/oauth/apis/oauth/v1
github.com/openshift/origin/pkg/project/apis/project/v1
github.com/openshift/origin/pkg/quota/apis/quota/v1
Expand Down
1 change: 0 additions & 1 deletion hack/update-generated-deep-copies.sh
Expand Up @@ -37,7 +37,6 @@ ALL_FQ_APIS=(
github.com/openshift/origin/pkg/authorization/apis/authorization
github.com/openshift/origin/pkg/build/apis/build
github.com/openshift/origin/pkg/image/apis/image
github.com/openshift/origin/pkg/network/apis/network
github.com/openshift/origin/pkg/oauth/apis/oauth
github.com/openshift/origin/pkg/project/apis/project
github.com/openshift/origin/pkg/quota/apis/quota
Expand Down
1 change: 0 additions & 1 deletion hack/update-generated-defaulters.sh
Expand Up @@ -16,7 +16,6 @@ ALL_FQ_APIS=(
github.com/openshift/origin/pkg/build/apis/build/v1
github.com/openshift/origin/pkg/cmd/server/apis/config/v1
github.com/openshift/origin/pkg/image/apis/image/v1
github.com/openshift/origin/pkg/network/apis/network/v1
github.com/openshift/origin/pkg/oauth/apis/oauth/v1
github.com/openshift/origin/pkg/project/apis/project/v1
github.com/openshift/origin/pkg/quota/apis/quota/v1
Expand Down
2 changes: 0 additions & 2 deletions pkg/api/install/install.go
Expand Up @@ -30,7 +30,6 @@ import (
authz "github.com/openshift/origin/pkg/authorization/apis/authorization/install"
build "github.com/openshift/origin/pkg/build/apis/build/install"
image "github.com/openshift/origin/pkg/image/apis/image/install"
network "github.com/openshift/origin/pkg/network/apis/network/install"
oauth "github.com/openshift/origin/pkg/oauth/apis/oauth/install"
project "github.com/openshift/origin/pkg/project/apis/project/install"
quota "github.com/openshift/origin/pkg/quota/apis/quota/install"
Expand All @@ -45,7 +44,6 @@ func InstallInternalOpenShift(scheme *runtime.Scheme) {
authz.Install(scheme)
build.Install(scheme)
image.Install(scheme)
network.Install(scheme)
oauth.Install(scheme)
project.Install(scheme)
quota.Install(scheme)
Expand Down
1 change: 0 additions & 1 deletion pkg/api/legacy/install.go
Expand Up @@ -31,7 +31,6 @@ func InstallInternalLegacyAll(scheme *runtime.Scheme) {
InstallInternalLegacyAuthorization(scheme)
InstallInternalLegacyBuild(scheme)
InstallInternalLegacyImage(scheme)
InstallInternalLegacyNetwork(scheme)
InstallInternalLegacyOAuth(scheme)
InstallInternalLegacyProject(scheme)
InstallInternalLegacyQuota(scheme)
Expand Down
28 changes: 0 additions & 28 deletions pkg/api/legacy/network.go
Expand Up @@ -5,24 +5,10 @@ import (
utilruntime "k8s.io/apimachinery/pkg/util/runtime"

networkv1 "github.com/openshift/api/network/v1"
"github.com/openshift/origin/pkg/network/apis/network"
networkv1helpers "github.com/openshift/origin/pkg/network/apis/network/v1"
)

// InstallLegacyNetwork this looks like a lot of duplication, but the code in the individual versions is living and may
// change. The code here should never change and needs to allow the other code to move independently.
func InstallInternalLegacyNetwork(scheme *runtime.Scheme) {
InstallExternalLegacyNetwork(scheme)

schemeBuilder := runtime.NewSchemeBuilder(
addUngroupifiedInternalNetworkTypes,

networkv1helpers.RegisterDefaults,
networkv1helpers.RegisterConversions,
)
utilruntime.Must(schemeBuilder.AddToScheme(scheme))
}

func InstallExternalLegacyNetwork(scheme *runtime.Scheme) {
schemeBuilder := runtime.NewSchemeBuilder(
addUngroupifiedNetworkTypes,
Expand All @@ -44,17 +30,3 @@ func addUngroupifiedNetworkTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(GroupVersion, types...)
return nil
}

func addUngroupifiedInternalNetworkTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(InternalGroupVersion,
&network.ClusterNetwork{},
&network.ClusterNetworkList{},
&network.HostSubnet{},
&network.HostSubnetList{},
&network.NetNamespace{},
&network.NetNamespaceList{},
&network.EgressNetworkPolicy{},
&network.EgressNetworkPolicyList{},
)
return nil
}
7 changes: 0 additions & 7 deletions pkg/api/validation/register.go
Expand Up @@ -5,7 +5,6 @@ import (
authorizationvalidation "github.com/openshift/origin/pkg/authorization/apis/authorization/validation"
buildvalidation "github.com/openshift/origin/pkg/build/apis/build/validation"
imagevalidation "github.com/openshift/origin/pkg/image/apis/image/validation"
sdnvalidation "github.com/openshift/origin/pkg/network/apis/network/validation"
oauthvalidation "github.com/openshift/origin/pkg/oauth/apis/oauth/validation"
projectvalidation "github.com/openshift/origin/pkg/project/apis/project/validation"
quotavalidation "github.com/openshift/origin/pkg/quota/apis/quota/validation"
Expand All @@ -18,7 +17,6 @@ import (
authorizationapi "github.com/openshift/origin/pkg/authorization/apis/authorization"
buildapi "github.com/openshift/origin/pkg/build/apis/build"
imageapi "github.com/openshift/origin/pkg/image/apis/image"
networkapi "github.com/openshift/origin/pkg/network/apis/network"
oauthapi "github.com/openshift/origin/pkg/oauth/apis/oauth"
projectapi "github.com/openshift/origin/pkg/project/apis/project"
quotaapi "github.com/openshift/origin/pkg/quota/apis/quota"
Expand Down Expand Up @@ -77,11 +75,6 @@ func registerAll() {

Validator.MustRegister(&routeapi.Route{}, true, routevalidation.ValidateRoute, routevalidation.ValidateRouteUpdate)

Validator.MustRegister(&networkapi.ClusterNetwork{}, false, sdnvalidation.ValidateClusterNetwork, sdnvalidation.ValidateClusterNetworkUpdate)
Validator.MustRegister(&networkapi.HostSubnet{}, false, sdnvalidation.ValidateHostSubnet, sdnvalidation.ValidateHostSubnetUpdate)
Validator.MustRegister(&networkapi.NetNamespace{}, false, sdnvalidation.ValidateNetNamespace, sdnvalidation.ValidateNetNamespaceUpdate)
Validator.MustRegister(&networkapi.EgressNetworkPolicy{}, true, sdnvalidation.ValidateEgressNetworkPolicy, sdnvalidation.ValidateEgressNetworkPolicyUpdate)

Validator.MustRegister(&templateapi.Template{}, true, templatevalidation.ValidateTemplate, templatevalidation.ValidateTemplateUpdate)
Validator.MustRegister(&templateapi.TemplateInstance{}, true, templatevalidation.ValidateTemplateInstance, templatevalidation.ValidateTemplateInstanceUpdate)
Validator.MustRegister(&templateapi.BrokerTemplateInstance{}, false, templatevalidation.ValidateBrokerTemplateInstance, templatevalidation.ValidateBrokerTemplateInstanceUpdate)
Expand Down
7 changes: 1 addition & 6 deletions pkg/cmd/openshift-apiserver/cmd.go
Expand Up @@ -54,7 +54,7 @@ func NewOpenShiftAPIServerCommand(name, basename string, out, errout io.Writer,

serviceability.StartProfiler()

if err := options.WithoutNetworkingAPI().RunAPIServer(stopCh); err != nil {
if err := options.RunAPIServer(stopCh); err != nil {
if kerrors.IsInvalid(err) {
if details := err.(*kerrors.StatusError).ErrStatus.Details; details != nil {
fmt.Fprintf(errout, "Invalid %s %s\n", details.Kind, details.Name)
Expand Down Expand Up @@ -86,11 +86,6 @@ func (o *OpenShiftAPIServer) Validate() error {
return nil
}

func (o *OpenShiftAPIServer) WithoutNetworkingAPI() *OpenShiftAPIServer {
featureKeepRemovedNetworkingAPI = false
return o
}

// RunAPIServer takes the options, starts the API server and waits until stopCh is closed or initial listening fails.
func (o *OpenShiftAPIServer) RunAPIServer(stopCh <-chan struct{}) error {
// try to decode into our new types first. right now there is no validation, no file path resolution. this unsticks the operator to start.
Expand Down
Expand Up @@ -40,7 +40,6 @@ import (
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy"
imageapiserver "github.com/openshift/origin/pkg/image/apiserver"
"github.com/openshift/origin/pkg/image/apiserver/registryhostname"
networkapiserver "github.com/openshift/origin/pkg/network/apiserver"
oauthapiserver "github.com/openshift/origin/pkg/oauth/apiserver"
projectapiserver "github.com/openshift/origin/pkg/project/apiserver"
projectauth "github.com/openshift/origin/pkg/project/auth"
Expand Down Expand Up @@ -249,24 +248,6 @@ func (c *completedConfig) withImageAPIServer(delegateAPIServer genericapiserver.
return server.GenericAPIServer, nil
}

func (c *completedConfig) withNetworkAPIServer(delegateAPIServer genericapiserver.DelegationTarget) (genericapiserver.DelegationTarget, error) {
cfg := &networkapiserver.NetworkAPIServerConfig{
GenericConfig: &genericapiserver.RecommendedConfig{Config: *c.GenericConfig.Config, SharedInformerFactory: c.GenericConfig.SharedInformerFactory},
ExtraConfig: networkapiserver.ExtraConfig{
Codecs: legacyscheme.Codecs,
Scheme: legacyscheme.Scheme,
},
}
config := cfg.Complete()
server, err := config.New(delegateAPIServer)
if err != nil {
return nil, err
}
server.GenericAPIServer.PrepareRun() // this triggers openapi construction

return server.GenericAPIServer, nil
}

func (c *completedConfig) withOAuthAPIServer(delegateAPIServer genericapiserver.DelegationTarget) (genericapiserver.DelegationTarget, error) {
cfg := &oauthapiserver.OAuthAPIServerConfig{
GenericConfig: &genericapiserver.RecommendedConfig{Config: *c.GenericConfig.Config, SharedInformerFactory: c.GenericConfig.SharedInformerFactory},
Expand Down Expand Up @@ -448,16 +429,13 @@ func addAPIServerOrDie(delegateAPIServer genericapiserver.DelegationTarget, apiS
return delegateAPIServer
}

func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget, keepRemovedNetworkingAPIs bool) (*OpenshiftAPIServer, error) {
func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget) (*OpenshiftAPIServer, error) {
delegateAPIServer := delegationTarget

delegateAPIServer = addAPIServerOrDie(delegateAPIServer, c.withAppsAPIServer)
delegateAPIServer = addAPIServerOrDie(delegateAPIServer, c.withAuthorizationAPIServer)
delegateAPIServer = addAPIServerOrDie(delegateAPIServer, c.withBuildAPIServer)
delegateAPIServer = addAPIServerOrDie(delegateAPIServer, c.withImageAPIServer)
if keepRemovedNetworkingAPIs {
delegateAPIServer = addAPIServerOrDie(delegateAPIServer, c.withNetworkAPIServer)
}
delegateAPIServer = addAPIServerOrDie(delegateAPIServer, c.withOAuthAPIServer)
delegateAPIServer = addAPIServerOrDie(delegateAPIServer, c.withProjectAPIServer)
delegateAPIServer = addAPIServerOrDie(delegateAPIServer, c.withQuotaAPIServer)
Expand Down
5 changes: 1 addition & 4 deletions pkg/cmd/openshift-apiserver/server.go
Expand Up @@ -16,9 +16,6 @@ import (
_ "k8s.io/kubernetes/pkg/util/workqueue/prometheus" // for workqueue metric registration
)

// default this to true so that the integration tests don't instantly break
var featureKeepRemovedNetworkingAPI = true

func RunOpenShiftAPIServer(serverConfig *openshiftcontrolplanev1.OpenShiftAPIServerConfig, stopCh <-chan struct{}) error {
serviceability.InitLogrusFromKlog()
// Allow privileged containers
Expand All @@ -35,7 +32,7 @@ func RunOpenShiftAPIServer(serverConfig *openshiftcontrolplanev1.OpenShiftAPISer
if err != nil {
return err
}
openshiftAPIServer, err := openshiftAPIServerRuntimeConfig.Complete().New(genericapiserver.NewEmptyDelegate(), featureKeepRemovedNetworkingAPI)
openshiftAPIServer, err := openshiftAPIServerRuntimeConfig.Complete().New(genericapiserver.NewEmptyDelegate())
if err != nil {
return err
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/network/apis/network/doc.go

This file was deleted.

20 changes: 0 additions & 20 deletions pkg/network/apis/network/install/install.go

This file was deleted.

7 changes: 0 additions & 7 deletions pkg/network/apis/network/plugin.go

This file was deleted.

43 changes: 0 additions & 43 deletions pkg/network/apis/network/register.go

This file was deleted.

0 comments on commit 94f86f9

Please sign in to comment.