Skip to content

Commit

Permalink
Merge pull request #62 from miscord-dev/fix-bugs
Browse files Browse the repository at this point in the history
Fix bugs
  • Loading branch information
tsuzu authored Mar 13, 2023
2 parents 71f2aca + 1788724 commit eb0f67a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tetrad/controllers/peernodesync_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (r *PeerNodeSyncReconciler) labels() map[string]string {
}

func (r *PeerNodeSyncReconciler) addrsLabels() map[string]string {
return labels.NodeTypeForNode(r.ClusterName, r.NodeName)
return labels.NodeTypeForNode(r.ClusterName, r.NodeName, "")
}

func peerNodeName(clusterName, nodeName string) string {
Expand Down
2 changes: 1 addition & 1 deletion tetrad/controllers/peerssync_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func (r *PeersSyncReconciler) labels() map[string]string {
}

func (r *PeersSyncReconciler) addressLabels() map[string]string {
return tetrapodlabels.NodeTypeForNode(r.ClusterName, r.NodeName)
return tetrapodlabels.NodeTypeForNode(r.ClusterName, r.NodeName, "")
}

// SetupWithManager sets up the controller with the Manager.
Expand Down
2 changes: 1 addition & 1 deletion tetrad/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func main() {
return name[:53-9] + "-" + hex.EncodeToString(hash[:])[:8]
},
Labels: func(templateName string) map[string]string {
return labels.NodeTypeForNode(config.ClusterName, config.NodeName)
return labels.NodeTypeForNode(config.ClusterName, config.NodeName, templateName)
},
}).SetupWithManager(mgr, "NodeAddressSync"); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "CIDRClaimer")
Expand Down
4 changes: 4 additions & 0 deletions tetrad/pkg/cniserver/cniserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ type GetExtraPodCIDRsArgs struct {
}

func (h *Handler) GetExtraPodCIDRs(args *GetExtraPodCIDRsArgs, cidrClaims *controlplanev1alpha1.CIDRClaimList) error {
if h.localCache == nil {
return nil
}

fn := func() error {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
Expand Down
5 changes: 4 additions & 1 deletion tetrad/pkg/labels/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ func ForNode(clusterName, nodeName string) map[string]string {
}
}

func NodeTypeForNode(clusterName, nodeName string) map[string]string {
func NodeTypeForNode(clusterName, nodeName, templateName string) map[string]string {
labels := ForNode(clusterName, nodeName)

labels["client.miscord.win/type"] = "node"
if templateName != "" {
labels[TemplateNameLabelKey] = templateName
}

return labels
}
Expand Down

0 comments on commit eb0f67a

Please sign in to comment.