Skip to content

Unknown field "initContainers" in io.securecodebox.execution.v1.Scan.spec #784

Closed

Description

@l4mb0san

🐞 Bug report

Describe the bug

secureCodeBox/semgrep gives 'failed to download" error when I install, in this case I installed through scanners/semgrep via repository (helm -f value.yaml ...) . Next, I used scanners/semgrep/example/vulnerable-flask-app/scan.yaml to generate a scan but got the error message 'error: error validating "scan.yaml": error validating data: ValidationError (Scan.spec): unknown field "initContainers" in io.securecodebox.execution.v1.Scan.spec; if you choose to ignore these errors, turn validation off with --validate=false'

Steps To Reproduce

  1. Upgrade secureCodeBox
    helm --namespace securecodebox-system upgrade --install securecodebox-operator secureCodeBox/operator
  2. Install Semgrep scanner (Error: failed to download "secureCodeBox/semgrep")
    helm upgrade --install semgrep secureCodeBox/semgrep -n securecodebox-system
  3. Install Semgrep scanner with source
    git clone https://github.com/secureCodeBox/secureCodeBox.git
    cd secureCodeBox/scanners/semgrep
    helm upgrade --install -f values.yaml semgrep . -n securecodebox-system
  4. Create scan (Error: unknown field "initContainers" in io.securecodebox.execution.v1.Scan.spec)
    cd scanners/semgrep/examples/vulnerable-flask-app
    kubectl apply -f scan.yaml

Expected behavior

How can I install semgrep scanner and make a scan with semgrep type working properly?

System (please complete the following information):

  • secureCodeBox: 2021-10-28 11:54:04.600105 +0700 +07 deployed operator-3.1.1
  • helm: version.BuildInfo{Version:"v3.7.0", GitTreeState:"clean", GoVersion:"go1.17"}
  • kubectl:
    Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.5", BuildDate:"2020-07-04T15:01:15Z", GoVersion:"go1.14.4", Compiler:"gc", Platform:"darwin/amd64"}
    Server Version: version.Info{Major:"1", Minor:"19+", GitVersion:"v1.19.13-gke.1900", BuildDate:"2021-08-11T09:19:42Z", GoVersion:"go1.15.13b5", Compiler:"gc", Platform:"linux/amd64"}

Screenshots / Logs

Screen Shot 2021-10-28 at 12 24 23

Screen Shot 2021-10-28 at 12 26 12

Additional context

I have seen the instructions and followed 2 ways but none of them work

