Skip to content

Commit

Permalink
Provide CSV markers to display CRD fields properly in OpenShift Conso…
Browse files Browse the repository at this point in the history
…le (grafana#49)
  • Loading branch information
periklis authored May 11, 2021
1 parent 2a0d510 commit d3986b9
Show file tree
Hide file tree
Showing 5 changed files with 385 additions and 26 deletions.
33 changes: 27 additions & 6 deletions api/v1beta1/lokistack_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type LokiComponentSpec struct {
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:hidden"
Replicas int32 `json:"replicas,omitempty"`

// NodeSelector defines the labels required by a node to schedule
Expand All @@ -102,30 +103,35 @@ type LokiTemplateSpec struct {
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Compactor pods"
Compactor *LokiComponentSpec `json:"compactor,omitempty"`

// Distributor defines the distributor component spec.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Distributor pods"
Distributor *LokiComponentSpec `json:"distributor,omitempty"`

// Ingester defines the ingester component spec.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Ingester pods"
Ingester *LokiComponentSpec `json:"ingester,omitempty"`

// Querier defines the querier component spec.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Querier pods"
Querier *LokiComponentSpec `json:"querier,omitempty"`

// QueryFrontend defines the query frontend component spec.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Query Frontend pods"
QueryFrontend *LokiComponentSpec `json:"queryFrontend,omitempty"`
}

Expand All @@ -135,6 +141,7 @@ type ObjectStorageSecretSpec struct {
//
// +required
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:io.kubernetes:Secret",displayName="Object Storage Secret"
Name string `json:"name"`
}

Expand All @@ -157,20 +164,23 @@ type QueryLimitSpec struct {
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:number",displayName="Max Entries Limit per Query"
MaxEntriesLimitPerQuery int32 `json:"maxEntriesLimitPerQuery,omitempty"`

// MaxChunksPerQuery defines the maximum number of chunks
// that can be fetched by a single query.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:number",displayName="Max Chunk per Query"
MaxChunksPerQuery int32 `json:"maxChunksPerQuery,omitempty"`

// MaxQuerySeries defines the the maximum of unique series
// that is returned by a metric query.
//
// + optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:number",displayName="Max Query Series"
MaxQuerySeries int32 `json:"maxQuerySeries,omitempty"`
}

Expand All @@ -181,6 +191,7 @@ type IngestionLimitSpec struct {
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:number",displayName="Ingestion Rate (in MB)"
IngestionRate int32 `json:"ingestionRate,omitempty"`

// IngestionBurstSize defines the local rate-limited sample size per
Expand All @@ -189,40 +200,46 @@ type IngestionLimitSpec struct {
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:number",displayName="Ingestion Burst Size (in MB)"
IngestionBurstSize int32 `json:"ingestionBurstSize,omitempty"`

// MaxLabelNameLength defines the maximum number of characters allowed
// for label keys in log streams.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:number",displayName="Max Label Name Length"
MaxLabelNameLength int32 `json:"maxLabelNameLength,omitempty"`

// MaxLabelValueLength defines the maximum number of characters allowed
// for label values in log streams.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:number",displayName="Max Label Value Length"
MaxLabelValueLength int32 `json:"maxLabelValueLength,omitempty"`

// MaxLabelNamesPerSeries defines the maximum number of label names per series
// in each log stream.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:number",displayName="Max Labels Names per Series"
MaxLabelNamesPerSeries int32 `json:"maxLabelNamesPerSeries,omitempty"`

// MaxGlobalStreamsPerTenant defines the maximum number of active streams
// per tenant, across the cluster.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:number",displayName="Max Global Streams per Tenant"
MaxGlobalStreamsPerTenant int32 `json:"maxGlobalStreamsPerTenant,omitempty"`

// MaxLineSize defines the aximum line size on ingestion path. Units in Bytes.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:number",displayName="Max Line Size"
MaxLineSize int32 `json:"maxLineSize,omitempty"`
}

Expand All @@ -249,12 +266,14 @@ type LimitsSpec struct {
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Global Limits"
Global *LimitsTemplateSpec `json:"global,omitempty"`

// Tenants defines the limits applied per tenant.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Limits per Tenant"
Tenants map[string]LimitsTemplateSpec `json:"tenants,omitempty"`
}

Expand All @@ -267,48 +286,50 @@ type LokiStackSpec struct {
// +required
// +kubebuilder:validation:Required
// +kubebuilder:default:=Managed
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Management State"
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:select:Managed","urn:alm:descriptor:com.tectonic.ui:select:Unmanaged"},displayName="Management State"
ManagementState ManagementStateType `json:"managementState,omitempty"`

// Size defines one of the support Loki deployment scale out sizes.
//
// +required
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Loki Stack Size"
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:select:1x.extra-small","urn:alm:descriptor:com.tectonic.ui:select:1x.small","urn:alm:descriptor:com.tectonic.ui:select:1x.medium"},displayName="LokiStack Size"
Size LokiStackSizeType `json:"size"`

// Storage defines the spec for the object storage endpoint to store logs.
//
// +required
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Loki Object Storage"
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Object Storage"
Storage ObjectStorageSpec `json:"storage"`

// Storage class name defines the storage class for ingester/querier PVCs.
//
// +required
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Loki Storage Class Name"
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:io.kubernetes:StorageClass",displayName="Storage Class Name"
StorageClassName string `json:"storageClassName"`

// ReplicationFactor defines the policy for log stream replication.
//
// +required
// +kubebuilder:validation:Required
// +kubebuilder:validation:Minimum:=1
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Replication Factor"
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:number",displayName="Replication Factor"
ReplicationFactor int32 `json:"replicationFactor"`

// Limits defines the limits to be applied to log stream processing.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:advanced",displayName="Rate Limiting"
Limits *LimitsSpec `json:"limits,omitempty"`

// Template defines the resource/limits/tolerations/nodeselectors per component
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:advanced",displayName="Node Placement"
Template *LokiTemplateSpec `json:"template,omitempty"`
}

Expand Down Expand Up @@ -346,7 +367,7 @@ type LokiStackStatus struct {
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:text"
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:io.kubernetes.conditions"
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

Expand Down
Loading

0 comments on commit d3986b9

Please sign in to comment.