-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add events when pre- or post-upgrade check fails
Signed-off-by: James Munson <[email protected]>
- Loading branch information
1 parent
56903ba
commit cf295c1
Showing
6 changed files
with
150 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package app | ||
|
||
import ( | ||
"github.com/pkg/errors" | ||
"github.com/sirupsen/logrus" | ||
|
||
"k8s.io/client-go/rest" | ||
"k8s.io/client-go/tools/record" | ||
|
||
clientset "k8s.io/client-go/kubernetes" | ||
typedv1core "k8s.io/client-go/kubernetes/typed/core/v1" | ||
) | ||
|
||
func createEventBroadcaster(config *rest.Config) (record.EventBroadcaster, error) { | ||
kubeClient, err := clientset.NewForConfig(config) | ||
if err != nil { | ||
return nil, errors.Wrap(err, "failed to get k8s client") | ||
} | ||
|
||
eventBroadcaster := record.NewBroadcaster() | ||
eventBroadcaster.StartLogging(logrus.Infof) | ||
// TODO: remove the wrapper when every clients have moved to use the clientset. | ||
eventBroadcaster.StartRecordingToSink(&typedv1core.EventSinkImpl{Interface: typedv1core.New(kubeClient.CoreV1().RESTClient()).Events("")}) | ||
|
||
return eventBroadcaster, nil | ||
} |
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