From 01f5f7e370b30b8cddcb2406a3370aecf4e1dc12 Mon Sep 17 00:00:00 2001 From: Yann Coleu Date: Thu, 22 Oct 2020 09:17:46 +0200 Subject: [PATCH] clean some tests files, README and namespace in case of emptiness --- README.md | 4 ++-- example/manifests/resources_in.yaml | 6 ++++++ example/manifests/resources_out.yaml | 5 +++++ kubernetes/structs.go | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 372cef2..f90952e 100644 --- a/README.md +++ b/README.md @@ -87,10 +87,10 @@ configmap "django-config-g55mctg456" deleted ingress.extensions "my-ingress" deleted ``` -If you want to fail on untracked resources (exit status 1), you can use `-fail=true`: +If you want to fail on untracked resources (exit status 1), you can use `-fail`: ``` -$ untrak -c untrak.yaml -fail=true +$ untrak -c untrak.yaml -fail ``` > **Caution**: please test this tool extensively before deleting resources. The software is provided "as is", without warranty of any kind. diff --git a/example/manifests/resources_in.yaml b/example/manifests/resources_in.yaml index 836dca2..1f2734e 100644 --- a/example/manifests/resources_in.yaml +++ b/example/manifests/resources_in.yaml @@ -1,5 +1,11 @@ --- apiVersion: v1 +kind: Namespace +metadata: + name: app + namespace: app +--- +apiVersion: v1 kind: Service metadata: labels: diff --git a/example/manifests/resources_out.yaml b/example/manifests/resources_out.yaml index dedc1bf..7e5c354 100644 --- a/example/manifests/resources_out.yaml +++ b/example/manifests/resources_out.yaml @@ -79,3 +79,8 @@ spec: serviceName: django servicePort: 80 path: / +--- +apiVersion: v1 +kind: Namespace +metadata: + name: app \ No newline at end of file diff --git a/kubernetes/structs.go b/kubernetes/structs.go index 050579c..abb1913 100644 --- a/kubernetes/structs.go +++ b/kubernetes/structs.go @@ -7,7 +7,7 @@ import ( // Metadata of kubernetes resource type Metadata struct { Name string `yaml:"name"` - Namespace string `yaml:"namespace"` + Namespace string `yaml:"namespace,omitempty"` } // Resource is a minimal description of a kubernetes object