Skip to content

Commit

Permalink
SC settings for ApiServerSource's Receive Adapter's container/deploym…
Browse files Browse the repository at this point in the history
…ent (#6788)

Fixes #6787

<!-- Please include the 'why' behind your changes if no issue exists -->

## Proposed Changes

<!-- Please categorize your changes:
- 🎁 Add new feature
- 🐛 Fix bug
- 🧹 Update or clean up current behavior
- 🗑️ Remove feature or internal logic
-->

- similar to our static manifests we set the required SC bits (see:
#6533), except SeccompProfile

### Pre-review Checklist

<!-- If these boxes are not checked, you will be asked to complete these
requirements or explain why they do not apply to your PR. -->

- [ ] **At least 80% unit test coverage**
- [ ] **E2E tests** for any new behavior
- [ ] **Docs PR** for any user-facing impact
- [ ] **Spec PR** for any new API feature
- [ ] **Conformance test** for any change to the spec

**Release Note**

<!--
:page_facing_up: If this change has user-visible impact, write a release
note in the block
below. Include the string "action required" if additional action is
required of
users switching to the new release, for example in case of a breaking
change.

Write as if you are speaking to users, not other Knative contributors.
If this
change has no user-visible impact, no release note is needed.
-->

```release-note
SecurityContext settings for ApiServerSource's Receive Adapter's container/deployment 
```


**Docs**

<!--
:book: If this change has user-visible impact, link to an issue or PR in
https://github.com/knative/docs.
-->

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
  • Loading branch information
matzew authored Mar 3, 2023
1 parent b474770 commit 397387e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/reconciler/apiserversource/resources/receive_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ func MakeReceiveAdapter(args *ReceiveAdapterArgs) (*appsv1.Deployment, error) {
},
},
},
SecurityContext: &corev1.SecurityContext{
AllowPrivilegeEscalation: ptr.Bool(false),
ReadOnlyRootFilesystem: ptr.Bool(true),
RunAsNonRoot: ptr.Bool(true),
Capabilities: &corev1.Capabilities{Drop: []corev1.Capability{"ALL"}},
SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault},
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ func TestMakeReceiveAdapters(t *testing.T) {
},
},
},
SecurityContext: &corev1.SecurityContext{
AllowPrivilegeEscalation: ptr.Bool(false),
ReadOnlyRootFilesystem: ptr.Bool(true),
RunAsNonRoot: ptr.Bool(true),
Capabilities: &corev1.Capabilities{Drop: []corev1.Capability{"ALL"}},
SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault},
},
},
},
},
Expand Down

0 comments on commit 397387e

Please sign in to comment.