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 0ddf08f
Show file tree
Hide file tree
Showing 37 changed files with 17 additions and 87 deletions.
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
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
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
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
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
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
2 changes: 0 additions & 2 deletions pkg/generators/system/console_statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// StatefulSet returns a basereconciler.GeneratorFunction function that will return
// a StatefulSet resource when called
func (gen *ConsoleGenerator) statefulset() *appsv1.StatefulSet {
sts := &appsv1.StatefulSet{
ObjectMeta: metav1.ObjectMeta{
Expand Down
1 change: 0 additions & 1 deletion pkg/generators/system/searchd_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 searchd
func (gen *SearchdGenerator) service() *corev1.Service {
return &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Expand Down
2 changes: 0 additions & 2 deletions pkg/generators/system/searchd_statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)

// StatefulSet returns a basereconciler.GeneratorFunction function that will return
// a StatefulSet resource when called
func (gen *SearchdGenerator) statefulset() *appsv1.StatefulSet {
return &appsv1.StatefulSet{
ObjectMeta: metav1.ObjectMeta{
Expand Down
2 changes: 0 additions & 2 deletions pkg/generators/system/sidekiq_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 basereconciler.GeneratorFunction function that will return a Deployment
// resource when called
func (gen *SidekiqGenerator) deployment() *appsv1.Deployment {
dep := &appsv1.Deployment{
Spec: appsv1.DeploymentSpec{
Expand Down
2 changes: 0 additions & 2 deletions pkg/generators/system/tekton_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// pipeline returns a basereconciler.GeneratorFunction function that will return a
// Tekton Pipeline resource for a Task when called
func (gen *SystemTektonGenerator) pipeline() *pipelinev1beta1.Pipeline {
pipeline := &pipelinev1beta1.Pipeline{
ObjectMeta: metav1.ObjectMeta{
Expand Down
2 changes: 0 additions & 2 deletions pkg/generators/system/tekton_task.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"
)

// task returns a basereconciler.GeneratorFunction function that will return a
// Tekton Task resource when called
func (gen *SystemTektonGenerator) task() *pipelinev1beta1.Task {
task := &pipelinev1beta1.Task{
ObjectMeta: metav1.ObjectMeta{
Expand Down
3 changes: 1 addition & 2 deletions pkg/generators/twemproxyconfig/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ const (
HealthBindAddress string = "127.0.0.1:22333"
)

// configMap returns a function that will return a ConfigMap
// resource when called. This ConfigMap holds the twemproxy config file.
// configMap returns a ConfigMap that holds the twemproxy config file.
func (gen *Generator) configMap(toYAML bool) *corev1.ConfigMap {
config := make(map[string]twemproxy.ServerPoolConfig, len(gen.Spec.ServerPools)+1)
for _, pool := range gen.Spec.ServerPools {
Expand Down
10 changes: 4 additions & 6 deletions pkg/generators/zync/api_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import (
"github.com/3scale-ops/saas-operator/pkg/resource_builders/pod"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)

// deployment returns a function that will return a *appsv1.Deployment for zync
func (gen *APIGenerator) deployment() *appsv1.Deployment {
dep := &appsv1.Deployment{
Spec: appsv1.DeploymentSpec{
Expand Down Expand Up @@ -44,17 +42,17 @@ func (gen *APIGenerator) deployment() *appsv1.Deployment {
envVars = append(envVars,
corev1.EnvVar{
Name: "POD_NAME",
ValueFrom: &v1.EnvVarSource{
FieldRef: &v1.ObjectFieldSelector{
ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{
FieldPath: "metadata.name",
APIVersion: "v1",
},
},
},
corev1.EnvVar{
Name: "POD_NAMESPACE",
ValueFrom: &v1.EnvVarSource{
FieldRef: &v1.ObjectFieldSelector{
ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{
FieldPath: "metadata.namespace",
APIVersion: "v1",
},
Expand Down
Loading

0 comments on commit 0ddf08f

Please sign in to comment.