mirror of https://github.com/linkerd/linkerd2.git
* Add support for uninject command to uninject namespace configs * Add relevant unit tests in cli/cmd/uninject_test.go Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
This commit is contained in:
parent
5958111533
commit
e91f2020db
|
@ -273,7 +273,7 @@ func TestUninjectAndInject(t *testing.T) {
|
|||
},
|
||||
{
|
||||
inputFileName: "inject_emojivoto_namespace_good.input.yml",
|
||||
goldenFileName: "inject_emojivoto_namespace_overidden.good.golden.yml",
|
||||
goldenFileName: "inject_emojivoto_namespace_overidden_good.golden.yml",
|
||||
reportFileName: "inject_emojivoto_namespace_good.golden.report",
|
||||
injectProxy: false,
|
||||
testInjectConfig: defaultConfig,
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
namespace "emojivoto" uninjected
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
name: emojivoto
|
||||
spec: {}
|
||||
status: {}
|
||||
---
|
|
@ -84,6 +84,16 @@ func TestUninjectYAML(t *testing.T) {
|
|||
goldenFileName: "inject_emojivoto_deployment_config_overrides.input.yml",
|
||||
reportFileName: "inject_emojivoto_deployment_uninject.report",
|
||||
},
|
||||
{
|
||||
inputFileName: "inject_emojivoto_namespace_good.golden.yml",
|
||||
goldenFileName: "inject_emojivoto_namespace_uninjected_good.golden.yml",
|
||||
reportFileName: "inject_emojivoto_namespace_uninjected_good.golden.report",
|
||||
},
|
||||
{
|
||||
inputFileName: "inject_emojivoto_namespace_overidden_good.golden.yml",
|
||||
goldenFileName: "inject_emojivoto_namespace_uninjected_good.golden.yml",
|
||||
reportFileName: "inject_emojivoto_namespace_uninjected_good.golden.report",
|
||||
},
|
||||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
|
|
|
@ -11,6 +11,11 @@ import (
|
|||
// Uninject removes from the workload in conf the init and proxy containers,
|
||||
// the TLS volumes and the extra annotations/labels that were added
|
||||
func (conf *ResourceConfig) Uninject(report *Report) ([]byte, error) {
|
||||
if conf.IsNamespace() {
|
||||
uninjectObjectMeta(conf.workload.Meta, report)
|
||||
return conf.YamlMarshalObj()
|
||||
}
|
||||
|
||||
if conf.pod.spec == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue