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

Make per-namespace Quotas configurable #16

Closed
blairdrummond opened this issue Nov 24, 2021 · 2 comments · Fixed by #21
Closed

Make per-namespace Quotas configurable #16

blairdrummond opened this issue Nov 24, 2021 · 2 comments · Fixed by #21
Assignees
Labels
size/L 4-5 days

Comments

@blairdrummond
Copy link
Contributor

As per this: https://www.youtube.com/watch?v=KUyEuY5ZSqI&t=653s

It would make sense for the metadata to be stored within the Profile metadata? Maybe?

The exact location of the metadata isn't super important, as long as it cannot be modified by users. We should decide on and implement this, incorporating it with the design of aaw-kubeflow-profiles to keep the quotas in CI.

@zachomedia
Copy link
Contributor

zachomedia commented Nov 24, 2021

@blairdrummond My thought for the easiest implementation was to use a label on the Profile to store "overrides" to the resource quotas, so like quotas.statcan.gc.ca/gpu-override: 2 for example.

(reason for a label over an annotation is we could do filters in the future to see what profiles have overridden limits)

@chuckbelisle
Copy link

chuckbelisle commented Jan 28, 2022

@rohank07
As discussed earlier, the block of code that needs to be changed is located in this statcan/aaw-kubeflow-profiles-controller/cmd/quotas.go

// generateResourceQuotas generates resource quotas for the given profile.
// TODO: Allow overrides in a namespace
func generateResourceQuotas(profile *kubeflowv1.Profile) []*corev1.ResourceQuota {
	quotas := []*corev1.ResourceQuota{}

	quotas = append(quotas, &corev1.ResourceQuota{
		ObjectMeta: metav1.ObjectMeta{
			Name:      "quotas",
			Namespace: profile.Name,
			OwnerReferences: []metav1.OwnerReference{
				*metav1.NewControllerRef(profile, kubeflowv1.SchemeGroupVersion.WithKind("Profile")),
			},
		},
		Spec: corev1.ResourceQuotaSpec{
			Hard: corev1.ResourceList{
				// CPU
				"requests.cpu": *resource.NewQuantity(70, resource.DecimalSI),
				"limits.cpu":   *resource.NewQuantity(70, resource.DecimalSI),

				// Memory
				"requests.memory": *resource.NewScaledQuantity(368, resource.Giga),
				"limits.memory":   *resource.NewScaledQuantity(368, resource.Giga),

				// Storage
				"requests.storage": *resource.NewScaledQuantity(4, resource.Tera),

				// GPU
				"requests.nvidia.com/gpu": *resource.NewQuantity(2, resource.DecimalSI),

				// Pods
				"pods": *resource.NewQuantity(100, resource.DecimalSI),

				// Services
				"services.nodeports":     *resource.NewQuantity(0, resource.DecimalSI),
				"services.loadbalancers": *resource.NewQuantity(0, resource.DecimalSI),
			},
		},
	})

	return quotas
}

When the profile is created, the default quotas are applied and the the labels included in the profile.jsonnet are also added/override those affected defaults.

Storage label name: quotas.statcan.gc.ca/requests.storage

All that would then be required would be to add quotas.statcan.gc.ca/requests.storage: 8 to requested profile in order to allow 8TB of storage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L 4-5 days
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants