Skip to content

Commit d15c94e

Browse files
author
Christoph Bühler
committed
fix: map spec updates correctly to v1beta1 crd
1 parent 59616d8 commit d15c94e

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

src/KubeOps/Operator/Entities/Extensions/V1CustomResourceDefinitionExtensions.cs

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,45 @@ private static V1beta1JSONSchemaProps Convert(this V1JSONSchemaProps props)
4444
{
4545
var betaProps = new V1beta1JSONSchemaProps();
4646

47-
betaProps.Description = props.Description;
48-
betaProps.Type = props.Type;
49-
betaProps.Format = props.Format;
50-
betaProps.EnumProperty = props.EnumProperty;
5147
betaProps.Nullable = props.Nullable;
48+
betaProps.Description = props.Description;
49+
50+
if (props.ExternalDocs != null)
51+
{
52+
betaProps.ExternalDocs = new V1beta1ExternalDocumentation(
53+
props.ExternalDocs.Description,
54+
props.ExternalDocs.Url);
55+
}
56+
57+
betaProps.MaxItems = props.MaxItems;
58+
betaProps.MinItems = props.MinItems;
59+
betaProps.UniqueItems = props.UniqueItems;
60+
61+
betaProps.MaxLength = props.MaxLength;
62+
betaProps.MinLength = props.MinLength;
63+
64+
betaProps.MultipleOf = props.MultipleOf;
65+
66+
betaProps.Pattern = props.Pattern;
67+
68+
betaProps.Maximum = props.Maximum;
69+
betaProps.ExclusiveMaximum = props.ExclusiveMaximum;
70+
71+
betaProps.Minimum = props.Minimum;
72+
betaProps.ExclusiveMinimum = props.ExclusiveMinimum;
73+
5274
if (props.Properties != null)
5375
{
5476
betaProps.Properties = new Dictionary<string, V1beta1JSONSchemaProps>(
5577
props.Properties.Select(p => KeyValuePair.Create(p.Key, p.Value.Convert())));
5678
}
5779

80+
betaProps.Type = props.Type;
81+
betaProps.Format = props.Format;
82+
betaProps.Items = (props.Items as V1JSONSchemaProps)?.Convert();
83+
betaProps.Required = props.Required;
84+
betaProps.EnumProperty = props.EnumProperty;
85+
5886
return betaProps;
5987
}
6088
}

0 commit comments

Comments
 (0)