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

feat: add autoscaler service integration support #836

Merged
merged 5 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
aliases alongside their associated indexes. Default is true
- Add `OpenSearch` field `userConfig.s3_migration.include_aliases`, type `boolean`: Whether to restore
aliases alongside their associated indexes. Default is true
- Add `ServiceIntegration` field `autoscaler`, type `object`: Autoscaler specific user configuration options
- Add `ServiceIntegrationEndpoint` field `autoscaler`, type `object`: Autoscaler configuration values

## v0.25.0 - 2024-09-19

Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/serviceintegration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/aiven/go-client-codegen/handler/service"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

autoscalerintegration "github.com/aiven/aiven-operator/api/v1alpha1/userconfig/integration/autoscaler"
clickhousekafkauserconfig "github.com/aiven/aiven-operator/api/v1alpha1/userconfig/integration/clickhouse_kafka"
clickhousepostgresqluserconfig "github.com/aiven/aiven-operator/api/v1alpha1/userconfig/integration/clickhouse_postgresql"
datadogintegration "github.com/aiven/aiven-operator/api/v1alpha1/userconfig/integration/datadog"
Expand Down Expand Up @@ -59,6 +60,9 @@ type ServiceIntegrationSpec struct {
// Destination project for the integration (if any)
DestinationProjectName string `json:"destinationProjectName,omitempty"`

// Autoscaler specific user configuration options
AutoscalerUserConfig *autoscalerintegration.AutoscalerUserConfig `json:"autoscaler,omitempty"`

// Datadog specific user configuration options
DatadogUserConfig *datadogintegration.DatadogUserConfig `json:"datadog,omitempty"`

Expand Down Expand Up @@ -130,6 +134,7 @@ func (in *ServiceIntegration) Conditions() *[]metav1.Condition {

func (in *ServiceIntegration) getUserConfigFields() map[service.IntegrationType]any {
return map[service.IntegrationType]any{
service.IntegrationTypeAutoscaler: in.Spec.AutoscalerUserConfig,
service.IntegrationTypeClickhouseKafka: in.Spec.ClickhouseKafkaUserConfig,
service.IntegrationTypeClickhousePostgresql: in.Spec.ClickhousePostgreSQLUserConfig,
service.IntegrationTypeDatadog: in.Spec.DatadogUserConfig,
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/serviceintegrationendpoint_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

autoscaleruserconfig "github.com/aiven/aiven-operator/api/v1alpha1/userconfig/integrationendpoints/autoscaler"
datadoguserconfig "github.com/aiven/aiven-operator/api/v1alpha1/userconfig/integrationendpoints/datadog"
externalawscloudwatchlogsuserconfig "github.com/aiven/aiven-operator/api/v1alpha1/userconfig/integrationendpoints/external_aws_cloudwatch_logs"
externalawscloudwatchmetricsuserconfig "github.com/aiven/aiven-operator/api/v1alpha1/userconfig/integrationendpoints/external_aws_cloudwatch_metrics"
Expand Down Expand Up @@ -37,6 +38,9 @@ type ServiceIntegrationEndpointSpec struct {
// Source endpoint for the integration (if any)
EndpointName string `json:"endpointName,omitempty"`

// Autoscaler configuration values
Autoscaler *autoscaleruserconfig.AutoscalerUserConfig `json:"autoscaler,omitempty"`

// Datadog configuration values
Datadog *datadoguserconfig.DatadogUserConfig `json:"datadog,omitempty"`

Expand Down Expand Up @@ -118,6 +122,7 @@ func (in *ServiceIntegrationEndpoint) Conditions() *[]metav1.Condition {

func (in *ServiceIntegrationEndpoint) getUserConfigFields() map[string]any {
return map[string]any{
"autoscaler": in.Spec.Autoscaler,
"datadog": in.Spec.Datadog,
"external_aws_cloudwatch_logs": in.Spec.ExternalAwsCloudwatchLogs,
"external_aws_cloudwatch_metrics": in.Spec.ExternalAwsCloudwatchMetrics,
Expand Down

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

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

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

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

12 changes: 12 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.

Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,35 @@ spec:
- key
- name
type: object
autoscaler:
description: Autoscaler configuration values
properties:
autoscaling:
description: Configure autoscaling thresholds for a service
items:
description: AutoscalingProperties
properties:
cap_gb:
description:
The maximum total disk size (in gb) to allow
autoscaler to scale up to
maximum: 10000
minimum: 50
type: integer
type:
description: Type of autoscale event
enum:
- autoscale_disk
type: string
required:
- cap_gb
- type
type: object
maxItems: 64
type: array
required:
- autoscaling
type: object
datadog:
description: Datadog configuration values
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ spec:
- key
- name
type: object
autoscaler:
description: Autoscaler specific user configuration options
type: object
clickhouseKafka:
description: Clickhouse Kafka configuration values
properties:
Expand Down
29 changes: 29 additions & 0 deletions config/crd/bases/aiven.io_serviceintegrationendpoints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,35 @@ spec:
- key
- name
type: object
autoscaler:
description: Autoscaler configuration values
properties:
autoscaling:
description: Configure autoscaling thresholds for a service
items:
description: AutoscalingProperties
properties:
cap_gb:
description:
The maximum total disk size (in gb) to allow
autoscaler to scale up to
maximum: 10000
minimum: 50
type: integer
type:
description: Type of autoscale event
enum:
- autoscale_disk
type: string
required:
- cap_gb
- type
type: object
maxItems: 64
type: array
required:
- autoscaling
type: object
datadog:
description: Datadog configuration values
properties:
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/aiven.io_serviceintegrations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ spec:
- key
- name
type: object
autoscaler:
description: Autoscaler specific user configuration options
type: object
clickhouseKafka:
description: Clickhouse Kafka configuration values
properties:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: aiven.io/v1alpha1
kind: ServiceIntegration
metadata:
name: my-service-integration
spec:
authSecretRef:
name: aiven-token
key: token

project: aiven-project-name
integrationType: autoscaler
sourceServiceName: my-pg
# Look up autoscaler integration endpoint ID via Console
destinationEndpointId: my-destination-endpoint-id

---

apiVersion: aiven.io/v1alpha1
kind: PostgreSQL
metadata:
name: my-pg
spec:
authSecretRef:
name: aiven-token
key: token

project: aiven-project-name
cloudName: google-europe-west1
plan: startup-4
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: aiven.io/v1alpha1
kind: ServiceIntegrationEndpoint
metadata:
name: my-service-integration-endpoint
spec:
authSecretRef:
name: aiven-token
key: token

project: aiven-project-name
endpointName: my-autoscaler
endpointType: autoscaler

autoscaler:
autoscaling:
- type: autoscale_disk
cap_gb: 100
Loading
Loading