pkg/k8s/apis: make more fields optional

This commit is contained in:
Lucas Servén Marín 2019-05-03 14:08:13 +02:00
parent cd9c83b3bc
commit 85180a80cc
No known key found for this signature in database
GPG Key ID: 586FEAF680DA74AD
2 changed files with 6 additions and 5 deletions

View File

@ -312,7 +312,7 @@ func schema_k8s_apis_kilo_v1alpha1_PeerSpec(ref common.ReferenceCallback) common
}, },
}, },
}, },
Required: []string{"allowedIPs", "persistentKeepalive", "publicKey"}, Required: []string{"allowedIPs", "publicKey"},
}, },
}, },
Dependencies: []string{ Dependencies: []string{

View File

@ -44,7 +44,7 @@ type Peer struct {
// Standard objects metadata. More info: // Standard objects metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
// +k8s:openapi-gen=false // +k8s:openapi-gen=false
metav1.ObjectMeta `json:"metadata"` metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the Kilo Peer. More info: // Specification of the desired behavior of the Kilo Peer. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec PeerSpec `json:"spec"` Spec PeerSpec `json:"spec"`
@ -58,11 +58,12 @@ type PeerSpec struct {
AllowedIPs []string `json:"allowedIPs"` AllowedIPs []string `json:"allowedIPs"`
// Endpoint is the initial endpoint for connections to the peer. // Endpoint is the initial endpoint for connections to the peer.
// +optional // +optional
Endpoint *PeerEndpoint `json:"endpoint"` Endpoint *PeerEndpoint `json:"endpoint,omitempty"`
// PersistentKeepalive is the interval in seconds of the emission // PersistentKeepalive is the interval in seconds of the emission
// of keepalive packets to the peer. This defaults to 0, which // of keepalive packets to the peer. This defaults to 0, which
// disables the feature. // disables the feature.
PersistentKeepalive int `json:"persistentKeepalive"` // +optional
PersistentKeepalive int `json:"persistentKeepalive,omitempty"`
// PublicKey is the WireGuard public key for the node. // PublicKey is the WireGuard public key for the node.
PublicKey string `json:"publicKey"` PublicKey string `json:"publicKey"`
} }
@ -136,7 +137,7 @@ func (p *Peer) Validate() error {
// PeerList is a list of peers. // PeerList is a list of peers.
type PeerList struct { type PeerList struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"` metav1.ListMeta `json:"metadata,omitempty"`
// List of peers. // List of peers.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md
Items []Peer `json:"items"` Items []Peer `json:"items"`