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

feat: add scheduling logic to zarf injector #1731

Merged

Conversation

ragingpastry
Copy link
Contributor

@ragingpastry ragingpastry commented May 18, 2023

Description

Checks to ensure that a node does not have a NoSchedule taint before choosing that node/image for the Zarf injector pod

Related Issue

Fixes #1730
Fixes #905

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Other (security config, docs update, etc)

Checklist before merging

Gave this a WAG. It seems to work locally, but am unsure if this is the direction you guys want to go. Let me know!

@netlify
Copy link

netlify bot commented May 18, 2023

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit 2e5b5c9
🔍 Latest deploy log https://app.netlify.com/sites/zarf-docs/deploys/646672fe4ca7c8000851f6c6

src/pkg/k8s/images.go Outdated Show resolved Hide resolved
src/pkg/k8s/nodes.go Outdated Show resolved Hide resolved
@ragingpastry ragingpastry force-pushed the zarf-injector-no-schedule branch 2 times, most recently from 5c6ae3e to eb8de6d Compare May 18, 2023 17:03
src/pkg/k8s/images.go Outdated Show resolved Hide resolved
Copy link
Contributor

@Racer159 Racer159 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't request it as a suggestion in this PR but one tiny thing after testing locally: Can you make the spinner for gathering images notify the user of the 5 minute timeout since they may hit that if all nodes have taints (similar to how waiting for cluster connection works)?

image
image

https://github.com/defenseunicorns/zarf/blob/main/src/internal/cluster/injector.go#L44

	// Get all the images from the cluster
	timeout := 5 * time.Minute
	spinner.Updatef("Getting the list of existing cluster images (%s timeout)", timeout.String())")
	if images, err = c.Kube.GetAllImages(timeout); err != nil {

https://github.com/defenseunicorns/zarf/blob/main/src/pkg/k8s/images.go#L22

func (k *K8s) GetAllImages(timeoutDuration time.Duration) (ImageNodeMap, error) {
	timeout := time.After(timeoutDuration)

Copy link
Contributor

@Racer159 Racer159 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@Noxsios Noxsios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Racer159 Racer159 merged commit d7e0cfd into defenseunicorns:main May 18, 2023
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants