-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into none-timeout
- Loading branch information
Showing
24 changed files
with
357 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 132 additions & 0 deletions
132
deploy/addons/pod-security-policy/pod-security-policy.yaml.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
--- | ||
apiVersion: policy/v1beta1 | ||
kind: PodSecurityPolicy | ||
metadata: | ||
name: privileged | ||
annotations: | ||
seccomp.security.alpha.kubernetes.io/allowedProfileNames: "*" | ||
labels: | ||
addonmanager.kubernetes.io/mode: EnsureExists | ||
spec: | ||
privileged: true | ||
allowPrivilegeEscalation: true | ||
allowedCapabilities: | ||
- "*" | ||
volumes: | ||
- "*" | ||
hostNetwork: true | ||
hostPorts: | ||
- min: 0 | ||
max: 65535 | ||
hostIPC: true | ||
hostPID: true | ||
runAsUser: | ||
rule: 'RunAsAny' | ||
seLinux: | ||
rule: 'RunAsAny' | ||
supplementalGroups: | ||
rule: 'RunAsAny' | ||
fsGroup: | ||
rule: 'RunAsAny' | ||
--- | ||
apiVersion: policy/v1beta1 | ||
kind: PodSecurityPolicy | ||
metadata: | ||
name: restricted | ||
labels: | ||
addonmanager.kubernetes.io/mode: EnsureExists | ||
spec: | ||
privileged: false | ||
allowPrivilegeEscalation: false | ||
requiredDropCapabilities: | ||
- ALL | ||
volumes: | ||
- 'configMap' | ||
- 'emptyDir' | ||
- 'projected' | ||
- 'secret' | ||
- 'downwardAPI' | ||
- 'persistentVolumeClaim' | ||
hostNetwork: false | ||
hostIPC: false | ||
hostPID: false | ||
runAsUser: | ||
rule: 'MustRunAsNonRoot' | ||
seLinux: | ||
rule: 'RunAsAny' | ||
supplementalGroups: | ||
rule: 'MustRunAs' | ||
ranges: | ||
# Forbid adding the root group. | ||
- min: 1 | ||
max: 65535 | ||
fsGroup: | ||
rule: 'MustRunAs' | ||
ranges: | ||
# Forbid adding the root group. | ||
- min: 1 | ||
max: 65535 | ||
readOnlyRootFilesystem: false | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: psp:privileged | ||
labels: | ||
addonmanager.kubernetes.io/mode: EnsureExists | ||
rules: | ||
- apiGroups: ['policy'] | ||
resources: ['podsecuritypolicies'] | ||
verbs: ['use'] | ||
resourceNames: | ||
- privileged | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: psp:restricted | ||
labels: | ||
addonmanager.kubernetes.io/mode: EnsureExists | ||
rules: | ||
- apiGroups: ['policy'] | ||
resources: ['podsecuritypolicies'] | ||
verbs: ['use'] | ||
resourceNames: | ||
- restricted | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: default:restricted | ||
labels: | ||
addonmanager.kubernetes.io/mode: EnsureExists | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: psp:restricted | ||
subjects: | ||
- kind: Group | ||
name: system:authenticated | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: default:privileged | ||
namespace: kube-system | ||
labels: | ||
addonmanager.kubernetes.io/mode: EnsureExists | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: psp:privileged | ||
subjects: | ||
- kind: Group | ||
name: system:masters | ||
apiGroup: rbac.authorization.k8s.io | ||
- kind: Group | ||
name: system:nodes | ||
apiGroup: rbac.authorization.k8s.io | ||
- kind: Group | ||
name: system:serviceaccounts:kube-system | ||
apiGroup: rbac.authorization.k8s.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
Copyright 2016 The Kubernetes Authors All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// Package bsutil will eventually be renamed to kubeadm package after getting rid of older one | ||
package bsutil | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
|
||
"k8s.io/minikube/pkg/minikube/config" | ||
) | ||
|
||
func TestFindInvalidExtraConfigFlags(t *testing.T) { | ||
defaultOpts := getExtraOpts() | ||
badOption1 := config.ExtraOption{Component: "bad_option_1"} | ||
badOption2 := config.ExtraOption{Component: "bad_option_2"} | ||
tests := []struct { | ||
name string | ||
opts config.ExtraOptionSlice | ||
want []string | ||
}{ | ||
{ | ||
name: "with valid options only", | ||
opts: defaultOpts, | ||
want: nil, | ||
}, | ||
{ | ||
name: "with invalid options", | ||
opts: append(defaultOpts, badOption1, badOption2), | ||
want: []string{"bad_option_1", "bad_option_2"}, | ||
}, | ||
{ | ||
name: "with invalid options and duplicates", | ||
opts: append(defaultOpts, badOption2, badOption1, badOption1), | ||
want: []string{"bad_option_2", "bad_option_1"}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := FindInvalidExtraConfigFlags(tt.opts); !reflect.DeepEqual(got, tt.want) { | ||
t.Errorf("FindInvalidExtraConfigFlags() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.