Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.12.2 rebase #67

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
1c4011e
UPSTREAM: <carry>: XFS quota for emptyDir volumes
sjenning Apr 26, 2018
8871ac6
UPSTREAM: <carry>: gracefully handle empty volume-config file
sjenning Jun 29, 2018
e2cf87d
UPSTREAM: <carry>: Allow overriding default generators for run
deads2k Jun 13, 2018
8422eff
UPSTREAM: <carry>: allow injection into kubectl for oc
deads2k Jul 20, 2018
7d93870
UPSTREAM: emicklei/go-restful-swagger12: <carry>: NEEDED TO BUILD shi…
deads2k Dec 1, 2017
0795ce1
UPSTREAM: <carry>: add service serving cert signer to token controller
deads2k May 26, 2016
eb7c4aa
UPSTREAM: <carry>: Disable file locking in clientcmd
smarterclayton Sep 13, 2016
cc90c12
UPSTREAM: <carry>: disambiguate operation names for legacy discovery
deads2k Jun 7, 2017
f705e39
UPSTREAM: <carry>: allow a filter function on admission registration
deads2k Oct 2, 2017
fb8c009
UPSTREAM: <carry>: ignored namespace lifecycle resources
deads2k Jun 14, 2017
9025243
UPSTREAM: <carry>: update clientset generator for openshift groups
mfojtik Oct 23, 2017
6aa18c4
UPSTREAM: <carry>: allow multiple containers to union for swagger
soltysh Oct 24, 2017
1422756
UPSTREAM: <carry>: make wiring in kubeproxy easy until we sort out co…
deads2k Jul 10, 2017
300d8be
UPSTREAM: <carry>: don't ignore some of the generated files
deads2k Dec 8, 2017
1ac833a
UPSTREAM: <carry>: allow running bare kube-controller-manager
deads2k Jan 5, 2018
d396e3e
UPSTREAM: <carry>: add our immortal namespaces directly to admission …
deads2k Dec 21, 2017
e29414a
UPSTREAM: <carry>: allow building/running local-up-cluster and genera…
deads2k Jun 29, 2018
7ffd6eb
UPSTREAM: <carry>: hack out the oapi for restmapping resources when m…
deads2k Jan 31, 2018
0b54ffc
UPSTREAM: <carry> hack in working scaling for legacy deploymentconfig
deads2k Jun 14, 2018
9d2876e
UPSTREAM: <carry>: aggregator to proxy oapi to apps.openshift.io server
deads2k Feb 19, 2018
7bf82cb
UPSTREAM: 49312: allow the /version endpoint to pass through
deads2k Jul 20, 2017
ca932bc
UPSTREAM: 57099: increase the podLogTimeout for downward volume test
mfojtik Dec 6, 2017
d570237
UPSTREAM: <carry>: filter daemonset nodes by namespace node selectors
deads2k Mar 15, 2018
f3852bd
UPSTREAM: <carry>: pods in openshift-* namespace can be marked critical
derekwaynecarr Mar 26, 2018
0194535
UPSTREAM: <carry>: enable critical pod support by default
derekwaynecarr Apr 24, 2018
f9e44c2
UPSTREAM: 62469: stop defaulting kubeconfig to http://localhost:8080
deads2k Apr 12, 2018
398665e
UPSTREAM: 63926: Avoid unnecessary calls to the cloud provider
Miciah May 16, 2018
2ee7f46
UPSTREAM: <carry>: add kubelet timeouts
soltysh Dec 21, 2015
81e68d7
UPSTREAM: <carry>: disable local storage isolation feature gate
sjenning Apr 11, 2018
6ee0077
UPSTREAM: <carry> test restmapper hack
deads2k Jun 22, 2018
f72236c
UPSTREAM: <carry>: fix fifo resync, remove after FIFO is dead
deads2k Jul 14, 2016
0a5dd45
UPSTREAM: <carry>: exclude some origin resources from quota
deads2k Dec 7, 2017
e0a4a4a
UPSTREAM: <carry>: expose ns lifecyle admission list of allowed resou…
deads2k Jul 10, 2018
11e5e84
UPSTREAM: <carry>: ensure perFSGroup quanity is positive
sjenning Aug 7, 2018
1ab52c8
UPSTREAM: <carry>: allow injection of kube-apiserver options
deads2k Aug 21, 2018
df9cb16
UPSTREAM: <carry>: Disable ephemeral storage in tests
smarterclayton Aug 24, 2018
6bddee8
UPSTREAM: <carry>: simplify kube-controller-manager patches
gnufied Sep 7, 2018
1ad2639
UPSTREAM: 68632: allow audit policy to be loaded from any byte source
deads2k Sep 13, 2018
512afea
UPSTREAM: 68678: tighten maximum retry loop for aggregate api availab…
deads2k Sep 17, 2018
b7f72b0
UPSTREAM: 68820: Wait for events instead of just checking them in cro…
soltysh Sep 19, 2018
b94e535
UPSTREAM: <carry>: Node selector aware DS controller should not process
aveshagarwal Sep 19, 2018
e311a8c
UPSTREAM: 68980: kubelet should not create pod sandbox
derekwaynecarr Sep 23, 2018
13a1428
UPSTREAM: <carry>: kube-controller-manager new config
deads2k Sep 24, 2018
b69592b
UPSTREAM: 69215: Fix flake in CSI plugin e2e test
bertinatto Sep 30, 2018
513cbbd
UPSTREAM: 69291: Increase the pod start short timeout
mrunalp Oct 1, 2018
5d4f8f9
UPSTREAM: 69300: test: Wait for pod event to show up
mrunalp Oct 1, 2018
c6944a9
UPSTREAM: 68141: Retry attaching multipath iSCSI volumes
jsafrane Oct 9, 2018
062fb3a
UPSTREAM: 70206: test/e2e/apps: fix race in cronjob test
runcom Oct 24, 2018
8b27eec
UPSTREAM: 70311: fix ContinueOnError visitor
juanvallejo Oct 26, 2018
25fadf7
UPSTREAM: 69313: fix cri-o when using unix prefix
sjenning Oct 1, 2018
42351b7
UPSTREAM: 69890: Bootstrap in background
smarterclayton Oct 16, 2018
32c65a3
UPSTREAM: <carry>: allow building and testing fork kubernetes
soltysh Nov 5, 2018
c94ff00
UPSTREAM: <drop>: generated
soltysh Nov 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,11 @@ kubernetes.tar.gz
# generated files in any directory
# TODO(thockin): uncomment this when we stop committing the generated files.
#zz_generated.*
zz_generated.openapi.go
zz_generated_*_test.go

