@@ -34,6 +34,7 @@ type UpdaterBuilder struct {
34
34
Converter Converter
35
35
IgnoredFields map [fieldpath.APIVersion ]* fieldpath.Set
36
36
37
+ // Deprecated: Unions don't work, this flag will panic if used.
37
38
EnableUnions bool
38
39
39
40
// Stop comparing the new object with old object after applying.
@@ -46,10 +47,12 @@ type UpdaterBuilder struct {
46
47
}
47
48
48
49
func (u * UpdaterBuilder ) BuildUpdater () * Updater {
50
+ if u .EnableUnions {
51
+ panic ("unions don't work and have been disabled." )
52
+ }
49
53
return & Updater {
50
54
Converter : u .Converter ,
51
55
IgnoredFields : u .IgnoredFields ,
52
- enableUnions : u .EnableUnions ,
53
56
returnInputOnNoop : u .ReturnInputOnNoop ,
54
57
}
55
58
}
@@ -63,17 +66,15 @@ type Updater struct {
63
66
// Deprecated: This will eventually become private.
64
67
IgnoredFields map [fieldpath.APIVersion ]* fieldpath.Set
65
68
66
- enableUnions bool
67
-
68
69
returnInputOnNoop bool
69
70
}
70
71
71
72
// EnableUnionFeature turns on union handling. It is disabled by default until the
72
73
// feature is complete.
73
74
//
74
- // Deprecated: Use the builder instead .
75
+ // Deprecated: Unions don't work, this function will panic if used .
75
76
func (s * Updater ) EnableUnionFeature () {
76
- s . enableUnions = true
77
+ panic ( "unions don't work and have been disabled." )
77
78
}
78
79
79
80
func (s * Updater ) update (oldObject , newObject * typed.TypedValue , version fieldpath.APIVersion , managers fieldpath.ManagedFields , workflow string , force bool ) (fieldpath.ManagedFields , * typed.Comparison , error ) {
@@ -160,12 +161,6 @@ func (s *Updater) Update(liveObject, newObject *typed.TypedValue, version fieldp
160
161
if err != nil {
161
162
return nil , fieldpath.ManagedFields {}, err
162
163
}
163
- if s .enableUnions {
164
- newObject , err = liveObject .NormalizeUnions (newObject )
165
- if err != nil {
166
- return nil , fieldpath.ManagedFields {}, err
167
- }
168
- }
169
164
managers , compare , err := s .update (liveObject , newObject , version , managers , manager , true )
170
165
if err != nil {
171
166
return nil , fieldpath.ManagedFields {}, err
@@ -198,22 +193,10 @@ func (s *Updater) Apply(liveObject, configObject *typed.TypedValue, version fiel
198
193
if err != nil {
199
194
return nil , fieldpath.ManagedFields {}, err
200
195
}
201
- if s .enableUnions {
202
- configObject , err = configObject .NormalizeUnionsApply (configObject )
203
- if err != nil {
204
- return nil , fieldpath.ManagedFields {}, err
205
- }
206
- }
207
196
newObject , err := liveObject .Merge (configObject )
208
197
if err != nil {
209
198
return nil , fieldpath.ManagedFields {}, fmt .Errorf ("failed to merge config: %v" , err )
210
199
}
211
- if s .enableUnions {
212
- newObject , err = configObject .NormalizeUnionsApply (newObject )
213
- if err != nil {
214
- return nil , fieldpath.ManagedFields {}, err
215
- }
216
- }
217
200
lastSet := managers [manager ]
218
201
set , err := configObject .ToFieldSet ()
219
202
if err != nil {
0 commit comments