-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #180 from AndiDog/detect-duplicates
Detect duplicate resources (same [API version, kind, namespace, name])
- Loading branch information
Showing
14 changed files
with
429 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Two objects with same name in same namespace, resource of non-namespaced kind | ||
|
||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: pv0003 | ||
spec: | ||
capacity: | ||
storage: 5Gi | ||
volumeMode: Filesystem | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Recycle | ||
storageClassName: slow | ||
mountOptions: | ||
- hard | ||
- nfsvers=4.1 | ||
nfs: | ||
path: /tmp | ||
server: 172.17.0.2 | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: pv0003 | ||
spec: | ||
capacity: | ||
storage: 5Gi | ||
volumeMode: Filesystem | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Recycle | ||
storageClassName: slow | ||
mountOptions: | ||
- hard | ||
- nfsvers=4.1 | ||
nfs: | ||
path: /tmp | ||
server: 172.17.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Two objects with same name in same namespace, but of a kind configured to be skipped | ||
|
||
apiVersion: v1 | ||
kind: SkipThisKind | ||
metadata: | ||
name: "identical" | ||
spec: | ||
replicas: 2 | ||
selector: | ||
app: nginx | ||
template: | ||
metadata: | ||
name: nginx | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
ports: | ||
- containerPort: 80 | ||
--- | ||
apiVersion: v1 | ||
kind: SkipThisKind | ||
metadata: | ||
name: "identical" | ||
spec: | ||
replicas: 2 | ||
selector: | ||
app: nginx | ||
template: | ||
metadata: | ||
name: nginx | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
ports: | ||
- containerPort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Two objects with same name in same namespace (one of them not given, i.e. will use default namespace as passed to kubeval) | ||
|
||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: "bob" | ||
namespace: the-default-namespace | ||
spec: | ||
replicas: 2 | ||
selector: | ||
app: nginx | ||
template: | ||
metadata: | ||
name: nginx | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
ports: | ||
- containerPort: 80 | ||
--- | ||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: "bob" | ||
# namespace not given | ||
spec: | ||
replicas: 2 | ||
selector: | ||
app: nginx | ||
template: | ||
metadata: | ||
name: nginx | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
ports: | ||
- containerPort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Two objects with same name in same namespace | ||
|
||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: "bob" | ||
namespace: x | ||
spec: | ||
replicas: 2 | ||
selector: | ||
app: nginx | ||
template: | ||
metadata: | ||
name: nginx | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
ports: | ||
- containerPort: 80 | ||
--- | ||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: "bob" | ||
namespace: x | ||
spec: | ||
replicas: 2 | ||
selector: | ||
app: nginx | ||
template: | ||
metadata: | ||
name: nginx | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
ports: | ||
- containerPort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Two objects with same name in same namespace | ||
|
||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: "bob" | ||
spec: | ||
replicas: 2 | ||
selector: | ||
app: nginx | ||
template: | ||
metadata: | ||
name: nginx | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
ports: | ||
- containerPort: 80 | ||
--- | ||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: "bob" | ||
spec: | ||
replicas: 2 | ||
selector: | ||
app: nginx | ||
template: | ||
metadata: | ||
name: nginx | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
ports: | ||
- containerPort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Two objects with same name in same namespace, and having the same kind, but | ||
# of different API (apps/v1 vs. apps/v1beta1). This is important when CRDs | ||
# introduce overlapping `metadata:name` values, e.g. `Deployment` in | ||
# `my-awesome-cd-tool.io/v1` (contrived scenario). | ||
|
||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nginx-deployment | ||
labels: | ||
app: nginx | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: nginx | ||
template: | ||
metadata: | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx:1.7.9 | ||
ports: | ||
- containerPort: 80 | ||
--- | ||
apiVersion: apps/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: nginx-deployment | ||
labels: | ||
app: nginx | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: nginx | ||
template: | ||
metadata: | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx:1.7.9 | ||
ports: | ||
- containerPort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Two objects with same name in different namespace, one of them being the configured default namespace | ||
|
||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: "bob" | ||
namespace: a | ||
spec: | ||
replicas: 2 | ||
selector: | ||
app: nginx | ||
template: | ||
metadata: | ||
name: nginx | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
ports: | ||
- containerPort: 80 | ||
--- | ||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: "bob" | ||
namespace: the-default-namespace | ||
spec: | ||
replicas: 2 | ||
selector: | ||
app: nginx | ||
template: | ||
metadata: | ||
name: nginx | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
ports: | ||
- containerPort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Two objects with same name in different namespace | ||
|
||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: "bob" | ||
namespace: a | ||
spec: | ||
replicas: 2 | ||
selector: | ||
app: nginx | ||
template: | ||
metadata: | ||
name: nginx | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
ports: | ||
- containerPort: 80 | ||
--- | ||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: "bob" | ||
namespace: b | ||
spec: | ||
replicas: 2 | ||
selector: | ||
app: nginx | ||
template: | ||
metadata: | ||
name: nginx | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
ports: | ||
- containerPort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.