feat(refacto): move everything in internal package
This allows to install katenary with `go install` and to clean up the project folder.
This commit is contained in:
34
internal/generator/labels.go
Normal file
34
internal/generator/labels.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package generator
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/katenary/katenary/internal/generator/labels"
|
||||
)
|
||||
|
||||
var componentLabel = labels.LabelName("component")
|
||||
|
||||
// GetLabels returns the labels for a service. It uses the appName to replace the __replace__ in the labels.
|
||||
// This is used to generate the labels in the templates.
|
||||
func GetLabels(serviceName, appName string) map[string]string {
|
||||
labels := map[string]string{
|
||||
componentLabel: serviceName,
|
||||
}
|
||||
|
||||
key := `{{- include "%s.labels" . | nindent __indent__ }}`
|
||||
labels[`__replace_`+serviceName] = fmt.Sprintf(key, appName)
|
||||
|
||||
return labels
|
||||
}
|
||||
|
||||
// GetMatchLabels returns the matchLabels for a service. It uses the appName to replace the __replace__ in the labels.
|
||||
// This is used to generate the matchLabels in the templates.
|
||||
func GetMatchLabels(serviceName, appName string) map[string]string {
|
||||
labels := map[string]string{
|
||||
componentLabel: serviceName,
|
||||
}
|
||||
|
||||
key := `{{- include "%s.selectorLabels" . | nindent __indent__ }}`
|
||||
labels[`__replace_`+serviceName] = fmt.Sprintf(key, appName)
|
||||
|
||||
return labels
|
||||
}
|
Reference in New Issue
Block a user