Skip to content

Commit 5d27848

Browse files
authored
Revert "🌱 [0.14] Deprecate component configuration package"
1 parent b9940ed commit 5d27848

17 files changed

+38
-85
lines changed

alias.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"k8s.io/apimachinery/pkg/runtime/schema"
2222
"sigs.k8s.io/controller-runtime/pkg/builder"
2323
"sigs.k8s.io/controller-runtime/pkg/client/config"
24-
cfg "sigs.k8s.io/controller-runtime/pkg/config" //nolint:staticcheck
24+
cfg "sigs.k8s.io/controller-runtime/pkg/config"
2525
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
2626
"sigs.k8s.io/controller-runtime/pkg/log"
2727
"sigs.k8s.io/controller-runtime/pkg/manager"
@@ -99,8 +99,7 @@ var (
9999
// ConfigFile returns the cfg.File function for deferred config file loading,
100100
// this is passed into Options{}.From() to populate the Options fields for
101101
// the manager.
102-
// Deprecated: This is deprecated in favor of using Options directly.
103-
ConfigFile = cfg.File //nolint:staticcheck
102+
ConfigFile = cfg.File
104103

105104
// NewControllerManagedBy returns a new controller builder that will be started by the provided Manager.
106105
NewControllerManagedBy = builder.ControllerManagedBy

pkg/builder/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ func (blder *Builder) getControllerName(gvk schema.GroupVersionKind, hasGVK bool
285285
}
286286

287287
func (blder *Builder) doController(r reconcile.Reconciler) error {
288-
globalOpts := blder.mgr.GetControllerOptions() //nolint:staticcheck
288+
globalOpts := blder.mgr.GetControllerOptions()
289289

290290
ctrlOptions := blder.ctrlOptions
291291
if ctrlOptions.Reconciler == nil {

pkg/builder/controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636

3737
"sigs.k8s.io/controller-runtime/pkg/cache"
3838
"sigs.k8s.io/controller-runtime/pkg/client"
39-
"sigs.k8s.io/controller-runtime/pkg/config/v1alpha1" //nolint:staticcheck
39+
"sigs.k8s.io/controller-runtime/pkg/config/v1alpha1"
4040
"sigs.k8s.io/controller-runtime/pkg/controller"
4141
"sigs.k8s.io/controller-runtime/pkg/event"
4242
"sigs.k8s.io/controller-runtime/pkg/handler"
@@ -235,7 +235,7 @@ var _ = Describe("application", func() {
235235

236236
By("creating a controller manager")
237237
m, err := manager.New(cfg, manager.Options{
238-
Controller: v1alpha1.ControllerConfigurationSpec{ //nolint:staticcheck
238+
Controller: v1alpha1.ControllerConfigurationSpec{
239239
GroupKindConcurrency: map[string]int{
240240
"ReplicaSet.apps": maxConcurrentReconciles,
241241
},

pkg/config/config.go

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,20 @@ import (
2424
"k8s.io/apimachinery/pkg/runtime"
2525
"k8s.io/apimachinery/pkg/runtime/serializer"
2626
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
27-
"sigs.k8s.io/controller-runtime/pkg/config/v1alpha1" //nolint:staticcheck
27+
"sigs.k8s.io/controller-runtime/pkg/config/v1alpha1"
2828
)
2929

3030
// ControllerManagerConfiguration defines the functions necessary to parse a config file
3131
// and to configure the Options struct for the ctrl.Manager.
32-
//
33-
// Deprecated: This package has been deprecated and will be removed in a future release.
3432
type ControllerManagerConfiguration interface {
3533
runtime.Object
3634

3735
// Complete returns the versioned configuration
38-
Complete() (v1alpha1.ControllerManagerConfigurationSpec, error) //nolint:staticcheck
36+
Complete() (v1alpha1.ControllerManagerConfigurationSpec, error)
3937
}
4038

4139
// DeferredFileLoader is used to configure the decoder for loading controller
4240
// runtime component config types.
43-
//
44-
// Deprecated: This package has been deprecated and will be removed in a future release.
4541
type DeferredFileLoader struct {
4642
ControllerManagerConfiguration
4743
path string
@@ -56,8 +52,6 @@ type DeferredFileLoader struct {
5652
// Defaults:
5753
// * Path: "./config.yaml"
5854
// * Kind: GenericControllerManagerConfiguration
59-
//
60-
// Deprecated: This package has been deprecated and will be removed in a future release.
6155
func File() *DeferredFileLoader {
6256
scheme := runtime.NewScheme()
6357
utilruntime.Must(v1alpha1.AddToScheme(scheme))
@@ -69,8 +63,6 @@ func File() *DeferredFileLoader {
6963
}
7064

7165
// Complete will use sync.Once to set the scheme.
72-
//
73-
// Deprecated: This package has been deprecated and will be removed in a future release.
7466
func (d *DeferredFileLoader) Complete() (v1alpha1.ControllerManagerConfigurationSpec, error) {
7567
d.once.Do(d.loadFile)
7668
if d.err != nil {
@@ -79,33 +71,25 @@ func (d *DeferredFileLoader) Complete() (v1alpha1.ControllerManagerConfiguration
7971
return d.ControllerManagerConfiguration.Complete()
8072
}
8173

82-
// AtPath will set the path to load the file for the decoder
83-
//
84-
// Deprecated: This package has been deprecated and will be removed in a future release.
74+
// AtPath will set the path to load the file for the decoder.
8575
func (d *DeferredFileLoader) AtPath(path string) *DeferredFileLoader {
8676
d.path = path
8777
return d
8878
}
8979

9080
// OfKind will set the type to be used for decoding the file into.
91-
//
92-
// Deprecated: This package has been deprecated and will be removed in a future release.
9381
func (d *DeferredFileLoader) OfKind(obj ControllerManagerConfiguration) *DeferredFileLoader {
9482
d.ControllerManagerConfiguration = obj
9583
return d
9684
}
9785

9886
// InjectScheme will configure the scheme to be used for decoding the file.
99-
//
100-
// Deprecated: This package has been deprecated and will be removed in a future release.
10187
func (d *DeferredFileLoader) InjectScheme(scheme *runtime.Scheme) error {
10288
d.scheme = scheme
10389
return nil
10490
}
10591

10692
// loadFile is used from the mutex.Once to load the file.
107-
//
108-
// Deprecated: This package has been deprecated and will be removed in a future release.
10993
func (d *DeferredFileLoader) loadFile() {
11094
if d.scheme == nil {
11195
d.err = fmt.Errorf("scheme not supplied to controller configuration loader")

pkg/config/config_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ package config_test
1919
import (
2020
. "github.com/onsi/ginkgo/v2"
2121
. "github.com/onsi/gomega"
22-
"sigs.k8s.io/controller-runtime/pkg/config" //nolint:staticcheck
23-
"sigs.k8s.io/controller-runtime/pkg/config/v1alpha1" //nolint:staticcheck
22+
"sigs.k8s.io/controller-runtime/pkg/config"
23+
"sigs.k8s.io/controller-runtime/pkg/config/v1alpha1"
2424
)
2525

2626
var _ = Describe("config", func() {
@@ -33,7 +33,7 @@ var _ = Describe("config", func() {
3333
})
3434

3535
It("should load a config from file", func() {
36-
conf := v1alpha1.ControllerManagerConfiguration{} //nolint:staticcheck
36+
conf := v1alpha1.ControllerManagerConfiguration{}
3737
loader := config.File().AtPath("./testdata/config.yaml").OfKind(&conf)
3838
Expect(conf.CacheNamespace).To(Equal(""))
3939

pkg/config/doc.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,4 @@ limitations under the License.
2222
// This uses a deferred file decoding allowing you to chain your configuration
2323
// setup. You can pass this into manager.Options#File and it will load your
2424
// config.
25-
//
26-
// Deprecated: This package has been deprecated and will be removed in a future release.
2725
package config

pkg/config/example_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ import (
2121
"os"
2222

2323
"k8s.io/apimachinery/pkg/runtime"
24+
"sigs.k8s.io/controller-runtime/pkg/config"
25+
2426
"sigs.k8s.io/controller-runtime/examples/configfile/custom/v1alpha1"
25-
"sigs.k8s.io/controller-runtime/pkg/config" //nolint:staticcheck
2627
)
2728

2829
var scheme = runtime.NewScheme()

pkg/config/v1alpha1/doc.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,4 @@ limitations under the License.
1717
// Package v1alpha1 provides the ControllerManagerConfiguration used for
1818
// configuring ctrl.Manager
1919
// +kubebuilder:object:generate=true
20-
//
21-
// Deprecated: This package has been deprecated and will be removed in a future release.
2220
package v1alpha1

pkg/config/v1alpha1/register.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,12 @@ import (
2323

2424
var (
2525
// GroupVersion is group version used to register these objects.
26-
//
27-
// Deprecated: This package has been deprecated and will be removed in a future release.
2826
GroupVersion = schema.GroupVersion{Group: "controller-runtime.sigs.k8s.io", Version: "v1alpha1"}
2927

3028
// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
31-
//
32-
// Deprecated: This package has been deprecated and will be removed in a future release.
3329
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
3430

3531
// AddToScheme adds the types in this group-version to the given scheme.
36-
//
37-
// Deprecated: This package has been deprecated and will be removed in a future release.
3832
AddToScheme = SchemeBuilder.AddToScheme
3933
)
4034

pkg/config/v1alpha1/types.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import (
2525
)
2626

2727
// ControllerManagerConfigurationSpec defines the desired state of GenericControllerManagerConfiguration.
28-
//
29-
// Deprecated: This package has been deprecated and will be removed in a future release.
3028
type ControllerManagerConfigurationSpec struct {
3129
// SyncPeriod determines the minimum frequency at which watched resources are
3230
// reconciled. A lower period will correct entropy more quickly, but reduce
@@ -77,8 +75,6 @@ type ControllerManagerConfigurationSpec struct {
7775

7876
// ControllerConfigurationSpec defines the global configuration for
7977
// controllers registered with the manager.
80-
//
81-
// Deprecated: This package has been deprecated and will be removed in a future release.
8278
type ControllerConfigurationSpec struct {
8379
// GroupKindConcurrency is a map from a Kind to the number of concurrent reconciliation
8480
// allowed for that controller.
@@ -153,20 +149,14 @@ type ControllerWebhook struct {
153149
// +kubebuilder:object:root=true
154150

155151
// ControllerManagerConfiguration is the Schema for the GenericControllerManagerConfigurations API.
156-
//
157-
// Deprecated: This package has been deprecated and will be removed in a future release.
158152
type ControllerManagerConfiguration struct {
159153
metav1.TypeMeta `json:",inline"`
160154

161155
// ControllerManagerConfiguration returns the contfigurations for controllers
162-
//
163-
// Deprecated: This package has been deprecated and will be removed in a future release.
164156
ControllerManagerConfigurationSpec `json:",inline"`
165157
}
166158

167159
// Complete returns the configuration for controller-runtime.
168-
//
169-
// Deprecated: This package has been deprecated and will be removed in a future release.
170160
func (c *ControllerManagerConfigurationSpec) Complete() (ControllerManagerConfigurationSpec, error) {
171161
return *c, nil
172162
}

0 commit comments

Comments
 (0)