Describe the bug
If you have a property with a name of something like IPAddress, the CLI generates a property in the CRD as iPAddress. However, when attempting to post that object to Kubernetes it uses a field named ipAddress. (Lower case p)
To reproduce
Create a class that has a field named IPAddress,
[EntityScope(EntityScope.Namespaced)]
[KubernetesEntity(Group ="multicluster.veccsolutions.io", ApiVersion = "v1alpha", Kind = "ClusterCache")]
public class V1ClusterCache : CustomKubernetesEntity
{
public V1ClusterCache()
{
Kind = "ClusterCache";
ApiVersion = "multicluster.veccsolutions.io/v1alpha";
}
public string LastHeartbeat { get; set; } = string.Empty;
public HostCache[] Hostnames { get; set; } = Array.Empty<HostCache>();
public EndpointCacheCount[] ServiceEndpointCounts { get; set; } = Array.Empty<EndpointCacheCount>();
public class EndpointCacheCount
{
public string Namespace { get; set; } = string.Empty;
public string Service { get; set; } = string.Empty;
public int Count { get; set; }
}
public class HostCache
{
public string Hostname { get; set; } = string.Empty;
public HostIPCache[] HostIPs { get; set; } = Array.Empty<HostIPCache>();
}
public class HostIPCache
{
public string IPAddress { get; set; } = string.Empty;
public int Priority { get; set; }
public int Weight { get; set; }
public string ClusterIdentifier { get; set; } = string.Empty;
}
}
Generate the CRD with ddotnet kubeops g op test
The result is this:
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clustercaches.multicluster.veccsolutions.io
spec:
group: multicluster.veccsolutions.io
names:
kind: ClusterCache
listKind: ClusterCacheList
plural: clustercaches
singular: clustercache
scope: Namespaced
versions:
- name: v1alpha
schema:
openAPIV3Schema:
properties:
lastHeartbeat:
nullable: false
type: string
hostnames:
items:
properties:
hostname:
nullable: false
type: string
hostIPs:
items:
properties:
iPAddress:
nullable: false
type: string
priority:
format: int32
nullable: false
type: integer
weight:
format: int32
nullable: false
type: integer
clusterIdentifier:
nullable: false
type: string
type: object
nullable: false
type: array
type: object
nullable: false
type: array
serviceEndpointCounts:
items:
properties:
namespace:
nullable: false
type: string
service:
nullable: false
type: string
count:
format: int32
nullable: false
type: integer
type: object
nullable: false
type: array
type: object
served: true
storage: true
Notice the incorrect iPAddress casing.
Expected behavior
The IPAddress property would render as ipAddress in the CRD.
Screenshots
No response
Additional Context
No response
Describe the bug
If you have a property with a name of something like
IPAddress, the CLI generates a property in the CRD asiPAddress. However, when attempting to post that object to Kubernetes it uses a field namedipAddress. (Lower casep)To reproduce
Create a class that has a field named
IPAddress,Generate the CRD with
ddotnet kubeops g op testThe result is this:
Notice the incorrect
iPAddresscasing.Expected behavior
The
IPAddressproperty would render asipAddressin the CRD.Screenshots
No response
Additional Context
No response