-
Notifications
You must be signed in to change notification settings - Fork 27
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
[WIP] Adding starter code for clustersets #109
Conversation
cli/cmds/cluster/delete.go
Outdated
@@ -29,6 +29,10 @@ func delete(clx *cli.Context) error { | |||
if err != nil { | |||
return err | |||
} | |||
namespace := "default" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use pkg/controller/util package and add the defaultNamespace there as a constant like we do with the K3kSystemNamespace
} | ||
|
||
if err := cluster.AddPodController(ctx, mgr); err != nil { | ||
klog.Fatalf("Failed to add the new cluster controller: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
klog.Fatalf("Failed to add the new cluster controller: %v", err) | |
klog.Fatalf("Failed to add the new pod controller: %v", err) |
the agent nodes | ||
type: object | ||
type: object | ||
defaultNodeSelector: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the defaults I think we need to add a validation here so that they can't be empty, or in the code to have default values for default limits and default node selector
return fmt.Errorf("error when finding cluster set: %w", err) | ||
} | ||
if !found { | ||
// this cluster isn't in a cluster set, don't apply any defaults |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add a log here stating that not just a comment
1cf73c5
to
1cb8651
Compare
Adds types for cluster sets, which allows constraining a few elements of clusters including: overall resource usage, and which nodes it can use.
Closed in favor of #128 |
This PR is a POC of adding a clusterset type that allows admins to selectively limit the Resources that a given group of clusters can consume.
Overview
Limit
field allowing users to specify the server/agent limits (separately) that apply to each replica. Note that this is applied separately to each replica - so with 2 agents and a limit of 1 CPU for the worker node, each agent will get a limit of 1 CPU for a cluster-wide total of 2 CPU.MaxLimits
provides an upper limit for the limits in the cluster. Note that this works like the limits from aResourceQuota
- if no limit is specified for that resource, clusters in this set have no limit. These limits are the sum across all servers/workers.DefaultLimits
provides the defaults for new clusters which don't specify a limit (mostly a UX item so that new clusters don't need to explicitly set these values).DefaultNodeSelector
provides a starting node selector for all clusters in the set.Using/testing
make build
.docker build -f package/Dockerfile . -t $REPO/$IMAGE:$TAG
image.repostory: $REPO/$IMAGE
andtag: $TAG
openssl genrsa -out rootCAKey.pem 4096
.openssl req -x509 -sha256 -nodes -key rootCAKey.pem -days 3650 -out rootCACert.pem --addext "subjectAltName=DNS:k3k-webhook.k3k-system.svc"
.cat rootCACert.pem | base64 | tr -d '\n'
kubectl create -f ns.yaml && k create secret tls webhook-secret -n k3k-system --cert=rootCACert.pem --key=rootCAKey.pem
. See below for the namespace (needs helm annotations to be imported when installing the chart).helm install k3k ./charts/k3k -n k3k-system
Note
--disable-agent
on the server nodes by default (or even by force), which would prevent users from scheduling pods on the server node.