Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
deads2k committed Aug 22, 2018
1 parent 1d2c1a7 commit f10076b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 deletions.
13 changes: 5 additions & 8 deletions pkg/cmd/openshift-kube-apiserver/openshiftkubeapiserver/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func ConfigToFlags(kubeAPIServerConfig *configapi.MasterConfig) ([]string, error
return nil, err
}

// TODO this list (and the content below) will be used to drive a config struct and a reflective test matching config to flags
// these flags are overridden by a patch
// admission-control
// authentication-token-webhook-cache-ttl
Expand Down Expand Up @@ -200,8 +201,8 @@ func admissionFlags(kubeAPIServerConfig *configapi.MasterConfig) (map[string][]s
if err != nil {
return nil, err
}
// if the config isn't a DefaultAdmissionConfig, then assume we're enabled (we were called after all)
// if the config *is* a DefaultAdmissionConfig and it explicitly said
// if the config isn't a DefaultAdmissionConfig, then assume we're enabled (we were called out after all)
// if the config *is* a DefaultAdmissionConfig and it explicitly said to disable us, we are disabled
obj, err := configapilatest.ReadYAML(bytes.NewBuffer(content))
// if we can't read it, let the plugin deal with it
// if nothing was there, let the plugin deal with it
Expand All @@ -218,14 +219,12 @@ func admissionFlags(kubeAPIServerConfig *configapi.MasterConfig) (map[string][]s
config.Location = ""
config.Configuration = &runtime.Unknown{Raw: content}
pluginConfig[pluginName] = *config
continue

} else if defaultConfig.Disable {
forceOff = append(forceOff, pluginName)
continue

} else {
forceOn = append(forceOn, pluginName)
continue
}

continue
Expand All @@ -234,14 +233,12 @@ func admissionFlags(kubeAPIServerConfig *configapi.MasterConfig) (map[string][]s
if defaultConfig, ok := config.Configuration.(*configapi.DefaultAdmissionConfig); !ok {
forceOn = append(forceOn, pluginName)
pluginConfig[pluginName] = *config
continue

} else if defaultConfig.Disable {
forceOff = append(forceOff, pluginName)
continue

} else {
forceOn = append(forceOn, pluginName)
continue
}

}
Expand Down
25 changes: 12 additions & 13 deletions pkg/cmd/openshift-kube-apiserver/openshiftkubeapiserver/patch.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package openshiftkubeapiserver

import (
"github.com/openshift/origin/pkg/admission/namespaceconditions"
configapi "github.com/openshift/origin/pkg/cmd/server/apis/config"
usercache "github.com/openshift/origin/pkg/user/cache"
"fmt"
"time"

"k8s.io/apiserver/pkg/admission"
admissionmetrics "k8s.io/apiserver/pkg/admission/metrics"
genericapiserver "k8s.io/apiserver/pkg/server"
"k8s.io/apiserver/pkg/server/options"
clientgoinformers "k8s.io/client-go/informers"
kexternalinformers "k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"
"k8s.io/kubernetes/cmd/kube-apiserver/app"
internalinformers "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion"
kinternalinformers "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion"
Expand All @@ -21,24 +24,20 @@ import (
oauthinformer "github.com/openshift/client-go/oauth/informers/externalversions"
userclient "github.com/openshift/client-go/user/clientset/versioned"
userinformer "github.com/openshift/client-go/user/informers/externalversions"
"github.com/openshift/origin/pkg/admission/namespaceconditions"
"github.com/openshift/origin/pkg/cmd/openshift-apiserver/openshiftapiserver"
"github.com/openshift/origin/pkg/cmd/openshift-apiserver/openshiftapiserver/configprocessing"
oadmission "github.com/openshift/origin/pkg/cmd/server/admission"
configapi "github.com/openshift/origin/pkg/cmd/server/apis/config"
originadmission "github.com/openshift/origin/pkg/cmd/server/origin/admission"
"github.com/openshift/origin/pkg/image/apiserver/registryhostname"
imageinformer "github.com/openshift/origin/pkg/image/generated/informers/internalversion"
imageclient "github.com/openshift/origin/pkg/image/generated/internalclientset"
quotainformer "github.com/openshift/origin/pkg/quota/generated/informers/internalversion"
quotaclient "github.com/openshift/origin/pkg/quota/generated/internalclientset"
securityinformer "github.com/openshift/origin/pkg/security/generated/informers/internalversion"
securityclient "github.com/openshift/origin/pkg/security/generated/internalclientset"

"fmt"
"time"

"github.com/openshift/origin/pkg/cmd/openshift-apiserver/openshiftapiserver"
"github.com/openshift/origin/pkg/cmd/openshift-apiserver/openshiftapiserver/configprocessing"
"github.com/openshift/origin/pkg/image/apiserver/registryhostname"
"k8s.io/apiserver/pkg/server/options"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/cache"
usercache "github.com/openshift/origin/pkg/user/cache"
)

type KubeAPIServerServerPatchContext struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ func BuildHandlerChain(genericConfig *genericapiserver.Config, kubeInformers inf
return func(apiHandler http.Handler, genericConfig *genericapiserver.Config) http.Handler {
// Machinery that let's use discover the Web Console Public URL
accessor := newWebConsolePublicURLAccessor(genericConfig.LoopbackClientConfig)
// the webconsole is proxied through the API server. This starts a small controller that keeps track of where to proxy.
// TODO stop proxying the webconsole. Should happen in a future release.
extraPostStartHooks["openshift.io-webconsolepublicurl"] = func(context genericapiserver.PostStartHookContext) error {
go accessor.Run(context.StopCh)
return nil
Expand Down

0 comments on commit f10076b

Please sign in to comment.