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

basereconciler v0.4 #282

Merged
merged 9 commits into from
Jan 9, 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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 0.21.0-alpha.18
VERSION ?= 0.21.0-alpha.19

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
Expand Down Expand Up @@ -122,7 +122,7 @@ test-e2e: manifests ginkgo kind-create kind-deploy kind-deploy-backup-assets ##

assets: go-bindata ## assets: Generate embedded assets
@echo Generate Go embedded assets files by processing source
PATH=$$PATH:$$PWD/bin go generate github.com/3scale/saas-operator/pkg/assets
PATH=$$PATH:$$PWD/bin go generate github.com/3scale-ops/saas-operator/pkg/assets

##@ Build

Expand Down
26 changes: 13 additions & 13 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins:
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
projectName: saas-operator
repo: github.com/3scale/saas-operator
repo: github.com/3scale-ops/saas-operator
resources:
- api:
crdVersion: v1
Expand All @@ -14,7 +14,7 @@ resources:
domain: 3scale.net
group: saas
kind: AutoSSL
path: github.com/3scale/saas-operator/api/v1alpha1
path: github.com/3scale-ops/saas-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
Expand All @@ -23,7 +23,7 @@ resources:
domain: 3scale.net
group: saas
kind: Apicast
path: github.com/3scale/saas-operator/api/v1alpha1
path: github.com/3scale-ops/saas-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
Expand All @@ -32,7 +32,7 @@ resources:
domain: 3scale.net
group: saas
kind: EchoAPI
path: github.com/3scale/saas-operator/api/v1alpha1
path: github.com/3scale-ops/saas-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
Expand All @@ -41,7 +41,7 @@ resources:
domain: 3scale.net
group: saas
kind: MappingService
path: github.com/3scale/saas-operator/api/v1alpha1
path: github.com/3scale-ops/saas-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
Expand All @@ -50,7 +50,7 @@ resources:
domain: 3scale.net
group: saas
kind: CORSProxy
path: github.com/3scale/saas-operator/api/v1alpha1
path: github.com/3scale-ops/saas-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
Expand All @@ -59,7 +59,7 @@ resources:
domain: 3scale.net
group: saas
kind: Backend
path: github.com/3scale/saas-operator/api/v1alpha1
path: github.com/3scale-ops/saas-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
Expand All @@ -68,7 +68,7 @@ resources:
domain: 3scale.net
group: saas
kind: System
path: github.com/3scale/saas-operator/api/v1alpha1
path: github.com/3scale-ops/saas-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
Expand All @@ -77,7 +77,7 @@ resources:
domain: 3scale.net
group: saas
kind: Zync
path: github.com/3scale/saas-operator/api/v1alpha1
path: github.com/3scale-ops/saas-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
Expand All @@ -86,7 +86,7 @@ resources:
domain: 3scale.net
group: saas
kind: Sentinel
path: github.com/3scale/saas-operator/api/v1alpha1
path: github.com/3scale-ops/saas-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
Expand All @@ -95,7 +95,7 @@ resources:
domain: 3scale.net
group: saas
kind: RedisShard
path: github.com/3scale/saas-operator/api/v1alpha1
path: github.com/3scale-ops/saas-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
Expand All @@ -104,7 +104,7 @@ resources:
domain: 3scale.net
group: saas
kind: TwemproxyConfig
path: github.com/3scale/saas-operator/api/v1alpha1
path: github.com/3scale-ops/saas-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
Expand All @@ -113,6 +113,6 @@ resources:
domain: 3scale.net
group: saas
kind: ShardedRedisBackup
path: github.com/3scale/saas-operator/api/v1alpha1
path: github.com/3scale-ops/saas-operator/api/v1alpha1
version: v1alpha1
version: "3"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

![3scale-saas](docs/logos/3scale-saas-logo.svg)