Activity

  1. self-assigned this
    on Oct 28, 2021
  2. malexmave commented on Oct 28, 2021

    @malexmave
    Member

    Hi there. This is interesting, thank you for the bug report. It looks like you are still running secureCodeBox 3.1.1 for the operator - the initContainer support was only added with 3.2, but there was an issue with the release process which means that the operator wasn't built and released properly, so the first working release with the new features is 3.3. So, this explains why it doesn't work for you.

    When did you run the upgrade of the operator? We released version 3.3 on the 26th - before that day, it may be that semgrep already showed up in the docs because of the way we build or docs, but the helm chart was not yet available, so the installation would have failed, as you saw.

    In general, your process looks good to me, so if your attempt at installing it has been more than 1.5 days ago, can you try again and report back?

  3. l4mb0san commented on Oct 28, 2021

    @l4mb0san
    Author

    Hi there. This is interesting, thank you for the bug report. It looks like you are still running secureCodeBox 3.1.1 for the operator - the initContainer support was only added with 3.2, but there was an issue with the release process which means that the operator wasn't built and released properly, so the first working release with the new features is 3.3. So, this explains why it doesn't work for you.

    When did you run the upgrade of the operator? We released version 3.3 on the 26th - before that day, it may be that semgrep already showed up in the docs because of the way we build or docs, but the helm chart was not yet available, so the installation would have failed, as you saw.

    In general, your process looks good to me, so if your attempt at installing it has been more than 1.5 days ago, can you try again and report back?

    Thanks for your reply.

    • I rerun helm --namespace securecodebox-system upgrade --install securecodebox-operator secureCodeBox/operator again but the version was still operator-3.1.1, so i installed it from source and now it's operator-v3.3.0.
    • And I reinstalled semgrep with helm upgrade --install semgrep secureCodeBox/semgrep command but still getting Error: failed to download "secureCodeBox/semgrep error, so i installed it from source.
    • And also unknown field "initContainers" error when creating a scan.

    Screen Shot 2021-10-28 at 14 00 09

  4. malexmave commented on Oct 28, 2021

    @malexmave
    Member

    Hmm, this is strange, the repo should be up to date. Did you run helm repo update to get the new indexes before trying this? What is the output of helm search repo secureCodeBox?

    If you install the operator from source, it may not necessarily also install the updated custom resource definitions (CRDs) that you need (depending on how exactly you installed it), so I would prefer to figure out why the helm install did not work properly for you :)

  5. l4mb0san commented on Oct 28, 2021

    @l4mb0san
    Author

    Hmm, this is strange, the repo should be up to date. Did you run helm repo update to get the new indexes before trying this? What is the output of helm search repo secureCodeBox?

    If you install the operator from source, it may not necessarily also install the updated custom resource definitions (CRDs) that you need (depending on how exactly you installed it), so I would prefer to figure out why the helm install did not work properly for you :)

    I didn't do helm repo update before. Currently, I have run helm repo update and can install from secureCodeBox/operator, as well as can install semgrep from secureCodeBox/semgrep, but still get unknown field "initContainers" error when creating a scan.

    I did helm uninstall securecodebox-operator before reinstalling it.

    Screen Shot 2021-10-28 at 14 45 25

    Screen Shot 2021-10-28 at 14 23 51

  6. J12934 commented on Oct 28, 2021

    @J12934
    Member

    Hi 👋

    Sorry forgot to mention this in the release notes: Helm has a limitation on handling CRDs. Helm only installs them, but never upgrades them even when they have been changed. 😕 https://helm.sh/docs/topics/charts/#limitations-on-crds

    That's why you still have the 3.1.x versions of the crds installed.

    You can manually update them by running:

    kubectl apply -f https://raw.githubusercontent.com/secureCodeBox/secureCodeBox/v3.3.0/operator/crds/cascading.securecodebox.io_cascadingrules.yaml
    kubectl apply -f https://raw.githubusercontent.com/secureCodeBox/secureCodeBox/v3.3.0/operator/crds/execution.securecodebox.io_parsedefinitions.yaml
    kubectl apply -f https://raw.githubusercontent.com/secureCodeBox/secureCodeBox/v3.3.0/operator/crds/execution.securecodebox.io_scancompletionhooks.yaml
    kubectl apply -f https://raw.githubusercontent.com/secureCodeBox/secureCodeBox/v3.3.0/operator/crds/execution.securecodebox.io_scans.yaml
    kubectl apply -f https://raw.githubusercontent.com/secureCodeBox/secureCodeBox/v3.3.0/operator/crds/execution.securecodebox.io_scantypes.yaml
    kubectl apply -f https://raw.githubusercontent.com/secureCodeBox/secureCodeBox/v3.3.0/operator/crds/execution.securecodebox.io_scheduledscans.yaml

    We should definitively add some upgrading notes to the release notes on releases when we add new fields to the crds.

  7. malexmave commented on Oct 28, 2021

    @malexmave
    Member

    Ooof, okay, I see - I didn't know that, either. Yes, we should add that to the release note, and I'll also post to the release discussion here on GitHub.

  8. malexmave commented on Oct 28, 2021

    @malexmave
    Member

    Let us know if this resolves the issue, @l4mb0san, and thank you for reporting this!

  9. l4mb0san commented on Oct 28, 2021

    @l4mb0san
    Author

    Thank you very much @malexmave @J12934 ,
    unknown field "initContainers" error has been fixed. I have created the scan to run normally.

    But there is one more small problem: parser-semgrep can't pull image, can you help me with this problem?

    Screen Shot 2021-10-28 at 15 14 44

    Screen Shot 2021-10-28 at 15 15 19

    Screen Shot 2021-10-28 at 15 17 35

  10. malexmave commented on Oct 28, 2021

    @malexmave
    Member

    Hmm, seems like our release process did not push the docker image to dockerhub, and none of our previous CI runs did so, either - @J12934 do you know what is going on here? Would be good to have this resolved before we merge secureCodeBox/documentation#150.

  11. added a commit that references this issue on Oct 28, 2021
  12. malexmave commented on Oct 28, 2021

    @malexmave
    Member

    We have just created a new release 3.3.1, which should fix the issue. Remember to run helm repo update before trying to install :) and let us know if it works now. Thanks again for pointing this issue out to us.

  13. l4mb0san commented on Oct 28, 2021

    @l4mb0san
    Author

    Thanks for your support ^^ @malexmave

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions