Skip to content

Commit

Permalink
refactor: omit a few spec fields if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
carlmontanari committed Dec 2, 2023
1 parent c6ff55a commit 45cc019
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
8 changes: 4 additions & 4 deletions apis/v1alpha1/topologyspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ type Persistence struct {
// to make the claim smaller you must delete the topology (or the node from the topology) and
// re-add it.
// +optional
ClaimSize string `json:"claimSize"`
ClaimSize string `json:"claimSize,omitempty"`
// StorageClassName is the storage class to set in the PVC -- if not provided this will be left
// empty which will end up using your default storage class. Note that currently we assume you
// have (as default) or provide a dynamically provisionable storage class, hence no selector.
// +optional
StorageClassName string `json:"storageClassName"`
StorageClassName string `json:"storageClassName,omitempty"`
}

// InsecureRegistries is a slice of strings of insecure registries to configure in the launcher
Expand All @@ -55,10 +55,10 @@ type InsecureRegistries []string
type Definition struct {
// Containerlab holds a valid containerlab topology.
// +optional
Containerlab string `json:"containerlab"`
Containerlab string `json:"containerlab,omitempty"`
// Kne holds a valid kne topology.
// +optional
Kne string `json:"kne"`
Kne string `json:"kne,omitempty"`
}

// Expose holds configurations relevant to how clabernetes exposes a topology.
Expand Down
3 changes: 0 additions & 3 deletions clabverter/test-fixtures/golden/srl02.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ spec:
links:
- endpoints: ["srl1:e1-1", "srl2:e1-1"]
kne: ""
deployment:
containerlabDebug: false
filesFromConfigMap:
Expand All @@ -53,9 +52,7 @@ spec:
filePath: srl2.license
filesFromURL: null
persistence:
claimSize: ""
enabled: false
storageClassName: ""
privilegedLauncher: false
resources: null
expose:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@ spec:
srl1:
kind: srl
image: ghcr.io/nokia/srlinux
kne: ""
deployment:
containerlabDebug: false
persistence:
claimSize: ""
enabled: false
storageClassName: ""
privilegedLauncher: false
expose:
disableAutoExpose: false
Expand Down
4 changes: 0 additions & 4 deletions generated/openapi/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 45cc019

Please sign in to comment.