Skip to content
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 Thanos Query frontend in Query CRD and deployment #82

Merged
merged 5 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions api/v1alpha1/thanosquery_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -44,13 +45,60 @@ type ThanosQuerySpec struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default:={matchLabels:{"operator.thanos.io/store-api": "true"}}
StoreLabelSelector *metav1.LabelSelector `json:"customStoreLabelSelector,omitempty"`
// QueryFrontend is the configuration for the Query Frontend
// If you specify this, the operator will create a Query Frontend in front of your
// Querier deployment.
// +kubebuilder:validation:Optional
QueryFrontend *QueryFrontendSpec `json:"queryFrontend,omitempty"`
// Additional configuration for the Thanos components. Allows you to add
// additional args, containers, volumes, and volume mounts to Thanos Deployments,
// and StatefulSets. Ideal to use for things like sidecars.
// +kubebuilder:validation:Optional
Additional `json:",inline"`
}

// QueryFrontendSpec defines the desired state of ThanosQueryFrontend
type QueryFrontendSpec struct {
CommonThanosFields `json:",inline"`
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=1
Replicas int32 `json:"replicas,omitempty"`
// CompressResponses enables response compression
// +kubebuilder:default=true
CompressResponses bool `json:"compressResponses,omitempty"`
// By default, the operator will add the first discoverable Query API to the
// Query Frontend, if they have query labels. You can optionally choose to override default
// Query selector labels, to select a subset of QueryAPIs to query.
// +kubebuilder:validation:Optional
// +kubebuilder:default:={matchLabels:{"operator.thanos.io/query-api": "true"}}
QueryLabelSelector *metav1.LabelSelector `json:"queryLabelSelector,omitempty"`
// LogQueriesLongerThan sets the duration threshold for logging long queries
// +kubebuilder:validation:Optional
LogQueriesLongerThan *Duration `json:"logQueriesLongerThan,omitempty"`
// QueryRangeResponseCacheConfig holds the configuration for the query range response cache
// +kubebuilder:validation:Optional
QueryRangeResponseCacheConfig *corev1.ConfigMapKeySelector `json:"queryRangeResponseCacheConfig,omitempty"`
// QueryRangeSplitInterval sets the split interval for query range
// +kubebuilder:validation:Optional
QueryRangeSplitInterval *Duration `json:"queryRangeSplitInterval,omitempty"`
// LabelsSplitInterval sets the split interval for labels
// +kubebuilder:validation:Optional
LabelsSplitInterval *Duration `json:"labelsSplitInterval,omitempty"`
// QueryRangeMaxRetries sets the maximum number of retries for query range requests
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=5
QueryRangeMaxRetries int `json:"queryRangeMaxRetries,omitempty"`
// LabelsMaxRetries sets the maximum number of retries for label requests
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=5
LabelsMaxRetries int `json:"labelsMaxRetries,omitempty"`
// LabelsDefaultTimeRange sets the default time range for label queries
// +kubebuilder:validation:Optional
LabelsDefaultTimeRange *Duration `json:"labelsDefaultTimeRange,omitempty"`
// Additional configuration for the Thanos components
Additional `json:",inline"`
}

// ThanosQueryStatus defines the observed state of ThanosQuery
type ThanosQueryStatus struct {
// Conditions represent the latest available observations of the state of the Querier.
Expand Down
52 changes: 52 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "ThanosRuler")
os.Exit(1)
}

//+kubebuilder:scaffold:builder

if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
Expand Down
Loading
Loading