support labels for namespace and chart (#459)
This commit is contained in:
		
							parent
							
								
									abeccc5e8e
								
							
						
					
					
						commit
						fb256b0161
					
				|  | @ -295,6 +295,8 @@ The `selector` parameter can be specified multiple times. Each parameter is reso | ||||||
| 
 | 
 | ||||||
| `--selector tier=frontend --selector tier=backend` will select all the charts | `--selector tier=frontend --selector tier=backend` will select all the charts | ||||||
| 
 | 
 | ||||||
|  | In addition to user supplied labels the name, namespace, and chart are available to be used as selectors.  The chart will just be the chart name excluding the repository (Example `stable/filebeat` would be selected using `--selector chart=filebeat`). | ||||||
|  | 
 | ||||||
| ## Templates | ## Templates | ||||||
| 
 | 
 | ||||||
| You can use go's text/template expressions in `helmfile.yaml` and `values.yaml.gotmpl` (templated helm values files). `values.yaml` references will be used verbatim. In other words: | You can use go's text/template expressions in `helmfile.yaml` and `values.yaml.gotmpl` (templated helm values files). `values.yaml` references will be used verbatim. In other words: | ||||||
|  |  | ||||||
|  | @ -3,7 +3,6 @@ package state | ||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"github.com/roboll/helmfile/helmexec" |  | ||||||
| 	"io/ioutil" | 	"io/ioutil" | ||||||
| 	"os" | 	"os" | ||||||
| 	"path" | 	"path" | ||||||
|  | @ -12,6 +11,8 @@ import ( | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" | 	"strings" | ||||||
| 
 | 
 | ||||||
|  | 	"github.com/roboll/helmfile/helmexec" | ||||||
|  | 
 | ||||||
| 	"regexp" | 	"regexp" | ||||||
| 
 | 
 | ||||||
| 	"os/exec" | 	"os/exec" | ||||||
|  | @ -747,8 +748,12 @@ func (st *HelmState) FilterReleases(labels []string) error { | ||||||
| 		if r.Labels == nil { | 		if r.Labels == nil { | ||||||
| 			r.Labels = map[string]string{} | 			r.Labels = map[string]string{} | ||||||
| 		} | 		} | ||||||
| 		// Let the release name be used as a tag
 | 		// Let the release name, namespace, and chart be used as a tag
 | ||||||
| 		r.Labels["name"] = r.Name | 		r.Labels["name"] = r.Name | ||||||
|  | 		r.Labels["namespace"] = r.Namespace | ||||||
|  | 		// Strip off just the last portion for the name stable/newrelic would give newrelic
 | ||||||
|  | 		chartSplit := strings.Split(r.Chart, "/") | ||||||
|  | 		r.Labels["chart"] = chartSplit[len(chartSplit)-1] | ||||||
| 		for _, f := range filters { | 		for _, f := range filters { | ||||||
| 			if r.Labels == nil { | 			if r.Labels == nil { | ||||||
| 				r.Labels = map[string]string{} | 				r.Labels = map[string]string{} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue