Skip to content

Commit

Permalink
fix(kubernetes): Deploy to a numeric k8s namespace fails (#1597)
Browse files Browse the repository at this point in the history
Allows deployment to a Kubernetes namespace that is numeric.

KubernetesV2Utils is mapping the deployment environment values to Map<String, Object>, and number-ish values are interpreted as numeric types by YAML.
This caused a numeric namespace value to get interpreted as a Long, and later hard-casts to String in KubernetesV2Executor.exists() threw a ClassCastException

Example failing config:

```
kubernetes:
- accounts:
  - name: foobar
    ...
    namespaces:
    - 123412341234
...
deploymentEnvironment:
  location: 123412341234
```

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
jcavanagh and mergify[bot] authored Jul 24, 2020
1 parent 42c2a53 commit 32236f9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apps/v1 # As of Kubernetes 1.16, apps/v1beta2 has been deprecated
kind: Deployment
metadata:
name: spin-{{ name }}
namespace: {{ namespace }}
namespace: "{{ namespace }}"
annotations:
moniker.spinnaker.io/application: '"spin"'
moniker.spinnaker.io/cluster: '"{{ name }}"'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kind: Namespace
apiVersion: v1
metadata:
name: {{ name }}
name: "{{ name }}"
labels:
app: spin
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kind: Service
apiVersion: v1
metadata:
name: spin-{{ name }}
namespace: {{ namespace }}
namespace: "{{ namespace }}"
labels:
app: spin
cluster: spin-{{ name }}
Expand Down

0 comments on commit 32236f9

Please sign in to comment.