# make-related metadata
/.make/

# Just in time generated data in the source, should never be committed
/test/e2e/generated/bindata.go

# This file used by some vendor repos (e.g. github.com/go-openapi/...) to store secret variables and should not be ignored
!\.drone\.sec
Expand Down
8 changes: 8 additions & 0 deletions build/root/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -603,3 +603,11 @@ else
bazel-release:
bazel build //build/release-tars
endif

.PHONY: fork-build
fork-build: generated_files
GOFLAGS="-tags kubernetes" hack/make-rules/build.sh $(WHAT)

.PHONY: fork-test
fork-test: generated_files
GOFLAGS="-tags kubernetes" hack/make-rules/test.sh $(WHAT) $(TESTS)
35 changes: 35 additions & 0 deletions cmd/kube-apiserver/app/patch_openshift.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package app

import (
"k8s.io/apiserver/pkg/admission"
genericapiserver "k8s.io/apiserver/pkg/server"
clientgoinformers "k8s.io/client-go/informers"
informers "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion"
"k8s.io/kubernetes/pkg/master"
)

type KubeAPIServerConfigFunc func(config *genericapiserver.Config, sharedInformers informers.SharedInformerFactory, versionedInformers clientgoinformers.SharedInformerFactory, pluginInitializers *[]admission.PluginInitializer) (genericapiserver.DelegationTarget, error)

var OpenShiftKubeAPIServerConfigPatch KubeAPIServerConfigFunc = nil

type KubeAPIServerServerFunc func(server *master.Master) error

func PatchKubeAPIServerConfig(config *genericapiserver.Config, sharedInformers informers.SharedInformerFactory, versionedInformers clientgoinformers.SharedInformerFactory, pluginInitializers *[]admission.PluginInitializer) (genericapiserver.DelegationTarget, error) {
if OpenShiftKubeAPIServerConfigPatch == nil {
return genericapiserver.NewEmptyDelegate(), nil
}

return OpenShiftKubeAPIServerConfigPatch(config, sharedInformers, versionedInformers, pluginInitializers)
}

var OpenShiftKubeAPIServerServerPatch KubeAPIServerServerFunc = nil

func PatchKubeAPIServerServer(server *master.Master) error {
if OpenShiftKubeAPIServerServerPatch == nil {
return nil
}

return OpenShiftKubeAPIServerServerPatch(server)
}

var StartingDelegate genericapiserver.DelegationTarget = genericapiserver.NewEmptyDelegate()
13 changes: 12 additions & 1 deletion cmd/kube-apiserver/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func CreateServerChain(completedOptions completedServerRunOptions, stopCh <-chan
if err != nil {
return nil, err
}
apiExtensionsServer, err := createAPIExtensionsServer(apiExtensionsConfig, genericapiserver.NewEmptyDelegate())
apiExtensionsServer, err := createAPIExtensionsServer(apiExtensionsConfig, StartingDelegate)
if err != nil {
return nil, err
}
Expand All @@ -186,6 +186,10 @@ func CreateServerChain(completedOptions completedServerRunOptions, stopCh <-chan
return nil, err
}

if err := PatchKubeAPIServerServer(kubeAPIServer); err != nil {
return nil, err
}

// otherwise go down the normal path of standing the aggregator up in front of the API server
// this wires up openapi
kubeAPIServer.GenericAPIServer.PrepareRun()
Expand Down Expand Up @@ -421,6 +425,7 @@ func CreateKubeAPIServerConfig(
func buildGenericConfig(
s *options.ServerRunOptions,
proxyTransport *http.Transport,

) (
genericConfig *genericapiserver.Config,
sharedInformers informers.SharedInformerFactory,
Expand Down Expand Up @@ -574,6 +579,12 @@ func buildGenericConfig(
return
}

StartingDelegate, err = PatchKubeAPIServerConfig(genericConfig, sharedInformers, versionedInformers, &pluginInitializers)
if err != nil {
lastErr = fmt.Errorf("failed to patch: %v", err)
return
}

err = s.Admission.ApplyTo(
genericConfig,
versionedInformers,
Expand Down
5 changes: 4 additions & 1 deletion cmd/kube-controller-manager/app/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ func startDaemonSetController(ctx ControllerContext) (http.Handler, bool, error)
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "daemonsets"}] {
return nil, false, nil
}
dsc, err := daemon.NewDaemonSetsController(
dsc, err := daemon.NewNodeSelectorAwareDaemonSetsController(
ctx.OpenShiftContext.OpenShiftDefaultProjectNodeSelector,
ctx.OpenShiftContext.KubeDefaultProjectNodeSelector,
ctx.InformerFactory.Core().V1().Namespaces(),
ctx.InformerFactory.Apps().V1().DaemonSets(),
ctx.InformerFactory.Apps().V1().ControllerRevisions(),
ctx.InformerFactory.Core().V1().Pods(),
Expand Down
2 changes: 2 additions & 0 deletions cmd/kube-controller-manager/app/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (

// Config is the main context object for the controller manager.
type Config struct {
OpenShiftContext OpenShiftContext

ComponentConfig kubectrlmgrconfig.KubeControllerManagerConfiguration

SecureServing *apiserver.SecureServingInfo
Expand Down
9 changes: 9 additions & 0 deletions cmd/kube-controller-manager/app/config/patch.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package config

// OpenShiftContext is additional context that we need to launch the kube-controller-manager for openshift.
// Basically, this holds our additional config information.
type OpenShiftContext struct {
OpenShiftConfig string
OpenShiftDefaultProjectNodeSelector string
KubeDefaultProjectNodeSelector string
}
25 changes: 22 additions & 3 deletions cmd/kube-controller-manager/app/controllermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ controller, and serviceaccounts controller.`,
os.Exit(1)
}

cleanupFn, err := ShimForOpenShift(s, c)
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}
defer cleanupFn()

if err := Run(c.Complete(), wait.NeverStop); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
Expand Down Expand Up @@ -193,6 +200,10 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
}
saTokenControllerInitFunc := serviceAccountTokenControllerStarter{rootClientBuilder: rootClientBuilder}.startServiceAccountTokenController

if err := createPVRecyclerSA(c.OpenShiftContext.OpenShiftConfig, rootClientBuilder); err != nil {
glog.Fatalf("error creating recycler serviceaccount: %v", err)
}

if err := StartControllers(controllerContext, saTokenControllerInitFunc, NewControllerInitializers(controllerContext.LoopMode), unsecuredMux); err != nil {
glog.Fatalf("error starting controllers: %v", err)
}
Expand Down Expand Up @@ -243,6 +254,8 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
}

type ControllerContext struct {
OpenShiftContext config.OpenShiftContext

// ClientBuilder will provide a client for this controller to use
ClientBuilder controller.ControllerClientBuilder

Expand Down Expand Up @@ -416,7 +429,12 @@ func GetAvailableResources(clientBuilder controller.ControllerClientBuilder) (ma
// the shared-informers client and token controller.
func CreateControllerContext(s *config.CompletedConfig, rootClientBuilder, clientBuilder controller.ControllerClientBuilder, stop <-chan struct{}) (ControllerContext, error) {
versionedClient := rootClientBuilder.ClientOrDie("shared-informers")
sharedInformers := informers.NewSharedInformerFactory(versionedClient, ResyncPeriod(s)())
var sharedInformers informers.SharedInformerFactory
if InformerFactoryOverride == nil {
sharedInformers = informers.NewSharedInformerFactory(versionedClient, ResyncPeriod(s)())
} else {
sharedInformers = InformerFactoryOverride
}

// If apiserver is not running we should wait for some time and fail only then. This is particularly
// important when we start apiserver and controller manager at the same time.
Expand Down Expand Up @@ -444,6 +462,7 @@ func CreateControllerContext(s *config.CompletedConfig, rootClientBuilder, clien
}

ctx := ControllerContext{
OpenShiftContext: s.OpenShiftContext,
ClientBuilder: clientBuilder,
InformerFactory: sharedInformers,
ComponentConfig: s.ComponentConfig,
Expand Down Expand Up @@ -543,10 +562,10 @@ func (c serviceAccountTokenControllerStarter) startServiceAccountTokenController
ctx.InformerFactory.Core().V1().ServiceAccounts(),
ctx.InformerFactory.Core().V1().Secrets(),
c.rootClientBuilder.ClientOrDie("tokens-controller"),
serviceaccountcontroller.TokensControllerOptions{
applyOpenShiftServiceServingCertCA(serviceaccountcontroller.TokensControllerOptions{
TokenGenerator: tokenGenerator,
RootCA: rootCA,
},
}),
)
if err != nil {
return nil, true, fmt.Errorf("error creating Tokens controller: %v", err)
Expand Down
9 changes: 7 additions & 2 deletions cmd/kube-controller-manager/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ type KubeControllerManagerOptions struct {
Authentication *apiserveroptions.DelegatingAuthenticationOptions
Authorization *apiserveroptions.DelegatingAuthorizationOptions

Master string
Kubeconfig string
Master string
Kubeconfig string
OpenShiftContext kubecontrollerconfig.OpenShiftContext
}

// NewKubeControllerManagerOptions creates a new KubeControllerManagerOptions with a default config.
Expand Down Expand Up @@ -263,6 +264,8 @@ func (s *KubeControllerManagerOptions) Flags(allControllers []string, disabledBy
var dummy string
fs.MarkDeprecated("insecure-experimental-approve-all-kubelet-csrs-for-group", "This flag does nothing.")
fs.StringVar(&dummy, "insecure-experimental-approve-all-kubelet-csrs-for-group", "", "This flag does nothing.")
fs.StringVar(&s.OpenShiftContext.OpenShiftConfig, "openshift-config", s.OpenShiftContext.OpenShiftConfig, "indicates that this process should be compatible with openshift start master")
fs.MarkHidden("openshift-config")
utilfeature.DefaultFeatureGate.AddFlag(fss.FlagSet("generic"))

return fss
Expand Down Expand Up @@ -356,6 +359,8 @@ func (s *KubeControllerManagerOptions) ApplyTo(c *kubecontrollerconfig.Config) e
c.ComponentConfig.Generic.Port = int32(s.InsecureServing.BindPort)
c.ComponentConfig.Generic.Address = s.InsecureServing.BindAddress.String()

c.OpenShiftContext = s.OpenShiftContext

return nil
}

Expand Down
49 changes: 49 additions & 0 deletions cmd/kube-controller-manager/app/patch.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package app

import (
"path"

"k8s.io/client-go/informers"
"k8s.io/kubernetes/cmd/kube-controller-manager/app/config"
"k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
)

var InformerFactoryOverride informers.SharedInformerFactory

func ShimForOpenShift(controllerManagerOptions *options.KubeControllerManagerOptions, controllerManager *config.Config) (func(), error) {
if len(controllerManager.OpenShiftContext.OpenShiftConfig) == 0 {
return func() {}, nil
}

// TODO this gets removed when no longer take flags and no longer build a recycler template
openshiftConfig, err := getOpenShiftConfig(controllerManager.OpenShiftContext.OpenShiftConfig)
if err != nil {
return func() {}, err
}
// apply the config based controller manager flags. They will override.
// TODO this should be replaced by the installer setting up the flags for us
if err := applyOpenShiftConfigFlags(controllerManagerOptions, controllerManager, openshiftConfig); err != nil {
return func() {}, err
}

// TODO this should be replaced by using a flex volume to inject service serving cert CAs into pods instead of adding it to the sa token
if err := applyOpenShiftServiceServingCertCAFunc(path.Dir(controllerManager.OpenShiftContext.OpenShiftConfig), openshiftConfig); err != nil {
return func() {}, err
}

// skip GC on some openshift resources
// TODO this should be replaced by discovery information in some way
if err := applyOpenShiftGCConfig(controllerManager); err != nil {
return func() {}, err
}

// Overwrite the informers, because we have our custom generic informers for quota.
// TODO update quota to create its own informer like garbage collection
if informers, err := newInformerFactory(controllerManager.Kubeconfig); err != nil {
return func() {}, err
} else {
InformerFactoryOverride = informers
}

return func() {}, nil
}
Loading