Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimized error and normal prompts when creating daemonSet exceptions #195

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions utils/clusterutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func getDaemonset(deployment *appsv1.Deployment) *appsv1.DaemonSet {

// Create the daemonset, using to-be-cached images as init containers. Blocks
// until daemonset is ready.
func createDaemonset(clientset *kubernetes.Clientset) error {
func createDaemonsetOrDie(clientset *kubernetes.Clientset) {
cfg := cfg.GetConfig()
thisDeployment := getImagePullerDeployment(clientset)
toCreate := getDaemonset(thisDeployment)
Expand All @@ -161,8 +161,9 @@ func createDaemonset(clientset *kubernetes.Clientset) error {
if watchErr != nil {
log.Printf("Unable to watch daemonset for readiness, falling back to manually checking.")
checkDaemonsetReadiness(clientset)
} else {
log.Printf("Daemonset ready.")
}
return err
}

// Wait for daemonset to be ready (MODIFIED event with all nodes scheduled)
Expand Down
9 changes: 2 additions & 7 deletions utils/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,15 @@ import (
func CacheImages(clientset *kubernetes.Clientset) {
log.Printf("Starting caching process")
// Create daemonset, wait for it to be ready
if err := createDaemonset(clientset); err != nil {
log.Printf("Could not create Daemonset: %v", err)
}
log.Printf("Daemonset ready.")
createDaemonsetOrDie(clientset)
}

// RefreshCache forces a refresh of all pods in the daemonset, to ensure images
// with mutable tags (e.g. nightlies) are up-to-date.
func RefreshCache(clientset *kubernetes.Clientset) {
log.Printf("Refreshing cached images")
DeleteDaemonsetIfExists(clientset)
if err := createDaemonset(clientset); err != nil {
chriskery marked this conversation as resolved.
Show resolved Hide resolved
log.Printf("Could not create Daemonset: %v", err)
}
CacheImages(clientset)
log.Printf("Refreshed images")
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.