diff --git a/DEPRECATIONS.md b/DEPRECATIONS.md new file mode 100644 index 0000000..bee634b --- /dev/null +++ b/DEPRECATIONS.md @@ -0,0 +1,20 @@ +# Deprecations + +## ChiaSeeder + +### bootstrapPeer + +Deprecated in: 0.12.5 +Expected to be removed in: 1.0.0 + +The `bootstrapPeer` API field was deprecated in favor of `bootstrapPeers`. The latter being the preferred way to specify multiple bootstrap peers for a seeder installation, which still allows for specifying a single peer. + +Switch to bootstrapPeers by specifying a yaml string list instead of a string: + +```yaml +spec: + chia: + # bootstrapPeer: "mainnet-node.chia.svc.cluster.local" + bootstrapPeers: + - "mainnet-node.chia.svc.cluster.local" +``` diff --git a/api/v1/chiaseeder_types.go b/api/v1/chiaseeder_types.go index 234179b..0d15c21 100644 --- a/api/v1/chiaseeder_types.go +++ b/api/v1/chiaseeder_types.go @@ -29,13 +29,18 @@ type ChiaSeederSpec struct { type ChiaSeederSpecChia struct { CommonSpecChia `json:",inline"` - // BootstrapPeer a peer to bootstrap the seeder's peer database + // BootstrapPeer a peer to bootstrap the seeder's peer database. + // DEPRECATED: Use BootstrapPeers instead. // +optional - BootstrapPeer *string `json:"bootstrapPeer"` + BootstrapPeer *string `json:"bootstrapPeer,omitempty"` + + // BootstrapPeers a list of peers to bootstrap the seeder's peer database + // +optional + BootstrapPeers *[]string `json:"bootstrapPeers,omitempty"` // MinimumHeight only consider nodes synced at least to this height // +optional - MinimumHeight *uint64 `json:"minimumHeight"` + MinimumHeight *uint64 `json:"minimumHeight,omitempty"` // DomainName the name of the NS record for your server with a trailing period. (ex. "seeder.example.com.") DomainName string `json:"domainName"` @@ -48,11 +53,11 @@ type ChiaSeederSpecChia struct { // CASecretName is the name of the secret that contains the CA crt and key. Not required for seeders. // +optional - CASecretName *string `json:"caSecretName"` + CASecretName *string `json:"caSecretName,omitempty"` // TTL field on DNS records that controls the length of time that a record is considered valid // +optional - TTL *uint32 `json:"ttl"` + TTL *uint32 `json:"ttl,omitempty"` } // ChiaSeederStatus defines the observed state of ChiaSeeder diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 3eeb06f..5243232 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -976,6 +976,15 @@ func (in *ChiaSeederSpecChia) DeepCopyInto(out *ChiaSeederSpecChia) { *out = new(string) **out = **in } + if in.BootstrapPeers != nil { + in, out := &in.BootstrapPeers, &out.BootstrapPeers + *out = new([]string) + if **in != nil { + in, out := *in, *out + *out = make([]string, len(*in)) + copy(*out, *in) + } + } if in.MinimumHeight != nil { in, out := &in.MinimumHeight, &out.MinimumHeight *out = new(uint64) diff --git a/config/crd/bases/k8s.chia.net_chiaseeders.yaml b/config/crd/bases/k8s.chia.net_chiaseeders.yaml index 723d3db..9999b5b 100644 --- a/config/crd/bases/k8s.chia.net_chiaseeders.yaml +++ b/config/crd/bases/k8s.chia.net_chiaseeders.yaml @@ -1142,9 +1142,16 @@ spec: type: string type: object bootstrapPeer: - description: BootstrapPeer a peer to bootstrap the seeder's peer - database + description: |- + BootstrapPeer a peer to bootstrap the seeder's peer database. + DEPRECATED: Use BootstrapPeers instead. type: string + bootstrapPeers: + description: BootstrapPeers a list of peers to bootstrap the seeder's + peer database + items: + type: string + type: array caSecretName: description: CASecretName is the name of the secret that contains the CA crt and key. Not required for seeders. diff --git a/docs/chiaseeder.md b/docs/chiaseeder.md index 9d8b27f..c9458a9 100644 --- a/docs/chiaseeder.md +++ b/docs/chiaseeder.md @@ -35,7 +35,8 @@ Some of Chia's configuration can be changed from within the CR. spec: chia: minimumHeight: 240000 # Only consider nodes synced at least to this height - bootstrapPeer: "mainnet-node.chia.svc.cluster.local" # Peers used for the initial crawler run to find peers + bootstrapPeers: + - "mainnet-node.chia.svc.cluster.local" # Peers used for the initial crawler run to find peers ttl: 900 # field on DNS records that controls the length of time that a record is considered valid ``` diff --git a/internal/controller/chiaseeder/helpers.go b/internal/controller/chiaseeder/helpers.go index 157e46d..f7ef8d0 100644 --- a/internal/controller/chiaseeder/helpers.go +++ b/internal/controller/chiaseeder/helpers.go @@ -6,6 +6,7 @@ package chiaseeder import ( "fmt" + "strings" "github.com/chia-network/chia-operator/internal/controller/common/kube" corev1 "k8s.io/api/core/v1" @@ -85,7 +86,12 @@ func getChiaEnv(seeder k8schianetv1.ChiaSeeder, networkData *map[string]string) }) // seeder_bootstrap_peers env var - if seeder.Spec.ChiaConfig.BootstrapPeer != nil { + if seeder.Spec.ChiaConfig.BootstrapPeers != nil { + env = append(env, corev1.EnvVar{ + Name: "seeder_bootstrap_peers", + Value: strings.Join(*seeder.Spec.ChiaConfig.BootstrapPeers, ","), + }) + } else if seeder.Spec.ChiaConfig.BootstrapPeer != nil { env = append(env, corev1.EnvVar{ Name: "seeder_bootstrap_peers", Value: *seeder.Spec.ChiaConfig.BootstrapPeer,