Skip to content

Commit

Permalink
chore: remove k8s master label
Browse files Browse the repository at this point in the history
Since talos now defaults to k8s 1.27, remove the handling
of `master` label for controlplane nodes.

Signed-off-by: Noel Georgi <git@frezbo.dev>
  • Loading branch information
frezbo committed Apr 25, 2023
1 parent e296a56 commit cad43f0
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,6 @@ func getDiscoveryMemberList(ctx context.Context, runtime runtime.Runtime) ([]*cl

func isControlPlaneNode(node *corev1.Node) bool {
for key := range node.Labels {
if key == constants.LabelNodeRoleMaster {
return true
}

if key == constants.LabelNodeRoleControlPlane {
return true
}
Expand Down
3 changes: 0 additions & 3 deletions internal/app/machined/pkg/controllers/k8s/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,6 @@ spec:
serviceAccountName: coredns
priorityClassName: system-cluster-critical
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
Expand Down
2 changes: 1 addition & 1 deletion internal/integration/provision/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ func (suite *UpgradeSuite) untaint(name string) {
k := 0

for _, taint := range n.Spec.Taints {
if taint.Key != constants.LabelNodeRoleMaster && taint.Key != constants.LabelNodeRoleControlPlane {
if taint.Key != constants.LabelNodeRoleControlPlane {
n.Spec.Taints[k] = taint
k++
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/check/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func K8sFullControlPlaneAssertion(ctx context.Context, cl ClusterInfo) error {

for _, node := range nodes.Items {
for label := range node.Labels {
if label == constants.LabelNodeRoleMaster || label == constants.LabelNodeRoleControlPlane {
if label == constants.LabelNodeRoleControlPlane {
var internalIP netip.Addr

var ips []netip.Addr
Expand Down
10 changes: 3 additions & 7 deletions pkg/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,15 @@ func (h *Client) NodeIPs(ctx context.Context, machineType machine.Type) (addrs [
addrs = []string{}

for _, node := range resp.Items {
_, labelMaster := node.Labels[constants.LabelNodeRoleMaster]
_, labelControlPlane := node.Labels[constants.LabelNodeRoleControlPlane]

var skip bool

switch machineType {
case machine.TypeInit, machine.TypeControlPlane:
skip = !(labelMaster || labelControlPlane)
skip = !labelControlPlane
case machine.TypeWorker:
skip = labelMaster || labelControlPlane
skip = labelControlPlane
case machine.TypeUnknown:
fallthrough
default:
Expand Down Expand Up @@ -205,14 +204,11 @@ func (h *Client) LabelNodeAsControlPlane(ctx context.Context, name string, taint
}

n.Labels[constants.LabelNodeRoleControlPlane] = ""
// TODO: frezbo
// remove all references to `constants.LabelNodeRoleMaster` when Talos supports k8s v1.27
delete(n.Labels, constants.LabelNodeRoleMaster)

newTaints := make([]corev1.Taint, 0, len(n.Spec.Taints))

for _, taint := range n.Spec.Taints {
if taint.Key == constants.LabelNodeRoleMaster || taint.Key == constants.LabelNodeRoleControlPlane {
if taint.Key == constants.LabelNodeRoleControlPlane {
continue
}

Expand Down
3 changes: 0 additions & 3 deletions pkg/machinery/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,6 @@ const (
// renovate: datasource=github-releases depName=coredns/coredns
DefaultCoreDNSVersion = "1.10.1"

// LabelNodeRoleMaster is the node label required by a control plane node.
LabelNodeRoleMaster = "node-role.kubernetes.io/master"

// LabelNodeRoleControlPlane is the node label required by a control plane node.
LabelNodeRoleControlPlane = "node-role.kubernetes.io/control-plane"

Expand Down

0 comments on commit cad43f0

Please sign in to comment.