Skip to content

Commit

Permalink
Sync with upstream release-1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
ReToCode committed Jan 8, 2024
1 parent 1e63968 commit 7adfffb
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 41 deletions.
10 changes: 0 additions & 10 deletions openshift/release/artifacts/serving-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1892,16 +1892,6 @@ spec:
url:
description: URL is the URL of this DomainMapping.
type: string
additionalPrinterColumns:
- name: URL
type: string
jsonPath: .status.url
- name: Ready
type: string
jsonPath: ".status.conditions[?(@.type=='Ready')].status"
- name: Reason
type: string
jsonPath: ".status.conditions[?(@.type=='Ready')].reason"
names:
kind: DomainMapping
plural: domainmappings
Expand Down
10 changes: 0 additions & 10 deletions openshift/release/artifacts/serving-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1501,16 +1501,6 @@ spec:
url:
description: URL is the URL of this DomainMapping.
type: string
additionalPrinterColumns:
- name: URL
type: string
jsonPath: .status.url
- name: Ready
type: string
jsonPath: ".status.conditions[?(@.type=='Ready')].status"
- name: Reason
type: string
jsonPath: ".status.conditions[?(@.type=='Ready')].reason"
names:
kind: DomainMapping
plural: domainmappings
Expand Down
15 changes: 3 additions & 12 deletions pkg/apis/serving/v1/revision_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,14 @@ func (rs *RevisionSpec) defaultSecurityContext(psc *corev1.PodSecurityContext, c
if updatedSC.AllowPrivilegeEscalation == nil {
updatedSC.AllowPrivilegeEscalation = ptr.Bool(false)
}
if psc.SeccompProfile == nil || psc.SeccompProfile.Type == "" {
if updatedSC.SeccompProfile == nil {
updatedSC.SeccompProfile = &corev1.SeccompProfile{}
}
if updatedSC.SeccompProfile.Type == "" {
updatedSC.SeccompProfile.Type = corev1.SeccompProfileTypeRuntimeDefault
}
}

if updatedSC.Capabilities == nil {
updatedSC.Capabilities = &corev1.Capabilities{}
updatedSC.Capabilities.Drop = []corev1.Capability{"ALL"}
// Default in NET_BIND_SERVICE to allow binding to low-numbered ports.
needsLowPort := false
for _, p := range container.Ports {
if p.ContainerPort < 1024 {
if p.ContainerPort > 0 && p.ContainerPort < 1024 {
needsLowPort = true
break
}
Expand All @@ -207,11 +200,9 @@ func (rs *RevisionSpec) defaultSecurityContext(psc *corev1.PodSecurityContext, c
updatedSC.Capabilities.Add = []corev1.Capability{"NET_BIND_SERVICE"}
}
}

if psc.RunAsNonRoot == nil {
if psc.RunAsNonRoot == nil && updatedSC.RunAsNonRoot == nil {
updatedSC.RunAsNonRoot = ptr.Bool(true)
}

if *updatedSC != (corev1.SecurityContext{}) {
container.SecurityContext = updatedSC
}
Expand Down
6 changes: 0 additions & 6 deletions pkg/apis/serving/v1/revision_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,6 @@ func TestRevisionDefaulting(t *testing.T) {
ReadinessProbe: defaultProbe,
Resources: defaultResources,
SecurityContext: &corev1.SecurityContext{
RunAsNonRoot: ptr.Bool(true),
AllowPrivilegeEscalation: ptr.Bool(false),
RunAsNonRoot: ptr.Bool(true),
Capabilities: &corev1.Capabilities{
Expand All @@ -912,7 +911,6 @@ func TestRevisionDefaulting(t *testing.T) {
Name: "sidecar",
Resources: defaultResources,
SecurityContext: &corev1.SecurityContext{
RunAsNonRoot: ptr.Bool(true),
AllowPrivilegeEscalation: ptr.Bool(false),
RunAsNonRoot: ptr.Bool(true),
Capabilities: &corev1.Capabilities{
Expand All @@ -923,7 +921,6 @@ func TestRevisionDefaulting(t *testing.T) {
Name: "special-sidecar",
Resources: defaultResources,
SecurityContext: &corev1.SecurityContext{
RunAsNonRoot: ptr.Bool(true),
AllowPrivilegeEscalation: ptr.Bool(true),
RunAsNonRoot: ptr.Bool(true),
Capabilities: &corev1.Capabilities{
Expand All @@ -935,7 +932,6 @@ func TestRevisionDefaulting(t *testing.T) {
InitContainers: []corev1.Container{{
Name: "special-init",
SecurityContext: &corev1.SecurityContext{
RunAsNonRoot: ptr.Bool(true),
AllowPrivilegeEscalation: ptr.Bool(true),
SeccompProfile: &corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeLocalhost,
Expand Down Expand Up @@ -999,7 +995,6 @@ func TestRevisionDefaulting(t *testing.T) {
ReadinessProbe: defaultProbe,
Resources: defaultResources,
SecurityContext: &corev1.SecurityContext{
RunAsNonRoot: ptr.Bool(true),
AllowPrivilegeEscalation: ptr.Bool(false),
RunAsNonRoot: ptr.Bool(true),
Capabilities: &corev1.Capabilities{
Expand All @@ -1010,7 +1005,6 @@ func TestRevisionDefaulting(t *testing.T) {
InitContainers: []corev1.Container{{
Name: "init",
SecurityContext: &corev1.SecurityContext{
RunAsNonRoot: ptr.Bool(true),
AllowPrivilegeEscalation: ptr.Bool(false),
RunAsNonRoot: ptr.Bool(true),
Capabilities: &corev1.Capabilities{
Expand Down
3 changes: 0 additions & 3 deletions pkg/reconciler/revision/resources/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ var (
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"},
},
SeccompProfile: &corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeRuntimeDefault,
},
}
)

Expand Down

0 comments on commit 7adfffb

Please sign in to comment.