Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

kubeless function describe panic #839

Merged
merged 1 commit into from Jun 29, 2018

Conversation

silenceshell
Copy link
Contributor

@silenceshell silenceshell commented Jun 29, 2018

Issue Ref: [Issue number related to this PR or None]

None

Description:

bug fix : kubeless function describe will panic when Containers are empty.
This happened when function is created by kubeless-ui.

func print(f kubelessApi.Function, name, output string) error {
...
    env, err := json.Marshal(f.Spec.Deployment.Spec.Template.Spec.Containers[0].Env)

The function is

$ kubectl get function xxx -o yaml
apiVersion: kubeless.io/v1beta1
kind: Function
metadata:
  clusterName: ""
  creationTimestamp: 2018-06-29T06:59:34Z
  finalizers:
  - kubeless.io/function
  generation: 1
  name: xxx
  namespace: default
  resourceVersion: "872425"
  selfLink: /apis/kubeless.io/v1beta1/namespaces/default/functions/xxx
  uid: fabbed3a-7b69-11e8-8251-6c0b84ace257
spec:
  checksum: sha256:f727da8be400e7412981aa011900905151c59c59e6ce959f3cec0f5c2bc00b8f
  deployment:
    metadata:
      creationTimestamp: null
    spec:
      strategy: {}
      template:
        metadata:
          creationTimestamp: null
        spec:
          containers: null
    status: {}
  deps: ""

And I think there is no need to use fmt.Sprintf for a string var.

TODOs:

  • Ready to review
  • Automated Tests
  • Docs

bug fix : kubeless function describe will panic when Containers are empty.
This happened when function is created by kubeless-ui.

```
func print(f kubelessApi.Function, name, output string) error {
...
    env, err := json.Marshal(f.Spec.Deployment.Spec.Template.Spec.Containers[0].Env)
```
@andresmgot
Copy link
Contributor

thanks for the PR!

@andresmgot andresmgot merged commit a70cc4c into vmware-archive:master Jun 29, 2018
@silenceshell silenceshell deleted the patch-1 branch November 22, 2018 09:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants