@@ -3,11 +3,8 @@ package controllers
33import (
44 "context"
55 "errors"
6- "fmt"
76 "strings"
87
9- refv1alpha1 "github.com/openshift/reference-addon/apis/reference/v1alpha1"
10- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
118 "k8s.io/apimachinery/pkg/types"
129 "k8s.io/client-go/util/workqueue"
1310 "sigs.k8s.io/controller-runtime/pkg/client"
@@ -19,37 +16,23 @@ import (
1916
2017var ErrEmptyOptionValue = errors .New ("empty option value" )
2118
22- func validateOptionValue (val string ) error {
19+ func ValidateOptionValue (val string ) error {
2320 if val != "" {
2421 return nil
2522 }
2623
2724 return ErrEmptyOptionValue
2825}
2926
30- func generateIngressPolicyName (prefix string ) string {
31- return fmt .Sprintf ("%s-ingress" , prefix )
32- }
33-
34- func boolPtr (b bool ) * bool {
27+ func BoolPtr (b bool ) * bool {
3528 return & b
3629}
3730
38- func stringPtr (s string ) * string {
31+ func StringPtr (s string ) * string {
3932 return & s
4033}
4134
42- func newAvailableCondition (reason refv1alpha1.ReferenceAddonAvailableReason , msg string ) metav1.Condition {
43- return metav1.Condition {
44- Type : refv1alpha1 .ReferenceAddonConditionAvailable .String (),
45- Status : reason .Status (),
46- Reason : reason .String (),
47- Message : msg ,
48- LastTransitionTime : metav1 .Now (),
49- }
50- }
51-
52- func enqueueObject (obj types.NamespacedName ) source.Func {
35+ func EnqueueObject (obj types.NamespacedName ) source.Func {
5336 return func (_ context.Context , _ handler.EventHandler , q workqueue.RateLimitingInterface , _ ... predicate.Predicate ) error {
5437 q .Add (reconcile.Request {
5538 NamespacedName : obj ,
@@ -59,15 +42,15 @@ func enqueueObject(obj types.NamespacedName) source.Func {
5942 }
6043}
6144
62- func hasNamePrefix (pfx string ) predicate.Funcs {
45+ func HasNamePrefix (pfx string ) predicate.Funcs {
6346 return predicate .NewPredicateFuncs (
6447 func (obj client.Object ) bool {
6548 return strings .HasPrefix (obj .GetName (), pfx )
6649 },
6750 )
6851}
6952
70- func hasName (name string ) predicate.Funcs {
53+ func HasName (name string ) predicate.Funcs {
7154 return predicate .NewPredicateFuncs (
7255 func (obj client.Object ) bool {
7356 return obj .GetName () == name
0 commit comments