Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(examples): add labels and antiAffinity to k8s example#5763

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
coadler merged 4 commits intomainfromcolin/k8s-example-anti-affinity
Jan 18, 2023

Conversation

coadler
Copy link
Contributor

No description provided.

@coadlercoadler self-assigned thisJan 17, 2023
Comment on lines +110 to +112
"app.kubernetes.io/name" = "coder-workspace"
"app.kubernetes.io/instance" = "coder-workspace-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
"app.kubernetes.io/part-of" = "coder"
Copy link
Member

Choose a reason for hiding this comment

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

Should add some more labels similar to what we do in v1 for workspace details. Should add these to the PVC too.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Added the labels I could from v1

$ kdpo coder-colin-geaName:             coder-colin-geaNamespace:        colin-coderPriority:         0Service Account:  defaultNode:             gke-dev-4-2-coder-node-pool-8b0aaa9c-wfg6/10.1.0.102Start Time:       Wed, 18 Jan 2023 10:49:01 -0600Labels:           app.kubernetes.io/instance=coder-workspace-colin-gea                  app.kubernetes.io/name=coder-workspace                  app.kubernetes.io/part-of=coder                  com.coder.resource=true                  com.coder.user=b851db54-9827-45bc-b453-72138b46f99c                  com.coder.username=colin                  com.coder.workspace.id=8118ca50-2edc-4b7c-8b70-61b3c7c3673d                  com.coder.workspace.name=gea
$ kd pvc coder-colin-gea-homeName:          coder-colin-gea-homeNamespace:     colin-coderStorageClass:  standardStatus:        BoundVolume:        pvc-d6612185-b553-459a-9c85-acce9bf33cc2Labels:        app.kubernetes.io/instance=coder-pvc-colin-gea               app.kubernetes.io/name=coder-pvc               app.kubernetes.io/part-of=coder               com.coder.resource=true               com.coder.workspace.id=8118ca50-2edc-4b7c-8b70-61b3c7c3673d               com.coder.workspace.name=gea

Comment on lines 146 to 161
affinity {
pod_anti_affinity {
preferred_during_scheduling_ignored_during_execution {
weight = 1
pod_affinity_term {
topology_key = "kubernetes.io/hostname"
label_selector {
match_expressions {
key = "app.kubernetes.io/name"
operator = "In"
values = ["coder-workspace"]
}
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused, because wouldn't this fail for the defaults on most Kubernetes cluster that don't have the hostname ofcoder-workspace?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

It's matching pods that haveapp.kubernetes.io/name: coder-workspace, summing the amount partitioned by hostname. Our helm chart has something similar

Copy link
Member

Choose a reason for hiding this comment

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

Ahh, I see. So even if you didn't deploy Coder with Kubernetes, this would still work? We should add a comment here.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

This is part of thespec, so I imagine any k8s-like apis would also implement this. I found some references to it in the openshift docs:https://docs.openshift.com/container-platform/4.8/nodes/scheduling/nodes-scheduler-node-selectors.html#nodes-scheduler-node-selectors-about_nodes-scheduler-node-selectors

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Oh I think I understand your question. This doesn't have anything to do with how Coder itself is deployed.

@coadlercoadlerenabled auto-merge (squash)January 18, 2023 16:55
"com.coder.workspace.id" = data.coder_workspace.me.id
"com.coder.workspace.name" = data.coder_workspace.me.name
"com.coder.user.id" = data.coder_workspace.me.owner_id
"com.coder.user.username" = data.coder_workspace.me.owner
Copy link
Member

Choose a reason for hiding this comment

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

email too, we provide email asowner_email

@coadlercoadler merged commit6ed4e21 intomainJan 18, 2023
@coadlercoadler deleted the colin/k8s-example-anti-affinity branchJanuary 18, 2023 17:01
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJan 18, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@kylecarbskylecarbskylecarbs left review comments

@deansheatherdeansheatherdeansheather approved these changes

Assignees

@coadlercoadler

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@coadler@kylecarbs@deansheather

[8]ページ先頭

©2009-2025 Movatter.jp