forked from red-hat-storage/ocs-client-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request red-hat-storage#253 from rewantsoni/avail-crd
Available CRDs check feature Signed-off-by: rchikatw <[email protected]>
- Loading branch information
Showing
41 changed files
with
4,279 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
RESTART_EXIT_CODE=42 | ||
|
||
while true; do | ||
./usr/local/bin/ocs-operator $@ | ||
EXIT_CODE=$? | ||
if [ $EXIT_CODE -ne $RESTART_EXIT_CODE ]; then | ||
exit $EXIT_CODE | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package utils | ||
|
||
import ( | ||
"github.com/go-logr/logr" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
"sigs.k8s.io/controller-runtime/pkg/event" | ||
"sigs.k8s.io/controller-runtime/pkg/predicate" | ||
) | ||
|
||
// Name Predicate return a predicate the filter events produced | ||
// by resources that matches the given name | ||
func NamePredicate(name string) predicate.Predicate { | ||
return predicate.NewPredicateFuncs(func(obj client.Object) bool { | ||
return obj.GetName() == name | ||
}) | ||
} | ||
|
||
func CrdCreateAndDeletePredicate(log *logr.Logger, crdName string, crdExists bool) predicate.Predicate { | ||
return predicate.Funcs{ | ||
CreateFunc: func(_ event.CreateEvent) bool { | ||
if !crdExists { | ||
log.Info("CustomResourceDefinition %s was Created.", crdName) | ||
} | ||
return !crdExists | ||
}, | ||
DeleteFunc: func(_ event.DeleteEvent) bool { | ||
if crdExists { | ||
log.Info("CustomResourceDefinition %s was Deleted.", crdName) | ||
} | ||
return crdExists | ||
}, | ||
UpdateFunc: func(_ event.UpdateEvent) bool { | ||
return false | ||
}, | ||
GenericFunc: func(_ event.GenericEvent) bool { | ||
return false | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.