File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ package manager
2
+
3
+ import (
4
+ . "github.com/onsi/ginkgo"
5
+ . "github.com/onsi/gomega"
6
+
7
+ "sigs.k8s.io/controller-runtime/pkg/config"
8
+
9
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
10
+ "k8s.io/apimachinery/pkg/runtime"
11
+ configv1alpha1 "sigs.k8s.io/controller-runtime/pkg/config/v1alpha1"
12
+ )
13
+
14
+ var _ = Describe ("manager.Options" , func () {
15
+ Describe ("AndFrom" , func () {
16
+ Describe ("reading custom type using OfKind" , func () {
17
+ It ("should not panic when leaderelection is not set" , func () {
18
+ s := runtime .NewScheme ()
19
+ o := Options {
20
+ Scheme : s ,
21
+ LeaderElection : true ,
22
+ }
23
+ c := customConfig {}
24
+ _ , err := o .AndFrom (config .File ().AtPath ("./testdata/custom-config.yaml" ).OfKind (& c ))
25
+ Expect (err ).To (Succeed ())
26
+ })
27
+ })
28
+ })
29
+ })
30
+
31
+ type customConfig struct {
32
+ metav1.TypeMeta `json:",inline"`
33
+ configv1alpha1.ControllerManagerConfigurationSpec `json:",inline"`
34
+ }
35
+
36
+ func (in * customConfig ) DeepCopyObject () runtime.Object {
37
+ out := & customConfig {}
38
+ * out = * in
39
+
40
+ in .ControllerManagerConfigurationSpec .DeepCopyInto (& out .ControllerManagerConfigurationSpec )
41
+
42
+ return out
43
+ }
Original file line number Diff line number Diff line change
1
+ apiVersion : controller-runtime.sigs.k8s.io/v1alpha1
2
+ kind : CustomControllerManagerConfiguration
3
+ customValue : foo
You can’t perform that action at this time.
0 commit comments