Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/release-1.11' into sync-upstre…
Browse files Browse the repository at this point in the history
…am-1.11

# Conflicts:
#	go.mod
#	pkg/apis/serving/v1/revision_defaults.go
  • Loading branch information
ReToCode committed Jan 8, 2024
2 parents 1f74a83 + 232d726 commit 1e63968
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 53 deletions.
10 changes: 0 additions & 10 deletions config/core/300-resources/domain-mapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -263,16 +263,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
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ module knative.dev/serving

// This comment was added so CI would trigger a point release with a
// newer version of Go
// Fixes: https://groups.google.com/g/golang-announce/c/iNNxDTCjZvo

// Fixes:
// - https://groups.google.com/g/golang-announce/c/iNNxDTCjZvo
// - https://github.com/knative/serving/issues/14732
go 1.18

require (
Expand All @@ -28,7 +29,7 @@ require (
golang.org/x/sync v0.2.0
golang.org/x/time v0.3.0
google.golang.org/api v0.124.0
google.golang.org/grpc v1.56.1
google.golang.org/grpc v1.56.3
k8s.io/api v0.26.5
k8s.io/apiextensions-apiserver v0.26.5
k8s.io/apimachinery v0.26.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -934,8 +934,8 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=
google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=
google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ=
google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc=
google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
15 changes: 12 additions & 3 deletions pkg/apis/serving/v1/revision_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,21 @@ 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 > 0 && p.ContainerPort < 1024 {
if p.ContainerPort < 1024 {
needsLowPort = true
break
}
Expand All @@ -200,9 +207,11 @@ func (rs *RevisionSpec) defaultSecurityContext(psc *corev1.PodSecurityContext, c
updatedSC.Capabilities.Add = []corev1.Capability{"NET_BIND_SERVICE"}
}
}
if psc.RunAsNonRoot == nil && updatedSC.RunAsNonRoot == nil {

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

if *updatedSC != (corev1.SecurityContext{}) {
container.SecurityContext = updatedSC
}
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/serving/v1/revision_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ 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 @@ -911,6 +912,7 @@ 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 @@ -921,6 +923,7 @@ 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 @@ -932,6 +935,7 @@ 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 @@ -995,6 +999,7 @@ 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 @@ -1005,6 +1010,7 @@ 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: 3 additions & 0 deletions pkg/reconciler/revision/resources/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ var (
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"},
},
SeccompProfile: &corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeRuntimeDefault,
},
}
)

Expand Down
11 changes: 3 additions & 8 deletions vendor/google.golang.org/grpc/internal/transport/http2_server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 48 additions & 21 deletions vendor/google.golang.org/grpc/server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 25 additions & 4 deletions vendor/google.golang.org/grpc/status/status.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/google.golang.org/grpc/version.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ google.golang.org/genproto/googleapis/api/httpbody
google.golang.org/genproto/googleapis/rpc/code
google.golang.org/genproto/googleapis/rpc/errdetails
google.golang.org/genproto/googleapis/rpc/status
# google.golang.org/grpc v1.56.1
# google.golang.org/grpc v1.56.3
## explicit; go 1.17
google.golang.org/grpc
google.golang.org/grpc/attributes
Expand Down

0 comments on commit 1e63968

Please sign in to comment.