Skip to content

Commit

Permalink
Merge pull request kubernetes#66722 from luxas/reference_new_generic_…
Browse files Browse the repository at this point in the history
…structs

Automatic merge from submit-queue (batch tested with PRs 67071, 66906, 66722, 67276, 67039). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Remove references to the structs that have moved to their own packages

**What this PR does / why we need it**:
Follows-up kubernetes#66058 and  kubernetes#66059 to remove the structs that now aren't needed in `pkg/apis/componentconfig`

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
xref kubernetes/community#2354

**Special notes for your reviewer**:

This PR depends on:
 - [x] kubernetes#67090
 - [x] kubernetes#67149
 - [x] kubernetes#67159
 - [x] kubernetes#67207

**Only review commit 'Remove references to the structs that have moved to their own packages' please**

**Release note**:

```release-note
NONE
```
/kind cleanup
/assign @sttts @thockin @jbeda @liggitt
  • Loading branch information
Kubernetes Submit Queue authored Aug 15, 2018
2 parents b6f0aed + db855a2 commit 698eb76
Show file tree
Hide file tree
Showing 25 changed files with 90 additions and 404 deletions.
2 changes: 0 additions & 2 deletions api/api-rules/violation_exceptions.list
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alp
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,CloudProviderConfiguration,Name
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,CloudProviderConfiguration,CloudConfigFile
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,DaemonSetControllerConfiguration,ConcurrentDaemonSetSyncs
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,DebuggingConfiguration,EnableProfiling
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,DebuggingConfiguration,EnableContentionProfiling
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,DeploymentControllerConfiguration,ConcurrentDeploymentSyncs
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,DeploymentControllerConfiguration,DeploymentControllerSyncPeriod
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,DeprecatedControllerConfiguration,DeletingPodsQps
Expand Down
2 changes: 1 addition & 1 deletion cmd/cloud-controller-manager/app/options/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ go_test(
embed = [":go_default_library"],
deps = [
"//cmd/controller-manager/app/options:go_default_library",
"//pkg/apis/componentconfig:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/apis/config:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/server/options:go_default_library",
"//vendor/github.com/spf13/pflag:go_default_library",
],
Expand Down
6 changes: 3 additions & 3 deletions cmd/cloud-controller-manager/app/options/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/diff"
apiserverconfig "k8s.io/apiserver/pkg/apis/config"
apiserveroptions "k8s.io/apiserver/pkg/server/options"
cmoptions "k8s.io/kubernetes/cmd/controller-manager/app/options"
"k8s.io/kubernetes/pkg/apis/componentconfig"
)

