Skip to content

Commit 41791ef

Browse files
committed
straight move of openshift apiserver
1 parent 5806d5b commit 41791ef

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

pkg/cmd/server/origin/legacy.go renamed to pkg/cmd/openshift-apiserver/openshiftapiserver/legacy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package origin
1+
package openshiftapiserver
22

33
import (
44
"k8s.io/apimachinery/pkg/runtime/schema"

pkg/cmd/server/origin/openshift_apiserver.go renamed to pkg/cmd/openshift-apiserver/openshiftapiserver/openshift_apiserver.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package origin
1+
package openshiftapiserver
22

33
import (
44
"encoding/json"
@@ -572,7 +572,7 @@ func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget)
572572
addReadinessCheckRoute(s.GenericAPIServer.Handler.NonGoRestfulMux, "/healthz/ready", c.ExtraConfig.ProjectAuthorizationCache.ReadyForAccess)
573573

574574
// this remains here and separate so that you can check both kube and openshift levels
575-
addOpenshiftVersionRoute(s.GenericAPIServer.Handler.GoRestfulContainer, "/version/openshift")
575+
AddOpenshiftVersionRoute(s.GenericAPIServer.Handler.GoRestfulContainer, "/version/openshift")
576576

577577
// register our poststarthooks
578578
s.GenericAPIServer.AddPostStartHookOrDie("project.openshift.io-projectcache", c.startProjectCache)
@@ -616,7 +616,7 @@ func addReadinessCheckRoute(mux *genericmux.PathRecorderMux, path string, readyF
616616
}
617617

618618
// initVersionRoute initializes an HTTP endpoint for the server's version information.
619-
func addOpenshiftVersionRoute(container *restful.Container, path string) {
619+
func AddOpenshiftVersionRoute(container *restful.Container, path string) {
620620
// Build version info once
621621
versionInfo, err := json.MarshalIndent(version.Get(), "", " ")
622622
if err != nil {
@@ -691,8 +691,8 @@ func (c *completedConfig) bootstrapSCC(context genericapiserver.PostStartHookCon
691691
return nil
692692
}
693693

694-
// ensureOpenShiftInfraNamespace is called as part of global policy initialization to ensure infra namespace exists
695-
func ensureOpenShiftInfraNamespace(context genericapiserver.PostStartHookContext) error {
694+
// EnsureOpenShiftInfraNamespace is called as part of global policy initialization to ensure infra namespace exists
695+
func EnsureOpenShiftInfraNamespace(context genericapiserver.PostStartHookContext) error {
696696
namespaceName := bootstrappolicy.DefaultOpenShiftInfraNamespace
697697

698698
var coreClient coreclient.CoreInterface

pkg/cmd/server/origin/master.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
kcorestorage "k8s.io/kubernetes/pkg/registry/core/rest"
1818
rbacrest "k8s.io/kubernetes/pkg/registry/rbac/rest"
1919

20+
"github.com/openshift/origin/pkg/cmd/openshift-apiserver/openshiftapiserver"
2021
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy"
2122
kubernetes "github.com/openshift/origin/pkg/cmd/server/kubernetes/master"
2223
cmdutil "github.com/openshift/origin/pkg/cmd/util"
@@ -35,7 +36,7 @@ const (
3536
openShiftOAuthCallbackPrefix = "/oauth2callback"
3637
)
3738

38-
func (c *MasterConfig) newOpenshiftAPIConfig(kubeAPIServerConfig apiserver.Config) (*OpenshiftAPIConfig, error) {
39+
func (c *MasterConfig) newOpenshiftAPIConfig(kubeAPIServerConfig apiserver.Config) (*openshiftapiserver.OpenshiftAPIConfig, error) {
3940
// sccStorage must use the upstream RESTOptionsGetter to be in the correct location
4041
// this probably creates a duplicate cache, but there are not very many SCCs, so live with it to avoid further linkage
4142
sccStorage := sccstorage.NewREST(kubeAPIServerConfig.RESTOptionsGetter)
@@ -56,9 +57,9 @@ func (c *MasterConfig) newOpenshiftAPIConfig(kubeAPIServerConfig apiserver.Confi
5657
}
5758
}
5859

59-
ret := &OpenshiftAPIConfig{
60+
ret := &openshiftapiserver.OpenshiftAPIConfig{
6061
GenericConfig: &apiserver.RecommendedConfig{Config: genericConfig},
61-
ExtraConfig: OpenshiftAPIExtraConfig{
62+
ExtraConfig: openshiftapiserver.OpenshiftAPIExtraConfig{
6263
KubeAPIServerClientConfig: &c.PrivilegedLoopbackClientConfig,
6364
KubeInternalInformers: c.InternalKubeInformers,
6465
KubeInformers: c.ClientGoKubeInformers,
@@ -160,7 +161,7 @@ func (c *MasterConfig) withKubeAPI(delegateAPIServer apiserver.DelegationTarget,
160161

161162
// this remains here and separate so that you can check both kube and openshift levels
162163
// TODO make this is a proxy at some point
163-
addOpenshiftVersionRoute(kubeAPIServer.GenericAPIServer.Handler.GoRestfulContainer, "/version/openshift")
164+
openshiftapiserver.AddOpenshiftVersionRoute(kubeAPIServer.GenericAPIServer.Handler.GoRestfulContainer, "/version/openshift")
164165

165166
return preparedKubeAPIServer.GenericAPIServer, nil
166167
}
@@ -278,7 +279,7 @@ func (c *MasterConfig) Run(stopCh <-chan struct{}) error {
278279

279280
// add post-start hooks
280281
aggregatedAPIServer.GenericAPIServer.AddPostStartHookOrDie("authorization.openshift.io-bootstrapclusterroles", bootstrapData(bootstrappolicy.Policy()).EnsureRBACPolicy())
281-
aggregatedAPIServer.GenericAPIServer.AddPostStartHookOrDie("authorization.openshift.io-ensureopenshift-infra", ensureOpenShiftInfraNamespace)
282+
aggregatedAPIServer.GenericAPIServer.AddPostStartHookOrDie("authorization.openshift.io-ensureopenshift-infra", openshiftapiserver.EnsureOpenShiftInfraNamespace)
282283
c.AddPostStartHooks(aggregatedAPIServer.GenericAPIServer)
283284

284285
for name, fn := range c.additionalPostStartHooks {
@@ -337,7 +338,7 @@ func (c *MasterConfig) RunKubeAPIServer(stopCh <-chan struct{}) error {
337338
}
338339

339340
aggregatedAPIServer.GenericAPIServer.AddPostStartHookOrDie("authorization.openshift.io-bootstrapclusterroles", bootstrapData(bootstrappolicy.Policy()).EnsureRBACPolicy())
340-
aggregatedAPIServer.GenericAPIServer.AddPostStartHookOrDie("authorization.openshift.io-ensureopenshift-infra", ensureOpenShiftInfraNamespace)
341+
aggregatedAPIServer.GenericAPIServer.AddPostStartHookOrDie("authorization.openshift.io-ensureopenshift-infra", openshiftapiserver.EnsureOpenShiftInfraNamespace)
341342
c.AddPostStartHooks(aggregatedAPIServer.GenericAPIServer)
342343

343344
// add post-start hooks

0 commit comments

Comments
 (0)