Skip to content

Commit

Permalink
Toggles for user attribute and usage profile features
Browse files Browse the repository at this point in the history
  • Loading branch information
bastjan committed Mar 5, 2024
1 parent 667e977 commit 231a353
Showing 1 changed file with 39 additions and 31 deletions.
70 changes: 39 additions & 31 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ func main() {
flag.IntVar(&qps, "qps", 20, "QPS to use for the controller-runtime client")
flag.IntVar(&burst, "burst", 100, "Burst to use for the controller-runtime client")

var disableUserAttributeSync, disableUsageProfiles bool
flag.BoolVar(&disableUserAttributeSync, "disable-user-attribute-sync", false, "Disable the UserAttributeSync controller")
flag.BoolVar(&disableUsageProfiles, "disable-usage-profiles", false, "Disable the UsageProfile controllers")

opts := zap.Options{}
opts.BindFlags(flag.CommandLine)
flag.Parse()
Expand Down Expand Up @@ -146,42 +150,46 @@ func main() {
registerRatioController(mgr, conf, conf.OrganizationLabel)
registerOrganizationRBACController(mgr, conf.OrganizationLabel, conf.DefaultOrganizationClusterRoles)

if err := (&controllers.UserAttributeSyncReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Recorder: mgr.GetEventRecorderFor("user-attribute-sync-controller"),
if !disableUserAttributeSync {
if err := (&controllers.UserAttributeSyncReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Recorder: mgr.GetEventRecorderFor("user-attribute-sync-controller"),

ForeignClient: controlAPICluster.GetClient(),
}).SetupWithManagerAndForeignCluster(mgr, controlAPICluster); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "UserAttributeSync")
os.Exit(1)
ForeignClient: controlAPICluster.GetClient(),
}).SetupWithManagerAndForeignCluster(mgr, controlAPICluster); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "UserAttributeSync")
os.Exit(1)
}
}

if err := (&controllers.ZoneUsageProfileSyncReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Recorder: mgr.GetEventRecorderFor("usage-profile-sync-controller"),
if !disableUsageProfiles {
if err := (&controllers.ZoneUsageProfileSyncReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Recorder: mgr.GetEventRecorderFor("usage-profile-sync-controller"),

ForeignClient: controlAPICluster.GetClient(),
}).SetupWithManagerAndForeignCluster(mgr, controlAPICluster); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ratio")
os.Exit(1)
}
if err := (&controllers.ZoneUsageProfileApplyReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Recorder: mgr.GetEventRecorderFor("usage-profile-apply-controller"),
Cache: mgr.GetCache(),

OrganizationLabel: conf.OrganizationLabel,
Transformers: []transformers.Transformer{
transformers.NewResourceQuotaTransformer("resourcequota.appuio.io"),
},
ForeignClient: controlAPICluster.GetClient(),
}).SetupWithManagerAndForeignCluster(mgr, controlAPICluster); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ratio")
os.Exit(1)
}
if err := (&controllers.ZoneUsageProfileApplyReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Recorder: mgr.GetEventRecorderFor("usage-profile-apply-controller"),
Cache: mgr.GetCache(),

OrganizationLabel: conf.OrganizationLabel,
Transformers: []transformers.Transformer{
transformers.NewResourceQuotaTransformer("resourcequota.appuio.io"),
},

SelectedProfile: selectedUsageProfile,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ratio")
os.Exit(1)
SelectedProfile: selectedUsageProfile,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ratio")
os.Exit(1)
}
}

psk := &skipper.PrivilegedUserSkipper{
Expand Down

0 comments on commit 231a353

Please sign in to comment.