[![test](https://github.com/3scale/saas-operator/actions/workflows/test.yaml/badge.svg)](https://github.com/3scale/saas-operator/actions/workflows/test.yaml)
[![release](https://badgen.net/github/release/3scale/saas-operator)](https://github.com/3scale/saas-operator/releases)
[![license](https://badgen.net/github/license/3scale/saas-operator)](https://github.com/3scale/saas-operator/LICENSE)
[![test](https://github.com/3scale-ops/saas-operator/actions/workflows/test.yaml/badge.svg)](https://github.com/3scale-ops/saas-operator/actions/workflows/test.yaml)
[![release](https://badgen.net/github/release/3scale/saas-operator)](https://github.com/3scale-ops/saas-operator/releases)
[![license](https://badgen.net/github/license/3scale/saas-operator)](https://github.com/3scale-ops/saas-operator/LICENSE)

A Kubernetes Operator based on the Operator SDK to manage 3scale SaaS (hosted version) on **Kubernetes/OpenShift**.

Expand Down
63 changes: 31 additions & 32 deletions api/v1alpha1/apicast_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,29 @@ limitations under the License.
package v1alpha1

import (
"github.com/3scale/saas-operator/pkg/util"
"github.com/3scale-ops/basereconciler/util"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
)

var (
apicastDefaultReplicas int32 = 2
apicastDefaultImage defaultImageSpec = defaultImageSpec{
Name: pointer.String("quay.io/3scale/apicast-cloud-hosted"),
Tag: pointer.String("latest"),
PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))),
Name: util.Pointer("quay.io/3scale/apicast-cloud-hosted"),
Tag: util.Pointer("latest"),
PullPolicy: (*corev1.PullPolicy)(util.Pointer(string(corev1.PullIfNotPresent))),
}
apicastDefaultLoadBalancer defaultLoadBalancerSpec = defaultLoadBalancerSpec{
ProxyProtocol: pointer.Bool(true),
CrossZoneLoadBalancingEnabled: pointer.Bool(true),
ConnectionDrainingEnabled: pointer.Bool(true),
ConnectionDrainingTimeout: pointer.Int32(60),
HealthcheckHealthyThreshold: pointer.Int32(2),
HealthcheckUnhealthyThreshold: pointer.Int32(2),
HealthcheckInterval: pointer.Int32(5),
HealthcheckTimeout: pointer.Int32(3),
ProxyProtocol: util.Pointer(true),
CrossZoneLoadBalancingEnabled: util.Pointer(true),
ConnectionDrainingEnabled: util.Pointer(true),
ConnectionDrainingTimeout: util.Pointer[int32](60),
HealthcheckHealthyThreshold: util.Pointer[int32](2),
HealthcheckUnhealthyThreshold: util.Pointer[int32](2),
HealthcheckInterval: util.Pointer[int32](5),
HealthcheckTimeout: util.Pointer[int32](3),
}
apicastDefaultResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{
Requests: corev1.ResourceList{
Expand All @@ -53,31 +52,31 @@ var (
},
}
apicastDefaultHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{
MinReplicas: pointer.Int32(2),
MaxReplicas: pointer.Int32(4),
ResourceUtilization: pointer.Int32(90),
ResourceName: pointer.String("cpu"),
MinReplicas: util.Pointer[int32](2),
MaxReplicas: util.Pointer[int32](4),
ResourceUtilization: util.Pointer[int32](90),
ResourceName: util.Pointer("cpu"),
}
apicastDefaultLivenessProbe defaultProbeSpec = defaultProbeSpec{
InitialDelaySeconds: pointer.Int32(5),
TimeoutSeconds: pointer.Int32(5),
PeriodSeconds: pointer.Int32(10),
SuccessThreshold: pointer.Int32(1),
FailureThreshold: pointer.Int32(3),
InitialDelaySeconds: util.Pointer[int32](5),
TimeoutSeconds: util.Pointer[int32](5),
PeriodSeconds: util.Pointer[int32](10),
SuccessThreshold: util.Pointer[int32](1),
FailureThreshold: util.Pointer[int32](3),
}
apicastDefaultReadinessProbe defaultProbeSpec = defaultProbeSpec{
InitialDelaySeconds: pointer.Int32(5),
TimeoutSeconds: pointer.Int32(5),
PeriodSeconds: pointer.Int32(30),
SuccessThreshold: pointer.Int32(1),
FailureThreshold: pointer.Int32(3),
InitialDelaySeconds: util.Pointer[int32](5),
TimeoutSeconds: util.Pointer[int32](5),
PeriodSeconds: util.Pointer[int32](30),
SuccessThreshold: util.Pointer[int32](1),
FailureThreshold: util.Pointer[int32](3),
}
apicastDefaultPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{
MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)),
MaxUnavailable: util.Pointer(intstr.FromInt(1)),
}
apicastDefaultGrafanaDashboard defaultGrafanaDashboardSpec = defaultGrafanaDashboardSpec{
SelectorKey: pointer.String("monitoring-key"),
SelectorValue: pointer.String("middleware"),
SelectorKey: util.Pointer("monitoring-key"),
SelectorValue: util.Pointer("middleware"),
}
apicastDefaultMarin3rSpec defaultMarin3rSidecarSpec = defaultMarin3rSidecarSpec{}
apicastDefaultLogLevel string = "warn"
Expand Down Expand Up @@ -227,8 +226,8 @@ type ApicastConfig struct {

// Default sets default values for any value not specifically set in the ApicastConfig struct
func (cfg *ApicastConfig) Default() {
cfg.LogLevel = stringOrDefault(cfg.LogLevel, pointer.String(apicastDefaultLogLevel))
cfg.OIDCLogLevel = stringOrDefault(cfg.OIDCLogLevel, pointer.String(apicastDefaultOIDCLogLevel))
cfg.LogLevel = stringOrDefault(cfg.LogLevel, util.Pointer(apicastDefaultLogLevel))
cfg.OIDCLogLevel = stringOrDefault(cfg.OIDCLogLevel, util.Pointer(apicastDefaultOIDCLogLevel))

}

Expand Down
55 changes: 27 additions & 28 deletions api/v1alpha1/autossl_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,29 @@ limitations under the License.
package v1alpha1

import (
"github.com/3scale/saas-operator/pkg/util"
"github.com/3scale-ops/basereconciler/util"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
)

var (
autosslDefaultReplicas int32 = 2
autosslDefaultImage defaultImageSpec = defaultImageSpec{
Name: pointer.String("quay.io/3scale/autossl"),
Tag: pointer.String("latest"),
PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))),
Name: util.Pointer("quay.io/3scale/autossl"),
Tag: util.Pointer("latest"),
PullPolicy: (*corev1.PullPolicy)(util.Pointer(string(corev1.PullIfNotPresent))),
}
autosslDefaultLoadBalancer defaultLoadBalancerSpec = defaultLoadBalancerSpec{
ProxyProtocol: pointer.Bool(true),
CrossZoneLoadBalancingEnabled: pointer.Bool(true),
ConnectionDrainingEnabled: pointer.Bool(true),
ConnectionDrainingTimeout: pointer.Int32(60),
HealthcheckHealthyThreshold: pointer.Int32(2),
HealthcheckUnhealthyThreshold: pointer.Int32(2),
HealthcheckInterval: pointer.Int32(5),
HealthcheckTimeout: pointer.Int32(3),
ProxyProtocol: util.Pointer(true),
CrossZoneLoadBalancingEnabled: util.Pointer(true),
ConnectionDrainingEnabled: util.Pointer(true),
ConnectionDrainingTimeout: util.Pointer[int32](60),
HealthcheckHealthyThreshold: util.Pointer[int32](2),
HealthcheckUnhealthyThreshold: util.Pointer[int32](2),
HealthcheckInterval: util.Pointer[int32](5),
HealthcheckTimeout: util.Pointer[int32](3),
}
autosslDefaultResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{
Requests: corev1.ResourceList{
Expand All @@ -53,25 +52,25 @@ var (
},
}
autosslDefaultHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{
MinReplicas: pointer.Int32(2),
MaxReplicas: pointer.Int32(4),
ResourceUtilization: pointer.Int32(90),
ResourceName: pointer.String("cpu"),
MinReplicas: util.Pointer[int32](2),
MaxReplicas: util.Pointer[int32](4),
ResourceUtilization: util.Pointer[int32](90),
ResourceName: util.Pointer("cpu"),
}
autosslDefaultProbe defaultProbeSpec = defaultProbeSpec{
InitialDelaySeconds: pointer.Int32(25),
TimeoutSeconds: pointer.Int32(1),
PeriodSeconds: pointer.Int32(10),
SuccessThreshold: pointer.Int32(1),
FailureThreshold: pointer.Int32(3),
InitialDelaySeconds: util.Pointer[int32](25),
TimeoutSeconds: util.Pointer[int32](1),
PeriodSeconds: util.Pointer[int32](10),
SuccessThreshold: util.Pointer[int32](1),
FailureThreshold: util.Pointer[int32](3),
}
autosslDefaultPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{
MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)),
MaxUnavailable: util.Pointer(intstr.FromInt(1)),
}

autosslDefaultGrafanaDashboard defaultGrafanaDashboardSpec = defaultGrafanaDashboardSpec{
SelectorKey: pointer.String("monitoring-key"),
SelectorValue: pointer.String("middleware"),
SelectorKey: util.Pointer("monitoring-key"),
SelectorValue: util.Pointer("middleware"),
}
autosslDefaultACMEStaging bool = false
autosslDefaultRedisPort int32 = 6379
Expand Down Expand Up @@ -208,9 +207,9 @@ type AutoSSLConfig struct {

// Default sets default values for any value not specifically set in the AutoSSLConfig struct
func (cfg *AutoSSLConfig) Default() {
cfg.ACMEStaging = boolOrDefault(cfg.ACMEStaging, pointer.Bool(autosslDefaultACMEStaging))
cfg.RedisPort = intOrDefault(cfg.RedisPort, pointer.Int32(autosslDefaultRedisPort))
cfg.LogLevel = stringOrDefault(cfg.LogLevel, pointer.String(autosslDefaultLogLevel))
cfg.ACMEStaging = boolOrDefault(cfg.ACMEStaging, util.Pointer(autosslDefaultACMEStaging))
cfg.RedisPort = intOrDefault(cfg.RedisPort, util.Pointer[int32](autosslDefaultRedisPort))
cfg.LogLevel = stringOrDefault(cfg.LogLevel, util.Pointer(autosslDefaultLogLevel))
if cfg.DomainWhitelist == nil {
cfg.DomainWhitelist = []string{}
}
Expand Down
Loading
Loading