(key, value string)
| 25 | const xSecretPrefix = "x-secret" |
| 26 | |
| 27 | func parseXSecretLabel(key, value string) (string, string, error) { |
| 28 | if !strings.HasPrefix(key, xSecretPrefix+":") { |
| 29 | return "", "", fmt.Errorf("label does not start with x-secret: %s", key) |
| 30 | } |
| 31 | name := strings.TrimPrefix(key, xSecretPrefix+":") |
| 32 | if !strings.HasPrefix(value, "/") { |
| 33 | return "", "", fmt.Errorf("%s is not an absolute path", value) |
| 34 | } |
| 35 | return name, filepath.ToSlash(value), nil |
| 36 | } |
| 37 | |
| 38 | func SecretMapFromLabels(labels map[string]string) map[string]string { |
| 39 | result := make(map[string]string) |
no test coverage detected