From f7aa55cbdfb0e501e1ca225b1505603b6e5850ea Mon Sep 17 00:00:00 2001 From: Carl Montanari Date: Sat, 15 Jun 2024 09:09:14 -0700 Subject: [PATCH] fix: conditions list type, revert omit empty things --- apis/v1alpha1/topology.go | 7 ++++--- apis/v1alpha1/topologyspec.go | 6 +++--- assets/crd/clabernetes.containerlab.dev_topologies.yaml | 1 + .../crds/clabernetes.containerlab.dev_topologies.yaml | 1 + clabverter/test-fixtures/golden/simple/topo01.yaml | 2 ++ generated/openapi/openapi_generated.go | 5 +++++ 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/apis/v1alpha1/topology.go b/apis/v1alpha1/topology.go index af90c198..24a9e627 100644 --- a/apis/v1alpha1/topology.go +++ b/apis/v1alpha1/topology.go @@ -44,7 +44,7 @@ type TopologySpec struct { // ImagePull holds configurations relevant to how clabernetes launcher pods handle pulling // images. // +optional - ImagePull ImagePull `json:"imagePull,omitempty"` + ImagePull ImagePull `json:"imagePull"` // Naming tells the clabernetes controller how it should name resources it creates -- that is // whether it should include the containerlab topology name as a prefix on resources spawned // from this Topology or not; this includes the actual (containerlab) node Deployment(s), as @@ -60,14 +60,14 @@ type TopologySpec struct { // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="naming field is immutable, to change this value delete and re-create the Topology" // +kubebuilder:validation:Enum=prefixed;non-prefixed;global // +kubebuilder:default=global - Naming string `json:"naming,omitempty"` + Naming string `json:"naming"` // Connectivity defines the type of connectivity to use between nodes in the topology. The // default behavior is to use vxlan tunnels, alternatively you can enable a more experimental // "slurpeeth" connectivity flavor that stuffs traffic into tcp tunnels to avoid any vxlan mtu // and/or fragmentation challenges. // +kubebuilder:validation:Enum=vxlan;slurpeeth // +kubebuilder:default=vxlan - Connectivity string `json:"connectivity,omitempty"` + Connectivity string `json:"connectivity"` } // TopologyStatus is the status for a Topology resource. @@ -97,6 +97,7 @@ type TopologyStatus struct { // from the conditions so we can easily snag it for print columns! TopologyReady bool `json:"topologyReady"` // Conditions is a list of conditions for the topology custom resource. + // +listType=atomic Conditions []metav1.Condition `json:"conditions"` } diff --git a/apis/v1alpha1/topologyspec.go b/apis/v1alpha1/topologyspec.go index a2859a91..48fef5d9 100644 --- a/apis/v1alpha1/topologyspec.go +++ b/apis/v1alpha1/topologyspec.go @@ -72,7 +72,7 @@ type Expose struct { // DisableExpose indicates if exposing nodes via LoadBalancer service should be disabled, by // default any mapped ports in a containerlab topology will be exposed. // +optional - DisableExpose bool `json:"disableExpose,omitempty"` + DisableExpose bool `json:"disableExpose"` // DisableAutoExpose disables the automagic exposing of ports for a given topology. When this // setting is disabled clabernetes will not auto add ports so if you want to expose (via a // load balancer service) you will need to have ports outlined in your containerlab config @@ -132,7 +132,7 @@ type Deployment struct { // the configmap is mounted in its entirety (like normal k8s things), so you *probably* want // to specify the sub path unless you are sure what you're doing! // +optional - FilesFromConfigMap map[string][]FileFromConfigMap `json:"filesFromConfigMap,omitempty"` + FilesFromConfigMap map[string][]FileFromConfigMap `json:"filesFromConfigMap"` // FilesFromURL is a mapping of FileFromURL that define a URL at which to fetch a file, and path // on a launcher node that the file should be downloaded to. This is useful for configs that are // larger than the ConfigMap (etcd) 1Mb size limit. @@ -273,7 +273,7 @@ type ImagePull struct { // InsecureRegistries is a slice of strings of insecure registries to configure in the launcher // pods. // +optional - InsecureRegistries InsecureRegistries `json:"insecureRegistries,omitempty"` + InsecureRegistries InsecureRegistries `json:"insecureRegistries"` // PullThroughOverride allows for overriding the image pull through mode for this // particular topology. // +kubebuilder:validation:Enum=auto;always;never diff --git a/assets/crd/clabernetes.containerlab.dev_topologies.yaml b/assets/crd/clabernetes.containerlab.dev_topologies.yaml index a04c69d0..3610bd50 100644 --- a/assets/crd/clabernetes.containerlab.dev_topologies.yaml +++ b/assets/crd/clabernetes.containerlab.dev_topologies.yaml @@ -675,6 +675,7 @@ spec: - type type: object type: array + x-kubernetes-list-type: atomic configs: additionalProperties: type: string diff --git a/charts/clabernetes/crds/clabernetes.containerlab.dev_topologies.yaml b/charts/clabernetes/crds/clabernetes.containerlab.dev_topologies.yaml index a04c69d0..3610bd50 100644 --- a/charts/clabernetes/crds/clabernetes.containerlab.dev_topologies.yaml +++ b/charts/clabernetes/crds/clabernetes.containerlab.dev_topologies.yaml @@ -675,6 +675,7 @@ spec: - type type: object type: array + x-kubernetes-list-type: atomic configs: additionalProperties: type: string diff --git a/clabverter/test-fixtures/golden/simple/topo01.yaml b/clabverter/test-fixtures/golden/simple/topo01.yaml index 0ddce5da..9f3c6b4a 100755 --- a/clabverter/test-fixtures/golden/simple/topo01.yaml +++ b/clabverter/test-fixtures/golden/simple/topo01.yaml @@ -5,6 +5,7 @@ metadata: name: topo01 namespace: notclabernetes spec: + connectivity: "" definition: containerlab: |- name: topo01 @@ -86,6 +87,7 @@ spec: tolerations: null expose: disableAutoExpose: false + disableExpose: false imagePull: insecureRegistries: - 1.2.3.4 diff --git a/generated/openapi/openapi_generated.go b/generated/openapi/openapi_generated.go index 1eab5160..a8aef785 100644 --- a/generated/openapi/openapi_generated.go +++ b/generated/openapi/openapi_generated.go @@ -2007,6 +2007,11 @@ func schema_srl_labs_clabernetes_apis_v1alpha1_TopologyStatus( }, }, "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Conditions is a list of conditions for the topology custom resource.", Type: []string{"array"},