func TestDefaultFlags(t *testing.T) {
Expand All @@ -48,7 +48,7 @@ func TestDefaultFlags(t *testing.T) {
KubeAPIQPS: 20.0,
KubeAPIBurst: 30,
ControllerStartInterval: metav1.Duration{Duration: 0},
LeaderElection: componentconfig.LeaderElectionConfiguration{
LeaderElection: apiserverconfig.LeaderElectionConfiguration{
ResourceLock: "endpoints",
LeaderElect: true,
LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
Expand Down Expand Up @@ -145,7 +145,7 @@ func TestAddFlags(t *testing.T) {
KubeAPIQPS: 50.0,
KubeAPIBurst: 100,
ControllerStartInterval: metav1.Duration{Duration: 2 * time.Minute},
LeaderElection: componentconfig.LeaderElectionConfiguration{
LeaderElection: apiserverconfig.LeaderElectionConfiguration{
ResourceLock: "configmap",
LeaderElect: false,
LeaseDuration: metav1.Duration{Duration: 30 * time.Second},
Expand Down
2 changes: 1 addition & 1 deletion cmd/controller-manager/app/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//pkg/api/legacyscheme:go_default_library",
"//pkg/apis/componentconfig:go_default_library",
"//pkg/util/configz:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/apis/config:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/endpoints/filters:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/endpoints/request:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/server:go_default_library",
Expand Down
1 change: 1 addition & 0 deletions cmd/controller-manager/app/options/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ go_library(
"//pkg/apis/componentconfig:go_default_library",
"//pkg/client/leaderelectionconfig:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/apis/config:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/server/options:go_default_library",
"//vendor/github.com/spf13/pflag:go_default_library",
],
Expand Down
4 changes: 2 additions & 2 deletions cmd/controller-manager/app/options/debugging.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package options
import (
"github.com/spf13/pflag"

"k8s.io/kubernetes/pkg/apis/componentconfig"
apiserverconfig "k8s.io/apiserver/pkg/apis/config"
)

// DebuggingOptions holds the Debugging options.
Expand All @@ -41,7 +41,7 @@ func (o *DebuggingOptions) AddFlags(fs *pflag.FlagSet) {
}

// ApplyTo fills up Debugging config with options.
func (o *DebuggingOptions) ApplyTo(cfg *componentconfig.DebuggingConfiguration) error {
func (o *DebuggingOptions) ApplyTo(cfg *apiserverconfig.DebuggingConfiguration) error {
if o == nil {
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/controller-manager/app/options/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/spf13/pflag"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
apiserverconfig "k8s.io/apiserver/pkg/apis/config"
"k8s.io/kubernetes/pkg/apis/componentconfig"
"k8s.io/kubernetes/pkg/client/leaderelectionconfig"
)
Expand All @@ -31,7 +32,7 @@ type GenericComponentConfigOptions struct {
KubeAPIQPS float32
KubeAPIBurst int32
ControllerStartInterval metav1.Duration
LeaderElection componentconfig.LeaderElectionConfiguration
LeaderElection apiserverconfig.LeaderElectionConfiguration
}

// NewGenericComponentConfigOptions returns generic configuration default values for both
Expand Down
4 changes: 2 additions & 2 deletions cmd/controller-manager/app/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/prometheus/client_golang/prometheus"

apiserverconfig "k8s.io/apiserver/pkg/apis/config"
genericapifilters "k8s.io/apiserver/pkg/endpoints/filters"
apirequest "k8s.io/apiserver/pkg/endpoints/request"
apiserver "k8s.io/apiserver/pkg/server"
Expand All @@ -30,7 +31,6 @@ import (
"k8s.io/apiserver/pkg/server/mux"
"k8s.io/apiserver/pkg/server/routes"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/apis/componentconfig"
"k8s.io/kubernetes/pkg/util/configz"
)

Expand All @@ -48,7 +48,7 @@ func BuildHandlerChain(apiHandler http.Handler, authorizationInfo *apiserver.Aut
}

// NewBaseHandler takes in CompletedConfig and returns a handler.
func NewBaseHandler(c *componentconfig.DebuggingConfiguration) *mux.PathRecorderMux {
func NewBaseHandler(c *apiserverconfig.DebuggingConfiguration) *mux.PathRecorderMux {
mux := mux.NewPathRecorderMux("controller-manager")
healthz.InstallHandler(mux)
if c.EnableProfiling {
Expand Down
1 change: 1 addition & 0 deletions cmd/kube-controller-manager/app/options/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ go_test(
"//pkg/apis/componentconfig:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/apis/config:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/server/options:go_default_library",
"//vendor/github.com/spf13/pflag:go_default_library",
],
Expand Down
3 changes: 2 additions & 1 deletion cmd/kube-controller-manager/app/options/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/diff"
apiserverconfig "k8s.io/apiserver/pkg/apis/config"
apiserveroptions "k8s.io/apiserver/pkg/server/options"
cmoptions "k8s.io/kubernetes/cmd/controller-manager/app/options"
"k8s.io/kubernetes/pkg/apis/componentconfig"
Expand Down Expand Up @@ -130,7 +131,7 @@ func TestAddFlags(t *testing.T) {
KubeAPIQPS: 50.0,
KubeAPIBurst: 100,
ControllerStartInterval: metav1.Duration{Duration: 2 * time.Minute},
LeaderElection: componentconfig.LeaderElectionConfiguration{
LeaderElection: apiserverconfig.LeaderElectionConfiguration{
ResourceLock: "configmap",
LeaderElect: false,
LeaseDuration: metav1.Duration{Duration: 30 * time.Second},
Expand Down
2 changes: 2 additions & 0 deletions cmd/kube-scheduler/app/options/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ go_library(
"//pkg/client/leaderelectionconfig:go_default_library",
"//pkg/scheduler/factory:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/config:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
Expand Down Expand Up @@ -66,6 +67,7 @@ go_test(
"//cmd/controller-manager/app/options:go_default_library",
"//cmd/kube-scheduler/app/config:go_default_library",
"//pkg/apis/componentconfig:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/config:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/rand:go_default_library",
],
)
3 changes: 2 additions & 1 deletion cmd/kube-scheduler/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/spf13/pflag"

corev1 "k8s.io/api/core/v1"
apimachineryconfig "k8s.io/apimachinery/pkg/apis/config"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/uuid"
apiserveroptions "k8s.io/apiserver/pkg/server/options"
Expand Down Expand Up @@ -262,7 +263,7 @@ func makeLeaderElectionConfig(config componentconfig.KubeSchedulerLeaderElection

// createClients creates a kube client and an event client from the given config and masterOverride.
// TODO remove masterOverride when CLI flags are removed.
func createClients(config componentconfig.ClientConnectionConfiguration, masterOverride string, timeout time.Duration) (clientset.Interface, clientset.Interface, v1core.EventsGetter, error) {
func createClients(config apimachineryconfig.ClientConnectionConfiguration, masterOverride string, timeout time.Duration) (clientset.Interface, clientset.Interface, v1core.EventsGetter, error) {
if len(config.Kubeconfig) == 0 && len(masterOverride) == 0 {
glog.Warningf("Neither --kubeconfig nor --master was specified. Using default API client. This might not work.")
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/kube-scheduler/app/options/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"strings"
"testing"

apimachineryconfig "k8s.io/apimachinery/pkg/apis/config"
"k8s.io/kubernetes/pkg/apis/componentconfig"
)

Expand Down Expand Up @@ -141,7 +142,7 @@ users:
name: "kubeconfig flag",
options: &Options{
ComponentConfig: componentconfig.KubeSchedulerConfiguration{
ClientConnection: componentconfig.ClientConnectionConfiguration{
ClientConnection: apimachineryconfig.ClientConnectionConfiguration{
Kubeconfig: flagKubeconfig}}},
expectedUsername: "flag",
},
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/componentconfig/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/apis/componentconfig",
deps = [
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/config:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/net:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/apis/config:go_default_library",
],
)

Expand Down
75 changes: 12 additions & 63 deletions pkg/apis/componentconfig/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,11 @@ limitations under the License.
package componentconfig

import (
apimachineryconfig "k8s.io/apimachinery/pkg/apis/config"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
apiserverconfig "k8s.io/apiserver/pkg/apis/config"
)

// ClientConnectionConfiguration contains details for constructing a client.
type ClientConnectionConfiguration struct {
// kubeconfig is the path to a KubeConfig file.
Kubeconfig string
// acceptContentTypes defines the Accept header sent by clients when connecting to a server, overriding the
// default value of 'application/json'. This field will control all connections to the server used by a particular
// client.
AcceptContentTypes string
// contentType is the content type used when sending data to the server from this client.
ContentType string
// qps controls the number of queries per second allowed for this connection.
QPS float32
// burst allows extra queries to accumulate when a client is exceeding its rate.
Burst int32
}

// SchedulerPolicyConfigMapKey defines the key of the element in the
// scheduler's policy ConfigMap that contains scheduler's policy config.
const SchedulerPolicyConfigMapKey string = "policy.cfg"
Expand Down Expand Up @@ -79,6 +65,11 @@ type SchedulerAlgorithmSource struct {
type KubeSchedulerConfiguration struct {
metav1.TypeMeta

// DebuggingConfiguration holds profiling- and debugging-related fields
// TODO: DebuggingConfiguration is inlined because it's been like that earlier.
// We might consider making it a "real" sub-struct.
apiserverconfig.DebuggingConfiguration

// schedulerName is name of the scheduler, used to select which pods
// will be processed by this scheduler, based on pod's "spec.SchedulerName".
SchedulerName string
Expand All @@ -94,19 +85,13 @@ type KubeSchedulerConfiguration struct {

// ClientConnection specifies the kubeconfig file and client connection
// settings for the proxy server to use when communicating with the apiserver.
ClientConnection ClientConnectionConfiguration
ClientConnection apimachineryconfig.ClientConnectionConfiguration
// HealthzBindAddress is the IP address and port for the health check server to serve on,
// defaulting to 0.0.0.0:10251
HealthzBindAddress string
// MetricsBindAddress is the IP address and port for the metrics server to
// serve on, defaulting to 0.0.0.0:10251.
MetricsBindAddress string
// EnableProfiling enables profiling via web interface on /debug/pprof
// handler. Profiling handlers will be handled by metrics server.
EnableProfiling bool
// EnableContentionProfiling enables lock contention profiling, if
// EnableProfiling is true.
EnableContentionProfiling bool

// Indicate the "all topologies" set for empty topologyKey when it's used for PreferredDuringScheduling pod anti-affinity.
// DEPRECATED: This is no longer used.
Expand All @@ -119,42 +104,14 @@ type KubeSchedulerConfiguration struct {
// KubeSchedulerLeaderElectionConfiguration expands LeaderElectionConfiguration
// to include scheduler specific configuration.
type KubeSchedulerLeaderElectionConfiguration struct {
LeaderElectionConfiguration
apiserverconfig.LeaderElectionConfiguration

// LockObjectNamespace defines the namespace of the lock object
LockObjectNamespace string
// LockObjectName defines the lock object name
LockObjectName string
}

// LeaderElectionConfiguration defines the configuration of leader election
// clients for components that can run with leader election enabled.
type LeaderElectionConfiguration struct {
// leaderElect enables a leader election client to gain leadership
// before executing the main loop. Enable this when running replicated
// components for high availability.
LeaderElect bool
// leaseDuration is the duration that non-leader candidates will wait
// after observing a leadership renewal until attempting to acquire
// leadership of a led but unrenewed leader slot. This is effectively the
// maximum duration that a leader can be stopped before it is replaced
// by another candidate. This is only applicable if leader election is
// enabled.
LeaseDuration metav1.Duration
// renewDeadline is the interval between attempts by the acting master to
// renew a leadership slot before it stops leading. This must be less
// than or equal to the lease duration. This is only applicable if leader
// election is enabled.
RenewDeadline metav1.Duration
// retryPeriod is the duration the clients should wait between attempting
// acquisition and renewal of a leadership. This is only applicable if
// leader election is enabled.
RetryPeriod metav1.Duration
// resourceLock indicates the resource object type that will be used to lock
// during leader election cycles.
ResourceLock string
}

type GroupResource struct {
// group is the group portion of the GroupResource.
Group string
Expand All @@ -170,7 +127,7 @@ type KubeControllerManagerConfiguration struct {
// CloudProviderConfiguration holds configuration for CloudProvider related features.
CloudProvider CloudProviderConfiguration
// DebuggingConfiguration holds configuration for Debugging related features.
Debugging DebuggingConfiguration
Debugging apiserverconfig.DebuggingConfiguration
// GenericComponentConfiguration holds configuration for GenericComponent
// related features both in cloud controller manager and kube-controller manager.
GenericComponent GenericComponentConfiguration
Expand Down Expand Up @@ -252,7 +209,7 @@ type CloudControllerManagerConfiguration struct {
// CloudProviderConfiguration holds configuration for CloudProvider related features.
CloudProvider CloudProviderConfiguration
// DebuggingConfiguration holds configuration for Debugging related features.
Debugging DebuggingConfiguration
Debugging apiserverconfig.DebuggingConfiguration
// GenericComponentConfiguration holds configuration for GenericComponent
// related features both in cloud controller manager and kube-controller manager.
GenericComponent GenericComponentConfiguration
Expand All @@ -273,14 +230,6 @@ type CloudProviderConfiguration struct {
CloudConfigFile string
}

type DebuggingConfiguration struct {
// enableProfiling enables profiling via web interface host:port/debug/pprof/
EnableProfiling bool
// EnableContentionProfiling enables lock contention profiling, if
// EnableProfiling is true.
EnableContentionProfiling bool
}

type GenericComponentConfiguration struct {
// minResyncPeriod is the resync period in reflectors; will be random between
// minResyncPeriod and 2*minResyncPeriod.
Expand All @@ -294,7 +243,7 @@ type GenericComponentConfiguration struct {
// How long to wait between starting controller managers
ControllerStartInterval metav1.Duration
// leaderElection defines the configuration of leader election client.
LeaderElection LeaderElectionConfiguration
LeaderElection apiserverconfig.LeaderElectionConfiguration
}

type KubeCloudSharedConfiguration struct {
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/componentconfig/v1alpha1/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ go_library(
"//pkg/apis/core:go_default_library",
"//pkg/kubelet/apis:go_default_library",
"//pkg/master/ports:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/config/v1alpha1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/apis/config/v1alpha1:go_default_library",
"//vendor/k8s.io/utils/pointer:go_default_library",
],
)
Expand Down
Loading

0 comments on commit 698eb76

Please sign in to comment.