| ... | ... |
@@ -1,6 +1,7 @@ |
| 1 | 1 |
package v1 |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "reflect" |
|
| 4 | 5 |
"sort" |
| 5 | 6 |
|
| 6 | 7 |
"k8s.io/kubernetes/pkg/conversion" |
| ... | ... |
@@ -12,7 +13,7 @@ import ( |
| 12 | 12 |
uservalidation "github.com/openshift/origin/pkg/user/api/validation" |
| 13 | 13 |
) |
| 14 | 14 |
|
| 15 |
-func convert_v1_ResourceAccessReview_To_api_ResourceAccessReview(in *ResourceAccessReview, out *newer.ResourceAccessReview, s conversion.Scope) error {
|
|
| 15 |
+func Convert_v1_ResourceAccessReview_To_api_ResourceAccessReview(in *ResourceAccessReview, out *newer.ResourceAccessReview, s conversion.Scope) error {
|
|
| 16 | 16 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 17 | 17 |
return err |
| 18 | 18 |
} |
| ... | ... |
@@ -23,7 +24,7 @@ func convert_v1_ResourceAccessReview_To_api_ResourceAccessReview(in *ResourceAcc |
| 23 | 23 |
return nil |
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 |
-func convert_api_ResourceAccessReview_To_v1_ResourceAccessReview(in *newer.ResourceAccessReview, out *ResourceAccessReview, s conversion.Scope) error {
|
|
| 26 |
+func Convert_api_ResourceAccessReview_To_v1_ResourceAccessReview(in *newer.ResourceAccessReview, out *ResourceAccessReview, s conversion.Scope) error {
|
|
| 27 | 27 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 28 | 28 |
return err |
| 29 | 29 |
} |
| ... | ... |
@@ -34,7 +35,7 @@ func convert_api_ResourceAccessReview_To_v1_ResourceAccessReview(in *newer.Resou |
| 34 | 34 |
return nil |
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 |
-func convert_v1_LocalResourceAccessReview_To_api_LocalResourceAccessReview(in *LocalResourceAccessReview, out *newer.LocalResourceAccessReview, s conversion.Scope) error {
|
|
| 37 |
+func Convert_v1_LocalResourceAccessReview_To_api_LocalResourceAccessReview(in *LocalResourceAccessReview, out *newer.LocalResourceAccessReview, s conversion.Scope) error {
|
|
| 38 | 38 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 39 | 39 |
return err |
| 40 | 40 |
} |
| ... | ... |
@@ -45,7 +46,7 @@ func convert_v1_LocalResourceAccessReview_To_api_LocalResourceAccessReview(in *L |
| 45 | 45 |
return nil |
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 |
-func convert_api_LocalResourceAccessReview_To_v1_LocalResourceAccessReview(in *newer.LocalResourceAccessReview, out *LocalResourceAccessReview, s conversion.Scope) error {
|
|
| 48 |
+func Convert_api_LocalResourceAccessReview_To_v1_LocalResourceAccessReview(in *newer.LocalResourceAccessReview, out *LocalResourceAccessReview, s conversion.Scope) error {
|
|
| 49 | 49 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 50 | 50 |
return err |
| 51 | 51 |
} |
| ... | ... |
@@ -56,7 +57,7 @@ func convert_api_LocalResourceAccessReview_To_v1_LocalResourceAccessReview(in *n |
| 56 | 56 |
return nil |
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 |
-func convert_v1_SubjectAccessReview_To_api_SubjectAccessReview(in *SubjectAccessReview, out *newer.SubjectAccessReview, s conversion.Scope) error {
|
|
| 59 |
+func Convert_v1_SubjectAccessReview_To_api_SubjectAccessReview(in *SubjectAccessReview, out *newer.SubjectAccessReview, s conversion.Scope) error {
|
|
| 60 | 60 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 61 | 61 |
return err |
| 62 | 62 |
} |
| ... | ... |
@@ -69,7 +70,7 @@ func convert_v1_SubjectAccessReview_To_api_SubjectAccessReview(in *SubjectAccess |
| 69 | 69 |
return nil |
| 70 | 70 |
} |
| 71 | 71 |
|
| 72 |
-func convert_api_SubjectAccessReview_To_v1_SubjectAccessReview(in *newer.SubjectAccessReview, out *SubjectAccessReview, s conversion.Scope) error {
|
|
| 72 |
+func Convert_api_SubjectAccessReview_To_v1_SubjectAccessReview(in *newer.SubjectAccessReview, out *SubjectAccessReview, s conversion.Scope) error {
|
|
| 73 | 73 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 74 | 74 |
return err |
| 75 | 75 |
} |
| ... | ... |
@@ -82,7 +83,7 @@ func convert_api_SubjectAccessReview_To_v1_SubjectAccessReview(in *newer.Subject |
| 82 | 82 |
return nil |
| 83 | 83 |
} |
| 84 | 84 |
|
| 85 |
-func convert_v1_LocalSubjectAccessReview_To_api_LocalSubjectAccessReview(in *LocalSubjectAccessReview, out *newer.LocalSubjectAccessReview, s conversion.Scope) error {
|
|
| 85 |
+func Convert_v1_LocalSubjectAccessReview_To_api_LocalSubjectAccessReview(in *LocalSubjectAccessReview, out *newer.LocalSubjectAccessReview, s conversion.Scope) error {
|
|
| 86 | 86 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 87 | 87 |
return err |
| 88 | 88 |
} |
| ... | ... |
@@ -95,7 +96,7 @@ func convert_v1_LocalSubjectAccessReview_To_api_LocalSubjectAccessReview(in *Loc |
| 95 | 95 |
return nil |
| 96 | 96 |
} |
| 97 | 97 |
|
| 98 |
-func convert_api_LocalSubjectAccessReview_To_v1_LocalSubjectAccessReview(in *newer.LocalSubjectAccessReview, out *LocalSubjectAccessReview, s conversion.Scope) error {
|
|
| 98 |
+func Convert_api_LocalSubjectAccessReview_To_v1_LocalSubjectAccessReview(in *newer.LocalSubjectAccessReview, out *LocalSubjectAccessReview, s conversion.Scope) error {
|
|
| 99 | 99 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 100 | 100 |
return err |
| 101 | 101 |
} |
| ... | ... |
@@ -108,7 +109,7 @@ func convert_api_LocalSubjectAccessReview_To_v1_LocalSubjectAccessReview(in *new |
| 108 | 108 |
return nil |
| 109 | 109 |
} |
| 110 | 110 |
|
| 111 |
-func convert_v1_ResourceAccessReviewResponse_To_api_ResourceAccessReviewResponse(in *ResourceAccessReviewResponse, out *newer.ResourceAccessReviewResponse, s conversion.Scope) error {
|
|
| 111 |
+func Convert_v1_ResourceAccessReviewResponse_To_api_ResourceAccessReviewResponse(in *ResourceAccessReviewResponse, out *newer.ResourceAccessReviewResponse, s conversion.Scope) error {
|
|
| 112 | 112 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 113 | 113 |
return err |
| 114 | 114 |
} |
| ... | ... |
@@ -119,7 +120,7 @@ func convert_v1_ResourceAccessReviewResponse_To_api_ResourceAccessReviewResponse |
| 119 | 119 |
return nil |
| 120 | 120 |
} |
| 121 | 121 |
|
| 122 |
-func convert_api_ResourceAccessReviewResponse_To_v1_ResourceAccessReviewResponse(in *newer.ResourceAccessReviewResponse, out *ResourceAccessReviewResponse, s conversion.Scope) error {
|
|
| 122 |
+func Convert_api_ResourceAccessReviewResponse_To_v1_ResourceAccessReviewResponse(in *newer.ResourceAccessReviewResponse, out *ResourceAccessReviewResponse, s conversion.Scope) error {
|
|
| 123 | 123 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 124 | 124 |
return err |
| 125 | 125 |
} |
| ... | ... |
@@ -130,7 +131,10 @@ func convert_api_ResourceAccessReviewResponse_To_v1_ResourceAccessReviewResponse |
| 130 | 130 |
return nil |
| 131 | 131 |
} |
| 132 | 132 |
|
| 133 |
-func convert_v1_PolicyRule_To_api_PolicyRule(in *PolicyRule, out *newer.PolicyRule, s conversion.Scope) error {
|
|
| 133 |
+func Convert_v1_PolicyRule_To_api_PolicyRule(in *PolicyRule, out *newer.PolicyRule, s conversion.Scope) error {
|
|
| 134 |
+ if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
| 135 |
+ defaulting.(func(*PolicyRule))(in) |
|
| 136 |
+ } |
|
| 134 | 137 |
if err := oapi.Convert_runtime_RawExtension_To_runtime_Object(&in.AttributeRestrictions, out.AttributeRestrictions, s); err != nil {
|
| 135 | 138 |
return err |
| 136 | 139 |
} |
| ... | ... |
@@ -153,7 +157,7 @@ func convert_v1_PolicyRule_To_api_PolicyRule(in *PolicyRule, out *newer.PolicyRu |
| 153 | 153 |
return nil |
| 154 | 154 |
} |
| 155 | 155 |
|
| 156 |
-func convert_api_PolicyRule_To_v1_PolicyRule(in *newer.PolicyRule, out *PolicyRule, s conversion.Scope) error {
|
|
| 156 |
+func Convert_api_PolicyRule_To_v1_PolicyRule(in *newer.PolicyRule, out *PolicyRule, s conversion.Scope) error {
|
|
| 157 | 157 |
if err := oapi.Convert_runtime_Object_To_runtime_RawExtension(in.AttributeRestrictions, &out.AttributeRestrictions, s); err != nil {
|
| 158 | 158 |
return err |
| 159 | 159 |
} |
| ... | ... |
@@ -173,19 +177,19 @@ func convert_api_PolicyRule_To_v1_PolicyRule(in *newer.PolicyRule, out *PolicyRu |
| 173 | 173 |
return nil |
| 174 | 174 |
} |
| 175 | 175 |
|
| 176 |
-func convert_v1_Policy_To_api_Policy(in *Policy, out *newer.Policy, s conversion.Scope) error {
|
|
| 176 |
+func Convert_v1_Policy_To_api_Policy(in *Policy, out *newer.Policy, s conversion.Scope) error {
|
|
| 177 | 177 |
out.LastModified = in.LastModified |
| 178 | 178 |
out.Roles = make(map[string]*newer.Role) |
| 179 | 179 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 180 | 180 |
} |
| 181 | 181 |
|
| 182 |
-func convert_api_Policy_To_v1_Policy(in *newer.Policy, out *Policy, s conversion.Scope) error {
|
|
| 182 |
+func Convert_api_Policy_To_v1_Policy(in *newer.Policy, out *Policy, s conversion.Scope) error {
|
|
| 183 | 183 |
out.LastModified = in.LastModified |
| 184 | 184 |
out.Roles = make([]NamedRole, 0, 0) |
| 185 | 185 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 186 | 186 |
} |
| 187 | 187 |
|
| 188 |
-func convert_v1_RoleBinding_To_api_RoleBinding(in *RoleBinding, out *newer.RoleBinding, s conversion.Scope) error {
|
|
| 188 |
+func Convert_v1_RoleBinding_To_api_RoleBinding(in *RoleBinding, out *newer.RoleBinding, s conversion.Scope) error {
|
|
| 189 | 189 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames); err != nil {
|
| 190 | 190 |
return err |
| 191 | 191 |
} |
| ... | ... |
@@ -200,7 +204,7 @@ func convert_v1_RoleBinding_To_api_RoleBinding(in *RoleBinding, out *newer.RoleB |
| 200 | 200 |
return nil |
| 201 | 201 |
} |
| 202 | 202 |
|
| 203 |
-func convert_api_RoleBinding_To_v1_RoleBinding(in *newer.RoleBinding, out *RoleBinding, s conversion.Scope) error {
|
|
| 203 |
+func Convert_api_RoleBinding_To_v1_RoleBinding(in *newer.RoleBinding, out *RoleBinding, s conversion.Scope) error {
|
|
| 204 | 204 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames); err != nil {
|
| 205 | 205 |
return err |
| 206 | 206 |
} |
| ... | ... |
@@ -210,32 +214,32 @@ func convert_api_RoleBinding_To_v1_RoleBinding(in *newer.RoleBinding, out *RoleB |
| 210 | 210 |
return nil |
| 211 | 211 |
} |
| 212 | 212 |
|
| 213 |
-func convert_v1_PolicyBinding_To_api_PolicyBinding(in *PolicyBinding, out *newer.PolicyBinding, s conversion.Scope) error {
|
|
| 213 |
+func Convert_v1_PolicyBinding_To_api_PolicyBinding(in *PolicyBinding, out *newer.PolicyBinding, s conversion.Scope) error {
|
|
| 214 | 214 |
out.LastModified = in.LastModified |
| 215 | 215 |
out.RoleBindings = make(map[string]*newer.RoleBinding) |
| 216 | 216 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 217 | 217 |
} |
| 218 | 218 |
|
| 219 |
-func convert_api_PolicyBinding_To_v1_PolicyBinding(in *newer.PolicyBinding, out *PolicyBinding, s conversion.Scope) error {
|
|
| 219 |
+func Convert_api_PolicyBinding_To_v1_PolicyBinding(in *newer.PolicyBinding, out *PolicyBinding, s conversion.Scope) error {
|
|
| 220 | 220 |
out.LastModified = in.LastModified |
| 221 | 221 |
out.RoleBindings = make([]NamedRoleBinding, 0, 0) |
| 222 | 222 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 223 | 223 |
} |
| 224 | 224 |
|
| 225 | 225 |
// and now the globals |
| 226 |
-func convert_v1_ClusterPolicy_To_api_ClusterPolicy(in *ClusterPolicy, out *newer.ClusterPolicy, s conversion.Scope) error {
|
|
| 226 |
+func Convert_v1_ClusterPolicy_To_api_ClusterPolicy(in *ClusterPolicy, out *newer.ClusterPolicy, s conversion.Scope) error {
|
|
| 227 | 227 |
out.LastModified = in.LastModified |
| 228 | 228 |
out.Roles = make(map[string]*newer.ClusterRole) |
| 229 | 229 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 230 | 230 |
} |
| 231 | 231 |
|
| 232 |
-func convert_api_ClusterPolicy_To_v1_ClusterPolicy(in *newer.ClusterPolicy, out *ClusterPolicy, s conversion.Scope) error {
|
|
| 232 |
+func Convert_api_ClusterPolicy_To_v1_ClusterPolicy(in *newer.ClusterPolicy, out *ClusterPolicy, s conversion.Scope) error {
|
|
| 233 | 233 |
out.LastModified = in.LastModified |
| 234 | 234 |
out.Roles = make([]NamedClusterRole, 0, 0) |
| 235 | 235 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 236 | 236 |
} |
| 237 | 237 |
|
| 238 |
-func convert_v1_ClusterRoleBinding_To_api_ClusterRoleBinding(in *ClusterRoleBinding, out *newer.ClusterRoleBinding, s conversion.Scope) error {
|
|
| 238 |
+func Convert_v1_ClusterRoleBinding_To_api_ClusterRoleBinding(in *ClusterRoleBinding, out *newer.ClusterRoleBinding, s conversion.Scope) error {
|
|
| 239 | 239 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames); err != nil {
|
| 240 | 240 |
return err |
| 241 | 241 |
} |
| ... | ... |
@@ -250,7 +254,7 @@ func convert_v1_ClusterRoleBinding_To_api_ClusterRoleBinding(in *ClusterRoleBind |
| 250 | 250 |
return nil |
| 251 | 251 |
} |
| 252 | 252 |
|
| 253 |
-func convert_api_ClusterRoleBinding_To_v1_ClusterRoleBinding(in *newer.ClusterRoleBinding, out *ClusterRoleBinding, s conversion.Scope) error {
|
|
| 253 |
+func Convert_api_ClusterRoleBinding_To_v1_ClusterRoleBinding(in *newer.ClusterRoleBinding, out *ClusterRoleBinding, s conversion.Scope) error {
|
|
| 254 | 254 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames); err != nil {
|
| 255 | 255 |
return err |
| 256 | 256 |
} |
| ... | ... |
@@ -260,171 +264,180 @@ func convert_api_ClusterRoleBinding_To_v1_ClusterRoleBinding(in *newer.ClusterRo |
| 260 | 260 |
return nil |
| 261 | 261 |
} |
| 262 | 262 |
|
| 263 |
-func convert_v1_ClusterPolicyBinding_To_api_ClusterPolicyBinding(in *ClusterPolicyBinding, out *newer.ClusterPolicyBinding, s conversion.Scope) error {
|
|
| 263 |
+func Convert_v1_ClusterPolicyBinding_To_api_ClusterPolicyBinding(in *ClusterPolicyBinding, out *newer.ClusterPolicyBinding, s conversion.Scope) error {
|
|
| 264 | 264 |
out.LastModified = in.LastModified |
| 265 | 265 |
out.RoleBindings = make(map[string]*newer.ClusterRoleBinding) |
| 266 | 266 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 267 | 267 |
} |
| 268 | 268 |
|
| 269 |
-func convert_api_ClusterPolicyBinding_To_v1_ClusterPolicyBinding(in *newer.ClusterPolicyBinding, out *ClusterPolicyBinding, s conversion.Scope) error {
|
|
| 269 |
+func Convert_api_ClusterPolicyBinding_To_v1_ClusterPolicyBinding(in *newer.ClusterPolicyBinding, out *ClusterPolicyBinding, s conversion.Scope) error {
|
|
| 270 | 270 |
out.LastModified = in.LastModified |
| 271 | 271 |
out.RoleBindings = make([]NamedClusterRoleBinding, 0, 0) |
| 272 | 272 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 273 | 273 |
} |
| 274 | 274 |
|
| 275 |
+func Convert_v1_NamedRoleArray_to_api_RoleArray(in *[]NamedRole, out *map[string]*newer.Role, s conversion.Scope) error {
|
|
| 276 |
+ for _, curr := range *in {
|
|
| 277 |
+ newRole := &newer.Role{}
|
|
| 278 |
+ if err := s.Convert(&curr.Role, newRole, 0); err != nil {
|
|
| 279 |
+ return err |
|
| 280 |
+ } |
|
| 281 |
+ (*out)[curr.Name] = newRole |
|
| 282 |
+ } |
|
| 283 |
+ |
|
| 284 |
+ return nil |
|
| 285 |
+} |
|
| 286 |
+func Convert_api_NamedRoleArray_to_v1_RoleArray(in *map[string]*newer.Role, out *[]NamedRole, s conversion.Scope) error {
|
|
| 287 |
+ allKeys := make([]string, 0, len(*in)) |
|
| 288 |
+ for key := range *in {
|
|
| 289 |
+ allKeys = append(allKeys, key) |
|
| 290 |
+ } |
|
| 291 |
+ sort.Strings(allKeys) |
|
| 292 |
+ |
|
| 293 |
+ for _, key := range allKeys {
|
|
| 294 |
+ newRole := (*in)[key] |
|
| 295 |
+ oldRole := &Role{}
|
|
| 296 |
+ if err := s.Convert(newRole, oldRole, 0); err != nil {
|
|
| 297 |
+ return err |
|
| 298 |
+ } |
|
| 299 |
+ |
|
| 300 |
+ namedRole := NamedRole{key, *oldRole}
|
|
| 301 |
+ *out = append(*out, namedRole) |
|
| 302 |
+ } |
|
| 303 |
+ |
|
| 304 |
+ return nil |
|
| 305 |
+} |
|
| 306 |
+ |
|
| 307 |
+func Convert_v1_NamedRoleBindingArray_to_api_RoleBindingArray(in *[]NamedRoleBinding, out *map[string]*newer.RoleBinding, s conversion.Scope) error {
|
|
| 308 |
+ for _, curr := range *in {
|
|
| 309 |
+ newRoleBinding := &newer.RoleBinding{}
|
|
| 310 |
+ if err := s.Convert(&curr.RoleBinding, newRoleBinding, 0); err != nil {
|
|
| 311 |
+ return err |
|
| 312 |
+ } |
|
| 313 |
+ (*out)[curr.Name] = newRoleBinding |
|
| 314 |
+ } |
|
| 315 |
+ |
|
| 316 |
+ return nil |
|
| 317 |
+} |
|
| 318 |
+func Convert_api_RoleBindingArray_to_v1_NamedRoleBindingArray(in *map[string]*newer.RoleBinding, out *[]NamedRoleBinding, s conversion.Scope) error {
|
|
| 319 |
+ allKeys := make([]string, 0, len(*in)) |
|
| 320 |
+ for key := range *in {
|
|
| 321 |
+ allKeys = append(allKeys, key) |
|
| 322 |
+ } |
|
| 323 |
+ sort.Strings(allKeys) |
|
| 324 |
+ |
|
| 325 |
+ for _, key := range allKeys {
|
|
| 326 |
+ newRoleBinding := (*in)[key] |
|
| 327 |
+ oldRoleBinding := &RoleBinding{}
|
|
| 328 |
+ if err := s.Convert(newRoleBinding, oldRoleBinding, 0); err != nil {
|
|
| 329 |
+ return err |
|
| 330 |
+ } |
|
| 331 |
+ |
|
| 332 |
+ namedRoleBinding := NamedRoleBinding{key, *oldRoleBinding}
|
|
| 333 |
+ *out = append(*out, namedRoleBinding) |
|
| 334 |
+ } |
|
| 335 |
+ |
|
| 336 |
+ return nil |
|
| 337 |
+} |
|
| 338 |
+ |
|
| 339 |
+func Convert_v1_NamedClusterRoleArray_to_api_ClusterRoleArray(in *[]NamedClusterRole, out *map[string]*newer.ClusterRole, s conversion.Scope) error {
|
|
| 340 |
+ for _, curr := range *in {
|
|
| 341 |
+ newRole := &newer.ClusterRole{}
|
|
| 342 |
+ if err := s.Convert(&curr.Role, newRole, 0); err != nil {
|
|
| 343 |
+ return err |
|
| 344 |
+ } |
|
| 345 |
+ (*out)[curr.Name] = newRole |
|
| 346 |
+ } |
|
| 347 |
+ |
|
| 348 |
+ return nil |
|
| 349 |
+} |
|
| 350 |
+func Convert_api_ClusterRoleArray_to_v1_NamedClusterRoleArray(in *map[string]*newer.ClusterRole, out *[]NamedClusterRole, s conversion.Scope) error {
|
|
| 351 |
+ allKeys := make([]string, 0, len(*in)) |
|
| 352 |
+ for key := range *in {
|
|
| 353 |
+ allKeys = append(allKeys, key) |
|
| 354 |
+ } |
|
| 355 |
+ sort.Strings(allKeys) |
|
| 356 |
+ |
|
| 357 |
+ for _, key := range allKeys {
|
|
| 358 |
+ newRole := (*in)[key] |
|
| 359 |
+ oldRole := &ClusterRole{}
|
|
| 360 |
+ if err := s.Convert(newRole, oldRole, 0); err != nil {
|
|
| 361 |
+ return err |
|
| 362 |
+ } |
|
| 363 |
+ |
|
| 364 |
+ namedRole := NamedClusterRole{key, *oldRole}
|
|
| 365 |
+ *out = append(*out, namedRole) |
|
| 366 |
+ } |
|
| 367 |
+ |
|
| 368 |
+ return nil |
|
| 369 |
+} |
|
| 370 |
+func Convert_v1_NamedClusterRoleBindingArray_to_ClusterRoleBindingArray(in *[]NamedClusterRoleBinding, out *map[string]*newer.ClusterRoleBinding, s conversion.Scope) error {
|
|
| 371 |
+ for _, curr := range *in {
|
|
| 372 |
+ newRoleBinding := &newer.ClusterRoleBinding{}
|
|
| 373 |
+ if err := s.Convert(&curr.RoleBinding, newRoleBinding, 0); err != nil {
|
|
| 374 |
+ return err |
|
| 375 |
+ } |
|
| 376 |
+ (*out)[curr.Name] = newRoleBinding |
|
| 377 |
+ } |
|
| 378 |
+ |
|
| 379 |
+ return nil |
|
| 380 |
+} |
|
| 381 |
+func Convert_api_ClusterRoleBindingArray_to_v1_NamedClusterRoleBindingArray(in *map[string]*newer.ClusterRoleBinding, out *[]NamedClusterRoleBinding, s conversion.Scope) error {
|
|
| 382 |
+ allKeys := make([]string, 0, len(*in)) |
|
| 383 |
+ for key := range *in {
|
|
| 384 |
+ allKeys = append(allKeys, key) |
|
| 385 |
+ } |
|
| 386 |
+ sort.Strings(allKeys) |
|
| 387 |
+ |
|
| 388 |
+ for _, key := range allKeys {
|
|
| 389 |
+ newRoleBinding := (*in)[key] |
|
| 390 |
+ oldRoleBinding := &ClusterRoleBinding{}
|
|
| 391 |
+ if err := s.Convert(newRoleBinding, oldRoleBinding, 0); err != nil {
|
|
| 392 |
+ return err |
|
| 393 |
+ } |
|
| 394 |
+ |
|
| 395 |
+ namedRoleBinding := NamedClusterRoleBinding{key, *oldRoleBinding}
|
|
| 396 |
+ *out = append(*out, namedRoleBinding) |
|
| 397 |
+ } |
|
| 398 |
+ |
|
| 399 |
+ return nil |
|
| 400 |
+} |
|
| 401 |
+ |
|
| 275 | 402 |
func addConversionFuncs(scheme *runtime.Scheme) {
|
| 276 | 403 |
err := scheme.AddConversionFuncs( |
| 277 |
- func(in *[]NamedRole, out *map[string]*newer.Role, s conversion.Scope) error {
|
|
| 278 |
- for _, curr := range *in {
|
|
| 279 |
- newRole := &newer.Role{}
|
|
| 280 |
- if err := s.Convert(&curr.Role, newRole, 0); err != nil {
|
|
| 281 |
- return err |
|
| 282 |
- } |
|
| 283 |
- (*out)[curr.Name] = newRole |
|
| 284 |
- } |
|
| 285 |
- |
|
| 286 |
- return nil |
|
| 287 |
- }, |
|
| 288 |
- func(in *map[string]*newer.Role, out *[]NamedRole, s conversion.Scope) error {
|
|
| 289 |
- allKeys := make([]string, 0, len(*in)) |
|
| 290 |
- for key := range *in {
|
|
| 291 |
- allKeys = append(allKeys, key) |
|
| 292 |
- } |
|
| 293 |
- sort.Strings(allKeys) |
|
| 294 |
- |
|
| 295 |
- for _, key := range allKeys {
|
|
| 296 |
- newRole := (*in)[key] |
|
| 297 |
- oldRole := &Role{}
|
|
| 298 |
- if err := s.Convert(newRole, oldRole, 0); err != nil {
|
|
| 299 |
- return err |
|
| 300 |
- } |
|
| 301 |
- |
|
| 302 |
- namedRole := NamedRole{key, *oldRole}
|
|
| 303 |
- *out = append(*out, namedRole) |
|
| 304 |
- } |
|
| 305 |
- |
|
| 306 |
- return nil |
|
| 307 |
- }, |
|
| 308 |
- |
|
| 309 |
- func(in *[]NamedRoleBinding, out *map[string]*newer.RoleBinding, s conversion.Scope) error {
|
|
| 310 |
- for _, curr := range *in {
|
|
| 311 |
- newRoleBinding := &newer.RoleBinding{}
|
|
| 312 |
- if err := s.Convert(&curr.RoleBinding, newRoleBinding, 0); err != nil {
|
|
| 313 |
- return err |
|
| 314 |
- } |
|
| 315 |
- (*out)[curr.Name] = newRoleBinding |
|
| 316 |
- } |
|
| 317 |
- |
|
| 318 |
- return nil |
|
| 319 |
- }, |
|
| 320 |
- func(in *map[string]*newer.RoleBinding, out *[]NamedRoleBinding, s conversion.Scope) error {
|
|
| 321 |
- allKeys := make([]string, 0, len(*in)) |
|
| 322 |
- for key := range *in {
|
|
| 323 |
- allKeys = append(allKeys, key) |
|
| 324 |
- } |
|
| 325 |
- sort.Strings(allKeys) |
|
| 326 |
- |
|
| 327 |
- for _, key := range allKeys {
|
|
| 328 |
- newRoleBinding := (*in)[key] |
|
| 329 |
- oldRoleBinding := &RoleBinding{}
|
|
| 330 |
- if err := s.Convert(newRoleBinding, oldRoleBinding, 0); err != nil {
|
|
| 331 |
- return err |
|
| 332 |
- } |
|
| 333 |
- |
|
| 334 |
- namedRoleBinding := NamedRoleBinding{key, *oldRoleBinding}
|
|
| 335 |
- *out = append(*out, namedRoleBinding) |
|
| 336 |
- } |
|
| 337 |
- |
|
| 338 |
- return nil |
|
| 339 |
- }, |
|
| 340 |
- |
|
| 341 |
- func(in *[]NamedClusterRole, out *map[string]*newer.ClusterRole, s conversion.Scope) error {
|
|
| 342 |
- for _, curr := range *in {
|
|
| 343 |
- newRole := &newer.ClusterRole{}
|
|
| 344 |
- if err := s.Convert(&curr.Role, newRole, 0); err != nil {
|
|
| 345 |
- return err |
|
| 346 |
- } |
|
| 347 |
- (*out)[curr.Name] = newRole |
|
| 348 |
- } |
|
| 349 |
- |
|
| 350 |
- return nil |
|
| 351 |
- }, |
|
| 352 |
- func(in *map[string]*newer.ClusterRole, out *[]NamedClusterRole, s conversion.Scope) error {
|
|
| 353 |
- allKeys := make([]string, 0, len(*in)) |
|
| 354 |
- for key := range *in {
|
|
| 355 |
- allKeys = append(allKeys, key) |
|
| 356 |
- } |
|
| 357 |
- sort.Strings(allKeys) |
|
| 358 |
- |
|
| 359 |
- for _, key := range allKeys {
|
|
| 360 |
- newRole := (*in)[key] |
|
| 361 |
- oldRole := &ClusterRole{}
|
|
| 362 |
- if err := s.Convert(newRole, oldRole, 0); err != nil {
|
|
| 363 |
- return err |
|
| 364 |
- } |
|
| 365 |
- |
|
| 366 |
- namedRole := NamedClusterRole{key, *oldRole}
|
|
| 367 |
- *out = append(*out, namedRole) |
|
| 368 |
- } |
|
| 369 |
- |
|
| 370 |
- return nil |
|
| 371 |
- }, |
|
| 372 |
- func(in *[]NamedClusterRoleBinding, out *map[string]*newer.ClusterRoleBinding, s conversion.Scope) error {
|
|
| 373 |
- for _, curr := range *in {
|
|
| 374 |
- newRoleBinding := &newer.ClusterRoleBinding{}
|
|
| 375 |
- if err := s.Convert(&curr.RoleBinding, newRoleBinding, 0); err != nil {
|
|
| 376 |
- return err |
|
| 377 |
- } |
|
| 378 |
- (*out)[curr.Name] = newRoleBinding |
|
| 379 |
- } |
|
| 380 |
- |
|
| 381 |
- return nil |
|
| 382 |
- }, |
|
| 383 |
- func(in *map[string]*newer.ClusterRoleBinding, out *[]NamedClusterRoleBinding, s conversion.Scope) error {
|
|
| 384 |
- allKeys := make([]string, 0, len(*in)) |
|
| 385 |
- for key := range *in {
|
|
| 386 |
- allKeys = append(allKeys, key) |
|
| 387 |
- } |
|
| 388 |
- sort.Strings(allKeys) |
|
| 389 |
- |
|
| 390 |
- for _, key := range allKeys {
|
|
| 391 |
- newRoleBinding := (*in)[key] |
|
| 392 |
- oldRoleBinding := &ClusterRoleBinding{}
|
|
| 393 |
- if err := s.Convert(newRoleBinding, oldRoleBinding, 0); err != nil {
|
|
| 394 |
- return err |
|
| 395 |
- } |
|
| 396 |
- |
|
| 397 |
- namedRoleBinding := NamedClusterRoleBinding{key, *oldRoleBinding}
|
|
| 398 |
- *out = append(*out, namedRoleBinding) |
|
| 399 |
- } |
|
| 400 |
- |
|
| 401 |
- return nil |
|
| 402 |
- }, |
|
| 403 |
- |
|
| 404 |
- convert_v1_SubjectAccessReview_To_api_SubjectAccessReview, |
|
| 405 |
- convert_api_SubjectAccessReview_To_v1_SubjectAccessReview, |
|
| 406 |
- convert_v1_LocalSubjectAccessReview_To_api_LocalSubjectAccessReview, |
|
| 407 |
- convert_api_LocalSubjectAccessReview_To_v1_LocalSubjectAccessReview, |
|
| 408 |
- convert_v1_ResourceAccessReview_To_api_ResourceAccessReview, |
|
| 409 |
- convert_api_ResourceAccessReview_To_v1_ResourceAccessReview, |
|
| 410 |
- convert_v1_LocalResourceAccessReview_To_api_LocalResourceAccessReview, |
|
| 411 |
- convert_api_LocalResourceAccessReview_To_v1_LocalResourceAccessReview, |
|
| 412 |
- convert_v1_ResourceAccessReviewResponse_To_api_ResourceAccessReviewResponse, |
|
| 413 |
- convert_api_ResourceAccessReviewResponse_To_v1_ResourceAccessReviewResponse, |
|
| 414 |
- convert_v1_PolicyRule_To_api_PolicyRule, |
|
| 415 |
- convert_api_PolicyRule_To_v1_PolicyRule, |
|
| 416 |
- convert_v1_Policy_To_api_Policy, |
|
| 417 |
- convert_api_Policy_To_v1_Policy, |
|
| 418 |
- convert_v1_RoleBinding_To_api_RoleBinding, |
|
| 419 |
- convert_api_RoleBinding_To_v1_RoleBinding, |
|
| 420 |
- convert_v1_PolicyBinding_To_api_PolicyBinding, |
|
| 421 |
- convert_api_PolicyBinding_To_v1_PolicyBinding, |
|
| 422 |
- convert_v1_ClusterPolicy_To_api_ClusterPolicy, |
|
| 423 |
- convert_api_ClusterPolicy_To_v1_ClusterPolicy, |
|
| 424 |
- convert_v1_ClusterRoleBinding_To_api_ClusterRoleBinding, |
|
| 425 |
- convert_api_ClusterRoleBinding_To_v1_ClusterRoleBinding, |
|
| 426 |
- convert_v1_ClusterPolicyBinding_To_api_ClusterPolicyBinding, |
|
| 427 |
- convert_api_ClusterPolicyBinding_To_v1_ClusterPolicyBinding, |
|
| 404 |
+ Convert_v1_NamedRoleArray_to_api_RoleArray, |
|
| 405 |
+ Convert_api_NamedRoleArray_to_v1_RoleArray, |
|
| 406 |
+ Convert_v1_NamedRoleBindingArray_to_api_RoleBindingArray, |
|
| 407 |
+ Convert_api_RoleBindingArray_to_v1_NamedRoleBindingArray, |
|
| 408 |
+ Convert_v1_NamedClusterRoleArray_to_api_ClusterRoleArray, |
|
| 409 |
+ Convert_api_ClusterRoleArray_to_v1_NamedClusterRoleArray, |
|
| 410 |
+ Convert_v1_NamedClusterRoleBindingArray_to_ClusterRoleBindingArray, |
|
| 411 |
+ Convert_api_ClusterRoleBindingArray_to_v1_NamedClusterRoleBindingArray, |
|
| 412 |
+ |
|
| 413 |
+ Convert_v1_SubjectAccessReview_To_api_SubjectAccessReview, |
|
| 414 |
+ Convert_api_SubjectAccessReview_To_v1_SubjectAccessReview, |
|
| 415 |
+ Convert_v1_LocalSubjectAccessReview_To_api_LocalSubjectAccessReview, |
|
| 416 |
+ Convert_api_LocalSubjectAccessReview_To_v1_LocalSubjectAccessReview, |
|
| 417 |
+ Convert_v1_ResourceAccessReview_To_api_ResourceAccessReview, |
|
| 418 |
+ Convert_api_ResourceAccessReview_To_v1_ResourceAccessReview, |
|
| 419 |
+ Convert_v1_LocalResourceAccessReview_To_api_LocalResourceAccessReview, |
|
| 420 |
+ Convert_api_LocalResourceAccessReview_To_v1_LocalResourceAccessReview, |
|
| 421 |
+ Convert_v1_ResourceAccessReviewResponse_To_api_ResourceAccessReviewResponse, |
|
| 422 |
+ Convert_api_ResourceAccessReviewResponse_To_v1_ResourceAccessReviewResponse, |
|
| 423 |
+ Convert_v1_PolicyRule_To_api_PolicyRule, |
|
| 424 |
+ Convert_api_PolicyRule_To_v1_PolicyRule, |
|
| 425 |
+ Convert_v1_Policy_To_api_Policy, |
|
| 426 |
+ Convert_api_Policy_To_v1_Policy, |
|
| 427 |
+ Convert_v1_RoleBinding_To_api_RoleBinding, |
|
| 428 |
+ Convert_api_RoleBinding_To_v1_RoleBinding, |
|
| 429 |
+ Convert_v1_PolicyBinding_To_api_PolicyBinding, |
|
| 430 |
+ Convert_api_PolicyBinding_To_v1_PolicyBinding, |
|
| 431 |
+ Convert_v1_ClusterPolicy_To_api_ClusterPolicy, |
|
| 432 |
+ Convert_api_ClusterPolicy_To_v1_ClusterPolicy, |
|
| 433 |
+ Convert_v1_ClusterRoleBinding_To_api_ClusterRoleBinding, |
|
| 434 |
+ Convert_api_ClusterRoleBinding_To_v1_ClusterRoleBinding, |
|
| 435 |
+ Convert_v1_ClusterPolicyBinding_To_api_ClusterPolicyBinding, |
|
| 436 |
+ Convert_api_ClusterPolicyBinding_To_v1_ClusterPolicyBinding, |
|
| 428 | 437 |
) |
| 429 | 438 |
if err != nil {
|
| 430 | 439 |
// If one of the conversion functions is malformed, detect it immediately. |
| 431 | 440 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,29 @@ |
| 0 |
+package v1_test |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "reflect" |
|
| 4 |
+ "testing" |
|
| 5 |
+ |
|
| 6 |
+ kapi "k8s.io/kubernetes/pkg/api" |
|
| 7 |
+ |
|
| 8 |
+ "github.com/openshift/origin/pkg/authorization/api" |
|
| 9 |
+ "github.com/openshift/origin/pkg/authorization/api/v1" |
|
| 10 |
+ |
|
| 11 |
+ // install all APIs |
|
| 12 |
+ _ "github.com/openshift/origin/pkg/api/install" |
|
| 13 |
+) |
|
| 14 |
+ |
|
| 15 |
+func TestDefaults(t *testing.T) {
|
|
| 16 |
+ obj := &v1.PolicyRule{
|
|
| 17 |
+ APIGroups: nil, |
|
| 18 |
+ Verbs: []string{api.VerbAll},
|
|
| 19 |
+ Resources: []string{api.ResourceAll},
|
|
| 20 |
+ } |
|
| 21 |
+ out := &api.PolicyRule{}
|
|
| 22 |
+ if err := kapi.Scheme.Convert(obj, out); err != nil {
|
|
| 23 |
+ t.Fatal(err) |
|
| 24 |
+ } |
|
| 25 |
+ if !reflect.DeepEqual(out.APIGroups, []string{api.APIGroupAll}) {
|
|
| 26 |
+ t.Errorf("did not default api groups: %#v", out)
|
|
| 27 |
+ } |
|
| 28 |
+} |
| ... | ... |
@@ -12,7 +12,7 @@ import ( |
| 12 | 12 |
uservalidation "github.com/openshift/origin/pkg/user/api/validation" |
| 13 | 13 |
) |
| 14 | 14 |
|
| 15 |
-func convert_v1beta3_ResourceAccessReview_To_api_ResourceAccessReview(in *ResourceAccessReview, out *newer.ResourceAccessReview, s conversion.Scope) error {
|
|
| 15 |
+func Convert_v1beta3_ResourceAccessReview_To_api_ResourceAccessReview(in *ResourceAccessReview, out *newer.ResourceAccessReview, s conversion.Scope) error {
|
|
| 16 | 16 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 17 | 17 |
return err |
| 18 | 18 |
} |
| ... | ... |
@@ -23,7 +23,7 @@ func convert_v1beta3_ResourceAccessReview_To_api_ResourceAccessReview(in *Resour |
| 23 | 23 |
return nil |
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 |
-func convert_api_ResourceAccessReview_To_v1beta3_ResourceAccessReview(in *newer.ResourceAccessReview, out *ResourceAccessReview, s conversion.Scope) error {
|
|
| 26 |
+func Convert_api_ResourceAccessReview_To_v1beta3_ResourceAccessReview(in *newer.ResourceAccessReview, out *ResourceAccessReview, s conversion.Scope) error {
|
|
| 27 | 27 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 28 | 28 |
return err |
| 29 | 29 |
} |
| ... | ... |
@@ -34,7 +34,7 @@ func convert_api_ResourceAccessReview_To_v1beta3_ResourceAccessReview(in *newer. |
| 34 | 34 |
return nil |
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 |
-func convert_v1beta3_LocalResourceAccessReview_To_api_LocalResourceAccessReview(in *LocalResourceAccessReview, out *newer.LocalResourceAccessReview, s conversion.Scope) error {
|
|
| 37 |
+func Convert_v1beta3_LocalResourceAccessReview_To_api_LocalResourceAccessReview(in *LocalResourceAccessReview, out *newer.LocalResourceAccessReview, s conversion.Scope) error {
|
|
| 38 | 38 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 39 | 39 |
return err |
| 40 | 40 |
} |
| ... | ... |
@@ -45,7 +45,7 @@ func convert_v1beta3_LocalResourceAccessReview_To_api_LocalResourceAccessReview( |
| 45 | 45 |
return nil |
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 |
-func convert_api_LocalResourceAccessReview_To_v1beta3_LocalResourceAccessReview(in *newer.LocalResourceAccessReview, out *LocalResourceAccessReview, s conversion.Scope) error {
|
|
| 48 |
+func Convert_api_LocalResourceAccessReview_To_v1beta3_LocalResourceAccessReview(in *newer.LocalResourceAccessReview, out *LocalResourceAccessReview, s conversion.Scope) error {
|
|
| 49 | 49 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 50 | 50 |
return err |
| 51 | 51 |
} |
| ... | ... |
@@ -56,7 +56,7 @@ func convert_api_LocalResourceAccessReview_To_v1beta3_LocalResourceAccessReview( |
| 56 | 56 |
return nil |
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 |
-func convert_v1beta3_SubjectAccessReview_To_api_SubjectAccessReview(in *SubjectAccessReview, out *newer.SubjectAccessReview, s conversion.Scope) error {
|
|
| 59 |
+func Convert_v1beta3_SubjectAccessReview_To_api_SubjectAccessReview(in *SubjectAccessReview, out *newer.SubjectAccessReview, s conversion.Scope) error {
|
|
| 60 | 60 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 61 | 61 |
return err |
| 62 | 62 |
} |
| ... | ... |
@@ -69,7 +69,7 @@ func convert_v1beta3_SubjectAccessReview_To_api_SubjectAccessReview(in *SubjectA |
| 69 | 69 |
return nil |
| 70 | 70 |
} |
| 71 | 71 |
|
| 72 |
-func convert_api_SubjectAccessReview_To_v1beta3_SubjectAccessReview(in *newer.SubjectAccessReview, out *SubjectAccessReview, s conversion.Scope) error {
|
|
| 72 |
+func Convert_api_SubjectAccessReview_To_v1beta3_SubjectAccessReview(in *newer.SubjectAccessReview, out *SubjectAccessReview, s conversion.Scope) error {
|
|
| 73 | 73 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 74 | 74 |
return err |
| 75 | 75 |
} |
| ... | ... |
@@ -82,7 +82,7 @@ func convert_api_SubjectAccessReview_To_v1beta3_SubjectAccessReview(in *newer.Su |
| 82 | 82 |
return nil |
| 83 | 83 |
} |
| 84 | 84 |
|
| 85 |
-func convert_v1beta3_LocalSubjectAccessReview_To_api_LocalSubjectAccessReview(in *LocalSubjectAccessReview, out *newer.LocalSubjectAccessReview, s conversion.Scope) error {
|
|
| 85 |
+func Convert_v1beta3_LocalSubjectAccessReview_To_api_LocalSubjectAccessReview(in *LocalSubjectAccessReview, out *newer.LocalSubjectAccessReview, s conversion.Scope) error {
|
|
| 86 | 86 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 87 | 87 |
return err |
| 88 | 88 |
} |
| ... | ... |
@@ -95,7 +95,7 @@ func convert_v1beta3_LocalSubjectAccessReview_To_api_LocalSubjectAccessReview(in |
| 95 | 95 |
return nil |
| 96 | 96 |
} |
| 97 | 97 |
|
| 98 |
-func convert_api_LocalSubjectAccessReview_To_v1beta3_LocalSubjectAccessReview(in *newer.LocalSubjectAccessReview, out *LocalSubjectAccessReview, s conversion.Scope) error {
|
|
| 98 |
+func Convert_api_LocalSubjectAccessReview_To_v1beta3_LocalSubjectAccessReview(in *newer.LocalSubjectAccessReview, out *LocalSubjectAccessReview, s conversion.Scope) error {
|
|
| 99 | 99 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 100 | 100 |
return err |
| 101 | 101 |
} |
| ... | ... |
@@ -108,7 +108,7 @@ func convert_api_LocalSubjectAccessReview_To_v1beta3_LocalSubjectAccessReview(in |
| 108 | 108 |
return nil |
| 109 | 109 |
} |
| 110 | 110 |
|
| 111 |
-func convert_v1beta3_ResourceAccessReviewResponse_To_api_ResourceAccessReviewResponse(in *ResourceAccessReviewResponse, out *newer.ResourceAccessReviewResponse, s conversion.Scope) error {
|
|
| 111 |
+func Convert_v1beta3_ResourceAccessReviewResponse_To_api_ResourceAccessReviewResponse(in *ResourceAccessReviewResponse, out *newer.ResourceAccessReviewResponse, s conversion.Scope) error {
|
|
| 112 | 112 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 113 | 113 |
return err |
| 114 | 114 |
} |
| ... | ... |
@@ -119,7 +119,7 @@ func convert_v1beta3_ResourceAccessReviewResponse_To_api_ResourceAccessReviewRes |
| 119 | 119 |
return nil |
| 120 | 120 |
} |
| 121 | 121 |
|
| 122 |
-func convert_api_ResourceAccessReviewResponse_To_v1beta3_ResourceAccessReviewResponse(in *newer.ResourceAccessReviewResponse, out *ResourceAccessReviewResponse, s conversion.Scope) error {
|
|
| 122 |
+func Convert_api_ResourceAccessReviewResponse_To_v1beta3_ResourceAccessReviewResponse(in *newer.ResourceAccessReviewResponse, out *ResourceAccessReviewResponse, s conversion.Scope) error {
|
|
| 123 | 123 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 124 | 124 |
return err |
| 125 | 125 |
} |
| ... | ... |
@@ -130,7 +130,7 @@ func convert_api_ResourceAccessReviewResponse_To_v1beta3_ResourceAccessReviewRes |
| 130 | 130 |
return nil |
| 131 | 131 |
} |
| 132 | 132 |
|
| 133 |
-func convert_v1beta3_PolicyRule_To_api_PolicyRule(in *PolicyRule, out *newer.PolicyRule, s conversion.Scope) error {
|
|
| 133 |
+func Convert_v1beta3_PolicyRule_To_api_PolicyRule(in *PolicyRule, out *newer.PolicyRule, s conversion.Scope) error {
|
|
| 134 | 134 |
if err := oapi.Convert_runtime_RawExtension_To_runtime_Object(&in.AttributeRestrictions, out.AttributeRestrictions, s); err != nil {
|
| 135 | 135 |
return err |
| 136 | 136 |
} |
| ... | ... |
@@ -154,7 +154,7 @@ func convert_v1beta3_PolicyRule_To_api_PolicyRule(in *PolicyRule, out *newer.Pol |
| 154 | 154 |
return nil |
| 155 | 155 |
} |
| 156 | 156 |
|
| 157 |
-func convert_api_PolicyRule_To_v1beta3_PolicyRule(in *newer.PolicyRule, out *PolicyRule, s conversion.Scope) error {
|
|
| 157 |
+func Convert_api_PolicyRule_To_v1beta3_PolicyRule(in *newer.PolicyRule, out *PolicyRule, s conversion.Scope) error {
|
|
| 158 | 158 |
if err := oapi.Convert_runtime_Object_To_runtime_RawExtension(in.AttributeRestrictions, &out.AttributeRestrictions, s); err != nil {
|
| 159 | 159 |
return err |
| 160 | 160 |
} |
| ... | ... |
@@ -174,19 +174,19 @@ func convert_api_PolicyRule_To_v1beta3_PolicyRule(in *newer.PolicyRule, out *Pol |
| 174 | 174 |
return nil |
| 175 | 175 |
} |
| 176 | 176 |
|
| 177 |
-func convert_v1beta3_Policy_To_api_Policy(in *Policy, out *newer.Policy, s conversion.Scope) error {
|
|
| 177 |
+func Convert_v1beta3_Policy_To_api_Policy(in *Policy, out *newer.Policy, s conversion.Scope) error {
|
|
| 178 | 178 |
out.LastModified = in.LastModified |
| 179 | 179 |
out.Roles = make(map[string]*newer.Role) |
| 180 | 180 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 181 | 181 |
} |
| 182 | 182 |
|
| 183 |
-func convert_api_Policy_To_v1beta3_Policy(in *newer.Policy, out *Policy, s conversion.Scope) error {
|
|
| 183 |
+func Convert_api_Policy_To_v1beta3_Policy(in *newer.Policy, out *Policy, s conversion.Scope) error {
|
|
| 184 | 184 |
out.LastModified = in.LastModified |
| 185 | 185 |
out.Roles = make([]NamedRole, 0, 0) |
| 186 | 186 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 187 | 187 |
} |
| 188 | 188 |
|
| 189 |
-func convert_v1beta3_RoleBinding_To_api_RoleBinding(in *RoleBinding, out *newer.RoleBinding, s conversion.Scope) error {
|
|
| 189 |
+func Convert_v1beta3_RoleBinding_To_api_RoleBinding(in *RoleBinding, out *newer.RoleBinding, s conversion.Scope) error {
|
|
| 190 | 190 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames); err != nil {
|
| 191 | 191 |
return err |
| 192 | 192 |
} |
| ... | ... |
@@ -201,7 +201,7 @@ func convert_v1beta3_RoleBinding_To_api_RoleBinding(in *RoleBinding, out *newer. |
| 201 | 201 |
return nil |
| 202 | 202 |
} |
| 203 | 203 |
|
| 204 |
-func convert_api_RoleBinding_To_v1beta3_RoleBinding(in *newer.RoleBinding, out *RoleBinding, s conversion.Scope) error {
|
|
| 204 |
+func Convert_api_RoleBinding_To_v1beta3_RoleBinding(in *newer.RoleBinding, out *RoleBinding, s conversion.Scope) error {
|
|
| 205 | 205 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames); err != nil {
|
| 206 | 206 |
return err |
| 207 | 207 |
} |
| ... | ... |
@@ -211,32 +211,32 @@ func convert_api_RoleBinding_To_v1beta3_RoleBinding(in *newer.RoleBinding, out * |
| 211 | 211 |
return nil |
| 212 | 212 |
} |
| 213 | 213 |
|
| 214 |
-func convert_v1beta3_PolicyBinding_To_api_PolicyBinding(in *PolicyBinding, out *newer.PolicyBinding, s conversion.Scope) error {
|
|
| 214 |
+func Convert_v1beta3_PolicyBinding_To_api_PolicyBinding(in *PolicyBinding, out *newer.PolicyBinding, s conversion.Scope) error {
|
|
| 215 | 215 |
out.LastModified = in.LastModified |
| 216 | 216 |
out.RoleBindings = make(map[string]*newer.RoleBinding) |
| 217 | 217 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 218 | 218 |
} |
| 219 | 219 |
|
| 220 |
-func convert_api_PolicyBinding_To_v1beta3_PolicyBinding(in *newer.PolicyBinding, out *PolicyBinding, s conversion.Scope) error {
|
|
| 220 |
+func Convert_api_PolicyBinding_To_v1beta3_PolicyBinding(in *newer.PolicyBinding, out *PolicyBinding, s conversion.Scope) error {
|
|
| 221 | 221 |
out.LastModified = in.LastModified |
| 222 | 222 |
out.RoleBindings = make([]NamedRoleBinding, 0, 0) |
| 223 | 223 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 224 | 224 |
} |
| 225 | 225 |
|
| 226 | 226 |
// and now the globals |
| 227 |
-func convert_v1beta3_ClusterPolicy_To_api_ClusterPolicy(in *ClusterPolicy, out *newer.ClusterPolicy, s conversion.Scope) error {
|
|
| 227 |
+func Convert_v1beta3_ClusterPolicy_To_api_ClusterPolicy(in *ClusterPolicy, out *newer.ClusterPolicy, s conversion.Scope) error {
|
|
| 228 | 228 |
out.LastModified = in.LastModified |
| 229 | 229 |
out.Roles = make(map[string]*newer.ClusterRole) |
| 230 | 230 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 231 | 231 |
} |
| 232 | 232 |
|
| 233 |
-func convert_api_ClusterPolicy_To_v1beta3_ClusterPolicy(in *newer.ClusterPolicy, out *ClusterPolicy, s conversion.Scope) error {
|
|
| 233 |
+func Convert_api_ClusterPolicy_To_v1beta3_ClusterPolicy(in *newer.ClusterPolicy, out *ClusterPolicy, s conversion.Scope) error {
|
|
| 234 | 234 |
out.LastModified = in.LastModified |
| 235 | 235 |
out.Roles = make([]NamedClusterRole, 0, 0) |
| 236 | 236 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 237 | 237 |
} |
| 238 | 238 |
|
| 239 |
-func convert_v1beta3_ClusterRoleBinding_To_api_ClusterRoleBinding(in *ClusterRoleBinding, out *newer.ClusterRoleBinding, s conversion.Scope) error {
|
|
| 239 |
+func Convert_v1beta3_ClusterRoleBinding_To_api_ClusterRoleBinding(in *ClusterRoleBinding, out *newer.ClusterRoleBinding, s conversion.Scope) error {
|
|
| 240 | 240 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames); err != nil {
|
| 241 | 241 |
return err |
| 242 | 242 |
} |
| ... | ... |
@@ -251,7 +251,7 @@ func convert_v1beta3_ClusterRoleBinding_To_api_ClusterRoleBinding(in *ClusterRol |
| 251 | 251 |
return nil |
| 252 | 252 |
} |
| 253 | 253 |
|
| 254 |
-func convert_api_ClusterRoleBinding_To_v1beta3_ClusterRoleBinding(in *newer.ClusterRoleBinding, out *ClusterRoleBinding, s conversion.Scope) error {
|
|
| 254 |
+func Convert_api_ClusterRoleBinding_To_v1beta3_ClusterRoleBinding(in *newer.ClusterRoleBinding, out *ClusterRoleBinding, s conversion.Scope) error {
|
|
| 255 | 255 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames); err != nil {
|
| 256 | 256 |
return err |
| 257 | 257 |
} |
| ... | ... |
@@ -261,13 +261,13 @@ func convert_api_ClusterRoleBinding_To_v1beta3_ClusterRoleBinding(in *newer.Clus |
| 261 | 261 |
return nil |
| 262 | 262 |
} |
| 263 | 263 |
|
| 264 |
-func convert_v1beta3_ClusterPolicyBinding_To_api_ClusterPolicyBinding(in *ClusterPolicyBinding, out *newer.ClusterPolicyBinding, s conversion.Scope) error {
|
|
| 264 |
+func Convert_v1beta3_ClusterPolicyBinding_To_api_ClusterPolicyBinding(in *ClusterPolicyBinding, out *newer.ClusterPolicyBinding, s conversion.Scope) error {
|
|
| 265 | 265 |
out.LastModified = in.LastModified |
| 266 | 266 |
out.RoleBindings = make(map[string]*newer.ClusterRoleBinding) |
| 267 | 267 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| 268 | 268 |
} |
| 269 | 269 |
|
| 270 |
-func convert_api_ClusterPolicyBinding_To_v1beta3_ClusterPolicyBinding(in *newer.ClusterPolicyBinding, out *ClusterPolicyBinding, s conversion.Scope) error {
|
|
| 270 |
+func Convert_api_ClusterPolicyBinding_To_v1beta3_ClusterPolicyBinding(in *newer.ClusterPolicyBinding, out *ClusterPolicyBinding, s conversion.Scope) error {
|
|
| 271 | 271 |
out.LastModified = in.LastModified |
| 272 | 272 |
out.RoleBindings = make([]NamedClusterRoleBinding, 0, 0) |
| 273 | 273 |
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) |
| ... | ... |
@@ -275,29 +275,29 @@ func convert_api_ClusterPolicyBinding_To_v1beta3_ClusterPolicyBinding(in *newer. |
| 275 | 275 |
|
| 276 | 276 |
func addConversionFuncs(scheme *runtime.Scheme) {
|
| 277 | 277 |
err := scheme.AddConversionFuncs( |
| 278 |
- convert_v1beta3_SubjectAccessReview_To_api_SubjectAccessReview, |
|
| 279 |
- convert_api_SubjectAccessReview_To_v1beta3_SubjectAccessReview, |
|
| 280 |
- convert_v1beta3_LocalSubjectAccessReview_To_api_LocalSubjectAccessReview, |
|
| 281 |
- convert_api_LocalSubjectAccessReview_To_v1beta3_LocalSubjectAccessReview, |
|
| 282 |
- convert_v1beta3_ResourceAccessReview_To_api_ResourceAccessReview, |
|
| 283 |
- convert_api_ResourceAccessReview_To_v1beta3_ResourceAccessReview, |
|
| 284 |
- convert_v1beta3_LocalResourceAccessReview_To_api_LocalResourceAccessReview, |
|
| 285 |
- convert_api_LocalResourceAccessReview_To_v1beta3_LocalResourceAccessReview, |
|
| 286 |
- convert_v1beta3_ResourceAccessReviewResponse_To_api_ResourceAccessReviewResponse, |
|
| 287 |
- convert_api_ResourceAccessReviewResponse_To_v1beta3_ResourceAccessReviewResponse, |
|
| 288 |
- convert_v1beta3_PolicyRule_To_api_PolicyRule, |
|
| 289 |
- convert_api_PolicyRule_To_v1beta3_PolicyRule, |
|
| 290 |
- convert_v1beta3_Policy_To_api_Policy, |
|
| 291 |
- convert_api_Policy_To_v1beta3_Policy, |
|
| 292 |
- convert_v1beta3_RoleBinding_To_api_RoleBinding, |
|
| 293 |
- convert_api_RoleBinding_To_v1beta3_RoleBinding, |
|
| 294 |
- convert_v1beta3_PolicyBinding_To_api_PolicyBinding, |
|
| 295 |
- convert_api_PolicyBinding_To_v1beta3_PolicyBinding, |
|
| 296 |
- convert_api_ClusterPolicy_To_v1beta3_ClusterPolicy, |
|
| 297 |
- convert_v1beta3_ClusterRoleBinding_To_api_ClusterRoleBinding, |
|
| 298 |
- convert_api_ClusterRoleBinding_To_v1beta3_ClusterRoleBinding, |
|
| 299 |
- convert_v1beta3_ClusterPolicyBinding_To_api_ClusterPolicyBinding, |
|
| 300 |
- convert_api_ClusterPolicyBinding_To_v1beta3_ClusterPolicyBinding, |
|
| 278 |
+ Convert_v1beta3_SubjectAccessReview_To_api_SubjectAccessReview, |
|
| 279 |
+ Convert_api_SubjectAccessReview_To_v1beta3_SubjectAccessReview, |
|
| 280 |
+ Convert_v1beta3_LocalSubjectAccessReview_To_api_LocalSubjectAccessReview, |
|
| 281 |
+ Convert_api_LocalSubjectAccessReview_To_v1beta3_LocalSubjectAccessReview, |
|
| 282 |
+ Convert_v1beta3_ResourceAccessReview_To_api_ResourceAccessReview, |
|
| 283 |
+ Convert_api_ResourceAccessReview_To_v1beta3_ResourceAccessReview, |
|
| 284 |
+ Convert_v1beta3_LocalResourceAccessReview_To_api_LocalResourceAccessReview, |
|
| 285 |
+ Convert_api_LocalResourceAccessReview_To_v1beta3_LocalResourceAccessReview, |
|
| 286 |
+ Convert_v1beta3_ResourceAccessReviewResponse_To_api_ResourceAccessReviewResponse, |
|
| 287 |
+ Convert_api_ResourceAccessReviewResponse_To_v1beta3_ResourceAccessReviewResponse, |
|
| 288 |
+ Convert_v1beta3_PolicyRule_To_api_PolicyRule, |
|
| 289 |
+ Convert_api_PolicyRule_To_v1beta3_PolicyRule, |
|
| 290 |
+ Convert_v1beta3_Policy_To_api_Policy, |
|
| 291 |
+ Convert_api_Policy_To_v1beta3_Policy, |
|
| 292 |
+ Convert_v1beta3_RoleBinding_To_api_RoleBinding, |
|
| 293 |
+ Convert_api_RoleBinding_To_v1beta3_RoleBinding, |
|
| 294 |
+ Convert_v1beta3_PolicyBinding_To_api_PolicyBinding, |
|
| 295 |
+ Convert_api_PolicyBinding_To_v1beta3_PolicyBinding, |
|
| 296 |
+ Convert_api_ClusterPolicy_To_v1beta3_ClusterPolicy, |
|
| 297 |
+ Convert_v1beta3_ClusterRoleBinding_To_api_ClusterRoleBinding, |
|
| 298 |
+ Convert_api_ClusterRoleBinding_To_v1beta3_ClusterRoleBinding, |
|
| 299 |
+ Convert_v1beta3_ClusterPolicyBinding_To_api_ClusterPolicyBinding, |
|
| 300 |
+ Convert_api_ClusterPolicyBinding_To_v1beta3_ClusterPolicyBinding, |
|
| 301 | 301 |
|
| 302 | 302 |
func(in *[]NamedRoleBinding, out *map[string]*newer.RoleBinding, s conversion.Scope) error {
|
| 303 | 303 |
for _, curr := range *in {
|
| ... | ... |
@@ -10,7 +10,7 @@ import ( |
| 10 | 10 |
imageapi "github.com/openshift/origin/pkg/image/api" |
| 11 | 11 |
) |
| 12 | 12 |
|
| 13 |
-func convert_v1_BuildConfig_To_api_BuildConfig(in *BuildConfig, out *newer.BuildConfig, s conversion.Scope) error {
|
|
| 13 |
+func Convert_v1_BuildConfig_To_api_BuildConfig(in *BuildConfig, out *newer.BuildConfig, s conversion.Scope) error {
|
|
| 14 | 14 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 15 | 15 |
return err |
| 16 | 16 |
} |
| ... | ... |
@@ -36,14 +36,14 @@ func convert_v1_BuildConfig_To_api_BuildConfig(in *BuildConfig, out *newer.Build |
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 | 38 |
// empty conversion needed because the conversion generator can't handle unidirectional custom conversions |
| 39 |
-func convert_api_BuildConfig_To_v1_BuildConfig(in *newer.BuildConfig, out *BuildConfig, s conversion.Scope) error {
|
|
| 39 |
+func Convert_api_BuildConfig_To_v1_BuildConfig(in *newer.BuildConfig, out *BuildConfig, s conversion.Scope) error {
|
|
| 40 | 40 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 41 | 41 |
return err |
| 42 | 42 |
} |
| 43 | 43 |
return nil |
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 |
-func convert_v1_SourceBuildStrategy_To_api_SourceBuildStrategy(in *SourceBuildStrategy, out *newer.SourceBuildStrategy, s conversion.Scope) error {
|
|
| 46 |
+func Convert_v1_SourceBuildStrategy_To_api_SourceBuildStrategy(in *SourceBuildStrategy, out *newer.SourceBuildStrategy, s conversion.Scope) error {
|
|
| 47 | 47 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 48 | 48 |
return err |
| 49 | 49 |
} |
| ... | ... |
@@ -56,14 +56,14 @@ func convert_v1_SourceBuildStrategy_To_api_SourceBuildStrategy(in *SourceBuildSt |
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
// empty conversion needed because the conversion generator can't handle unidirectional custom conversions |
| 59 |
-func convert_api_SourceBuildStrategy_To_v1_SourceBuildStrategy(in *newer.SourceBuildStrategy, out *SourceBuildStrategy, s conversion.Scope) error {
|
|
| 59 |
+func Convert_api_SourceBuildStrategy_To_v1_SourceBuildStrategy(in *newer.SourceBuildStrategy, out *SourceBuildStrategy, s conversion.Scope) error {
|
|
| 60 | 60 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 61 | 61 |
return err |
| 62 | 62 |
} |
| 63 | 63 |
return nil |
| 64 | 64 |
} |
| 65 | 65 |
|
| 66 |
-func convert_v1_DockerBuildStrategy_To_api_DockerBuildStrategy(in *DockerBuildStrategy, out *newer.DockerBuildStrategy, s conversion.Scope) error {
|
|
| 66 |
+func Convert_v1_DockerBuildStrategy_To_api_DockerBuildStrategy(in *DockerBuildStrategy, out *newer.DockerBuildStrategy, s conversion.Scope) error {
|
|
| 67 | 67 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 68 | 68 |
return err |
| 69 | 69 |
} |
| ... | ... |
@@ -78,14 +78,14 @@ func convert_v1_DockerBuildStrategy_To_api_DockerBuildStrategy(in *DockerBuildSt |
| 78 | 78 |
} |
| 79 | 79 |
|
| 80 | 80 |
// empty conversion needed because the conversion generator can't handle unidirectional custom conversions |
| 81 |
-func convert_api_DockerBuildStrategy_To_v1_DockerBuildStrategy(in *newer.DockerBuildStrategy, out *DockerBuildStrategy, s conversion.Scope) error {
|
|
| 81 |
+func Convert_api_DockerBuildStrategy_To_v1_DockerBuildStrategy(in *newer.DockerBuildStrategy, out *DockerBuildStrategy, s conversion.Scope) error {
|
|
| 82 | 82 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 83 | 83 |
return err |
| 84 | 84 |
} |
| 85 | 85 |
return nil |
| 86 | 86 |
} |
| 87 | 87 |
|
| 88 |
-func convert_v1_CustomBuildStrategy_To_api_CustomBuildStrategy(in *CustomBuildStrategy, out *newer.CustomBuildStrategy, s conversion.Scope) error {
|
|
| 88 |
+func Convert_v1_CustomBuildStrategy_To_api_CustomBuildStrategy(in *CustomBuildStrategy, out *newer.CustomBuildStrategy, s conversion.Scope) error {
|
|
| 89 | 89 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 90 | 90 |
return err |
| 91 | 91 |
} |
| ... | ... |
@@ -98,14 +98,14 @@ func convert_v1_CustomBuildStrategy_To_api_CustomBuildStrategy(in *CustomBuildSt |
| 98 | 98 |
} |
| 99 | 99 |
|
| 100 | 100 |
// empty conversion needed because the conversion generator can't handle unidirectional custom conversions |
| 101 |
-func convert_api_CustomBuildStrategy_To_v1_CustomBuildStrategy(in *newer.CustomBuildStrategy, out *CustomBuildStrategy, s conversion.Scope) error {
|
|
| 101 |
+func Convert_api_CustomBuildStrategy_To_v1_CustomBuildStrategy(in *newer.CustomBuildStrategy, out *CustomBuildStrategy, s conversion.Scope) error {
|
|
| 102 | 102 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 103 | 103 |
return err |
| 104 | 104 |
} |
| 105 | 105 |
return nil |
| 106 | 106 |
} |
| 107 | 107 |
|
| 108 |
-func convert_v1_BuildOutput_To_api_BuildOutput(in *BuildOutput, out *newer.BuildOutput, s conversion.Scope) error {
|
|
| 108 |
+func Convert_v1_BuildOutput_To_api_BuildOutput(in *BuildOutput, out *newer.BuildOutput, s conversion.Scope) error {
|
|
| 109 | 109 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 110 | 110 |
return err |
| 111 | 111 |
} |
| ... | ... |
@@ -117,7 +117,7 @@ func convert_v1_BuildOutput_To_api_BuildOutput(in *BuildOutput, out *newer.Build |
| 117 | 117 |
} |
| 118 | 118 |
|
| 119 | 119 |
// empty conversion needed because the conversion generator can't handle unidirectional custom conversions |
| 120 |
-func convert_api_BuildOutput_To_v1_BuildOutput(in *newer.BuildOutput, out *BuildOutput, s conversion.Scope) error {
|
|
| 120 |
+func Convert_api_BuildOutput_To_v1_BuildOutput(in *newer.BuildOutput, out *BuildOutput, s conversion.Scope) error {
|
|
| 121 | 121 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 122 | 122 |
return err |
| 123 | 123 |
} |
| ... | ... |
@@ -125,14 +125,14 @@ func convert_api_BuildOutput_To_v1_BuildOutput(in *newer.BuildOutput, out *Build |
| 125 | 125 |
} |
| 126 | 126 |
|
| 127 | 127 |
// empty conversion needed because the conversion generator can't handle unidirectional custom conversions |
| 128 |
-func convert_api_BuildTriggerPolicy_To_v1_BuildTriggerPolicy(in *newer.BuildTriggerPolicy, out *BuildTriggerPolicy, s conversion.Scope) error {
|
|
| 128 |
+func Convert_api_BuildTriggerPolicy_To_v1_BuildTriggerPolicy(in *newer.BuildTriggerPolicy, out *BuildTriggerPolicy, s conversion.Scope) error {
|
|
| 129 | 129 |
if err := s.DefaultConvert(in, out, conversion.DestFromSource); err != nil {
|
| 130 | 130 |
return err |
| 131 | 131 |
} |
| 132 | 132 |
return nil |
| 133 | 133 |
} |
| 134 | 134 |
|
| 135 |
-func convert_v1_BuildTriggerPolicy_To_api_BuildTriggerPolicy(in *BuildTriggerPolicy, out *newer.BuildTriggerPolicy, s conversion.Scope) error {
|
|
| 135 |
+func Convert_v1_BuildTriggerPolicy_To_api_BuildTriggerPolicy(in *BuildTriggerPolicy, out *newer.BuildTriggerPolicy, s conversion.Scope) error {
|
|
| 136 | 136 |
if err := s.DefaultConvert(in, out, conversion.DestFromSource); err != nil {
|
| 137 | 137 |
return err |
| 138 | 138 |
} |
| ... | ... |
@@ -147,7 +147,7 @@ func convert_v1_BuildTriggerPolicy_To_api_BuildTriggerPolicy(in *BuildTriggerPol |
| 147 | 147 |
return nil |
| 148 | 148 |
} |
| 149 | 149 |
|
| 150 |
-func convert_api_SourceRevision_To_v1_SourceRevision(in *newer.SourceRevision, out *SourceRevision, s conversion.Scope) error {
|
|
| 150 |
+func Convert_api_SourceRevision_To_v1_SourceRevision(in *newer.SourceRevision, out *SourceRevision, s conversion.Scope) error {
|
|
| 151 | 151 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 152 | 152 |
return err |
| 153 | 153 |
} |
| ... | ... |
@@ -155,14 +155,14 @@ func convert_api_SourceRevision_To_v1_SourceRevision(in *newer.SourceRevision, o |
| 155 | 155 |
return nil |
| 156 | 156 |
} |
| 157 | 157 |
|
| 158 |
-func convert_v1_SourceRevision_To_api_SourceRevision(in *SourceRevision, out *newer.SourceRevision, s conversion.Scope) error {
|
|
| 158 |
+func Convert_v1_SourceRevision_To_api_SourceRevision(in *SourceRevision, out *newer.SourceRevision, s conversion.Scope) error {
|
|
| 159 | 159 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 160 | 160 |
return err |
| 161 | 161 |
} |
| 162 | 162 |
return nil |
| 163 | 163 |
} |
| 164 | 164 |
|
| 165 |
-func convert_api_BuildSource_To_v1_BuildSource(in *newer.BuildSource, out *BuildSource, s conversion.Scope) error {
|
|
| 165 |
+func Convert_api_BuildSource_To_v1_BuildSource(in *newer.BuildSource, out *BuildSource, s conversion.Scope) error {
|
|
| 166 | 166 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 167 | 167 |
return err |
| 168 | 168 |
} |
| ... | ... |
@@ -181,14 +181,14 @@ func convert_api_BuildSource_To_v1_BuildSource(in *newer.BuildSource, out *Build |
| 181 | 181 |
return nil |
| 182 | 182 |
} |
| 183 | 183 |
|
| 184 |
-func convert_v1_BuildSource_To_api_BuildSource(in *BuildSource, out *newer.BuildSource, s conversion.Scope) error {
|
|
| 184 |
+func Convert_v1_BuildSource_To_api_BuildSource(in *BuildSource, out *newer.BuildSource, s conversion.Scope) error {
|
|
| 185 | 185 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 186 | 186 |
return err |
| 187 | 187 |
} |
| 188 | 188 |
return nil |
| 189 | 189 |
} |
| 190 | 190 |
|
| 191 |
-func convert_api_BuildStrategy_To_v1_BuildStrategy(in *newer.BuildStrategy, out *BuildStrategy, s conversion.Scope) error {
|
|
| 191 |
+func Convert_api_BuildStrategy_To_v1_BuildStrategy(in *newer.BuildStrategy, out *BuildStrategy, s conversion.Scope) error {
|
|
| 192 | 192 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 193 | 193 |
return err |
| 194 | 194 |
} |
| ... | ... |
@@ -203,7 +203,7 @@ func convert_api_BuildStrategy_To_v1_BuildStrategy(in *newer.BuildStrategy, out |
| 203 | 203 |
return nil |
| 204 | 204 |
} |
| 205 | 205 |
|
| 206 |
-func convert_v1_BuildStrategy_To_api_BuildStrategy(in *BuildStrategy, out *newer.BuildStrategy, s conversion.Scope) error {
|
|
| 206 |
+func Convert_v1_BuildStrategy_To_api_BuildStrategy(in *BuildStrategy, out *newer.BuildStrategy, s conversion.Scope) error {
|
|
| 207 | 207 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 208 | 208 |
return err |
| 209 | 209 |
} |
| ... | ... |
@@ -237,6 +237,8 @@ func addConversionFuncs(scheme *runtime.Scheme) {
|
| 237 | 237 |
obj.From.Kind = "ImageStreamTag" |
| 238 | 238 |
} |
| 239 | 239 |
}, |
| 240 |
+ // TODO: this defaulter is never called, because triggers with ImageChange type but imagechange nil |
|
| 241 |
+ // are dropped. |
|
| 240 | 242 |
func(obj *BuildTriggerPolicy) {
|
| 241 | 243 |
if obj.Type == ImageChangeBuildTriggerType && obj.ImageChange == nil {
|
| 242 | 244 |
obj.ImageChange = &ImageChangeTrigger{}
|
| ... | ... |
@@ -248,24 +250,24 @@ func addConversionFuncs(scheme *runtime.Scheme) {
|
| 248 | 248 |
} |
| 249 | 249 |
|
| 250 | 250 |
scheme.AddConversionFuncs( |
| 251 |
- convert_v1_BuildConfig_To_api_BuildConfig, |
|
| 252 |
- convert_api_BuildConfig_To_v1_BuildConfig, |
|
| 253 |
- convert_v1_SourceBuildStrategy_To_api_SourceBuildStrategy, |
|
| 254 |
- convert_api_SourceBuildStrategy_To_v1_SourceBuildStrategy, |
|
| 255 |
- convert_v1_DockerBuildStrategy_To_api_DockerBuildStrategy, |
|
| 256 |
- convert_api_DockerBuildStrategy_To_v1_DockerBuildStrategy, |
|
| 257 |
- convert_v1_CustomBuildStrategy_To_api_CustomBuildStrategy, |
|
| 258 |
- convert_api_CustomBuildStrategy_To_v1_CustomBuildStrategy, |
|
| 259 |
- convert_v1_BuildOutput_To_api_BuildOutput, |
|
| 260 |
- convert_api_BuildOutput_To_v1_BuildOutput, |
|
| 261 |
- convert_v1_BuildTriggerPolicy_To_api_BuildTriggerPolicy, |
|
| 262 |
- convert_api_BuildTriggerPolicy_To_v1_BuildTriggerPolicy, |
|
| 263 |
- convert_v1_SourceRevision_To_api_SourceRevision, |
|
| 264 |
- convert_api_SourceRevision_To_v1_SourceRevision, |
|
| 265 |
- convert_v1_BuildSource_To_api_BuildSource, |
|
| 266 |
- convert_api_BuildSource_To_v1_BuildSource, |
|
| 267 |
- convert_v1_BuildStrategy_To_api_BuildStrategy, |
|
| 268 |
- convert_api_BuildStrategy_To_v1_BuildStrategy, |
|
| 251 |
+ Convert_v1_BuildConfig_To_api_BuildConfig, |
|
| 252 |
+ Convert_api_BuildConfig_To_v1_BuildConfig, |
|
| 253 |
+ Convert_v1_SourceBuildStrategy_To_api_SourceBuildStrategy, |
|
| 254 |
+ Convert_api_SourceBuildStrategy_To_v1_SourceBuildStrategy, |
|
| 255 |
+ Convert_v1_DockerBuildStrategy_To_api_DockerBuildStrategy, |
|
| 256 |
+ Convert_api_DockerBuildStrategy_To_v1_DockerBuildStrategy, |
|
| 257 |
+ Convert_v1_CustomBuildStrategy_To_api_CustomBuildStrategy, |
|
| 258 |
+ Convert_api_CustomBuildStrategy_To_v1_CustomBuildStrategy, |
|
| 259 |
+ Convert_v1_BuildOutput_To_api_BuildOutput, |
|
| 260 |
+ Convert_api_BuildOutput_To_v1_BuildOutput, |
|
| 261 |
+ Convert_v1_BuildTriggerPolicy_To_api_BuildTriggerPolicy, |
|
| 262 |
+ Convert_api_BuildTriggerPolicy_To_v1_BuildTriggerPolicy, |
|
| 263 |
+ Convert_v1_SourceRevision_To_api_SourceRevision, |
|
| 264 |
+ Convert_api_SourceRevision_To_v1_SourceRevision, |
|
| 265 |
+ Convert_v1_BuildSource_To_api_BuildSource, |
|
| 266 |
+ Convert_api_BuildSource_To_v1_BuildSource, |
|
| 267 |
+ Convert_v1_BuildStrategy_To_api_BuildStrategy, |
|
| 268 |
+ Convert_api_BuildStrategy_To_v1_BuildStrategy, |
|
| 269 | 269 |
) |
| 270 | 270 |
|
| 271 | 271 |
if err := scheme.AddFieldLabelConversionFunc("v1", "Build",
|
| 272 | 272 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,84 @@ |
| 0 |
+package v1_test |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "testing" |
|
| 4 |
+ |
|
| 5 |
+ kapi "k8s.io/kubernetes/pkg/api" |
|
| 6 |
+ kapiv1 "k8s.io/kubernetes/pkg/api/v1" |
|
| 7 |
+ "k8s.io/kubernetes/pkg/runtime" |
|
| 8 |
+ |
|
| 9 |
+ "github.com/openshift/origin/pkg/build/api" |
|
| 10 |
+ "github.com/openshift/origin/pkg/build/api/v1" |
|
| 11 |
+ |
|
| 12 |
+ // install all APIs |
|
| 13 |
+ _ "github.com/openshift/origin/pkg/api/install" |
|
| 14 |
+) |
|
| 15 |
+ |
|
| 16 |
+func TestDefaults(t *testing.T) {
|
|
| 17 |
+ testCases := []struct {
|
|
| 18 |
+ External runtime.Object |
|
| 19 |
+ Internal runtime.Object |
|
| 20 |
+ Ok func(runtime.Object) bool |
|
| 21 |
+ }{
|
|
| 22 |
+ {
|
|
| 23 |
+ External: &v1.Build{
|
|
| 24 |
+ Spec: v1.BuildSpec{Strategy: v1.BuildStrategy{Type: v1.DockerBuildStrategyType}},
|
|
| 25 |
+ }, |
|
| 26 |
+ Internal: &api.Build{},
|
|
| 27 |
+ Ok: func(out runtime.Object) bool {
|
|
| 28 |
+ obj := out.(*api.Build) |
|
| 29 |
+ return obj.Spec.Strategy.DockerStrategy != nil |
|
| 30 |
+ }, |
|
| 31 |
+ }, |
|
| 32 |
+ {
|
|
| 33 |
+ External: &v1.Build{
|
|
| 34 |
+ Spec: v1.BuildSpec{Strategy: v1.BuildStrategy{SourceStrategy: &v1.SourceBuildStrategy{}}},
|
|
| 35 |
+ }, |
|
| 36 |
+ Internal: &api.Build{},
|
|
| 37 |
+ Ok: func(out runtime.Object) bool {
|
|
| 38 |
+ obj := out.(*api.Build) |
|
| 39 |
+ return obj.Spec.Strategy.SourceStrategy.From.Kind == "ImageStreamTag" |
|
| 40 |
+ }, |
|
| 41 |
+ }, |
|
| 42 |
+ {
|
|
| 43 |
+ External: &v1.Build{
|
|
| 44 |
+ Spec: v1.BuildSpec{Strategy: v1.BuildStrategy{DockerStrategy: &v1.DockerBuildStrategy{From: &kapiv1.ObjectReference{}}}},
|
|
| 45 |
+ }, |
|
| 46 |
+ Internal: &api.Build{},
|
|
| 47 |
+ Ok: func(out runtime.Object) bool {
|
|
| 48 |
+ obj := out.(*api.Build) |
|
| 49 |
+ return obj.Spec.Strategy.DockerStrategy.From.Kind == "ImageStreamTag" |
|
| 50 |
+ }, |
|
| 51 |
+ }, |
|
| 52 |
+ {
|
|
| 53 |
+ External: &v1.Build{
|
|
| 54 |
+ Spec: v1.BuildSpec{Strategy: v1.BuildStrategy{CustomStrategy: &v1.CustomBuildStrategy{}}},
|
|
| 55 |
+ }, |
|
| 56 |
+ Internal: &api.Build{},
|
|
| 57 |
+ Ok: func(out runtime.Object) bool {
|
|
| 58 |
+ obj := out.(*api.Build) |
|
| 59 |
+ return obj.Spec.Strategy.CustomStrategy.From.Kind == "ImageStreamTag" |
|
| 60 |
+ }, |
|
| 61 |
+ }, |
|
| 62 |
+ {
|
|
| 63 |
+ External: &v1.BuildConfig{
|
|
| 64 |
+ Spec: v1.BuildConfigSpec{Triggers: []v1.BuildTriggerPolicy{{Type: v1.ImageChangeBuildTriggerType}}},
|
|
| 65 |
+ }, |
|
| 66 |
+ Internal: &api.BuildConfig{},
|
|
| 67 |
+ Ok: func(out runtime.Object) bool {
|
|
| 68 |
+ obj := out.(*api.BuildConfig) |
|
| 69 |
+ // conversion drops this trigger because it has no type |
|
| 70 |
+ return len(obj.Spec.Triggers) == 0 |
|
| 71 |
+ }, |
|
| 72 |
+ }, |
|
| 73 |
+ } |
|
| 74 |
+ |
|
| 75 |
+ for i, test := range testCases {
|
|
| 76 |
+ if err := kapi.Scheme.Convert(test.External, test.Internal); err != nil {
|
|
| 77 |
+ t.Fatal(err) |
|
| 78 |
+ } |
|
| 79 |
+ if !test.Ok(test.Internal) {
|
|
| 80 |
+ t.Errorf("%d: did not match: %#v", i, test.Internal)
|
|
| 81 |
+ } |
|
| 82 |
+ } |
|
| 83 |
+} |
| ... | ... |
@@ -11,7 +11,7 @@ import ( |
| 11 | 11 |
imageapi "github.com/openshift/origin/pkg/image/api" |
| 12 | 12 |
) |
| 13 | 13 |
|
| 14 |
-func convert_v1beta3_BuildConfig_To_api_BuildConfig(in *BuildConfig, out *newer.BuildConfig, s conversion.Scope) error {
|
|
| 14 |
+func Convert_v1beta3_BuildConfig_To_api_BuildConfig(in *BuildConfig, out *newer.BuildConfig, s conversion.Scope) error {
|
|
| 15 | 15 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 16 | 16 |
return err |
| 17 | 17 |
} |
| ... | ... |
@@ -37,14 +37,14 @@ func convert_v1beta3_BuildConfig_To_api_BuildConfig(in *BuildConfig, out *newer. |
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
// empty conversion needed because the conversion generator can't handle unidirectional custom conversions |
| 40 |
-func convert_api_BuildConfig_To_v1beta3_BuildConfig(in *newer.BuildConfig, out *BuildConfig, s conversion.Scope) error {
|
|
| 40 |
+func Convert_api_BuildConfig_To_v1beta3_BuildConfig(in *newer.BuildConfig, out *BuildConfig, s conversion.Scope) error {
|
|
| 41 | 41 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 42 | 42 |
return err |
| 43 | 43 |
} |
| 44 | 44 |
return nil |
| 45 | 45 |
} |
| 46 | 46 |
|
| 47 |
-func convert_v1beta3_SourceBuildStrategy_To_api_SourceBuildStrategy(in *SourceBuildStrategy, out *newer.SourceBuildStrategy, s conversion.Scope) error {
|
|
| 47 |
+func Convert_v1beta3_SourceBuildStrategy_To_api_SourceBuildStrategy(in *SourceBuildStrategy, out *newer.SourceBuildStrategy, s conversion.Scope) error {
|
|
| 48 | 48 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 49 | 49 |
return err |
| 50 | 50 |
} |
| ... | ... |
@@ -57,14 +57,14 @@ func convert_v1beta3_SourceBuildStrategy_To_api_SourceBuildStrategy(in *SourceBu |
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 | 59 |
// empty conversion needed because the conversion generator can't handle unidirectional custom conversions |
| 60 |
-func convert_api_SourceBuildStrategy_To_v1beta3_SourceBuildStrategy(in *newer.SourceBuildStrategy, out *SourceBuildStrategy, s conversion.Scope) error {
|
|
| 60 |
+func Convert_api_SourceBuildStrategy_To_v1beta3_SourceBuildStrategy(in *newer.SourceBuildStrategy, out *SourceBuildStrategy, s conversion.Scope) error {
|
|
| 61 | 61 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 62 | 62 |
return err |
| 63 | 63 |
} |
| 64 | 64 |
return nil |
| 65 | 65 |
} |
| 66 | 66 |
|
| 67 |
-func convert_v1beta3_DockerBuildStrategy_To_api_DockerBuildStrategy(in *DockerBuildStrategy, out *newer.DockerBuildStrategy, s conversion.Scope) error {
|
|
| 67 |
+func Convert_v1beta3_DockerBuildStrategy_To_api_DockerBuildStrategy(in *DockerBuildStrategy, out *newer.DockerBuildStrategy, s conversion.Scope) error {
|
|
| 68 | 68 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 69 | 69 |
return err |
| 70 | 70 |
} |
| ... | ... |
@@ -79,14 +79,14 @@ func convert_v1beta3_DockerBuildStrategy_To_api_DockerBuildStrategy(in *DockerBu |
| 79 | 79 |
} |
| 80 | 80 |
|
| 81 | 81 |
// empty conversion needed because the conversion generator can't handle unidirectional custom conversions |
| 82 |
-func convert_api_DockerBuildStrategy_To_v1beta3_DockerBuildStrategy(in *newer.DockerBuildStrategy, out *DockerBuildStrategy, s conversion.Scope) error {
|
|
| 82 |
+func Convert_api_DockerBuildStrategy_To_v1beta3_DockerBuildStrategy(in *newer.DockerBuildStrategy, out *DockerBuildStrategy, s conversion.Scope) error {
|
|
| 83 | 83 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 84 | 84 |
return err |
| 85 | 85 |
} |
| 86 | 86 |
return nil |
| 87 | 87 |
} |
| 88 | 88 |
|
| 89 |
-func convert_v1beta3_CustomBuildStrategy_To_api_CustomBuildStrategy(in *CustomBuildStrategy, out *newer.CustomBuildStrategy, s conversion.Scope) error {
|
|
| 89 |
+func Convert_v1beta3_CustomBuildStrategy_To_api_CustomBuildStrategy(in *CustomBuildStrategy, out *newer.CustomBuildStrategy, s conversion.Scope) error {
|
|
| 90 | 90 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 91 | 91 |
return err |
| 92 | 92 |
} |
| ... | ... |
@@ -99,14 +99,14 @@ func convert_v1beta3_CustomBuildStrategy_To_api_CustomBuildStrategy(in *CustomBu |
| 99 | 99 |
} |
| 100 | 100 |
|
| 101 | 101 |
// empty conversion needed because the conversion generator can't handle unidirectional custom conversions |
| 102 |
-func convert_api_CustomBuildStrategy_To_v1beta3_CustomBuildStrategy(in *newer.CustomBuildStrategy, out *CustomBuildStrategy, s conversion.Scope) error {
|
|
| 102 |
+func Convert_api_CustomBuildStrategy_To_v1beta3_CustomBuildStrategy(in *newer.CustomBuildStrategy, out *CustomBuildStrategy, s conversion.Scope) error {
|
|
| 103 | 103 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 104 | 104 |
return err |
| 105 | 105 |
} |
| 106 | 106 |
return nil |
| 107 | 107 |
} |
| 108 | 108 |
|
| 109 |
-func convert_v1beta3_BuildOutput_To_api_BuildOutput(in *BuildOutput, out *newer.BuildOutput, s conversion.Scope) error {
|
|
| 109 |
+func Convert_v1beta3_BuildOutput_To_api_BuildOutput(in *BuildOutput, out *newer.BuildOutput, s conversion.Scope) error {
|
|
| 110 | 110 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 111 | 111 |
return err |
| 112 | 112 |
} |
| ... | ... |
@@ -118,14 +118,14 @@ func convert_v1beta3_BuildOutput_To_api_BuildOutput(in *BuildOutput, out *newer. |
| 118 | 118 |
} |
| 119 | 119 |
|
| 120 | 120 |
// empty conversion needed because the conversion generator can't handle unidirectional custom conversions |
| 121 |
-func convert_api_BuildOutput_To_v1beta3_BuildOutput(in *newer.BuildOutput, out *BuildOutput, s conversion.Scope) error {
|
|
| 121 |
+func Convert_api_BuildOutput_To_v1beta3_BuildOutput(in *newer.BuildOutput, out *BuildOutput, s conversion.Scope) error {
|
|
| 122 | 122 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 123 | 123 |
return err |
| 124 | 124 |
} |
| 125 | 125 |
return nil |
| 126 | 126 |
} |
| 127 | 127 |
|
| 128 |
-func convert_v1beta3_BuildTriggerPolicy_To_api_BuildTriggerPolicy(in *BuildTriggerPolicy, out *newer.BuildTriggerPolicy, s conversion.Scope) error {
|
|
| 128 |
+func Convert_v1beta3_BuildTriggerPolicy_To_api_BuildTriggerPolicy(in *BuildTriggerPolicy, out *newer.BuildTriggerPolicy, s conversion.Scope) error {
|
|
| 129 | 129 |
if err := s.DefaultConvert(in, out, conversion.DestFromSource); err != nil {
|
| 130 | 130 |
return err |
| 131 | 131 |
} |
| ... | ... |
@@ -140,7 +140,7 @@ func convert_v1beta3_BuildTriggerPolicy_To_api_BuildTriggerPolicy(in *BuildTrigg |
| 140 | 140 |
return nil |
| 141 | 141 |
} |
| 142 | 142 |
|
| 143 |
-func convert_api_BuildTriggerPolicy_To_v1beta3_BuildTriggerPolicy(in *newer.BuildTriggerPolicy, out *BuildTriggerPolicy, s conversion.Scope) error {
|
|
| 143 |
+func Convert_api_BuildTriggerPolicy_To_v1beta3_BuildTriggerPolicy(in *newer.BuildTriggerPolicy, out *BuildTriggerPolicy, s conversion.Scope) error {
|
|
| 144 | 144 |
if err := s.DefaultConvert(in, out, conversion.DestFromSource); err != nil {
|
| 145 | 145 |
return err |
| 146 | 146 |
} |
| ... | ... |
@@ -155,14 +155,14 @@ func convert_api_BuildTriggerPolicy_To_v1beta3_BuildTriggerPolicy(in *newer.Buil |
| 155 | 155 |
return nil |
| 156 | 156 |
} |
| 157 | 157 |
|
| 158 |
-func convert_v1beta3_SourceRevision_To_api_SourceRevision(in *SourceRevision, out *newer.SourceRevision, s conversion.Scope) error {
|
|
| 158 |
+func Convert_v1beta3_SourceRevision_To_api_SourceRevision(in *SourceRevision, out *newer.SourceRevision, s conversion.Scope) error {
|
|
| 159 | 159 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 160 | 160 |
return err |
| 161 | 161 |
} |
| 162 | 162 |
return nil |
| 163 | 163 |
} |
| 164 | 164 |
|
| 165 |
-func convert_api_SourceRevision_To_v1beta3_SourceRevision(in *newer.SourceRevision, out *SourceRevision, s conversion.Scope) error {
|
|
| 165 |
+func Convert_api_SourceRevision_To_v1beta3_SourceRevision(in *newer.SourceRevision, out *SourceRevision, s conversion.Scope) error {
|
|
| 166 | 166 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 167 | 167 |
return err |
| 168 | 168 |
} |
| ... | ... |
@@ -170,14 +170,14 @@ func convert_api_SourceRevision_To_v1beta3_SourceRevision(in *newer.SourceRevisi |
| 170 | 170 |
return nil |
| 171 | 171 |
} |
| 172 | 172 |
|
| 173 |
-func convert_v1beta3_BuildSource_To_api_BuildSource(in *BuildSource, out *newer.BuildSource, s conversion.Scope) error {
|
|
| 173 |
+func Convert_v1beta3_BuildSource_To_api_BuildSource(in *BuildSource, out *newer.BuildSource, s conversion.Scope) error {
|
|
| 174 | 174 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 175 | 175 |
return err |
| 176 | 176 |
} |
| 177 | 177 |
return nil |
| 178 | 178 |
} |
| 179 | 179 |
|
| 180 |
-func convert_api_BuildSource_To_v1beta3_BuildSource(in *newer.BuildSource, out *BuildSource, s conversion.Scope) error {
|
|
| 180 |
+func Convert_api_BuildSource_To_v1beta3_BuildSource(in *newer.BuildSource, out *BuildSource, s conversion.Scope) error {
|
|
| 181 | 181 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 182 | 182 |
return err |
| 183 | 183 |
} |
| ... | ... |
@@ -196,14 +196,14 @@ func convert_api_BuildSource_To_v1beta3_BuildSource(in *newer.BuildSource, out * |
| 196 | 196 |
return nil |
| 197 | 197 |
} |
| 198 | 198 |
|
| 199 |
-func convert_v1beta3_BuildStrategy_To_api_BuildStrategy(in *BuildStrategy, out *newer.BuildStrategy, s conversion.Scope) error {
|
|
| 199 |
+func Convert_v1beta3_BuildStrategy_To_api_BuildStrategy(in *BuildStrategy, out *newer.BuildStrategy, s conversion.Scope) error {
|
|
| 200 | 200 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 201 | 201 |
return err |
| 202 | 202 |
} |
| 203 | 203 |
return nil |
| 204 | 204 |
} |
| 205 | 205 |
|
| 206 |
-func convert_api_BuildStrategy_To_v1beta3_BuildStrategy(in *newer.BuildStrategy, out *BuildStrategy, s conversion.Scope) error {
|
|
| 206 |
+func Convert_api_BuildStrategy_To_v1beta3_BuildStrategy(in *newer.BuildStrategy, out *BuildStrategy, s conversion.Scope) error {
|
|
| 207 | 207 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 208 | 208 |
return err |
| 209 | 209 |
} |
| ... | ... |
@@ -254,24 +254,24 @@ func addConversionFuncs(scheme *runtime.Scheme) {
|
| 254 | 254 |
} |
| 255 | 255 |
|
| 256 | 256 |
scheme.AddConversionFuncs( |
| 257 |
- convert_v1beta3_BuildConfig_To_api_BuildConfig, |
|
| 258 |
- convert_api_BuildConfig_To_v1beta3_BuildConfig, |
|
| 259 |
- convert_v1beta3_SourceBuildStrategy_To_api_SourceBuildStrategy, |
|
| 260 |
- convert_api_SourceBuildStrategy_To_v1beta3_SourceBuildStrategy, |
|
| 261 |
- convert_v1beta3_DockerBuildStrategy_To_api_DockerBuildStrategy, |
|
| 262 |
- convert_api_DockerBuildStrategy_To_v1beta3_DockerBuildStrategy, |
|
| 263 |
- convert_v1beta3_CustomBuildStrategy_To_api_CustomBuildStrategy, |
|
| 264 |
- convert_api_CustomBuildStrategy_To_v1beta3_CustomBuildStrategy, |
|
| 265 |
- convert_v1beta3_BuildOutput_To_api_BuildOutput, |
|
| 266 |
- convert_api_BuildOutput_To_v1beta3_BuildOutput, |
|
| 267 |
- convert_v1beta3_BuildTriggerPolicy_To_api_BuildTriggerPolicy, |
|
| 268 |
- convert_api_BuildTriggerPolicy_To_v1beta3_BuildTriggerPolicy, |
|
| 269 |
- convert_v1beta3_SourceRevision_To_api_SourceRevision, |
|
| 270 |
- convert_api_SourceRevision_To_v1beta3_SourceRevision, |
|
| 271 |
- convert_v1beta3_BuildSource_To_api_BuildSource, |
|
| 272 |
- convert_api_BuildSource_To_v1beta3_BuildSource, |
|
| 273 |
- convert_v1beta3_BuildStrategy_To_api_BuildStrategy, |
|
| 274 |
- convert_api_BuildStrategy_To_v1beta3_BuildStrategy, |
|
| 257 |
+ Convert_v1beta3_BuildConfig_To_api_BuildConfig, |
|
| 258 |
+ Convert_api_BuildConfig_To_v1beta3_BuildConfig, |
|
| 259 |
+ Convert_v1beta3_SourceBuildStrategy_To_api_SourceBuildStrategy, |
|
| 260 |
+ Convert_api_SourceBuildStrategy_To_v1beta3_SourceBuildStrategy, |
|
| 261 |
+ Convert_v1beta3_DockerBuildStrategy_To_api_DockerBuildStrategy, |
|
| 262 |
+ Convert_api_DockerBuildStrategy_To_v1beta3_DockerBuildStrategy, |
|
| 263 |
+ Convert_v1beta3_CustomBuildStrategy_To_api_CustomBuildStrategy, |
|
| 264 |
+ Convert_api_CustomBuildStrategy_To_v1beta3_CustomBuildStrategy, |
|
| 265 |
+ Convert_v1beta3_BuildOutput_To_api_BuildOutput, |
|
| 266 |
+ Convert_api_BuildOutput_To_v1beta3_BuildOutput, |
|
| 267 |
+ Convert_v1beta3_BuildTriggerPolicy_To_api_BuildTriggerPolicy, |
|
| 268 |
+ Convert_api_BuildTriggerPolicy_To_v1beta3_BuildTriggerPolicy, |
|
| 269 |
+ Convert_v1beta3_SourceRevision_To_api_SourceRevision, |
|
| 270 |
+ Convert_api_SourceRevision_To_v1beta3_SourceRevision, |
|
| 271 |
+ Convert_v1beta3_BuildSource_To_api_BuildSource, |
|
| 272 |
+ Convert_api_BuildSource_To_v1beta3_BuildSource, |
|
| 273 |
+ Convert_v1beta3_BuildStrategy_To_api_BuildStrategy, |
|
| 274 |
+ Convert_api_BuildStrategy_To_v1beta3_BuildStrategy, |
|
| 275 | 275 |
) |
| 276 | 276 |
|
| 277 | 277 |
// Add field conversion funcs. |
| ... | ... |
@@ -28,7 +28,7 @@ func OkDeploymentConfigStatus(version int) deployapi.DeploymentConfigStatus {
|
| 28 | 28 |
|
| 29 | 29 |
func OkImageChangeDetails() *deployapi.DeploymentDetails {
|
| 30 | 30 |
return &deployapi.DeploymentDetails{
|
| 31 |
- Causes: []*deployapi.DeploymentCause{{
|
|
| 31 |
+ Causes: []deployapi.DeploymentCause{{
|
|
| 32 | 32 |
Type: deployapi.DeploymentTriggerOnImageChange, |
| 33 | 33 |
ImageTrigger: &deployapi.DeploymentCauseImageTrigger{
|
| 34 | 34 |
From: kapi.ObjectReference{
|
| ... | ... |
@@ -39,7 +39,7 @@ func OkImageChangeDetails() *deployapi.DeploymentDetails {
|
| 39 | 39 |
|
| 40 | 40 |
func OkConfigChangeDetails() *deployapi.DeploymentDetails {
|
| 41 | 41 |
return &deployapi.DeploymentDetails{
|
| 42 |
- Causes: []*deployapi.DeploymentCause{{
|
|
| 42 |
+ Causes: []deployapi.DeploymentCause{{
|
|
| 43 | 43 |
Type: deployapi.DeploymentTriggerOnConfigChange, |
| 44 | 44 |
}}} |
| 45 | 45 |
} |
| ... | ... |
@@ -354,7 +354,7 @@ type DeploymentDetails struct {
|
| 354 | 354 |
// Message is the user specified change message, if this deployment was triggered manually by the user |
| 355 | 355 |
Message string |
| 356 | 356 |
// Causes are extended data associated with all the causes for creating a new deployment |
| 357 |
- Causes []*DeploymentCause |
|
| 357 |
+ Causes []DeploymentCause |
|
| 358 | 358 |
} |
| 359 | 359 |
|
| 360 | 360 |
// DeploymentCause captures information about a particular cause of a deployment. |
| ... | ... |
@@ -3,6 +3,7 @@ package v1 |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"math" |
| 6 |
+ "reflect" |
|
| 6 | 7 |
"strings" |
| 7 | 8 |
|
| 8 | 9 |
"k8s.io/kubernetes/pkg/conversion" |
| ... | ... |
@@ -14,7 +15,11 @@ import ( |
| 14 | 14 |
imageapi "github.com/openshift/origin/pkg/image/api" |
| 15 | 15 |
) |
| 16 | 16 |
|
| 17 |
-func convert_v1_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImageChangeParams(in *DeploymentTriggerImageChangeParams, out *newer.DeploymentTriggerImageChangeParams, s conversion.Scope) error {
|
|
| 17 |
+func Convert_v1_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImageChangeParams(in *DeploymentTriggerImageChangeParams, out *newer.DeploymentTriggerImageChangeParams, s conversion.Scope) error {
|
|
| 18 |
+ if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
| 19 |
+ defaulting.(func(*DeploymentTriggerImageChangeParams))(in) |
|
| 20 |
+ } |
|
| 21 |
+ |
|
| 18 | 22 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 19 | 23 |
return err |
| 20 | 24 |
} |
| ... | ... |
@@ -31,7 +36,7 @@ func convert_v1_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImage |
| 31 | 31 |
return nil |
| 32 | 32 |
} |
| 33 | 33 |
|
| 34 |
-func convert_api_DeploymentTriggerImageChangeParams_To_v1_DeploymentTriggerImageChangeParams(in *newer.DeploymentTriggerImageChangeParams, out *DeploymentTriggerImageChangeParams, s conversion.Scope) error {
|
|
| 34 |
+func Convert_api_DeploymentTriggerImageChangeParams_To_v1_DeploymentTriggerImageChangeParams(in *newer.DeploymentTriggerImageChangeParams, out *DeploymentTriggerImageChangeParams, s conversion.Scope) error {
|
|
| 35 | 35 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 36 | 36 |
return err |
| 37 | 37 |
} |
| ... | ... |
@@ -48,7 +53,10 @@ func convert_api_DeploymentTriggerImageChangeParams_To_v1_DeploymentTriggerImage |
| 48 | 48 |
return nil |
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 |
-func convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategyParams(in *RollingDeploymentStrategyParams, out *newer.RollingDeploymentStrategyParams, s conversion.Scope) error {
|
|
| 51 |
+func Convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategyParams(in *RollingDeploymentStrategyParams, out *newer.RollingDeploymentStrategyParams, s conversion.Scope) error {
|
|
| 52 |
+ if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
| 53 |
+ defaulting.(func(*RollingDeploymentStrategyParams))(in) |
|
| 54 |
+ } |
|
| 52 | 55 |
out.UpdatePeriodSeconds = in.UpdatePeriodSeconds |
| 53 | 56 |
out.IntervalSeconds = in.IntervalSeconds |
| 54 | 57 |
out.TimeoutSeconds = in.TimeoutSeconds |
| ... | ... |
@@ -83,7 +91,7 @@ func convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategy |
| 83 | 83 |
return nil |
| 84 | 84 |
} |
| 85 | 85 |
|
| 86 |
-func convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStrategyParams(in *newer.RollingDeploymentStrategyParams, out *RollingDeploymentStrategyParams, s conversion.Scope) error {
|
|
| 86 |
+func Convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStrategyParams(in *newer.RollingDeploymentStrategyParams, out *RollingDeploymentStrategyParams, s conversion.Scope) error {
|
|
| 87 | 87 |
out.UpdatePeriodSeconds = in.UpdatePeriodSeconds |
| 88 | 88 |
out.IntervalSeconds = in.IntervalSeconds |
| 89 | 89 |
out.TimeoutSeconds = in.TimeoutSeconds |
| ... | ... |
@@ -126,11 +134,11 @@ func convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStrategy |
| 126 | 126 |
|
| 127 | 127 |
func addConversionFuncs(scheme *runtime.Scheme) {
|
| 128 | 128 |
err := scheme.AddConversionFuncs( |
| 129 |
- convert_v1_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImageChangeParams, |
|
| 130 |
- convert_api_DeploymentTriggerImageChangeParams_To_v1_DeploymentTriggerImageChangeParams, |
|
| 129 |
+ Convert_v1_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImageChangeParams, |
|
| 130 |
+ Convert_api_DeploymentTriggerImageChangeParams_To_v1_DeploymentTriggerImageChangeParams, |
|
| 131 | 131 |
|
| 132 |
- convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategyParams, |
|
| 133 |
- convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStrategyParams, |
|
| 132 |
+ Convert_v1_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategyParams, |
|
| 133 |
+ Convert_api_RollingDeploymentStrategyParams_To_v1_RollingDeploymentStrategyParams, |
|
| 134 | 134 |
) |
| 135 | 135 |
if err != nil {
|
| 136 | 136 |
panic(err) |
| ... | ... |
@@ -280,3 +280,92 @@ func newInt(val int) *int {
|
| 280 | 280 |
func newIntOrString(ios intstr.IntOrString) *intstr.IntOrString {
|
| 281 | 281 |
return &ios |
| 282 | 282 |
} |
| 283 |
+ |
|
| 284 |
+func TestDeepDefaults(t *testing.T) {
|
|
| 285 |
+ testCases := []struct {
|
|
| 286 |
+ External runtime.Object |
|
| 287 |
+ Internal runtime.Object |
|
| 288 |
+ Ok func(runtime.Object) bool |
|
| 289 |
+ }{
|
|
| 290 |
+ {
|
|
| 291 |
+ External: &deployv1.DeploymentConfig{
|
|
| 292 |
+ Spec: deployv1.DeploymentConfigSpec{
|
|
| 293 |
+ Strategy: deployv1.DeploymentStrategy{
|
|
| 294 |
+ Type: deployv1.DeploymentStrategyTypeRolling, |
|
| 295 |
+ RollingParams: &deployv1.RollingDeploymentStrategyParams{},
|
|
| 296 |
+ }, |
|
| 297 |
+ }, |
|
| 298 |
+ }, |
|
| 299 |
+ Internal: &deployapi.DeploymentConfig{},
|
|
| 300 |
+ Ok: func(out runtime.Object) bool {
|
|
| 301 |
+ obj := out.(*deployapi.DeploymentConfig) |
|
| 302 |
+ if *obj.Spec.Strategy.RollingParams.IntervalSeconds != deployapi.DefaultRollingIntervalSeconds {
|
|
| 303 |
+ return false |
|
| 304 |
+ } |
|
| 305 |
+ if *obj.Spec.Strategy.RollingParams.UpdatePeriodSeconds != deployapi.DefaultRollingUpdatePeriodSeconds {
|
|
| 306 |
+ return false |
|
| 307 |
+ } |
|
| 308 |
+ if *obj.Spec.Strategy.RollingParams.TimeoutSeconds != deployapi.DefaultRollingTimeoutSeconds {
|
|
| 309 |
+ return false |
|
| 310 |
+ } |
|
| 311 |
+ return true |
|
| 312 |
+ }, |
|
| 313 |
+ }, |
|
| 314 |
+ {
|
|
| 315 |
+ External: &deployv1.DeploymentConfig{
|
|
| 316 |
+ Spec: deployv1.DeploymentConfigSpec{
|
|
| 317 |
+ Strategy: deployv1.DeploymentStrategy{
|
|
| 318 |
+ Type: deployv1.DeploymentStrategyTypeRecreate, |
|
| 319 |
+ RecreateParams: &deployv1.RecreateDeploymentStrategyParams{},
|
|
| 320 |
+ }, |
|
| 321 |
+ }, |
|
| 322 |
+ }, |
|
| 323 |
+ Internal: &deployapi.DeploymentConfig{},
|
|
| 324 |
+ Ok: func(out runtime.Object) bool {
|
|
| 325 |
+ obj := out.(*deployapi.DeploymentConfig) |
|
| 326 |
+ return *obj.Spec.Strategy.RecreateParams.TimeoutSeconds == deployapi.DefaultRollingTimeoutSeconds |
|
| 327 |
+ }, |
|
| 328 |
+ }, |
|
| 329 |
+ {
|
|
| 330 |
+ External: &deployv1.DeploymentConfig{
|
|
| 331 |
+ Spec: deployv1.DeploymentConfigSpec{
|
|
| 332 |
+ Strategy: deployv1.DeploymentStrategy{
|
|
| 333 |
+ Type: deployv1.DeploymentStrategyTypeRecreate, |
|
| 334 |
+ }, |
|
| 335 |
+ }, |
|
| 336 |
+ }, |
|
| 337 |
+ Internal: &deployapi.DeploymentConfig{},
|
|
| 338 |
+ Ok: func(out runtime.Object) bool {
|
|
| 339 |
+ obj := out.(*deployapi.DeploymentConfig) |
|
| 340 |
+ return obj.Spec.Strategy.RecreateParams != nil |
|
| 341 |
+ }, |
|
| 342 |
+ }, |
|
| 343 |
+ {
|
|
| 344 |
+ External: &deployv1.DeploymentConfig{
|
|
| 345 |
+ Spec: deployv1.DeploymentConfigSpec{
|
|
| 346 |
+ Triggers: []deployv1.DeploymentTriggerPolicy{
|
|
| 347 |
+ {
|
|
| 348 |
+ Type: deployv1.DeploymentTriggerOnImageChange, |
|
| 349 |
+ ImageChangeParams: &deployv1.DeploymentTriggerImageChangeParams{},
|
|
| 350 |
+ }, |
|
| 351 |
+ }, |
|
| 352 |
+ }, |
|
| 353 |
+ }, |
|
| 354 |
+ Internal: &deployapi.DeploymentConfig{},
|
|
| 355 |
+ Ok: func(out runtime.Object) bool {
|
|
| 356 |
+ obj := out.(*deployapi.DeploymentConfig) |
|
| 357 |
+ t.Logf("%#v", obj.Spec.Triggers[0].ImageChangeParams)
|
|
| 358 |
+ return obj.Spec.Triggers[0].ImageChangeParams.From.Kind == "ImageStreamTag" |
|
| 359 |
+ }, |
|
| 360 |
+ }, |
|
| 361 |
+ } |
|
| 362 |
+ |
|
| 363 |
+ for i, test := range testCases {
|
|
| 364 |
+ if err := kapi.Scheme.Convert(test.External, test.Internal); err != nil {
|
|
| 365 |
+ t.Fatal(err) |
|
| 366 |
+ } |
|
| 367 |
+ if !test.Ok(test.Internal) {
|
|
| 368 |
+ t.Errorf("%d: did not match: %#v", i, test.Internal)
|
|
| 369 |
+ } |
|
| 370 |
+ } |
|
| 371 |
+} |
| ... | ... |
@@ -320,7 +320,7 @@ type DeploymentDetails struct {
|
| 320 | 320 |
// Message is the user specified change message, if this deployment was triggered manually by the user |
| 321 | 321 |
Message string `json:"message,omitempty"` |
| 322 | 322 |
// Causes are extended data associated with all the causes for creating a new deployment |
| 323 |
- Causes []*DeploymentCause `json:"causes,omitempty"` |
|
| 323 |
+ Causes []DeploymentCause `json:"causes"` |
|
| 324 | 324 |
} |
| 325 | 325 |
|
| 326 | 326 |
// DeploymentCause captures information about a particular cause of a deployment. |
| ... | ... |
@@ -13,7 +13,7 @@ import ( |
| 13 | 13 |
imageapi "github.com/openshift/origin/pkg/image/api" |
| 14 | 14 |
) |
| 15 | 15 |
|
| 16 |
-func convert_v1beta3_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImageChangeParams(in *DeploymentTriggerImageChangeParams, out *newer.DeploymentTriggerImageChangeParams, s conversion.Scope) error {
|
|
| 16 |
+func Convert_v1beta3_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImageChangeParams(in *DeploymentTriggerImageChangeParams, out *newer.DeploymentTriggerImageChangeParams, s conversion.Scope) error {
|
|
| 17 | 17 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 18 | 18 |
return err |
| 19 | 19 |
} |
| ... | ... |
@@ -30,7 +30,7 @@ func convert_v1beta3_DeploymentTriggerImageChangeParams_To_api_DeploymentTrigger |
| 30 | 30 |
return nil |
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 |
-func convert_api_DeploymentTriggerImageChangeParams_To_v1beta3_DeploymentTriggerImageChangeParams(in *newer.DeploymentTriggerImageChangeParams, out *DeploymentTriggerImageChangeParams, s conversion.Scope) error {
|
|
| 33 |
+func Convert_api_DeploymentTriggerImageChangeParams_To_v1beta3_DeploymentTriggerImageChangeParams(in *newer.DeploymentTriggerImageChangeParams, out *DeploymentTriggerImageChangeParams, s conversion.Scope) error {
|
|
| 34 | 34 |
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
|
| 35 | 35 |
return err |
| 36 | 36 |
} |
| ... | ... |
@@ -47,7 +47,7 @@ func convert_api_DeploymentTriggerImageChangeParams_To_v1beta3_DeploymentTrigger |
| 47 | 47 |
return nil |
| 48 | 48 |
} |
| 49 | 49 |
|
| 50 |
-func convert_v1beta3_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategyParams(in *RollingDeploymentStrategyParams, out *newer.RollingDeploymentStrategyParams, s conversion.Scope) error {
|
|
| 50 |
+func Convert_v1beta3_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategyParams(in *RollingDeploymentStrategyParams, out *newer.RollingDeploymentStrategyParams, s conversion.Scope) error {
|
|
| 51 | 51 |
out.UpdatePeriodSeconds = in.UpdatePeriodSeconds |
| 52 | 52 |
out.IntervalSeconds = in.IntervalSeconds |
| 53 | 53 |
out.TimeoutSeconds = in.TimeoutSeconds |
| ... | ... |
@@ -82,7 +82,7 @@ func convert_v1beta3_RollingDeploymentStrategyParams_To_api_RollingDeploymentStr |
| 82 | 82 |
return nil |
| 83 | 83 |
} |
| 84 | 84 |
|
| 85 |
-func convert_api_RollingDeploymentStrategyParams_To_v1beta3_RollingDeploymentStrategyParams(in *newer.RollingDeploymentStrategyParams, out *RollingDeploymentStrategyParams, s conversion.Scope) error {
|
|
| 85 |
+func Convert_api_RollingDeploymentStrategyParams_To_v1beta3_RollingDeploymentStrategyParams(in *newer.RollingDeploymentStrategyParams, out *RollingDeploymentStrategyParams, s conversion.Scope) error {
|
|
| 86 | 86 |
out.UpdatePeriodSeconds = in.UpdatePeriodSeconds |
| 87 | 87 |
out.IntervalSeconds = in.IntervalSeconds |
| 88 | 88 |
out.TimeoutSeconds = in.TimeoutSeconds |
| ... | ... |
@@ -125,11 +125,11 @@ func convert_api_RollingDeploymentStrategyParams_To_v1beta3_RollingDeploymentStr |
| 125 | 125 |
|
| 126 | 126 |
func addConversionFuncs(scheme *runtime.Scheme) {
|
| 127 | 127 |
err := scheme.AddConversionFuncs( |
| 128 |
- convert_v1beta3_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImageChangeParams, |
|
| 129 |
- convert_api_DeploymentTriggerImageChangeParams_To_v1beta3_DeploymentTriggerImageChangeParams, |
|
| 128 |
+ Convert_v1beta3_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImageChangeParams, |
|
| 129 |
+ Convert_api_DeploymentTriggerImageChangeParams_To_v1beta3_DeploymentTriggerImageChangeParams, |
|
| 130 | 130 |
|
| 131 |
- convert_v1beta3_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategyParams, |
|
| 132 |
- convert_api_RollingDeploymentStrategyParams_To_v1beta3_RollingDeploymentStrategyParams, |
|
| 131 |
+ Convert_v1beta3_RollingDeploymentStrategyParams_To_api_RollingDeploymentStrategyParams, |
|
| 132 |
+ Convert_api_RollingDeploymentStrategyParams_To_v1beta3_RollingDeploymentStrategyParams, |
|
| 133 | 133 |
) |
| 134 | 134 |
if err != nil {
|
| 135 | 135 |
panic(err) |
| ... | ... |
@@ -334,7 +334,7 @@ type DeploymentDetails struct {
|
| 334 | 334 |
// The user specified change message, if this deployment was triggered manually by the user |
| 335 | 335 |
Message string `json:"message,omitempty"` |
| 336 | 336 |
// Extended data associated with all the causes for creating a new deployment |
| 337 |
- Causes []*DeploymentCause `json:"causes,omitempty"` |
|
| 337 |
+ Causes []DeploymentCause `json:"causes"` |
|
| 338 | 338 |
} |
| 339 | 339 |
|
| 340 | 340 |
// DeploymentCause captures information about a particular cause of a deployment. |
| ... | ... |
@@ -110,11 +110,11 @@ func (c *DeploymentConfigChangeController) generateDeployment(config *deployapi. |
| 110 | 110 |
} |
| 111 | 111 |
|
| 112 | 112 |
// set the trigger details for the new deployment config |
| 113 |
- causes := []*deployapi.DeploymentCause{}
|
|
| 114 |
- causes = append(causes, |
|
| 115 |
- &deployapi.DeploymentCause{
|
|
| 113 |
+ causes := []deployapi.DeploymentCause{
|
|
| 114 |
+ {
|
|
| 116 | 115 |
Type: deployapi.DeploymentTriggerOnConfigChange, |
| 117 |
- }) |
|
| 116 |
+ }, |
|
| 117 |
+ } |
|
| 118 | 118 |
newConfig.Status.Details = &deployapi.DeploymentDetails{
|
| 119 | 119 |
Causes: causes, |
| 120 | 120 |
} |
| ... | ... |
@@ -31,7 +31,7 @@ func (g *DeploymentConfigGenerator) Generate(ctx kapi.Context, name string) (*de |
| 31 | 31 |
// Update the containers with new images based on defined triggers |
| 32 | 32 |
configChanged := false |
| 33 | 33 |
errs := field.ErrorList{}
|
| 34 |
- causes := []*deployapi.DeploymentCause{}
|
|
| 34 |
+ causes := []deployapi.DeploymentCause{}
|
|
| 35 | 35 |
for i, trigger := range config.Spec.Triggers {
|
| 36 | 36 |
params := trigger.ImageChangeParams |
| 37 | 37 |
|
| ... | ... |
@@ -85,16 +85,15 @@ func (g *DeploymentConfigGenerator) Generate(ctx kapi.Context, name string) (*de |
| 85 | 85 |
// If any container was updated, create a cause for the change |
| 86 | 86 |
if containerChanged {
|
| 87 | 87 |
configChanged = true |
| 88 |
- causes = append(causes, |
|
| 89 |
- &deployapi.DeploymentCause{
|
|
| 90 |
- Type: deployapi.DeploymentTriggerOnImageChange, |
|
| 91 |
- ImageTrigger: &deployapi.DeploymentCauseImageTrigger{
|
|
| 92 |
- From: kapi.ObjectReference{
|
|
| 93 |
- Name: imageapi.JoinImageStreamTag(imageStream.Name, tag), |
|
| 94 |
- Kind: "ImageStreamTag", |
|
| 95 |
- }, |
|
| 88 |
+ causes = append(causes, deployapi.DeploymentCause{
|
|
| 89 |
+ Type: deployapi.DeploymentTriggerOnImageChange, |
|
| 90 |
+ ImageTrigger: &deployapi.DeploymentCauseImageTrigger{
|
|
| 91 |
+ From: kapi.ObjectReference{
|
|
| 92 |
+ Name: imageapi.JoinImageStreamTag(imageStream.Name, tag), |
|
| 93 |
+ Kind: "ImageStreamTag", |
|
| 96 | 94 |
}, |
| 97 |
- }) |
|
| 95 |
+ }, |
|
| 96 |
+ }) |
|
| 98 | 97 |
} |
| 99 | 98 |
} |
| 100 | 99 |
|
| ... | ... |
@@ -10,45 +10,48 @@ import ( |
| 10 | 10 |
newer "github.com/openshift/origin/pkg/image/api" |
| 11 | 11 |
) |
| 12 | 12 |
|
| 13 |
+// Convert docker client object to internal object, but only when this package is included |
|
| 14 |
+func Convert_dockerpre012_ImagePre_012_to_api_DockerImage(in *docker.ImagePre012, out *newer.DockerImage, s conversion.Scope) error {
|
|
| 15 |
+ if err := s.Convert(in.Config, &out.Config, conversion.AllowDifferentFieldTypeNames); err != nil {
|
|
| 16 |
+ return err |
|
| 17 |
+ } |
|
| 18 |
+ if err := s.Convert(&in.ContainerConfig, &out.ContainerConfig, conversion.AllowDifferentFieldTypeNames); err != nil {
|
|
| 19 |
+ return err |
|
| 20 |
+ } |
|
| 21 |
+ out.ID = in.ID |
|
| 22 |
+ out.Parent = in.Parent |
|
| 23 |
+ out.Comment = in.Comment |
|
| 24 |
+ out.Created = unversioned.NewTime(in.Created) |
|
| 25 |
+ out.Container = in.Container |
|
| 26 |
+ out.DockerVersion = in.DockerVersion |
|
| 27 |
+ out.Author = in.Author |
|
| 28 |
+ out.Architecture = in.Architecture |
|
| 29 |
+ out.Size = in.Size |
|
| 30 |
+ return nil |
|
| 31 |
+} |
|
| 32 |
+func Convert_api_DockerImage_to_dockerpre012_ImagePre_012(in *newer.DockerImage, out *docker.ImagePre012, s conversion.Scope) error {
|
|
| 33 |
+ if err := s.Convert(&in.Config, &out.Config, conversion.AllowDifferentFieldTypeNames); err != nil {
|
|
| 34 |
+ return err |
|
| 35 |
+ } |
|
| 36 |
+ if err := s.Convert(&in.ContainerConfig, &out.ContainerConfig, conversion.AllowDifferentFieldTypeNames); err != nil {
|
|
| 37 |
+ return err |
|
| 38 |
+ } |
|
| 39 |
+ out.ID = in.ID |
|
| 40 |
+ out.Parent = in.Parent |
|
| 41 |
+ out.Comment = in.Comment |
|
| 42 |
+ out.Created = in.Created.Time |
|
| 43 |
+ out.Container = in.Container |
|
| 44 |
+ out.DockerVersion = in.DockerVersion |
|
| 45 |
+ out.Author = in.Author |
|
| 46 |
+ out.Architecture = in.Architecture |
|
| 47 |
+ out.Size = in.Size |
|
| 48 |
+ return nil |
|
| 49 |
+} |
|
| 50 |
+ |
|
| 13 | 51 |
func addConversionFuncs(scheme *runtime.Scheme) {
|
| 14 | 52 |
err := scheme.AddConversionFuncs( |
| 15 |
- // Convert docker client object to internal object, but only when this package is included |
|
| 16 |
- func(in *docker.ImagePre012, out *newer.DockerImage, s conversion.Scope) error {
|
|
| 17 |
- if err := s.Convert(in.Config, &out.Config, conversion.AllowDifferentFieldTypeNames); err != nil {
|
|
| 18 |
- return err |
|
| 19 |
- } |
|
| 20 |
- if err := s.Convert(&in.ContainerConfig, &out.ContainerConfig, conversion.AllowDifferentFieldTypeNames); err != nil {
|
|
| 21 |
- return err |
|
| 22 |
- } |
|
| 23 |
- out.ID = in.ID |
|
| 24 |
- out.Parent = in.Parent |
|
| 25 |
- out.Comment = in.Comment |
|
| 26 |
- out.Created = unversioned.NewTime(in.Created) |
|
| 27 |
- out.Container = in.Container |
|
| 28 |
- out.DockerVersion = in.DockerVersion |
|
| 29 |
- out.Author = in.Author |
|
| 30 |
- out.Architecture = in.Architecture |
|
| 31 |
- out.Size = in.Size |
|
| 32 |
- return nil |
|
| 33 |
- }, |
|
| 34 |
- func(in *newer.DockerImage, out *docker.ImagePre012, s conversion.Scope) error {
|
|
| 35 |
- if err := s.Convert(&in.Config, &out.Config, conversion.AllowDifferentFieldTypeNames); err != nil {
|
|
| 36 |
- return err |
|
| 37 |
- } |
|
| 38 |
- if err := s.Convert(&in.ContainerConfig, &out.ContainerConfig, conversion.AllowDifferentFieldTypeNames); err != nil {
|
|
| 39 |
- return err |
|
| 40 |
- } |
|
| 41 |
- out.ID = in.ID |
|
| 42 |
- out.Parent = in.Parent |
|
| 43 |
- out.Comment = in.Comment |
|
| 44 |
- out.Created = in.Created.Time |
|
| 45 |
- out.Container = in.Container |
|
| 46 |
- out.DockerVersion = in.DockerVersion |
|
| 47 |
- out.Author = in.Author |
|
| 48 |
- out.Architecture = in.Architecture |
|
| 49 |
- out.Size = in.Size |
|
| 50 |
- return nil |
|
| 51 |
- }, |
|
| 53 |
+ Convert_dockerpre012_ImagePre_012_to_api_DockerImage, |
|
| 54 |
+ Convert_api_DockerImage_to_dockerpre012_ImagePre_012, |
|
| 52 | 55 |
) |
| 53 | 56 |
if err != nil {
|
| 54 | 57 |
// If one of the conversion functions is malformed, detect it immediately. |
| ... | ... |
@@ -15,7 +15,7 @@ import ( |
| 15 | 15 |
) |
| 16 | 16 |
|
| 17 | 17 |
// The docker metadata must be cast to a version |
| 18 |
-func convert_api_Image_To_v1_Image(in *newer.Image, out *Image, s conversion.Scope) error {
|
|
| 18 |
+func Convert_api_Image_To_v1_Image(in *newer.Image, out *Image, s conversion.Scope) error {
|
|
| 19 | 19 |
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
|
| 20 | 20 |
return err |
| 21 | 21 |
} |
| ... | ... |
@@ -45,9 +45,8 @@ func convert_api_Image_To_v1_Image(in *newer.Image, out *Image, s conversion.Sco |
| 45 | 45 |
if in.DockerImageLayers != nil {
|
| 46 | 46 |
out.DockerImageLayers = make([]ImageLayer, len(in.DockerImageLayers)) |
| 47 | 47 |
for i := range in.DockerImageLayers {
|
| 48 |
- if err := s.Convert(&in.DockerImageLayers[i], &out.DockerImageLayers[i], 0); err != nil {
|
|
| 49 |
- return err |
|
| 50 |
- } |
|
| 48 |
+ out.DockerImageLayers[i].Name = in.DockerImageLayers[i].Name |
|
| 49 |
+ out.DockerImageLayers[i].Size = in.DockerImageLayers[i].Size |
|
| 51 | 50 |
} |
| 52 | 51 |
} else {
|
| 53 | 52 |
out.DockerImageLayers = nil |
| ... | ... |
@@ -56,7 +55,7 @@ func convert_api_Image_To_v1_Image(in *newer.Image, out *Image, s conversion.Sco |
| 56 | 56 |
return nil |
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 |
-func convert_v1_Image_To_api_Image(in *Image, out *newer.Image, s conversion.Scope) error {
|
|
| 59 |
+func Convert_v1_Image_To_api_Image(in *Image, out *newer.Image, s conversion.Scope) error {
|
|
| 60 | 60 |
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
|
| 61 | 61 |
return err |
| 62 | 62 |
} |
| ... | ... |
@@ -86,9 +85,8 @@ func convert_v1_Image_To_api_Image(in *Image, out *newer.Image, s conversion.Sco |
| 86 | 86 |
if in.DockerImageLayers != nil {
|
| 87 | 87 |
out.DockerImageLayers = make([]newer.ImageLayer, len(in.DockerImageLayers)) |
| 88 | 88 |
for i := range in.DockerImageLayers {
|
| 89 |
- if err := s.Convert(&in.DockerImageLayers[i], &out.DockerImageLayers[i], 0); err != nil {
|
|
| 90 |
- return err |
|
| 91 |
- } |
|
| 89 |
+ out.DockerImageLayers[i].Name = in.DockerImageLayers[i].Name |
|
| 90 |
+ out.DockerImageLayers[i].Size = in.DockerImageLayers[i].Size |
|
| 92 | 91 |
} |
| 93 | 92 |
} else {
|
| 94 | 93 |
out.DockerImageLayers = nil |
| ... | ... |
@@ -97,13 +95,13 @@ func convert_v1_Image_To_api_Image(in *Image, out *newer.Image, s conversion.Sco |
| 97 | 97 |
return nil |
| 98 | 98 |
} |
| 99 | 99 |
|
| 100 |
-func convert_v1_ImageStreamSpec_To_api_ImageStreamSpec(in *ImageStreamSpec, out *newer.ImageStreamSpec, s conversion.Scope) error {
|
|
| 100 |
+func Convert_v1_ImageStreamSpec_To_api_ImageStreamSpec(in *ImageStreamSpec, out *newer.ImageStreamSpec, s conversion.Scope) error {
|
|
| 101 | 101 |
out.DockerImageRepository = in.DockerImageRepository |
| 102 | 102 |
out.Tags = make(map[string]newer.TagReference) |
| 103 | 103 |
return s.Convert(&in.Tags, &out.Tags, 0) |
| 104 | 104 |
} |
| 105 | 105 |
|
| 106 |
-func convert_api_ImageStreamSpec_To_v1_ImageStreamSpec(in *newer.ImageStreamSpec, out *ImageStreamSpec, s conversion.Scope) error {
|
|
| 106 |
+func Convert_api_ImageStreamSpec_To_v1_ImageStreamSpec(in *newer.ImageStreamSpec, out *ImageStreamSpec, s conversion.Scope) error {
|
|
| 107 | 107 |
out.DockerImageRepository = in.DockerImageRepository |
| 108 | 108 |
if len(in.DockerImageRepository) > 0 {
|
| 109 | 109 |
// ensure that stored image references have no tag or ID, which was possible from 1.0.0 until 1.0.7 |
| ... | ... |
@@ -118,13 +116,13 @@ func convert_api_ImageStreamSpec_To_v1_ImageStreamSpec(in *newer.ImageStreamSpec |
| 118 | 118 |
return s.Convert(&in.Tags, &out.Tags, 0) |
| 119 | 119 |
} |
| 120 | 120 |
|
| 121 |
-func convert_v1_ImageStreamStatus_To_api_ImageStreamStatus(in *ImageStreamStatus, out *newer.ImageStreamStatus, s conversion.Scope) error {
|
|
| 121 |
+func Convert_v1_ImageStreamStatus_To_api_ImageStreamStatus(in *ImageStreamStatus, out *newer.ImageStreamStatus, s conversion.Scope) error {
|
|
| 122 | 122 |
out.DockerImageRepository = in.DockerImageRepository |
| 123 | 123 |
out.Tags = make(map[string]newer.TagEventList) |
| 124 | 124 |
return s.Convert(&in.Tags, &out.Tags, 0) |
| 125 | 125 |
} |
| 126 | 126 |
|
| 127 |
-func convert_api_ImageStreamStatus_To_v1_ImageStreamStatus(in *newer.ImageStreamStatus, out *ImageStreamStatus, s conversion.Scope) error {
|
|
| 127 |
+func Convert_api_ImageStreamStatus_To_v1_ImageStreamStatus(in *newer.ImageStreamStatus, out *ImageStreamStatus, s conversion.Scope) error {
|
|
| 128 | 128 |
out.DockerImageRepository = in.DockerImageRepository |
| 129 | 129 |
if len(in.DockerImageRepository) > 0 {
|
| 130 | 130 |
// ensure that stored image references have no tag or ID, which was possible from 1.0.0 until 1.0.7 |
| ... | ... |
@@ -139,14 +137,79 @@ func convert_api_ImageStreamStatus_To_v1_ImageStreamStatus(in *newer.ImageStream |
| 139 | 139 |
return s.Convert(&in.Tags, &out.Tags, 0) |
| 140 | 140 |
} |
| 141 | 141 |
|
| 142 |
-func convert_api_ImageStreamMapping_To_v1_ImageStreamMapping(in *newer.ImageStreamMapping, out *ImageStreamMapping, s conversion.Scope) error {
|
|
| 142 |
+func Convert_api_ImageStreamMapping_To_v1_ImageStreamMapping(in *newer.ImageStreamMapping, out *ImageStreamMapping, s conversion.Scope) error {
|
|
| 143 | 143 |
return s.DefaultConvert(in, out, conversion.DestFromSource) |
| 144 | 144 |
} |
| 145 | 145 |
|
| 146 |
-func convert_v1_ImageStreamMapping_To_api_ImageStreamMapping(in *ImageStreamMapping, out *newer.ImageStreamMapping, s conversion.Scope) error {
|
|
| 146 |
+func Convert_v1_ImageStreamMapping_To_api_ImageStreamMapping(in *ImageStreamMapping, out *newer.ImageStreamMapping, s conversion.Scope) error {
|
|
| 147 | 147 |
return s.DefaultConvert(in, out, conversion.SourceToDest) |
| 148 | 148 |
} |
| 149 | 149 |
|
| 150 |
+func Convert_v1_NamedTagEventListArray_to_api_TagEventListArray(in *[]NamedTagEventList, out *map[string]newer.TagEventList, s conversion.Scope) error {
|
|
| 151 |
+ for _, curr := range *in {
|
|
| 152 |
+ newTagEventList := newer.TagEventList{}
|
|
| 153 |
+ if err := s.Convert(&curr.Conditions, &newTagEventList.Conditions, 0); err != nil {
|
|
| 154 |
+ return err |
|
| 155 |
+ } |
|
| 156 |
+ if err := s.Convert(&curr.Items, &newTagEventList.Items, 0); err != nil {
|
|
| 157 |
+ return err |
|
| 158 |
+ } |
|
| 159 |
+ (*out)[curr.Tag] = newTagEventList |
|
| 160 |
+ } |
|
| 161 |
+ |
|
| 162 |
+ return nil |
|
| 163 |
+} |
|
| 164 |
+func Convert_api_TagEventListArray_to_v1_NamedTagEventListArray(in *map[string]newer.TagEventList, out *[]NamedTagEventList, s conversion.Scope) error {
|
|
| 165 |
+ allKeys := make([]string, 0, len(*in)) |
|
| 166 |
+ for key := range *in {
|
|
| 167 |
+ allKeys = append(allKeys, key) |
|
| 168 |
+ } |
|
| 169 |
+ sort.Strings(allKeys) |
|
| 170 |
+ |
|
| 171 |
+ for _, key := range allKeys {
|
|
| 172 |
+ newTagEventList := (*in)[key] |
|
| 173 |
+ oldTagEventList := &NamedTagEventList{Tag: key}
|
|
| 174 |
+ if err := s.Convert(&newTagEventList.Conditions, &oldTagEventList.Conditions, 0); err != nil {
|
|
| 175 |
+ return err |
|
| 176 |
+ } |
|
| 177 |
+ if err := s.Convert(&newTagEventList.Items, &oldTagEventList.Items, 0); err != nil {
|
|
| 178 |
+ return err |
|
| 179 |
+ } |
|
| 180 |
+ |
|
| 181 |
+ *out = append(*out, *oldTagEventList) |
|
| 182 |
+ } |
|
| 183 |
+ |
|
| 184 |
+ return nil |
|
| 185 |
+} |
|
| 186 |
+func Convert_v1_TagReferenceArray_to_api_TagReferenceMap(in *[]TagReference, out *map[string]newer.TagReference, s conversion.Scope) error {
|
|
| 187 |
+ for _, curr := range *in {
|
|
| 188 |
+ r := newer.TagReference{}
|
|
| 189 |
+ if err := s.Convert(&curr, &r, 0); err != nil {
|
|
| 190 |
+ return err |
|
| 191 |
+ } |
|
| 192 |
+ (*out)[curr.Name] = r |
|
| 193 |
+ } |
|
| 194 |
+ return nil |
|
| 195 |
+} |
|
| 196 |
+func Convert_api_TagReferenceMap_to_v1_TagReferenceArray(in *map[string]newer.TagReference, out *[]TagReference, s conversion.Scope) error {
|
|
| 197 |
+ allTags := make([]string, 0, len(*in)) |
|
| 198 |
+ for tag := range *in {
|
|
| 199 |
+ allTags = append(allTags, tag) |
|
| 200 |
+ } |
|
| 201 |
+ sort.Strings(allTags) |
|
| 202 |
+ |
|
| 203 |
+ for _, tag := range allTags {
|
|
| 204 |
+ newTagReference := (*in)[tag] |
|
| 205 |
+ oldTagReference := TagReference{}
|
|
| 206 |
+ if err := s.Convert(&newTagReference, &oldTagReference, 0); err != nil {
|
|
| 207 |
+ return err |
|
| 208 |
+ } |
|
| 209 |
+ oldTagReference.Name = tag |
|
| 210 |
+ *out = append(*out, oldTagReference) |
|
| 211 |
+ } |
|
| 212 |
+ return nil |
|
| 213 |
+} |
|
| 214 |
+ |
|
| 150 | 215 |
func addConversionFuncs(scheme *runtime.Scheme) {
|
| 151 | 216 |
err := scheme.AddDefaultingFuncs( |
| 152 | 217 |
func(obj *ImageImportSpec) {
|
| ... | ... |
@@ -163,79 +226,19 @@ func addConversionFuncs(scheme *runtime.Scheme) {
|
| 163 | 163 |
panic(err) |
| 164 | 164 |
} |
| 165 | 165 |
err = scheme.AddConversionFuncs( |
| 166 |
- func(in *[]NamedTagEventList, out *map[string]newer.TagEventList, s conversion.Scope) error {
|
|
| 167 |
- for _, curr := range *in {
|
|
| 168 |
- newTagEventList := newer.TagEventList{}
|
|
| 169 |
- if err := s.Convert(&curr.Conditions, &newTagEventList.Conditions, 0); err != nil {
|
|
| 170 |
- return err |
|
| 171 |
- } |
|
| 172 |
- if err := s.Convert(&curr.Items, &newTagEventList.Items, 0); err != nil {
|
|
| 173 |
- return err |
|
| 174 |
- } |
|
| 175 |
- (*out)[curr.Tag] = newTagEventList |
|
| 176 |
- } |
|
| 177 |
- |
|
| 178 |
- return nil |
|
| 179 |
- }, |
|
| 180 |
- func(in *map[string]newer.TagEventList, out *[]NamedTagEventList, s conversion.Scope) error {
|
|
| 181 |
- allKeys := make([]string, 0, len(*in)) |
|
| 182 |
- for key := range *in {
|
|
| 183 |
- allKeys = append(allKeys, key) |
|
| 184 |
- } |
|
| 185 |
- sort.Strings(allKeys) |
|
| 186 |
- |
|
| 187 |
- for _, key := range allKeys {
|
|
| 188 |
- newTagEventList := (*in)[key] |
|
| 189 |
- oldTagEventList := &NamedTagEventList{Tag: key}
|
|
| 190 |
- if err := s.Convert(&newTagEventList.Conditions, &oldTagEventList.Conditions, 0); err != nil {
|
|
| 191 |
- return err |
|
| 192 |
- } |
|
| 193 |
- if err := s.Convert(&newTagEventList.Items, &oldTagEventList.Items, 0); err != nil {
|
|
| 194 |
- return err |
|
| 195 |
- } |
|
| 196 |
- |
|
| 197 |
- *out = append(*out, *oldTagEventList) |
|
| 198 |
- } |
|
| 199 |
- |
|
| 200 |
- return nil |
|
| 201 |
- }, |
|
| 202 |
- func(in *[]TagReference, out *map[string]newer.TagReference, s conversion.Scope) error {
|
|
| 203 |
- for _, curr := range *in {
|
|
| 204 |
- r := newer.TagReference{}
|
|
| 205 |
- if err := s.Convert(&curr, &r, 0); err != nil {
|
|
| 206 |
- return err |
|
| 207 |
- } |
|
| 208 |
- (*out)[curr.Name] = r |
|
| 209 |
- } |
|
| 210 |
- return nil |
|
| 211 |
- }, |
|
| 212 |
- func(in *map[string]newer.TagReference, out *[]TagReference, s conversion.Scope) error {
|
|
| 213 |
- allTags := make([]string, 0, len(*in)) |
|
| 214 |
- for tag := range *in {
|
|
| 215 |
- allTags = append(allTags, tag) |
|
| 216 |
- } |
|
| 217 |
- sort.Strings(allTags) |
|
| 218 |
- |
|
| 219 |
- for _, tag := range allTags {
|
|
| 220 |
- newTagReference := (*in)[tag] |
|
| 221 |
- oldTagReference := TagReference{}
|
|
| 222 |
- if err := s.Convert(&newTagReference, &oldTagReference, 0); err != nil {
|
|
| 223 |
- return err |
|
| 224 |
- } |
|
| 225 |
- oldTagReference.Name = tag |
|
| 226 |
- *out = append(*out, oldTagReference) |
|
| 227 |
- } |
|
| 228 |
- return nil |
|
| 229 |
- }, |
|
| 166 |
+ Convert_v1_NamedTagEventListArray_to_api_TagEventListArray, |
|
| 167 |
+ Convert_api_TagEventListArray_to_v1_NamedTagEventListArray, |
|
| 168 |
+ Convert_v1_TagReferenceArray_to_api_TagReferenceMap, |
|
| 169 |
+ Convert_api_TagReferenceMap_to_v1_TagReferenceArray, |
|
| 230 | 170 |
|
| 231 |
- convert_api_Image_To_v1_Image, |
|
| 232 |
- convert_v1_Image_To_api_Image, |
|
| 233 |
- convert_v1_ImageStreamSpec_To_api_ImageStreamSpec, |
|
| 234 |
- convert_api_ImageStreamSpec_To_v1_ImageStreamSpec, |
|
| 235 |
- convert_v1_ImageStreamStatus_To_api_ImageStreamStatus, |
|
| 236 |
- convert_api_ImageStreamStatus_To_v1_ImageStreamStatus, |
|
| 237 |
- convert_api_ImageStreamMapping_To_v1_ImageStreamMapping, |
|
| 238 |
- convert_v1_ImageStreamMapping_To_api_ImageStreamMapping, |
|
| 171 |
+ Convert_api_Image_To_v1_Image, |
|
| 172 |
+ Convert_v1_Image_To_api_Image, |
|
| 173 |
+ Convert_v1_ImageStreamSpec_To_api_ImageStreamSpec, |
|
| 174 |
+ Convert_api_ImageStreamSpec_To_v1_ImageStreamSpec, |
|
| 175 |
+ Convert_v1_ImageStreamStatus_To_api_ImageStreamStatus, |
|
| 176 |
+ Convert_api_ImageStreamStatus_To_v1_ImageStreamStatus, |
|
| 177 |
+ Convert_api_ImageStreamMapping_To_v1_ImageStreamMapping, |
|
| 178 |
+ Convert_v1_ImageStreamMapping_To_api_ImageStreamMapping, |
|
| 239 | 179 |
) |
| 240 | 180 |
if err != nil {
|
| 241 | 181 |
// If one of the conversion functions is malformed, detect it immediately. |
| ... | ... |
@@ -60,3 +60,25 @@ func TestFieldSelectors(t *testing.T) {
|
| 60 | 60 |
"name", "spec.dockerImageRepository", "status.dockerImageRepository", |
| 61 | 61 |
) |
| 62 | 62 |
} |
| 63 |
+ |
|
| 64 |
+func TestImageImportSpecDefaulting(t *testing.T) {
|
|
| 65 |
+ i := &newer.ImageStreamImport{
|
|
| 66 |
+ Spec: newer.ImageStreamImportSpec{
|
|
| 67 |
+ Images: []newer.ImageImportSpec{
|
|
| 68 |
+ {From: kapi.ObjectReference{Name: "something:other"}},
|
|
| 69 |
+ }, |
|
| 70 |
+ }, |
|
| 71 |
+ } |
|
| 72 |
+ data, err := runtime.Encode(kapi.Codecs.LegacyCodec(v1.SchemeGroupVersion), i) |
|
| 73 |
+ if err != nil {
|
|
| 74 |
+ t.Fatal(err) |
|
| 75 |
+ } |
|
| 76 |
+ obj, err := runtime.Decode(kapi.Codecs.UniversalDecoder(), data) |
|
| 77 |
+ if err != nil {
|
|
| 78 |
+ t.Fatal(err) |
|
| 79 |
+ } |
|
| 80 |
+ isi := obj.(*newer.ImageStreamImport) |
|
| 81 |
+ if isi.Spec.Images[0].To == nil || isi.Spec.Images[0].To.Name != "other" {
|
|
| 82 |
+ t.Errorf("unexpected round trip: %#v", isi)
|
|
| 83 |
+ } |
|
| 84 |
+} |
| ... | ... |
@@ -14,7 +14,7 @@ import ( |
| 14 | 14 |
) |
| 15 | 15 |
|
| 16 | 16 |
// The docker metadata must be cast to a version |
| 17 |
-func convert_api_Image_To_v1beta3_Image(in *newer.Image, out *Image, s conversion.Scope) error {
|
|
| 17 |
+func Convert_api_Image_To_v1beta3_Image(in *newer.Image, out *Image, s conversion.Scope) error {
|
|
| 18 | 18 |
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
|
| 19 | 19 |
return err |
| 20 | 20 |
} |
| ... | ... |
@@ -44,7 +44,7 @@ func convert_api_Image_To_v1beta3_Image(in *newer.Image, out *Image, s conversio |
| 44 | 44 |
return nil |
| 45 | 45 |
} |
| 46 | 46 |
|
| 47 |
-func convert_v1beta3_Image_To_api_Image(in *Image, out *newer.Image, s conversion.Scope) error {
|
|
| 47 |
+func Convert_v1beta3_Image_To_api_Image(in *Image, out *newer.Image, s conversion.Scope) error {
|
|
| 48 | 48 |
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
|
| 49 | 49 |
return err |
| 50 | 50 |
} |
| ... | ... |
@@ -74,7 +74,7 @@ func convert_v1beta3_Image_To_api_Image(in *Image, out *newer.Image, s conversio |
| 74 | 74 |
return nil |
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 |
-func convert_v1beta3_ImageStreamSpec_To_api_ImageStreamSpec(in *ImageStreamSpec, out *newer.ImageStreamSpec, s conversion.Scope) error {
|
|
| 77 |
+func Convert_v1beta3_ImageStreamSpec_To_api_ImageStreamSpec(in *ImageStreamSpec, out *newer.ImageStreamSpec, s conversion.Scope) error {
|
|
| 78 | 78 |
out.DockerImageRepository = in.DockerImageRepository |
| 79 | 79 |
if len(in.DockerImageRepository) > 0 {
|
| 80 | 80 |
// ensure that stored image references have no tag or ID, which was possible from 1.0.0 until 1.0.7 |
| ... | ... |
@@ -89,13 +89,13 @@ func convert_v1beta3_ImageStreamSpec_To_api_ImageStreamSpec(in *ImageStreamSpec, |
| 89 | 89 |
return s.Convert(&in.Tags, &out.Tags, 0) |
| 90 | 90 |
} |
| 91 | 91 |
|
| 92 |
-func convert_api_ImageStreamSpec_To_v1beta3_ImageStreamSpec(in *newer.ImageStreamSpec, out *ImageStreamSpec, s conversion.Scope) error {
|
|
| 92 |
+func Convert_api_ImageStreamSpec_To_v1beta3_ImageStreamSpec(in *newer.ImageStreamSpec, out *ImageStreamSpec, s conversion.Scope) error {
|
|
| 93 | 93 |
out.DockerImageRepository = in.DockerImageRepository |
| 94 | 94 |
out.Tags = make([]TagReference, 0, 0) |
| 95 | 95 |
return s.Convert(&in.Tags, &out.Tags, 0) |
| 96 | 96 |
} |
| 97 | 97 |
|
| 98 |
-func convert_v1beta3_ImageStreamStatus_To_api_ImageStreamStatus(in *ImageStreamStatus, out *newer.ImageStreamStatus, s conversion.Scope) error {
|
|
| 98 |
+func Convert_v1beta3_ImageStreamStatus_To_api_ImageStreamStatus(in *ImageStreamStatus, out *newer.ImageStreamStatus, s conversion.Scope) error {
|
|
| 99 | 99 |
out.DockerImageRepository = in.DockerImageRepository |
| 100 | 100 |
if len(in.DockerImageRepository) > 0 {
|
| 101 | 101 |
// ensure that stored image references have no tag or ID, which was possible from 1.0.0 until 1.0.7 |
| ... | ... |
@@ -110,21 +110,21 @@ func convert_v1beta3_ImageStreamStatus_To_api_ImageStreamStatus(in *ImageStreamS |
| 110 | 110 |
return s.Convert(&in.Tags, &out.Tags, 0) |
| 111 | 111 |
} |
| 112 | 112 |
|
| 113 |
-func convert_api_ImageStreamStatus_To_v1beta3_ImageStreamStatus(in *newer.ImageStreamStatus, out *ImageStreamStatus, s conversion.Scope) error {
|
|
| 113 |
+func Convert_api_ImageStreamStatus_To_v1beta3_ImageStreamStatus(in *newer.ImageStreamStatus, out *ImageStreamStatus, s conversion.Scope) error {
|
|
| 114 | 114 |
out.DockerImageRepository = in.DockerImageRepository |
| 115 | 115 |
out.Tags = make([]NamedTagEventList, 0, 0) |
| 116 | 116 |
return s.Convert(&in.Tags, &out.Tags, 0) |
| 117 | 117 |
} |
| 118 | 118 |
|
| 119 |
-func convert_api_ImageStreamMapping_To_v1beta3_ImageStreamMapping(in *newer.ImageStreamMapping, out *ImageStreamMapping, s conversion.Scope) error {
|
|
| 119 |
+func Convert_api_ImageStreamMapping_To_v1beta3_ImageStreamMapping(in *newer.ImageStreamMapping, out *ImageStreamMapping, s conversion.Scope) error {
|
|
| 120 | 120 |
return s.DefaultConvert(in, out, conversion.DestFromSource) |
| 121 | 121 |
} |
| 122 | 122 |
|
| 123 |
-func convert_v1beta3_ImageStreamMapping_To_api_ImageStreamMapping(in *ImageStreamMapping, out *newer.ImageStreamMapping, s conversion.Scope) error {
|
|
| 123 |
+func Convert_v1beta3_ImageStreamMapping_To_api_ImageStreamMapping(in *ImageStreamMapping, out *newer.ImageStreamMapping, s conversion.Scope) error {
|
|
| 124 | 124 |
return s.DefaultConvert(in, out, conversion.SourceToDest) |
| 125 | 125 |
} |
| 126 | 126 |
|
| 127 |
-func convert_api_ImageStream_To_v1beta3_ImageStream(in *newer.ImageStream, out *ImageStream, s conversion.Scope) error {
|
|
| 127 |
+func Convert_api_ImageStream_To_v1beta3_ImageStream(in *newer.ImageStream, out *ImageStream, s conversion.Scope) error {
|
|
| 128 | 128 |
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
|
| 129 | 129 |
return err |
| 130 | 130 |
} |
| ... | ... |
@@ -134,7 +134,7 @@ func convert_api_ImageStream_To_v1beta3_ImageStream(in *newer.ImageStream, out * |
| 134 | 134 |
return s.Convert(&in.Status, &out.Status, 0) |
| 135 | 135 |
} |
| 136 | 136 |
|
| 137 |
-func convert_v1beta3_ImageStream_To_api_ImageStream(in *ImageStream, out *newer.ImageStream, s conversion.Scope) error {
|
|
| 137 |
+func Convert_v1beta3_ImageStream_To_api_ImageStream(in *ImageStream, out *newer.ImageStream, s conversion.Scope) error {
|
|
| 138 | 138 |
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
|
| 139 | 139 |
return err |
| 140 | 140 |
} |
| ... | ... |
@@ -144,7 +144,7 @@ func convert_v1beta3_ImageStream_To_api_ImageStream(in *ImageStream, out *newer. |
| 144 | 144 |
return s.Convert(&in.Status, &out.Status, 0) |
| 145 | 145 |
} |
| 146 | 146 |
|
| 147 |
-func convert_api_ImageStreamImage_To_v1beta3_ImageStreamImage(in *newer.ImageStreamImage, out *ImageStreamImage, s conversion.Scope) error {
|
|
| 147 |
+func Convert_api_ImageStreamImage_To_v1beta3_ImageStreamImage(in *newer.ImageStreamImage, out *ImageStreamImage, s conversion.Scope) error {
|
|
| 148 | 148 |
if err := s.Convert(&in.Image, &out.Image, 0); err != nil {
|
| 149 | 149 |
return err |
| 150 | 150 |
} |
| ... | ... |
@@ -159,7 +159,7 @@ func convert_api_ImageStreamImage_To_v1beta3_ImageStreamImage(in *newer.ImageStr |
| 159 | 159 |
return nil |
| 160 | 160 |
} |
| 161 | 161 |
|
| 162 |
-func convert_v1beta3_ImageStreamImage_To_api_ImageStreamImage(in *ImageStreamImage, out *newer.ImageStreamImage, s conversion.Scope) error {
|
|
| 162 |
+func Convert_v1beta3_ImageStreamImage_To_api_ImageStreamImage(in *ImageStreamImage, out *newer.ImageStreamImage, s conversion.Scope) error {
|
|
| 163 | 163 |
imageName := in.ImageName |
| 164 | 164 |
isiName := in.Name |
| 165 | 165 |
|
| ... | ... |
@@ -177,7 +177,7 @@ func convert_v1beta3_ImageStreamImage_To_api_ImageStreamImage(in *ImageStreamIma |
| 177 | 177 |
return nil |
| 178 | 178 |
} |
| 179 | 179 |
|
| 180 |
-func convert_api_ImageStreamTag_To_v1beta3_ImageStreamTag(in *newer.ImageStreamTag, out *ImageStreamTag, s conversion.Scope) error {
|
|
| 180 |
+func Convert_api_ImageStreamTag_To_v1beta3_ImageStreamTag(in *newer.ImageStreamTag, out *ImageStreamTag, s conversion.Scope) error {
|
|
| 181 | 181 |
if err := s.Convert(&in.Image, &out.Image, 0); err != nil {
|
| 182 | 182 |
return err |
| 183 | 183 |
} |
| ... | ... |
@@ -192,7 +192,7 @@ func convert_api_ImageStreamTag_To_v1beta3_ImageStreamTag(in *newer.ImageStreamT |
| 192 | 192 |
return nil |
| 193 | 193 |
} |
| 194 | 194 |
|
| 195 |
-func convert_v1beta3_ImageStreamTag_To_api_ImageStreamTag(in *ImageStreamTag, out *newer.ImageStreamTag, s conversion.Scope) error {
|
|
| 195 |
+func Convert_v1beta3_ImageStreamTag_To_api_ImageStreamTag(in *ImageStreamTag, out *newer.ImageStreamTag, s conversion.Scope) error {
|
|
| 196 | 196 |
imageName := in.ImageName |
| 197 | 197 |
istName := in.Name |
| 198 | 198 |
|
| ... | ... |
@@ -276,20 +276,20 @@ func addConversionFuncs(scheme *runtime.Scheme) {
|
| 276 | 276 |
return nil |
| 277 | 277 |
}, |
| 278 | 278 |
|
| 279 |
- convert_api_Image_To_v1beta3_Image, |
|
| 280 |
- convert_v1beta3_Image_To_api_Image, |
|
| 281 |
- convert_v1beta3_ImageStreamSpec_To_api_ImageStreamSpec, |
|
| 282 |
- convert_api_ImageStreamSpec_To_v1beta3_ImageStreamSpec, |
|
| 283 |
- convert_v1beta3_ImageStreamStatus_To_api_ImageStreamStatus, |
|
| 284 |
- convert_api_ImageStreamStatus_To_v1beta3_ImageStreamStatus, |
|
| 285 |
- convert_api_ImageStreamMapping_To_v1beta3_ImageStreamMapping, |
|
| 286 |
- convert_v1beta3_ImageStreamMapping_To_api_ImageStreamMapping, |
|
| 287 |
- convert_api_ImageStream_To_v1beta3_ImageStream, |
|
| 288 |
- convert_v1beta3_ImageStream_To_api_ImageStream, |
|
| 289 |
- convert_api_ImageStreamImage_To_v1beta3_ImageStreamImage, |
|
| 290 |
- convert_v1beta3_ImageStreamImage_To_api_ImageStreamImage, |
|
| 291 |
- convert_api_ImageStreamTag_To_v1beta3_ImageStreamTag, |
|
| 292 |
- convert_v1beta3_ImageStreamTag_To_api_ImageStreamTag, |
|
| 279 |
+ Convert_api_Image_To_v1beta3_Image, |
|
| 280 |
+ Convert_v1beta3_Image_To_api_Image, |
|
| 281 |
+ Convert_v1beta3_ImageStreamSpec_To_api_ImageStreamSpec, |
|
| 282 |
+ Convert_api_ImageStreamSpec_To_v1beta3_ImageStreamSpec, |
|
| 283 |
+ Convert_v1beta3_ImageStreamStatus_To_api_ImageStreamStatus, |
|
| 284 |
+ Convert_api_ImageStreamStatus_To_v1beta3_ImageStreamStatus, |
|
| 285 |
+ Convert_api_ImageStreamMapping_To_v1beta3_ImageStreamMapping, |
|
| 286 |
+ Convert_v1beta3_ImageStreamMapping_To_api_ImageStreamMapping, |
|
| 287 |
+ Convert_api_ImageStream_To_v1beta3_ImageStream, |
|
| 288 |
+ Convert_v1beta3_ImageStream_To_api_ImageStream, |
|
| 289 |
+ Convert_api_ImageStreamImage_To_v1beta3_ImageStreamImage, |
|
| 290 |
+ Convert_v1beta3_ImageStreamImage_To_api_ImageStreamImage, |
|
| 291 |
+ Convert_api_ImageStreamTag_To_v1beta3_ImageStreamTag, |
|
| 292 |
+ Convert_v1beta3_ImageStreamTag_To_api_ImageStreamTag, |
|
| 293 | 293 |
) |
| 294 | 294 |
if err != nil {
|
| 295 | 295 |
// If one of the conversion functions is malformed, detect it immediately. |
| ... | ... |
@@ -4,6 +4,7 @@ import ( |
| 4 | 4 |
"testing" |
| 5 | 5 |
|
| 6 | 6 |
kapi "k8s.io/kubernetes/pkg/api" |
| 7 |
+ kapiv1 "k8s.io/kubernetes/pkg/api/v1" |
|
| 7 | 8 |
|
| 8 | 9 |
"github.com/openshift/origin/pkg/route/api" |
| 9 | 10 |
"github.com/openshift/origin/pkg/route/api/v1" |
| ... | ... |
@@ -39,3 +40,22 @@ func TestSupportingCamelConstants(t *testing.T) {
|
| 39 | 39 |
} |
| 40 | 40 |
} |
| 41 | 41 |
} |
| 42 |
+ |
|
| 43 |
+func TestDefaults(t *testing.T) {
|
|
| 44 |
+ obj := &v1.Route{
|
|
| 45 |
+ Spec: v1.RouteSpec{
|
|
| 46 |
+ To: kapiv1.ObjectReference{Name: "other"},
|
|
| 47 |
+ TLS: &v1.TLSConfig{},
|
|
| 48 |
+ }, |
|
| 49 |
+ } |
|
| 50 |
+ out := &api.Route{}
|
|
| 51 |
+ if err := kapi.Scheme.Convert(obj, out); err != nil {
|
|
| 52 |
+ t.Fatal(err) |
|
| 53 |
+ } |
|
| 54 |
+ if out.Spec.TLS.Termination != api.TLSTerminationEdge {
|
|
| 55 |
+ t.Errorf("did not default termination: %#v", out)
|
|
| 56 |
+ } |
|
| 57 |
+ if out.Spec.To.Kind != "Service" {
|
|
| 58 |
+ t.Errorf("did not default object reference kind: %#v", out)
|
|
| 59 |
+ } |
|
| 60 |
+} |
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
newer "github.com/openshift/origin/pkg/template/api" |
| 9 | 9 |
) |
| 10 | 10 |
|
| 11 |
-func convert_api_Template_To_v1_Template(in *newer.Template, out *Template, s conversion.Scope) error {
|
|
| 11 |
+func Convert_api_Template_To_v1_Template(in *newer.Template, out *Template, s conversion.Scope) error {
|
|
| 12 | 12 |
//FIXME: DefaultConvert should not overwrite the Labels field on the |
| 13 | 13 |
// the base object. This is likely a bug in the DefaultConvert |
| 14 | 14 |
// code. For now, it is called before converting the labels. |
| ... | ... |
@@ -34,7 +34,7 @@ func convert_api_Template_To_v1_Template(in *newer.Template, out *Template, s co |
| 34 | 34 |
return nil |
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 |
-func convert_v1_Template_To_api_Template(in *Template, out *newer.Template, s conversion.Scope) error {
|
|
| 37 |
+func Convert_v1_Template_To_api_Template(in *Template, out *newer.Template, s conversion.Scope) error {
|
|
| 38 | 38 |
if err := s.Convert(&in.Labels, &out.ObjectLabels, 0); err != nil {
|
| 39 | 39 |
return err |
| 40 | 40 |
} |
| ... | ... |
@@ -43,8 +43,8 @@ func convert_v1_Template_To_api_Template(in *Template, out *newer.Template, s co |
| 43 | 43 |
|
| 44 | 44 |
func addConversionFuncs(scheme *runtime.Scheme) {
|
| 45 | 45 |
err := scheme.AddConversionFuncs( |
| 46 |
- convert_api_Template_To_v1_Template, |
|
| 47 |
- convert_v1_Template_To_api_Template, |
|
| 46 |
+ Convert_api_Template_To_v1_Template, |
|
| 47 |
+ Convert_v1_Template_To_api_Template, |
|
| 48 | 48 |
) |
| 49 | 49 |
if err != nil {
|
| 50 | 50 |
panic(err) |
| ... | ... |
@@ -7,7 +7,7 @@ import ( |
| 7 | 7 |
newer "github.com/openshift/origin/pkg/template/api" |
| 8 | 8 |
) |
| 9 | 9 |
|
| 10 |
-func convert_api_Template_To_v1beta3_Template(in *newer.Template, out *Template, s conversion.Scope) error {
|
|
| 10 |
+func Convert_api_Template_To_v1beta3_Template(in *newer.Template, out *Template, s conversion.Scope) error {
|
|
| 11 | 11 |
//FIXME: DefaultConvert should not overwrite the Labels field on the |
| 12 | 12 |
// the base object. This is likely a bug in the DefaultConvert |
| 13 | 13 |
// code. For now, it is called before converting the labels. |
| ... | ... |
@@ -33,7 +33,7 @@ func convert_api_Template_To_v1beta3_Template(in *newer.Template, out *Template, |
| 33 | 33 |
return nil |
| 34 | 34 |
} |
| 35 | 35 |
|
| 36 |
-func convert_v1beta3_Template_To_api_Template(in *Template, out *newer.Template, s conversion.Scope) error {
|
|
| 36 |
+func Convert_v1beta3_Template_To_api_Template(in *Template, out *newer.Template, s conversion.Scope) error {
|
|
| 37 | 37 |
if err := s.Convert(&in.Labels, &out.ObjectLabels, 0); err != nil {
|
| 38 | 38 |
return err |
| 39 | 39 |
} |
| ... | ... |
@@ -42,8 +42,8 @@ func convert_v1beta3_Template_To_api_Template(in *Template, out *newer.Template, |
| 42 | 42 |
|
| 43 | 43 |
func addConversionFuncs(scheme *runtime.Scheme) {
|
| 44 | 44 |
err := scheme.AddConversionFuncs( |
| 45 |
- convert_api_Template_To_v1beta3_Template, |
|
| 46 |
- convert_v1beta3_Template_To_api_Template, |
|
| 45 |
+ Convert_api_Template_To_v1beta3_Template, |
|
| 46 |
+ Convert_v1beta3_Template_To_api_Template, |
|
| 47 | 47 |
) |
| 48 | 48 |
if err != nil {
|
| 49 | 49 |
panic(err) |