Skip to content

Commit e1dc959

Browse files
authored
Merge pull request kubernetes#84113 from enxebre/x-kubernetes-map-type
Adds x-kubernetes-map-type annotation as a CRD API extension
2 parents ad47fe3 + b598b3e commit e1dc959

22 files changed

+663
-369
lines changed

api/api-rules/violation_exceptions.list

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiexten
527527
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaProps,XIntOrString
528528
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaProps,XListMapKeys
529529
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaProps,XListType
530+
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaProps,XMapType
530531
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaProps,XPreserveUnknownFields
531532
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaPropsOrArray,JSONSchemas
532533
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaPropsOrArray,Schema
@@ -542,6 +543,7 @@ API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiexten
542543
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1,JSONSchemaProps,XIntOrString
543544
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1,JSONSchemaProps,XListMapKeys
544545
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1,JSONSchemaProps,XListType
546+
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1,JSONSchemaProps,XMapType
545547
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1,JSONSchemaProps,XPreserveUnknownFields
546548
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1,JSONSchemaPropsOrArray,JSONSchemas
547549
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1,JSONSchemaPropsOrArray,Schema

api/openapi-spec/swagger.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/deepcopy.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,5 +284,11 @@ func (in *JSONSchemaProps) DeepCopy() *JSONSchemaProps {
284284
}
285285
}
286286

287+
if in.XMapType != nil {
288+
in, out := &in.XMapType, &out.XMapType
289+
*out = new(string)
290+
**out = **in
291+
}
292+
287293
return out
288294
}

staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/types_jsonschema.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,18 @@ type JSONSchemaProps struct {
109109
// used to identify them. Order is preserved upon merge. The map tag
110110
// must only be used on a list with elements of type object.
111111
XListType *string
112+
113+
// x-kubernetes-map-type annotates an object to further describe its topology.
114+
// This extension must only be used when type is object and may have 2 possible values:
115+
//
116+
// 1) `granular`:
117+
// These maps are actual maps (key-value pairs) and each fields are independent
118+
// from each other (they can each be manipulated by separate actors). This is
119+
// the default behaviour for all maps.
120+
// 2) `atomic`: the list is treated as a single entity, like a scalar.
121+
// Atomic maps will be entirely replaced when updated.
122+
// +optional
123+
XMapType *string
112124
}
113125

114126
// JSON represents any valid JSON value.

staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/deepcopy.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,5 +244,11 @@ func (in *JSONSchemaProps) DeepCopy() *JSONSchemaProps {
244244
}
245245
}
246246

247+
if in.XMapType != nil {
248+
in, out := &in.XMapType, &out.XMapType
249+
*out = new(string)
250+
**out = **in
251+
}
252+
247253
return out
248254
}

0 commit comments

Comments
 (0)