Skip to content
Draft
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
6 changes: 3 additions & 3 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ spec:
resources:
limits:
cpu: 500m
memory: 128Mi
memory: 1Gi
requests:
cpu: 10m
memory: 64Mi
cpu: 100m
memory: 256Mi
serviceAccountName: controller-manager
terminationGracePeriodSeconds: 10
11 changes: 9 additions & 2 deletions controllers/conditionalttl_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ import (
"context"
"errors"
"fmt"
"github.com/vtex/cleaner-controller/custom_cel"
"strings"
"time"

"github.com/vtex/cleaner-controller/custom_cel"

cloudevents "github.com/cloudevents/sdk-go/v2"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/storage/driver"
Expand Down Expand Up @@ -199,7 +201,12 @@ func (r *ConditionalTTLReconciler) Reconcile(ctx context.Context, req ctrl.Reque
// given a labelSelector.
func (r *ConditionalTTLReconciler) resolveTarget(ctx context.Context, namespace string, t *cleanerv1alpha1.Target) (runtime.Unstructured, error) {
log := log.FromContext(ctx)
gvk := schema.FromAPIVersionAndKind(t.Reference.APIVersion, t.Reference.Kind)
gvk := schema.FromAPIVersionAndKind(
t.Reference.APIVersion,
// TODO: don't hack the correct kind case here, instead use the correct
// name in our cTTLs: revision -> Revision, service -> Service
strings.ToUpper(t.Reference.Kind[0:1])+t.Reference.Kind[1:],
)
if t.Reference.Name != nil {
u := &unstructured.Unstructured{}
u.SetGroupVersionKind(gvk)
Expand Down
11 changes: 9 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package main
import (
"flag"
"os"

"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

Expand Down Expand Up @@ -69,8 +71,13 @@ func main() {
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Metrics: server.Options{BindAddress: metricsAddr},
Scheme: scheme,
Metrics: server.Options{BindAddress: metricsAddr},
Client: client.Options{
Cache: &client.CacheOptions{
Unstructured: true,
},
},
WebhookServer: webhook.NewServer(webhook.Options{Port: 9443}),
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
Expand Down