Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
roivaz committed Dec 19, 2023
1 parent d10b3b2 commit 5419404
Show file tree
Hide file tree
Showing 48 changed files with 32 additions and 104 deletions.
2 changes: 1 addition & 1 deletion 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.15
VERSION ?= 0.21.0-alpha.16

# 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
8 changes: 4 additions & 4 deletions bundle/manifests/saas-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -598,15 +598,15 @@ metadata:
capabilities: Basic Install
categories: Integration & Delivery
containerImage: quay.io/3scale/saas-operator
createdAt: "2023-12-18T15:40:44Z"
createdAt: "2023-12-19T14:21:12Z"
description: |-
The 3scale SaaS Operator creates and maintains a SaaS-ready deployment
of the Red Hat 3scale API Management on OpenShift.
operators.operatorframework.io/builder: operator-sdk-v1.27.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/3scale-ops/saas-operator
support: Red Hat
name: saas-operator.v0.21.0-alpha.15
name: saas-operator.v0.21.0-alpha.16
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -4481,7 +4481,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.annotations['olm.targetNamespaces']
image: quay.io/3scale/saas-operator:v0.21.0-alpha.15
image: quay.io/3scale/saas-operator:v0.21.0-alpha.16
livenessProbe:
httpGet:
path: /healthz
Expand Down Expand Up @@ -5045,4 +5045,4 @@ spec:
provider:
name: Red Hat
url: https://www.3scale.net/
version: 0.21.0-alpha.15
version: 0.21.0-alpha.16
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ kind: Kustomization
images:
- name: controller
newName: quay.io/3scale/saas-operator
newTag: v0.21.0-alpha.15
newTag: v0.21.0-alpha.16
8 changes: 4 additions & 4 deletions controllers/shardedredisbackup_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"time"

"github.com/3scale-ops/basereconciler/reconciler"
reconciler_util "github.com/3scale-ops/basereconciler/util"
"github.com/3scale-ops/basereconciler/util"
saasv1alpha1 "github.com/3scale-ops/saas-operator/api/v1alpha1"
testutil "github.com/3scale-ops/saas-operator/test/util"
"github.com/google/go-cmp/cmp"
Expand All @@ -47,7 +47,7 @@ func TestShardedRedisBackupReconciler_reconcileBackupList(t *testing.T) {
args: args{
nextRun: testutil.MustParseRFC3339("2023-09-01T00:01:00Z"),
instance: &saasv1alpha1.ShardedRedisBackup{
Spec: saasv1alpha1.ShardedRedisBackupSpec{HistoryLimit: reconciler_util.Pointer(int32(10))},
Spec: saasv1alpha1.ShardedRedisBackupSpec{HistoryLimit: util.Pointer(int32(10))},
Status: saasv1alpha1.ShardedRedisBackupStatus{},
},
shards: []string{"shard01", "shard02"},
Expand Down Expand Up @@ -76,7 +76,7 @@ func TestShardedRedisBackupReconciler_reconcileBackupList(t *testing.T) {
args: args{
nextRun: testutil.MustParseRFC3339("2023-09-01T00:01:00Z"),
instance: &saasv1alpha1.ShardedRedisBackup{
Spec: saasv1alpha1.ShardedRedisBackupSpec{HistoryLimit: reconciler_util.Pointer(int32(10))},
Spec: saasv1alpha1.ShardedRedisBackupSpec{HistoryLimit: util.Pointer(int32(10))},
Status: saasv1alpha1.ShardedRedisBackupStatus{
Backups: []saasv1alpha1.BackupStatus{
{
Expand Down Expand Up @@ -119,7 +119,7 @@ func TestShardedRedisBackupReconciler_reconcileBackupList(t *testing.T) {
args: args{
nextRun: testutil.MustParseRFC3339("2023-09-01T00:02:00Z"),
instance: &saasv1alpha1.ShardedRedisBackup{
Spec: saasv1alpha1.ShardedRedisBackupSpec{HistoryLimit: reconciler_util.Pointer(int32(10))},
Spec: saasv1alpha1.ShardedRedisBackupSpec{HistoryLimit: util.Pointer(int32(10))},
Status: saasv1alpha1.ShardedRedisBackupStatus{
Backups: []saasv1alpha1.BackupStatus{
{
Expand Down
2 changes: 0 additions & 2 deletions controllers/system_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
saasv1alpha1 "github.com/3scale-ops/saas-operator/api/v1alpha1"
"github.com/3scale-ops/saas-operator/pkg/generators/system"
externalsecretsv1beta1 "github.com/external-secrets/external-secrets/apis/externalsecrets/v1beta1"
"github.com/go-logr/logr"
grafanav1alpha1 "github.com/grafana-operator/grafana-operator/v4/api/integreatly/v1alpha1"
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
Expand All @@ -40,7 +39,6 @@ import (
// SystemReconciler reconciles a System object
type SystemReconciler struct {
*reconciler.Reconciler
Log logr.Logger
}

// +kubebuilder:rbac:groups=saas.3scale.net,namespace=placeholder,resources=systems,verbs=get;list;watch;create;update;patch;delete
Expand Down
1 change: 0 additions & 1 deletion controllers/twemproxyconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import (
// TwemproxyConfigReconciler reconciles a TwemproxyConfig object
type TwemproxyConfigReconciler struct {
*reconciler.Reconciler
Log logr.Logger
SentinelEvents threads.Manager
Pool *redis.ServerPool
}
Expand Down
2 changes: 0 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ func main() {
os.Exit(1)
}

/* WORKLOADS RECONCILER BASED CONTROLLERS*/

if err = (&controllers.ApicastReconciler{
Reconciler: reconciler.NewFromManager(mgr).
WithLogger(ctrl.Log.WithName("controllers").WithName("Apicast")),
Expand Down
2 changes: 0 additions & 2 deletions pkg/generators/apicast/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// Deployment returns a function that will return a Deployment
// resource when called
func (gen *EnvGenerator) deployment() *appsv1.Deployment {

dep := &appsv1.Deployment{
Expand Down
2 changes: 1 addition & 1 deletion pkg/generators/apicast/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (gen *Generator) Resources() ([]resource.TemplateInterface, error) {
WithEnabled(!gen.GrafanaDashboardSpec.IsDeactivated()),
}

return operatorutil.ConcatSlices[resource.TemplateInterface](staging, production, misc), nil
return operatorutil.ConcatSlices(staging, production, misc), nil
}

// EnvGenerator has methods to generate resources for an
Expand Down
4 changes: 0 additions & 4 deletions pkg/generators/apicast/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// GatewayService returns a function that will return the
// gateway Service resource when called
func (gen *EnvGenerator) gatewayService() *corev1.Service {
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -32,8 +30,6 @@ func (gen *EnvGenerator) gatewayService() *corev1.Service {
}
}

// MgmtService returns a function that will return the
// management Service resource when called
func (gen *EnvGenerator) mgmtService() *corev1.Service {
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Expand Down
1 change: 0 additions & 1 deletion pkg/generators/autossl/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// deployment returns a function that will return a *appsv1.Deployment for autossl
func (gen *Generator) deployment() *appsv1.Deployment {
return &appsv1.Deployment{
Spec: appsv1.DeploymentSpec{
Expand Down
2 changes: 1 addition & 1 deletion pkg/generators/autossl/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (gen *Generator) Resources() ([]resource.TemplateInterface, error) {
grafanadashboard.New(gen.GetKey(), gen.GetLabels(), *gen.Spec.GrafanaDashboard, "dashboards/autossl.json.gtpl")).
WithEnabled(!gen.Spec.GrafanaDashboard.IsDeactivated()),
}
return operatorutil.ConcatSlices[resource.TemplateInterface](workload, misc), nil
return operatorutil.ConcatSlices(workload, misc), nil
}

func (gen *Generator) Services() []*resource.Template[*corev1.Service] {
Expand Down
1 change: 0 additions & 1 deletion pkg/generators/autossl/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// service returns a function that will return the corev1.Service for autossl
func (gen *Generator) service() *corev1.Service {
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Expand Down
2 changes: 0 additions & 2 deletions pkg/generators/backend/cron_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// Deployment returns a function that will return a Deployment
// resource when called
func (gen *CronGenerator) deployment() *appsv1.Deployment {
return &appsv1.Deployment{
Spec: appsv1.DeploymentSpec{
Expand Down
3 changes: 1 addition & 2 deletions pkg/generators/backend/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (gen *Generator) Resources() ([]resource.TemplateInterface, error) {
WithEnabled(gen.config.ErrorMonitoringKey != nil),
}

return operatorutil.ConcatSlices[resource.TemplateInterface](listener_resources, worker_resources, cron_resources, misc), nil
return operatorutil.ConcatSlices(listener_resources, worker_resources, cron_resources, misc), nil
}

// ListenerGenerator has methods to generate resources for a
Expand Down Expand Up @@ -315,7 +315,6 @@ var _ deployment_workload.DeploymentWorkload = &CronGenerator{}

func (gen *CronGenerator) Deployment() *resource.Template[*appsv1.Deployment] {
return resource.NewTemplateFromObjectFunction(gen.deployment).
WithMutation(mutators.SetDeploymentReplicas(true)).
WithMutation(mutators.RolloutTrigger{Name: "backend-error-monitoring", SecretName: util.Pointer("backend-error-monitoring")}.Add())
}
func (gen *CronGenerator) HPASpec() *saasv1alpha1.HorizontalPodAutoscalerSpec {
Expand Down
2 changes: 0 additions & 2 deletions pkg/generators/backend/listener_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// Deployment returns a function that will return a Deployment
// resource when called
func (gen *ListenerGenerator) deployment() *appsv1.Deployment {
dep := &appsv1.Deployment{
Spec: appsv1.DeploymentSpec{
Expand Down
4 changes: 0 additions & 4 deletions pkg/generators/backend/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// service returns a function that will return the
// public service resource when called
func (gen *ListenerGenerator) service() *corev1.Service {
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -32,8 +30,6 @@ func (gen *ListenerGenerator) service() *corev1.Service {
}
}

// internalService returns a function that will return the
// internal Service resource when called
func (gen *ListenerGenerator) internalService() *corev1.Service {
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Expand Down
2 changes: 0 additions & 2 deletions pkg/generators/backend/worker_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// Deployment returns a function that will return a Deployment
// resource when called
func (gen *WorkerGenerator) deployment() *appsv1.Deployment {
dep := &appsv1.Deployment{
Spec: appsv1.DeploymentSpec{
Expand Down
1 change: 0 additions & 1 deletion pkg/generators/corsproxy/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// deployment returns a function that will return a *appsv1.Deployment for echo-api
func (gen *Generator) deployment() *appsv1.Deployment {
return &appsv1.Deployment{
Spec: appsv1.DeploymentSpec{
Expand Down
2 changes: 1 addition & 1 deletion pkg/generators/corsproxy/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (gen *Generator) Resources() ([]resource.TemplateInterface, error) {
grafanadashboard.New(gen.GetKey(), gen.GetLabels(), *gen.Spec.GrafanaDashboard, "dashboards/cors-proxy.json.gtpl")).
WithEnabled(!gen.Spec.GrafanaDashboard.IsDeactivated()),
}
return operatorutil.ConcatSlices[resource.TemplateInterface](workload, misc), nil
return operatorutil.ConcatSlices(workload, misc), nil
}

func (gen *Generator) Services() []*resource.Template[*corev1.Service] {
Expand Down
1 change: 0 additions & 1 deletion pkg/generators/corsproxy/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// service returns a function that will return the corev1.Service for echo-api
func (gen *Generator) service() *corev1.Service {
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Expand Down
1 change: 0 additions & 1 deletion pkg/generators/echoapi/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// deployment returns a function that will return a *appsv1.Deployment for echo-api
func (gen *Generator) deployment() *appsv1.Deployment {

dep := &appsv1.Deployment{
Expand Down
1 change: 0 additions & 1 deletion pkg/generators/echoapi/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// service returns a function that will return the corev1.Service for echo-api
func (gen *Generator) service() *corev1.Service {
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Expand Down
1 change: 0 additions & 1 deletion pkg/generators/mappingservice/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// deployment returns a function that will return a *appsv1.Deployment for echo-api
func (gen *Generator) deployment() *appsv1.Deployment {
return &appsv1.Deployment{
Spec: appsv1.DeploymentSpec{
Expand Down
2 changes: 1 addition & 1 deletion pkg/generators/mappingservice/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (gen *Generator) Resources() ([]resource.TemplateInterface, error) {
*gen.Spec.Config.ExternalSecret.SecretStoreRef.Name, *gen.Spec.Config.ExternalSecret.SecretStoreRef.Kind,
*gen.Spec.Config.ExternalSecret.RefreshInterval, gen.GetLabels(), gen.Options)),
}
return operatorutil.ConcatSlices[resource.TemplateInterface](workload, misc), nil
return operatorutil.ConcatSlices(workload, misc), nil
}

func (gen *Generator) Services() []*resource.Template[*corev1.Service] {
Expand Down
1 change: 0 additions & 1 deletion pkg/generators/mappingservice/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// service returns a function that will return the corev1.Service for echo-api
func (gen *Generator) service() *corev1.Service {
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Expand Down
4 changes: 0 additions & 4 deletions pkg/generators/redisshard/configmaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// RedisConfigConfigMap returns a function that will return a ConfigMap
// resource when called
func (gen *Generator) redisConfigConfigMap() *corev1.ConfigMap {
return &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -24,8 +22,6 @@ func (gen *Generator) redisConfigConfigMap() *corev1.ConfigMap {
}
}

// RedisReadinessScriptConfigMap returns a function that will return a ConfigMap
// resource when called
func (gen *Generator) redisReadinessScriptConfigMap() *corev1.ConfigMap {
return &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Expand Down
2 changes: 0 additions & 2 deletions pkg/generators/redisshard/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// Service returns a function that will return a Service
// resource when called
func (gen *Generator) service() *corev1.Service {
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Expand Down
2 changes: 0 additions & 2 deletions pkg/generators/redisshard/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// StatefulSet returns a function that will return
// a StatefulSet resource when called
func (gen *Generator) statefulSet() *appsv1.StatefulSet {
return &appsv1.StatefulSet{
ObjectMeta: metav1.ObjectMeta{
Expand Down
2 changes: 0 additions & 2 deletions pkg/generators/sentinel/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// configMap returns a function that will return a configMap
// resource when called
func (gen *Generator) configMap() *corev1.ConfigMap {
return &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Expand Down
5 changes: 0 additions & 5 deletions pkg/generators/sentinel/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const (
statefulsetPodSelectorLabelKey string = "statefulset.kubernetes.io/pod-name"
)

// statefulSetService returns a function function that returns a Service
// resource when called
func (gen *Generator) statefulSetService() *corev1.Service {
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -31,9 +29,6 @@ func (gen *Generator) statefulSetService() *corev1.Service {
}
}

// podServices returns a function that returns a Service that points
// ot a specific StatefulSet Pod when called
// resource when called
func (gen *Generator) podServices(index int) *corev1.Service {
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Expand Down
2 changes: 0 additions & 2 deletions pkg/generators/sentinel/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ var (
healthCommand string = fmt.Sprintf("redis-cli -p %d PING", saasv1alpha1.SentinelPort)
)

// statefulSet returns a function that will return
// a StatefulSet resource when called
func (gen *Generator) statefulSet() *appsv1.StatefulSet {
return &appsv1.StatefulSet{
ObjectMeta: metav1.ObjectMeta{
Expand Down
2 changes: 0 additions & 2 deletions pkg/generators/system/app_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// Deployment returns a function that will return a Deployment
// resource when called
func (gen *AppGenerator) deployment() *appsv1.Deployment {
dep := &appsv1.Deployment{
Spec: appsv1.DeploymentSpec{
Expand Down
1 change: 0 additions & 1 deletion pkg/generators/system/app_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// service returns a function that will return the corev1.Service for system
func (gen *AppGenerator) service() *corev1.Service {
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Expand Down
Loading

0 comments on commit 5419404

Please sign in to comment.