MCPcopy Create free account
hub / github.com/cloudtty/cloudtty / AddLabel

Function AddLabel

pkg/controllers/utils.go:61–69  ·  view source on GitHub ↗
(o metav1.Object, key, value string)

Source from the content-addressed store, hash-verified

59}
60
61func AddLabel(o metav1.Object, key, value string) {
62 labels := o.GetLabels()
63 if labels == nil {
64 labels = make(map[string]string)
65 }
66
67 labels[key] = truncateAndHashIfExceed(value)
68 o.SetLabels(labels)
69}
70
71func truncateAndHashIfExceed(input string) string {
72 if len(input) <= LabelMaxLength {

Callers 1

syncCloudShellMethod · 0.85

Calls 1

truncateAndHashIfExceedFunction · 0.85

Tested by

no test coverage detected