-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add data_layer support #230
Open
Starttoaster
wants to merge
14
commits into
main
Choose a base branch
from
datalayer-crd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
78e34f7
Fix session affinity for all non-peer Services
Starttoaster 3393106
Check in code
Starttoaster 7ffbdbf
Re-comment crd from kustomize resources
Starttoaster 1f59294
Remove hyphen from datalayer
Starttoaster 16a9565
Fix datalayer server volume setting
Starttoaster 1bb1036
Lint fixes
Starttoaster 3c2805f
Add newline markdown file
Starttoaster 9e7aebc
Run make
Starttoaster 57f07ba
Run make again
Starttoaster f481590
Clean up main.go changes
Starttoaster 8cc68e0
Remove underscore from paths for consistency to other mountpoints
Starttoaster fc45bab
Add datalayer http server container assembler
Starttoaster 1a6bca4
Set datalayer http daemon port to not conflict with main chia container
Starttoaster 5e262d6
Reinforce example datalayer resource in docs
Starttoaster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
Copyright 2024 Chia Network Inc. | ||
*/ | ||
|
||
package v1 | ||
|
||
import ( | ||
appsv1 "k8s.io/api/apps/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// ChiaDataLayerSpec defines the desired state of ChiaDataLayer | ||
type ChiaDataLayerSpec struct { | ||
CommonSpec `json:",inline"` | ||
|
||
// ChiaConfig defines the configuration options available to Chia component containers | ||
ChiaConfig ChiaDataLayerSpecChia `json:"chia"` | ||
|
||
// DataLayerHTTPConfig defines the desired state of an optional data_layer_http sidecar | ||
// +optional | ||
DataLayerHTTPConfig ChiaDataLayerHTTPSpecChia `json:"dataLayerHTTP"` | ||
|
||
// Strategy describes how to replace existing pods with new ones. | ||
// +optional | ||
Strategy *appsv1.DeploymentStrategy `json:"strategy,omitempty"` | ||
} | ||
|
||
// ChiaDataLayerSpecChia defines the desired state of Chia component configuration | ||
type ChiaDataLayerSpecChia struct { | ||
CommonSpecChia `json:",inline"` | ||
|
||
// CASecretName is the name of the secret that contains the CA crt and key. | ||
// +optional | ||
CASecretName *string `json:"caSecretName"` | ||
|
||
// SecretKey defines the k8s Secret name and key for a Chia mnemonic | ||
SecretKey ChiaSecretKey `json:"secretKey"` | ||
|
||
// FullNodePeers is a list of hostnames/IPs and port numbers to full_node peers. | ||
// Either fullNodePeer or fullNodePeers should be specified. fullNodePeers takes precedence. | ||
// +optional | ||
FullNodePeers *[]Peer `json:"fullNodePeers,omitempty"` | ||
|
||
// TrustedCIDRs is a list of CIDRs that this chia component should trust peers from | ||
// See: https://docs.chia.net/faq/?_highlight=trust#what-are-trusted-peers-and-how-do-i-add-them | ||
// +optional | ||
TrustedCIDRs *[]string `json:"trustedCIDRs,omitempty"` | ||
} | ||
|
||
// ChiaDataLayerHTTPSpecChia defines the desired state of an optional data_layer_http sidecar | ||
// data_layer_http is a chia component, and therefore inherits most of the generic configuration options for any chia component | ||
type ChiaDataLayerHTTPSpecChia struct { | ||
CommonSpecChia `json:",inline"` | ||
|
||
// Enabled defines whether a data_layer_http sidecar container should run as a sidecar to the chia container | ||
// +optional | ||
Enabled *bool `json:"enabled,omitempty"` | ||
|
||
// Service defines settings for the Service optionally installed with any data_layer_http resource. | ||
// This Service will default to being enabled with a ClusterIP Service type if data_layer_http is enabled. | ||
// +optional | ||
Service Service `json:"service,omitempty"` | ||
} | ||
|
||
// ChiaDataLayerStatus defines the observed state of ChiaDataLayer | ||
type ChiaDataLayerStatus struct { | ||
// Ready says whether the chia component is ready, this should be true when the data_layer resource is in the target namespace | ||
// +kubebuilder:default=false | ||
Ready bool `json:"ready,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
|
||
// ChiaDataLayer is the Schema for the chiadatalayers API | ||
type ChiaDataLayer struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec ChiaDataLayerSpec `json:"spec,omitempty"` | ||
Status ChiaDataLayerStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// ChiaDataLayerList contains a list of ChiaDataLayer | ||
type ChiaDataLayerList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []ChiaDataLayer `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&ChiaDataLayer{}, &ChiaDataLayerList{}) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What settings would be valuable for this? Off the top of my head, it would be cool to be able to add or delete store IDs from the builtin wallet in the yaml config. But doing that I believe would likely require config sidecar be developed that runs alongside the data_layer container in the Pod and makes all the RPC requests for managing stores from the yaml config for a ChiaDatalayer resource.
Maybe there's another option? But I don't think using the chia-docker entrypoint script works as I believe the data_layer/wallet RPC needs to be up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we go that far with developing the config sidecar, it may as well support all of the actions from https://docs.chia.net/guides/datalayer-user-guide/
Config sidecar will likely be developed after this PR. Just standing up the instance and managing the wallet manually by exec-ing into the chia container as a MVP.