knative / client

Knative developer experience, docs, reference Knative CLI implementation
Apache License 2.0
354 stars 261 forks source link

Add default SecurityContext to every new ksvc #1821

Closed dsimansk closed 1 year ago

dsimansk commented 1 year ago

Description

This's handling a warning from API-server validation about SecurityContext being empty for kn service create and related cmds.

I'll look into a few further improvements. E.g. either adding SecurityContext builder pattern or at least plain --security-context seccon.yaml flag to make it customizable.

/cc @rhuss @vyasgun

Changes

Reference

Fixes #

Release Note

Add default SecurityContext to every new ksvc
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 82.92% and project coverage change: +0.03 :tada:

Comparison is base (00e38dc) 79.70% compared to head (009b2e7) 79.74%.

:exclamation: Current head 009b2e7 differs from pull request most recent head c96dc6c. Consider uploading reports for the commit c96dc6c to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1821 +/- ## ========================================== + Coverage 79.70% 79.74% +0.03% ========================================== Files 179 179 Lines 13850 13891 +41 ========================================== + Hits 11039 11077 +38 - Misses 2050 2052 +2 - Partials 761 762 +1 ``` | [Impacted Files](https://app.codecov.io/gh/knative/client/pull/1821?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) | Coverage Δ | | |---|---|---| | [pkg/kn/flags/podspec.go](https://app.codecov.io/gh/knative/client/pull/1821?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-cGtnL2tuL2ZsYWdzL3BvZHNwZWMuZ28=) | `74.33% <46.15%> (-1.28%)` | :arrow_down: | | [pkg/kn/flags/podspec\_helper.go](https://app.codecov.io/gh/knative/client/pull/1821?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-cGtnL2tuL2ZsYWdzL3BvZHNwZWNfaGVscGVyLmdv) | `85.53% <100.00%> (+1.03%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

rhuss commented 1 year ago

Please see my comment https://github.com/knative/client/pull/1821/files#r1242163943 that we should already add basic option handling here. Otherwise, I think it would break too much.

Also note the linter warnings.

dsimansk commented 1 year ago

/retest

knative-prow[bot] commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dsimansk, rhuss

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/knative/client/blob/main/OWNERS)~~ [dsimansk,rhuss] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment