Merge branch 'main' into update-strategy-feature
Signed-off-by: Simon Bouchard <sbouchard@rbbn.com>
This commit is contained in:
		
						commit
						767cdb9497
					
				|  | @ -52,6 +52,7 @@ func NewDiffCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||||
| 	f.StringArrayVar(&diffOptions.Suppress, "suppress", nil, "suppress specified Kubernetes objects in the output. Can be provided multiple times. For example: --suppress KeycloakClient --suppress VaultSecret") | 	f.StringArrayVar(&diffOptions.Suppress, "suppress", nil, "suppress specified Kubernetes objects in the output. Can be provided multiple times. For example: --suppress KeycloakClient --suppress VaultSecret") | ||||||
| 	f.BoolVar(&diffOptions.ReuseValues, "reuse-values", false, `Override helmDefaults.reuseValues "helm diff upgrade --install --reuse-values"`) | 	f.BoolVar(&diffOptions.ReuseValues, "reuse-values", false, `Override helmDefaults.reuseValues "helm diff upgrade --install --reuse-values"`) | ||||||
| 	f.BoolVar(&diffOptions.ResetValues, "reset-values", false, `Override helmDefaults.reuseValues "helm diff upgrade --install --reset-values"`) | 	f.BoolVar(&diffOptions.ResetValues, "reset-values", false, `Override helmDefaults.reuseValues "helm diff upgrade --install --reset-values"`) | ||||||
|  | 	f.BoolVar(&diffOptions.TakeOwnership, "take-ownership", false, "add --take-ownership flag to helm") | ||||||
| 	f.StringVar(&diffOptions.PostRenderer, "post-renderer", "", `pass --post-renderer to "helm template" or "helm upgrade --install"`) | 	f.StringVar(&diffOptions.PostRenderer, "post-renderer", "", `pass --post-renderer to "helm template" or "helm upgrade --install"`) | ||||||
| 	f.StringArrayVar(&diffOptions.PostRendererArgs, "post-renderer-args", nil, `pass --post-renderer-args to "helm template" or "helm upgrade --install"`) | 	f.StringArrayVar(&diffOptions.PostRendererArgs, "post-renderer-args", nil, `pass --post-renderer-args to "helm template" or "helm upgrade --install"`) | ||||||
| 	f.StringArrayVar(&diffOptions.SuppressOutputLineRegex, "suppress-output-line-regex", nil, "a list of regex patterns to suppress output lines from the diff output") | 	f.StringArrayVar(&diffOptions.SuppressOutputLineRegex, "suppress-output-line-regex", nil, "a list of regex patterns to suppress output lines from the diff output") | ||||||
|  |  | ||||||
							
								
								
									
										16
									
								
								go.mod
								
								
								
								
							
							
						
						
									
										16
									
								
								go.mod
								
								
								
								
							|  | @ -1,6 +1,6 @@ | ||||||
| module github.com/helmfile/helmfile | module github.com/helmfile/helmfile | ||||||
| 
 | 
 | ||||||
| go 1.24 | go 1.24.2 | ||||||
| 
 | 
 | ||||||
| require ( | require ( | ||||||
| 	dario.cat/mergo v1.0.1 | 	dario.cat/mergo v1.0.1 | ||||||
|  | @ -30,7 +30,7 @@ require ( | ||||||
| 	golang.org/x/term v0.31.0 | 	golang.org/x/term v0.31.0 | ||||||
| 	gopkg.in/yaml.v2 v2.4.0 | 	gopkg.in/yaml.v2 v2.4.0 | ||||||
| 	helm.sh/helm/v3 v3.17.3 | 	helm.sh/helm/v3 v3.17.3 | ||||||
| 	k8s.io/apimachinery v0.32.4 | 	k8s.io/apimachinery v0.33.0 | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| require ( | require ( | ||||||
|  | @ -99,11 +99,11 @@ require ( | ||||||
| 	golang.org/x/oauth2 v0.28.0 // indirect | 	golang.org/x/oauth2 v0.28.0 // indirect | ||||||
| 	golang.org/x/sys v0.32.0 // indirect | 	golang.org/x/sys v0.32.0 // indirect | ||||||
| 	golang.org/x/text v0.23.0 // indirect | 	golang.org/x/text v0.23.0 // indirect | ||||||
| 	golang.org/x/time v0.8.0 // indirect | 	golang.org/x/time v0.9.0 // indirect | ||||||
| 	google.golang.org/api v0.215.0 // indirect | 	google.golang.org/api v0.215.0 // indirect | ||||||
| 	google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect | 	google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect | ||||||
| 	google.golang.org/grpc v1.68.0 // indirect | 	google.golang.org/grpc v1.68.0 // indirect | ||||||
| 	google.golang.org/protobuf v1.36.1 // indirect | 	google.golang.org/protobuf v1.36.5 // indirect | ||||||
| 	gopkg.in/ini.v1 v1.67.0 // indirect | 	gopkg.in/ini.v1 v1.67.0 // indirect | ||||||
| 	sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect | 	sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect | ||||||
| 	sigs.k8s.io/yaml v1.4.0 // indirect | 	sigs.k8s.io/yaml v1.4.0 // indirect | ||||||
|  | @ -222,9 +222,8 @@ require ( | ||||||
| 	github.com/gogo/protobuf v1.3.2 // indirect | 	github.com/gogo/protobuf v1.3.2 // indirect | ||||||
| 	github.com/golang-jwt/jwt/v5 v5.2.2 // indirect | 	github.com/golang-jwt/jwt/v5 v5.2.2 // indirect | ||||||
| 	github.com/google/btree v1.0.1 // indirect | 	github.com/google/btree v1.0.1 // indirect | ||||||
| 	github.com/google/gnostic-models v0.6.8 // indirect | 	github.com/google/gnostic-models v0.6.9 // indirect | ||||||
| 	github.com/google/go-jsonnet v0.20.0 // indirect | 	github.com/google/go-jsonnet v0.20.0 // indirect | ||||||
| 	github.com/google/gofuzz v1.2.0 // indirect |  | ||||||
| 	github.com/google/s2a-go v0.1.8 // indirect | 	github.com/google/s2a-go v0.1.8 // indirect | ||||||
| 	github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect | 	github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect | ||||||
| 	github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect | 	github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect | ||||||
|  | @ -316,11 +315,12 @@ require ( | ||||||
| 	k8s.io/client-go v0.32.3 // indirect | 	k8s.io/client-go v0.32.3 // indirect | ||||||
| 	k8s.io/component-base v0.32.2 // indirect | 	k8s.io/component-base v0.32.2 // indirect | ||||||
| 	k8s.io/klog/v2 v2.130.1 // indirect | 	k8s.io/klog/v2 v2.130.1 // indirect | ||||||
| 	k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect | 	k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect | ||||||
| 	k8s.io/kubectl v0.32.2 // indirect | 	k8s.io/kubectl v0.32.2 // indirect | ||||||
| 	k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect | 	k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect | ||||||
| 	oras.land/oras-go v1.2.5 // indirect | 	oras.land/oras-go v1.2.5 // indirect | ||||||
| 	sigs.k8s.io/kustomize/api v0.18.0 // indirect | 	sigs.k8s.io/kustomize/api v0.18.0 // indirect | ||||||
| 	sigs.k8s.io/kustomize/kyaml v0.18.1 // indirect | 	sigs.k8s.io/kustomize/kyaml v0.18.1 // indirect | ||||||
| 	sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect | 	sigs.k8s.io/randfill v1.0.0 // indirect | ||||||
|  | 	sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect | ||||||
| ) | ) | ||||||
|  |  | ||||||
							
								
								
									
										31
									
								
								go.sum
								
								
								
								
							
							
						
						
									
										31
									
								
								go.sum
								
								
								
								
							|  | @ -1080,8 +1080,8 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ | ||||||
| github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= | github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= | ||||||
| github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= | github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= | ||||||
| github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= | github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= | ||||||
| github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= | github.com/google/gnostic-models v0.6.9 h1:MU/8wDLif2qCXZmzncUQ/BOfxWfthHi63KqpoNbWqVw= | ||||||
| github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= | github.com/google/gnostic-models v0.6.9/go.mod h1:CiWsm0s6BSQd1hRn8/QmxqB6BesYcbSZxsz9b0KuDBw= | ||||||
| github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= | ||||||
| github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= | ||||||
| github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= | ||||||
|  | @ -1444,8 +1444,8 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L | ||||||
| github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= | github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= | ||||||
| github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= | github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= | ||||||
| github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= | github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= | ||||||
| github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= | github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= | ||||||
| github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= | github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= | ||||||
| github.com/rubenv/sql-migrate v1.7.1 h1:f/o0WgfO/GqNuVg+6801K/KW3WdDSupzSjDYODmiUq4= | github.com/rubenv/sql-migrate v1.7.1 h1:f/o0WgfO/GqNuVg+6801K/KW3WdDSupzSjDYODmiUq4= | ||||||
| github.com/rubenv/sql-migrate v1.7.1/go.mod h1:Ob2Psprc0/3ggbM6wCzyYVFFuc6FyZrb2AS+ezLDFb4= | github.com/rubenv/sql-migrate v1.7.1/go.mod h1:Ob2Psprc0/3ggbM6wCzyYVFFuc6FyZrb2AS+ezLDFb4= | ||||||
| github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= | github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= | ||||||
|  | @ -1932,8 +1932,8 @@ golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxb | ||||||
| golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= | golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= | ||||||
| golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= | golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= | ||||||
| golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= | golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= | ||||||
| golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= | golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= | ||||||
| golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= | golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= | ||||||
| golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | ||||||
| golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | ||||||
| golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | ||||||
|  | @ -2285,8 +2285,8 @@ google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw | ||||||
| google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= | google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= | ||||||
| google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= | google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= | ||||||
| google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= | google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= | ||||||
| google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk= | google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= | ||||||
| google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= | google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= | ||||||
| gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= | gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= | ||||||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||||
| gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||||
|  | @ -2328,8 +2328,8 @@ k8s.io/api v0.32.3 h1:Hw7KqxRusq+6QSplE3NYG4MBxZw1BZnq4aP4cJVINls= | ||||||
| k8s.io/api v0.32.3/go.mod h1:2wEDTXADtm/HA7CCMD8D8bK4yuBUptzaRhYcYEEYA3k= | k8s.io/api v0.32.3/go.mod h1:2wEDTXADtm/HA7CCMD8D8bK4yuBUptzaRhYcYEEYA3k= | ||||||
| k8s.io/apiextensions-apiserver v0.32.2 h1:2YMk285jWMk2188V2AERy5yDwBYrjgWYggscghPCvV4= | k8s.io/apiextensions-apiserver v0.32.2 h1:2YMk285jWMk2188V2AERy5yDwBYrjgWYggscghPCvV4= | ||||||
| k8s.io/apiextensions-apiserver v0.32.2/go.mod h1:GPwf8sph7YlJT3H6aKUWtd0E+oyShk/YHWQHf/OOgCA= | k8s.io/apiextensions-apiserver v0.32.2/go.mod h1:GPwf8sph7YlJT3H6aKUWtd0E+oyShk/YHWQHf/OOgCA= | ||||||
| k8s.io/apimachinery v0.32.4 h1:8EEksaxA7nd7xWJkkwLDN4SvWS5ot9g6Z/VZb3ju25I= | k8s.io/apimachinery v0.33.0 h1:1a6kHrJxb2hs4t8EE5wuR/WxKDwGN1FKH3JvDtA0CIQ= | ||||||
| k8s.io/apimachinery v0.32.4/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= | k8s.io/apimachinery v0.33.0/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM= | ||||||
| k8s.io/cli-runtime v0.32.2 h1:aKQR4foh9qeyckKRkNXUccP9moxzffyndZAvr+IXMks= | k8s.io/cli-runtime v0.32.2 h1:aKQR4foh9qeyckKRkNXUccP9moxzffyndZAvr+IXMks= | ||||||
| k8s.io/cli-runtime v0.32.2/go.mod h1:a/JpeMztz3xDa7GCyyShcwe55p8pbcCVQxvqZnIwXN8= | k8s.io/cli-runtime v0.32.2/go.mod h1:a/JpeMztz3xDa7GCyyShcwe55p8pbcCVQxvqZnIwXN8= | ||||||
| k8s.io/client-go v0.32.3 h1:RKPVltzopkSgHS7aS98QdscAgtgah/+zmpAogooIqVU= | k8s.io/client-go v0.32.3 h1:RKPVltzopkSgHS7aS98QdscAgtgah/+zmpAogooIqVU= | ||||||
|  | @ -2338,8 +2338,8 @@ k8s.io/component-base v0.32.2 h1:1aUL5Vdmu7qNo4ZsE+569PV5zFatM9hl+lb3dEea2zU= | ||||||
| k8s.io/component-base v0.32.2/go.mod h1:PXJ61Vx9Lg+P5mS8TLd7bCIr+eMJRQTyXe8KvkrvJq0= | k8s.io/component-base v0.32.2/go.mod h1:PXJ61Vx9Lg+P5mS8TLd7bCIr+eMJRQTyXe8KvkrvJq0= | ||||||
| k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= | k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= | ||||||
| k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= | k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= | ||||||
| k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= | k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff h1:/usPimJzUKKu+m+TE36gUyGcf03XZEP0ZIKgKj35LS4= | ||||||
| k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= | k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff/go.mod h1:5jIi+8yX4RIb8wk3XwBo5Pq2ccx4FP10ohkbSKCZoK8= | ||||||
| k8s.io/kubectl v0.32.2 h1:TAkag6+XfSBgkqK9I7ZvwtF0WVtUAvK8ZqTt+5zi1Us= | k8s.io/kubectl v0.32.2 h1:TAkag6+XfSBgkqK9I7ZvwtF0WVtUAvK8ZqTt+5zi1Us= | ||||||
| k8s.io/kubectl v0.32.2/go.mod h1:+h/NQFSPxiDZYX/WZaWw9fwYezGLISP0ud8nQKg+3g8= | k8s.io/kubectl v0.32.2/go.mod h1:+h/NQFSPxiDZYX/WZaWw9fwYezGLISP0ud8nQKg+3g8= | ||||||
| k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= | k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= | ||||||
|  | @ -2390,7 +2390,10 @@ sigs.k8s.io/kustomize/api v0.18.0 h1:hTzp67k+3NEVInwz5BHyzc9rGxIauoXferXyjv5lWPo | ||||||
| sigs.k8s.io/kustomize/api v0.18.0/go.mod h1:f8isXnX+8b+SGLHQ6yO4JG1rdkZlvhaCf/uZbLVMb0U= | sigs.k8s.io/kustomize/api v0.18.0/go.mod h1:f8isXnX+8b+SGLHQ6yO4JG1rdkZlvhaCf/uZbLVMb0U= | ||||||
| sigs.k8s.io/kustomize/kyaml v0.18.1 h1:WvBo56Wzw3fjS+7vBjN6TeivvpbW9GmRaWZ9CIVmt4E= | sigs.k8s.io/kustomize/kyaml v0.18.1 h1:WvBo56Wzw3fjS+7vBjN6TeivvpbW9GmRaWZ9CIVmt4E= | ||||||
| sigs.k8s.io/kustomize/kyaml v0.18.1/go.mod h1:C3L2BFVU1jgcddNBE1TxuVLgS46TjObMwW5FT9FcjYo= | sigs.k8s.io/kustomize/kyaml v0.18.1/go.mod h1:C3L2BFVU1jgcddNBE1TxuVLgS46TjObMwW5FT9FcjYo= | ||||||
| sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= | sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= | ||||||
| sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= | sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= | ||||||
|  | sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= | ||||||
|  | sigs.k8s.io/structured-merge-diff/v4 v4.6.0 h1:IUA9nvMmnKWcj5jl84xn+T5MnlZKThmUW1TdblaLVAc= | ||||||
|  | sigs.k8s.io/structured-merge-diff/v4 v4.6.0/go.mod h1:dDy58f92j70zLsuZVuUX5Wp9vtxXpaZnkPGWeqDfCps= | ||||||
| sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= | sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= | ||||||
| sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= | sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= | ||||||
|  |  | ||||||
|  | @ -1390,6 +1390,7 @@ func (a *App) apply(r *Run, c ApplyConfigProvider) (bool, bool, []error) { | ||||||
| 		PostRendererArgs:        c.PostRendererArgs(), | 		PostRendererArgs:        c.PostRendererArgs(), | ||||||
| 		SkipSchemaValidation:    c.SkipSchemaValidation(), | 		SkipSchemaValidation:    c.SkipSchemaValidation(), | ||||||
| 		SuppressOutputLineRegex: c.SuppressOutputLineRegex(), | 		SuppressOutputLineRegex: c.SuppressOutputLineRegex(), | ||||||
|  | 		TakeOwnership:           c.TakeOwnership(), | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	infoMsg, releasesToBeUpdated, releasesToBeReinstalled, releasesToBeDeleted, errs := r.diff(false, detailedExitCode, c, diffOpts) | 	infoMsg, releasesToBeUpdated, releasesToBeReinstalled, releasesToBeDeleted, errs := r.diff(false, detailedExitCode, c, diffOpts) | ||||||
|  | @ -1643,6 +1644,7 @@ func (a *App) diff(r *Run, c DiffConfigProvider) (*string, bool, bool, []error) | ||||||
| 			PostRendererArgs:        c.PostRendererArgs(), | 			PostRendererArgs:        c.PostRendererArgs(), | ||||||
| 			SkipSchemaValidation:    c.SkipSchemaValidation(), | 			SkipSchemaValidation:    c.SkipSchemaValidation(), | ||||||
| 			SuppressOutputLineRegex: c.SuppressOutputLineRegex(), | 			SuppressOutputLineRegex: c.SuppressOutputLineRegex(), | ||||||
|  | 			TakeOwnership:           c.TakeOwnership(), | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		filtered := &Run{ | 		filtered := &Run{ | ||||||
|  |  | ||||||
|  | @ -157,6 +157,7 @@ type DiffConfigProvider interface { | ||||||
| 	NoColor() bool | 	NoColor() bool | ||||||
| 	Context() int | 	Context() int | ||||||
| 	DiffOutput() string | 	DiffOutput() string | ||||||
|  | 	TakeOwnership() bool | ||||||
| 
 | 
 | ||||||
| 	concurrencyConfig | 	concurrencyConfig | ||||||
| 	valuesControlMode | 	valuesControlMode | ||||||
|  |  | ||||||
|  | @ -46,6 +46,7 @@ type diffConfig struct { | ||||||
| 	skipSchemaValidation    bool | 	skipSchemaValidation    bool | ||||||
| 	reuseValues             bool | 	reuseValues             bool | ||||||
| 	logger                  *zap.SugaredLogger | 	logger                  *zap.SugaredLogger | ||||||
|  | 	takeOwnership           bool | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (a diffConfig) Args() string { | func (a diffConfig) Args() string { | ||||||
|  | @ -183,6 +184,9 @@ func (a diffConfig) SkipSchemaValidation() bool { | ||||||
| func (a diffConfig) SuppressOutputLineRegex() []string { | func (a diffConfig) SuppressOutputLineRegex() []string { | ||||||
| 	return a.suppressOutputLineRegex | 	return a.suppressOutputLineRegex | ||||||
| } | } | ||||||
|  | func (a diffConfig) TakeOwnership() bool { | ||||||
|  | 	return a.takeOwnership | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| func TestDiff(t *testing.T) { | func TestDiff(t *testing.T) { | ||||||
| 	type flags struct { | 	type flags struct { | ||||||
|  |  | ||||||
|  | @ -269,6 +269,7 @@ func (a *ApplyImpl) TakeOwnership() bool { | ||||||
| 	return a.ApplyOptions.TakeOwnership | 	return a.ApplyOptions.TakeOwnership | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // SyncReleaseLabels returns the SyncReleaseLabels.
 | ||||||
| func (a *ApplyImpl) SyncReleaseLabels() bool { | func (a *ApplyImpl) SyncReleaseLabels() bool { | ||||||
| 	return a.ApplyOptions.SyncReleaseLabels | 	return a.ApplyOptions.SyncReleaseLabels | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -49,6 +49,8 @@ type DiffOptions struct { | ||||||
| 	// SuppressOutputLineRegex is a list of regexes to suppress output lines
 | 	// SuppressOutputLineRegex is a list of regexes to suppress output lines
 | ||||||
| 	SuppressOutputLineRegex []string | 	SuppressOutputLineRegex []string | ||||||
| 	SkipSchemaValidation    bool | 	SkipSchemaValidation    bool | ||||||
|  | 	// TakeOwnership is true if the ownership should be taken
 | ||||||
|  | 	TakeOwnership bool | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // NewDiffOptions creates a new Apply
 | // NewDiffOptions creates a new Apply
 | ||||||
|  | @ -201,6 +203,12 @@ func (t *DiffImpl) SuppressOutputLineRegex() []string { | ||||||
| 	return t.DiffOptions.SuppressOutputLineRegex | 	return t.DiffOptions.SuppressOutputLineRegex | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // SkipSchemaValidation returns the SkipSchemaValidation.
 | ||||||
| func (t *DiffImpl) SkipSchemaValidation() bool { | func (t *DiffImpl) SkipSchemaValidation() bool { | ||||||
| 	return t.DiffOptions.SkipSchemaValidation | 	return t.DiffOptions.SkipSchemaValidation | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | // TakeOwnership returns the TakeOwnership.
 | ||||||
|  | func (t *DiffImpl) TakeOwnership() bool { | ||||||
|  | 	return t.DiffOptions.TakeOwnership | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ func CastKeysToStrings(s any) (map[string]any, error) { | ||||||
| 				return nil, fmt.Errorf("unexpected type of key in map: expected string, got %T: value=%v, map=%v", typedK, typedK, src) | 				return nil, fmt.Errorf("unexpected type of key in map: expected string, got %T: value=%v, map=%v", typedK, typedK, src) | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			castedV, err := recursivelyStringifyMapKey(v) | 			castedV, err := RecursivelyStringifyMapKey(v) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|  | @ -28,7 +28,7 @@ func CastKeysToStrings(s any) (map[string]any, error) { | ||||||
| 		} | 		} | ||||||
| 	case map[string]any: | 	case map[string]any: | ||||||
| 		for k, v := range src { | 		for k, v := range src { | ||||||
| 			castedV, err := recursivelyStringifyMapKey(v) | 			castedV, err := RecursivelyStringifyMapKey(v) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|  | @ -39,7 +39,7 @@ func CastKeysToStrings(s any) (map[string]any, error) { | ||||||
| 	return new, nil | 	return new, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func recursivelyStringifyMapKey(v any) (any, error) { | func RecursivelyStringifyMapKey(v any) (any, error) { | ||||||
| 	var castedV any | 	var castedV any | ||||||
| 	switch typedV := v.(type) { | 	switch typedV := v.(type) { | ||||||
| 	case map[any]any, map[string]any: | 	case map[any]any, map[string]any: | ||||||
|  | @ -51,7 +51,7 @@ func recursivelyStringifyMapKey(v any) (any, error) { | ||||||
| 	case []any: | 	case []any: | ||||||
| 		a := []any{} | 		a := []any{} | ||||||
| 		for i := range typedV { | 		for i := range typedV { | ||||||
| 			res, err := recursivelyStringifyMapKey(typedV[i]) | 			res, err := RecursivelyStringifyMapKey(typedV[i]) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | @ -54,7 +54,22 @@ func formatLabels(labels map[string]string) string { | ||||||
| 
 | 
 | ||||||
| // append labels flags to helm flags, starting from helm v3.13.0
 | // append labels flags to helm flags, starting from helm v3.13.0
 | ||||||
| func (st *HelmState) appendLabelsFlags(flags []string, helm helmexec.Interface, release *ReleaseSpec, syncReleaseLabels bool) []string { | func (st *HelmState) appendLabelsFlags(flags []string, helm helmexec.Interface, release *ReleaseSpec, syncReleaseLabels bool) []string { | ||||||
| 	if helm.IsVersionAtLeast("3.13.0") && (syncReleaseLabels || release.SyncReleaseLabels) { | 	if !helm.IsVersionAtLeast("3.13.0") { | ||||||
|  | 		return flags | ||||||
|  | 	} | ||||||
|  | 	isSyncReleaseLabels := false | ||||||
|  | 	switch { | ||||||
|  | 	// Check if SyncReleaseLabels is true in the release spec.
 | ||||||
|  | 	case release.SyncReleaseLabels != nil && *release.SyncReleaseLabels: | ||||||
|  | 		isSyncReleaseLabels = true | ||||||
|  | 	// Check if syncReleaseLabels argument is true.
 | ||||||
|  | 	case syncReleaseLabels: | ||||||
|  | 		isSyncReleaseLabels = true | ||||||
|  | 	// Check if SyncReleaseLabels is true in HelmDefaults.
 | ||||||
|  | 	case st.HelmDefaults.SyncReleaseLabels != nil && *st.HelmDefaults.SyncReleaseLabels: | ||||||
|  | 		isSyncReleaseLabels = true | ||||||
|  | 	} | ||||||
|  | 	if isSyncReleaseLabels { | ||||||
| 		labels := formatLabels(release.Labels) | 		labels := formatLabels(release.Labels) | ||||||
| 		if labels != "" { | 		if labels != "" { | ||||||
| 			flags = append(flags, "--labels", labels) | 			flags = append(flags, "--labels", labels) | ||||||
|  | @ -203,13 +218,17 @@ func (st *HelmState) appendHideNotesFlags(flags []string, helm helmexec.Interfac | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // append take-ownership flags to helm flags
 | // append take-ownership flags to helm flags
 | ||||||
| func (st *HelmState) appendTakeOwnershipFlags(flags []string, helm helmexec.Interface, ops *SyncOpts) []string { | func (st *HelmState) appendTakeOwnershipFlagsForUpgrade(flags []string, helm helmexec.Interface, release *ReleaseSpec, takeOwnership bool) []string { | ||||||
| 	// see https://github.com/helm/helm/releases/tag/v3.17.0
 | 	// see https://github.com/helm/helm/releases/tag/v3.17.0
 | ||||||
| 	if !helm.IsVersionAtLeast("3.17.0") { | 	if !helm.IsVersionAtLeast("3.17.0") { | ||||||
| 		return flags | 		return flags | ||||||
| 	} | 	} | ||||||
| 	switch { | 	switch { | ||||||
| 	case ops.TakeOwnership: | 	case release.TakeOwnership != nil && *release.TakeOwnership: | ||||||
|  | 		flags = append(flags, "--take-ownership") | ||||||
|  | 	case takeOwnership: | ||||||
|  | 		flags = append(flags, "--take-ownership") | ||||||
|  | 	case st.HelmDefaults.TakeOwnership != nil && *st.HelmDefaults.TakeOwnership: | ||||||
| 		flags = append(flags, "--take-ownership") | 		flags = append(flags, "--take-ownership") | ||||||
| 	} | 	} | ||||||
| 	return flags | 	return flags | ||||||
|  |  | ||||||
|  | @ -387,12 +387,13 @@ func TestAppendHideNotesFlags(t *testing.T) { | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestAppendTakeOwnershipFlags(t *testing.T) { | func TestAppendTakeOwnershipFlagsForUpgrade(t *testing.T) { | ||||||
| 	type args struct { | 	type args struct { | ||||||
| 		flags    []string | 		flags    []string | ||||||
| 		helm     helmexec.Interface | 		helm     helmexec.Interface | ||||||
| 		helmSpec HelmSpec | 		helmSpec HelmSpec | ||||||
| 		opt      *SyncOpts | 		opt      *SyncOpts | ||||||
|  | 		release  *ReleaseSpec | ||||||
| 		expected []string | 		expected []string | ||||||
| 	} | 	} | ||||||
| 	tests := []struct { | 	tests := []struct { | ||||||
|  | @ -403,6 +404,7 @@ func TestAppendTakeOwnershipFlags(t *testing.T) { | ||||||
| 			name: "no take-ownership when helm less than 3.17.0", | 			name: "no take-ownership when helm less than 3.17.0", | ||||||
| 			args: args{ | 			args: args{ | ||||||
| 				flags:   []string{}, | 				flags:   []string{}, | ||||||
|  | 				release: &ReleaseSpec{}, | ||||||
| 				helm:    testutil.NewVersionHelmExec("3.16.0"), | 				helm:    testutil.NewVersionHelmExec("3.16.0"), | ||||||
| 				opt: &SyncOpts{ | 				opt: &SyncOpts{ | ||||||
| 					TakeOwnership: true, | 					TakeOwnership: true, | ||||||
|  | @ -415,19 +417,32 @@ func TestAppendTakeOwnershipFlags(t *testing.T) { | ||||||
| 			args: args{ | 			args: args{ | ||||||
| 				flags:   []string{}, | 				flags:   []string{}, | ||||||
| 				helm:    testutil.NewVersionHelmExec("3.17.0"), | 				helm:    testutil.NewVersionHelmExec("3.17.0"), | ||||||
|  | 				release: &ReleaseSpec{}, | ||||||
| 				opt: &SyncOpts{ | 				opt: &SyncOpts{ | ||||||
| 					TakeOwnership: true, | 					TakeOwnership: true, | ||||||
| 				}, | 				}, | ||||||
| 				expected: []string{"--take-ownership"}, | 				expected: []string{"--take-ownership"}, | ||||||
| 			}, | 			}, | ||||||
| 		}, | 		}, | ||||||
|  | 		{ | ||||||
|  | 			name: "take-ownership from release", | ||||||
|  | 			args: args{ | ||||||
|  | 				flags: []string{}, | ||||||
|  | 				helm:  testutil.NewVersionHelmExec("3.17.0"), | ||||||
|  | 				release: &ReleaseSpec{ | ||||||
|  | 					TakeOwnership: &[]bool{true}[0], | ||||||
|  | 				}, | ||||||
|  | 				opt:      &SyncOpts{}, | ||||||
|  | 				expected: []string{"--take-ownership"}, | ||||||
|  | 			}, | ||||||
|  | 		}, | ||||||
| 	} | 	} | ||||||
| 	for _, tt := range tests { | 	for _, tt := range tests { | ||||||
| 		t.Run(tt.name, func(t *testing.T) { | 		t.Run(tt.name, func(t *testing.T) { | ||||||
| 			st := &HelmState{} | 			st := &HelmState{} | ||||||
| 			st.HelmDefaults = tt.args.helmSpec | 			st.HelmDefaults = tt.args.helmSpec | ||||||
| 			got := st.appendTakeOwnershipFlags(tt.args.flags, tt.args.helm, tt.args.opt) | 			got := st.appendTakeOwnershipFlagsForUpgrade(tt.args.flags, tt.args.helm, tt.args.release, tt.args.opt.TakeOwnership) | ||||||
| 			require.Equalf(t, tt.args.expected, got, "appendTakeOwnershipFlags() = %v, want %v", got, tt.args.expected) | 			require.Equalf(t, tt.args.expected, got, "appendTakeOwnershipFlagsForUpgrade() = %v, want %v", got, tt.args.expected) | ||||||
| 		}) | 		}) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -204,11 +204,13 @@ type HelmSpec struct { | ||||||
| 	// PlainHttp is true if the remote charte should be fetched using HTTP and not HTTPS
 | 	// PlainHttp is true if the remote charte should be fetched using HTTP and not HTTPS
 | ||||||
| 	PlainHttp bool `yaml:"plainHttp,omitempty"` | 	PlainHttp bool `yaml:"plainHttp,omitempty"` | ||||||
| 	// Wait, if set to true, will wait until all resources are deleted before mark delete command as successful
 | 	// Wait, if set to true, will wait until all resources are deleted before mark delete command as successful
 | ||||||
| 	DeleteWait bool `yaml:"deleteWait"` | 	DeleteWait bool `yaml:"deleteWait,omitempty"` | ||||||
| 	// Timeout is the time in seconds to wait for helmfile delete command (default 300)
 | 	// Timeout is the time in seconds to wait for helmfile delete command (default 300)
 | ||||||
| 	DeleteTimeout int `yaml:"deleteTimeout"` | 	DeleteTimeout int `yaml:"deleteTimeout,omitempty"` | ||||||
| 	// SyncReleaseLabels is true if the release labels should be synced with the helmfile labels
 | 	// SyncReleaseLabels is true if the release labels should be synced with the helmfile labels
 | ||||||
| 	SyncReleaseLabels bool `yaml:"syncReleaseLabels"` | 	SyncReleaseLabels *bool `yaml:"syncReleaseLabels,omitempty"` | ||||||
|  | 	// TakeOwnership is true if the helmfile should take ownership of the release
 | ||||||
|  | 	TakeOwnership *bool `yaml:"takeOwnership,omitempty"` | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // RepositorySpec that defines values for a helm repo
 | // RepositorySpec that defines values for a helm repo
 | ||||||
|  | @ -414,7 +416,9 @@ type ReleaseSpec struct { | ||||||
| 	// Timeout is the time in seconds to wait for helmfile delete command (default 300)
 | 	// Timeout is the time in seconds to wait for helmfile delete command (default 300)
 | ||||||
| 	DeleteTimeout *int `yaml:"deleteTimeout,omitempty"` | 	DeleteTimeout *int `yaml:"deleteTimeout,omitempty"` | ||||||
| 	// SyncReleaseLabels is true if the release labels should be synced with the helmfile labels
 | 	// SyncReleaseLabels is true if the release labels should be synced with the helmfile labels
 | ||||||
| 	SyncReleaseLabels bool `yaml:"syncReleaseLabels"` | 	SyncReleaseLabels *bool `yaml:"syncReleaseLabels,omitempty"` | ||||||
|  | 	// TakeOwnership is true if the release should take ownership of the resources
 | ||||||
|  | 	TakeOwnership *bool `yaml:"takeOwnership,omitempty"` | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (r *Inherits) UnmarshalYAML(unmarshal func(any) error) error { | func (r *Inherits) UnmarshalYAML(unmarshal func(any) error) error { | ||||||
|  | @ -2142,6 +2146,7 @@ type DiffOpts struct { | ||||||
| 	PostRendererArgs        []string | 	PostRendererArgs        []string | ||||||
| 	SuppressOutputLineRegex []string | 	SuppressOutputLineRegex []string | ||||||
| 	SkipSchemaValidation    bool | 	SkipSchemaValidation    bool | ||||||
|  | 	TakeOwnership           bool | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (o *DiffOpts) Apply(opts *DiffOpts) { | func (o *DiffOpts) Apply(opts *DiffOpts) { | ||||||
|  | @ -2899,9 +2904,11 @@ func (st *HelmState) flagsForUpgrade(helm helmexec.Interface, release *ReleaseSp | ||||||
| 
 | 
 | ||||||
| 	postRenderer := "" | 	postRenderer := "" | ||||||
| 	syncReleaseLabels := false | 	syncReleaseLabels := false | ||||||
|  | 	takeOwnership := false | ||||||
| 	if opt != nil { | 	if opt != nil { | ||||||
| 		postRenderer = opt.PostRenderer | 		postRenderer = opt.PostRenderer | ||||||
| 		syncReleaseLabels = opt.SyncReleaseLabels | 		syncReleaseLabels = opt.SyncReleaseLabels | ||||||
|  | 		takeOwnership = opt.TakeOwnership | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	flags = st.appendConnectionFlags(flags, release) | 	flags = st.appendConnectionFlags(flags, release) | ||||||
|  | @ -2930,7 +2937,7 @@ func (st *HelmState) flagsForUpgrade(helm helmexec.Interface, release *ReleaseSp | ||||||
| 	flags = st.appendHideNotesFlags(flags, helm, opt) | 	flags = st.appendHideNotesFlags(flags, helm, opt) | ||||||
| 
 | 
 | ||||||
| 	// append take-ownership flag
 | 	// append take-ownership flag
 | ||||||
| 	flags = st.appendTakeOwnershipFlags(flags, helm, opt) | 	flags = st.appendTakeOwnershipFlagsForUpgrade(flags, helm, release, takeOwnership) | ||||||
| 
 | 
 | ||||||
| 	flags = st.appendExtraSyncFlags(flags, opt) | 	flags = st.appendExtraSyncFlags(flags, opt) | ||||||
| 
 | 
 | ||||||
|  | @ -3071,6 +3078,17 @@ func (st *HelmState) flagsForDiff(helm helmexec.Interface, release *ReleaseSpec, | ||||||
| 		flags = st.appendSuppressOutputLineRegexFlags(flags, release, suppressOutputLineRegex) | 		flags = st.appendSuppressOutputLineRegexFlags(flags, release, suppressOutputLineRegex) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	takeOwnership := false | ||||||
|  | 	if opt != nil { | ||||||
|  | 		takeOwnership = opt.TakeOwnership | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	var err error | ||||||
|  | 	flags, err = st.appendTakeOwnershipFlagsForDiff(flags, release, takeOwnership) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, nil, err | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	common, files, err := st.namespaceAndValuesFlags(helm, release, workerIndex) | 	common, files, err := st.namespaceAndValuesFlags(helm, release, workerIndex) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, files, err | 		return nil, files, err | ||||||
|  | @ -3079,6 +3097,33 @@ func (st *HelmState) flagsForDiff(helm helmexec.Interface, release *ReleaseSpec, | ||||||
| 	return append(flags, common...), files, nil | 	return append(flags, common...), files, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (st *HelmState) appendTakeOwnershipFlagsForDiff(flags []string, release *ReleaseSpec, takeOwnership bool) ([]string, error) { | ||||||
|  | 	settings := cli.New() | ||||||
|  | 	isAppendTakeOwnership := false | ||||||
|  | 
 | ||||||
|  | 	switch { | ||||||
|  | 	case release.TakeOwnership != nil && *release.TakeOwnership: | ||||||
|  | 		isAppendTakeOwnership = true | ||||||
|  | 	case takeOwnership: | ||||||
|  | 		isAppendTakeOwnership = true | ||||||
|  | 	case st.HelmDefaults.TakeOwnership != nil && *st.HelmDefaults.TakeOwnership: | ||||||
|  | 		isAppendTakeOwnership = true | ||||||
|  | 	} | ||||||
|  | 	if isAppendTakeOwnership { | ||||||
|  | 		diffVersion, err := helmexec.GetPluginVersion("diff", settings.PluginsDirectory) | ||||||
|  | 		if err != nil { | ||||||
|  | 			return flags, err | ||||||
|  | 		} | ||||||
|  | 		dv, _ := semver.NewVersion("v3.11.0") | ||||||
|  | 
 | ||||||
|  | 		if diffVersion.LessThan(dv) { | ||||||
|  | 			return flags, fmt.Errorf("take-ownership is not supported by helm-diff plugin version %s, please use at least v3.11.0", diffVersion) | ||||||
|  | 		} | ||||||
|  | 		flags = append(flags, "--take-ownership") | ||||||
|  | 	} | ||||||
|  | 	return flags, nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func (st *HelmState) appendChartVersionFlags(flags []string, release *ReleaseSpec) []string { | func (st *HelmState) appendChartVersionFlags(flags []string, release *ReleaseSpec) []string { | ||||||
| 	if release.Version != "" { | 	if release.Version != "" { | ||||||
| 		flags = append(flags, "--version", release.Version) | 		flags = append(flags, "--version", release.Version) | ||||||
|  |  | ||||||
|  | @ -38,39 +38,39 @@ func TestGenerateID(t *testing.T) { | ||||||
| 	run(testcase{ | 	run(testcase{ | ||||||
| 		subject: "baseline", | 		subject: "baseline", | ||||||
| 		release: ReleaseSpec{Name: "foo", Chart: "incubator/raw"}, | 		release: ReleaseSpec{Name: "foo", Chart: "incubator/raw"}, | ||||||
| 		want:    "foo-values-57cf65699f", | 		want:    "foo-values-5859bbd547", | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| 	run(testcase{ | 	run(testcase{ | ||||||
| 		subject: "different bytes content", | 		subject: "different bytes content", | ||||||
| 		release: ReleaseSpec{Name: "foo", Chart: "incubator/raw"}, | 		release: ReleaseSpec{Name: "foo", Chart: "incubator/raw"}, | ||||||
| 		data:    []byte(`{"k":"v"}`), | 		data:    []byte(`{"k":"v"}`), | ||||||
| 		want:    "foo-values-78ccf5c7cb", | 		want:    "foo-values-56876c54b8", | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| 	run(testcase{ | 	run(testcase{ | ||||||
| 		subject: "different map content", | 		subject: "different map content", | ||||||
| 		release: ReleaseSpec{Name: "foo", Chart: "incubator/raw"}, | 		release: ReleaseSpec{Name: "foo", Chart: "incubator/raw"}, | ||||||
| 		data:    map[string]any{"k": "v"}, | 		data:    map[string]any{"k": "v"}, | ||||||
| 		want:    "foo-values-f94dd98bb", | 		want:    "foo-values-5ccd486f8b", | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| 	run(testcase{ | 	run(testcase{ | ||||||
| 		subject: "different chart", | 		subject: "different chart", | ||||||
| 		release: ReleaseSpec{Name: "foo", Chart: "stable/envoy"}, | 		release: ReleaseSpec{Name: "foo", Chart: "stable/envoy"}, | ||||||
| 		want:    "foo-values-6d977c9b54", | 		want:    "foo-values-6f477bcd58", | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| 	run(testcase{ | 	run(testcase{ | ||||||
| 		subject: "different name", | 		subject: "different name", | ||||||
| 		release: ReleaseSpec{Name: "bar", Chart: "incubator/raw"}, | 		release: ReleaseSpec{Name: "bar", Chart: "incubator/raw"}, | ||||||
| 		want:    "bar-values-5bc44889dd", | 		want:    "bar-values-86d77b4c7b", | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| 	run(testcase{ | 	run(testcase{ | ||||||
| 		subject: "specific ns", | 		subject: "specific ns", | ||||||
| 		release: ReleaseSpec{Name: "foo", Chart: "incubator/raw", Namespace: "myns"}, | 		release: ReleaseSpec{Name: "foo", Chart: "incubator/raw", Namespace: "myns"}, | ||||||
| 		want:    "myns-foo-values-589f97d65d", | 		want:    "myns-foo-values-68d8d6f46", | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| 	for id, n := range ids { | 	for id, n := range ids { | ||||||
|  |  | ||||||
|  | @ -307,14 +307,14 @@ func ToYaml(v any) (string, error) { | ||||||
| 	return string(data), nil | 	return string(data), nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func FromYaml(str string) (Values, error) { | func FromYaml(str string) (any, error) { | ||||||
| 	m := map[string]any{} | 	var m any | ||||||
| 
 | 
 | ||||||
| 	if err := yaml.Unmarshal([]byte(str), &m); err != nil { | 	if err := yaml.Unmarshal([]byte(str), &m); err != nil { | ||||||
| 		return nil, fmt.Errorf("%s, offending yaml: %s", err, str) | 		return nil, fmt.Errorf("%s, offending yaml: %s", err, str) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	m, err := maputil.CastKeysToStrings(m) | 	m, err := maputil.RecursivelyStringifyMapKey(m) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, fmt.Errorf("%s, offending yaml: %s", err, str) | 		return nil, fmt.Errorf("%s, offending yaml: %s", err, str) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -200,7 +200,88 @@ func TestToYaml(t *testing.T) { | ||||||
| 	require.Equal(t, expected, actual) | 	require.Equal(t, expected, actual) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func testFromYaml(t *testing.T, goccyGoYaml bool, expected Values) { | func testFromYamlObject(t *testing.T) { | ||||||
|  | 	raw := `foo: | ||||||
|  |   bar: BAR | ||||||
|  | ` | ||||||
|  | 
 | ||||||
|  | 	actual, err := FromYaml(raw) | ||||||
|  | 	require.NoError(t, err) | ||||||
|  | 	require.Equal( | ||||||
|  | 		t, | ||||||
|  | 		map[string]any{ | ||||||
|  | 			"foo": map[string]any{ | ||||||
|  | 				"bar": "BAR", | ||||||
|  | 			}, | ||||||
|  | 		}, | ||||||
|  | 		actual, | ||||||
|  | 	) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func testFromYamlArray(t *testing.T) { | ||||||
|  | 	raw := `- foo | ||||||
|  | - bar: BAR | ||||||
|  | ` | ||||||
|  | 
 | ||||||
|  | 	actual, err := FromYaml(raw) | ||||||
|  | 	require.NoError(t, err) | ||||||
|  | 	require.Equal( | ||||||
|  | 		t, | ||||||
|  | 		[]any{ | ||||||
|  | 			"foo", | ||||||
|  | 			map[string]any{ | ||||||
|  | 				"bar": "BAR", | ||||||
|  | 			}, | ||||||
|  | 		}, | ||||||
|  | 		actual, | ||||||
|  | 	) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func testFromYamlString(t *testing.T) { | ||||||
|  | 	raw := `foo | ||||||
|  | ` | ||||||
|  | 
 | ||||||
|  | 	actual, err := FromYaml(raw) | ||||||
|  | 	require.NoError(t, err) | ||||||
|  | 	require.Equal(t, "foo", actual) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func testFromYamlNumber(t *testing.T) { | ||||||
|  | 	raw := `1234 | ||||||
|  | ` | ||||||
|  | 
 | ||||||
|  | 	actual, err := FromYaml(raw) | ||||||
|  | 	require.NoError(t, err) | ||||||
|  | 
 | ||||||
|  | 	switch a := actual.(type) { | ||||||
|  | 	case int: | ||||||
|  | 		require.Equal(t, 1234, a) | ||||||
|  | 	case uint64: | ||||||
|  | 		require.Equal(t, uint64(1234), a) | ||||||
|  | 	default: | ||||||
|  | 		t.Errorf("unexpected type: %T", a) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func testFromYamlBoolean(t *testing.T) { | ||||||
|  | 	raw := `true | ||||||
|  | ` | ||||||
|  | 
 | ||||||
|  | 	actual, err := FromYaml(raw) | ||||||
|  | 	require.NoError(t, err) | ||||||
|  | 	require.Equal(t, true, actual) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func testFromYamlNull(t *testing.T) { | ||||||
|  | 	raw := `null | ||||||
|  | ` | ||||||
|  | 
 | ||||||
|  | 	actual, err := FromYaml(raw) | ||||||
|  | 	require.NoError(t, err) | ||||||
|  | 	require.Equal(t, nil, actual) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func testFromYaml(t *testing.T, goccyGoYaml bool) { | ||||||
| 	t.Helper() | 	t.Helper() | ||||||
| 
 | 
 | ||||||
| 	v := runtime.GoccyGoYaml | 	v := runtime.GoccyGoYaml | ||||||
|  | @ -209,39 +290,26 @@ func testFromYaml(t *testing.T, goccyGoYaml bool, expected Values) { | ||||||
| 		runtime.GoccyGoYaml = v | 		runtime.GoccyGoYaml = v | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| 	raw := `foo: | 	t.Run("test unmarshalling object", testFromYamlObject) | ||||||
|   bar: BAR | 
 | ||||||
| ` | 	t.Run("test unmarshalling array", testFromYamlArray) | ||||||
| 	actual, err := FromYaml(raw) | 
 | ||||||
| 	require.NoError(t, err) | 	t.Run("test unmarshalling string", testFromYamlString) | ||||||
| 	require.Equal(t, expected, actual) | 
 | ||||||
|  | 	t.Run("test unmarshalling number", testFromYamlNumber) | ||||||
|  | 
 | ||||||
|  | 	t.Run("test unmarshalling boolean", testFromYamlBoolean) | ||||||
|  | 
 | ||||||
|  | 	t.Run("test unmarshalling null", testFromYamlNull) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestFromYaml(t *testing.T) { | func TestFromYaml(t *testing.T) { | ||||||
| 	t.Run("with goccy/go-yaml", func(t *testing.T) { | 	t.Run("with goccy/go-yaml", func(t *testing.T) { | ||||||
| 		testFromYaml( | 		testFromYaml(t, true) | ||||||
| 			t, |  | ||||||
| 			true, |  | ||||||
| 			// nolint: unconvert
 |  | ||||||
| 			Values(map[string]any{ |  | ||||||
| 				"foo": map[string]any{ |  | ||||||
| 					"bar": "BAR", |  | ||||||
| 				}, |  | ||||||
| 			}), |  | ||||||
| 		) |  | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| 	t.Run("with gopkg.in/yaml.v2", func(t *testing.T) { | 	t.Run("with gopkg.in/yaml.v2", func(t *testing.T) { | ||||||
| 		testFromYaml( | 		testFromYaml(t, false) | ||||||
| 			t, |  | ||||||
| 			false, |  | ||||||
| 			// nolint: unconvert
 |  | ||||||
| 			Values(map[string]any{ |  | ||||||
| 				"foo": map[string]any{ |  | ||||||
| 					"bar": "BAR", |  | ||||||
| 				}, |  | ||||||
| 			}), |  | ||||||
| 		) |  | ||||||
| 	}) | 	}) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -19,7 +19,6 @@ releases: | ||||||
|     name: default-shared-resources |     name: default-shared-resources | ||||||
|     namespace: default |     namespace: default | ||||||
|     service: shared-resources |     service: shared-resources | ||||||
|   syncReleaseLabels: false |  | ||||||
| - chart: aservo/util | - chart: aservo/util | ||||||
|   version: 0.0.1 |   version: 0.0.1 | ||||||
|   needs: |   needs: | ||||||
|  | @ -31,10 +30,8 @@ releases: | ||||||
|     name: default-release-resources |     name: default-release-resources | ||||||
|     namespace: default |     namespace: default | ||||||
|     service: release-resources |     service: release-resources | ||||||
|   syncReleaseLabels: false |  | ||||||
| templates: | templates: | ||||||
|   defaults: |   defaults: | ||||||
|     name: default-{{ .Release.Labels.service }} |     name: default-{{ .Release.Labels.service }} | ||||||
|     namespace: default |     namespace: default | ||||||
|     syncReleaseLabels: false |  | ||||||
| renderedvalues: {} | renderedvalues: {} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue