mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Optimizing some format problems (#82983)
* modify the error string * omit redundant type bool from variable declarations
This commit is contained in:
parent
58323cbf4e
commit
65f2280a38
@ -102,7 +102,7 @@ func validateHost(runtime string) error {
|
|||||||
|
|
||||||
// Check build support.
|
// Check build support.
|
||||||
if isDisabledBuild {
|
if isDisabledBuild {
|
||||||
return errors.New("Binary not compiled for linux")
|
return errors.New("binary not compiled for linux")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check kernel support.
|
// Check kernel support.
|
||||||
@ -112,7 +112,7 @@ func validateHost(runtime string) error {
|
|||||||
|
|
||||||
// Check runtime support. Currently only Docker is supported.
|
// Check runtime support. Currently only Docker is supported.
|
||||||
if runtime != kubetypes.DockerContainerRuntime && runtime != kubetypes.RemoteContainerRuntime {
|
if runtime != kubetypes.DockerContainerRuntime && runtime != kubetypes.RemoteContainerRuntime {
|
||||||
return fmt.Errorf("AppArmor is only enabled for 'docker' and 'remote' runtimes. Found: %q.", runtime)
|
return fmt.Errorf("AppArmor is only enabled for 'docker' and 'remote' runtimes. Found: %q", runtime)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -556,7 +556,7 @@ func TestValidateContainerFailures(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
failPrivPod := defaultPod()
|
failPrivPod := defaultPod()
|
||||||
var priv bool = true
|
var priv = true
|
||||||
failPrivPod.Spec.Containers[0].SecurityContext.Privileged = &priv
|
failPrivPod.Spec.Containers[0].SecurityContext.Privileged = &priv
|
||||||
|
|
||||||
failProcMountPod := defaultPod()
|
failProcMountPod := defaultPod()
|
||||||
@ -1043,7 +1043,7 @@ func TestValidateContainerSuccess(t *testing.T) {
|
|||||||
privPSP := defaultPSP()
|
privPSP := defaultPSP()
|
||||||
privPSP.Spec.Privileged = true
|
privPSP.Spec.Privileged = true
|
||||||
privPod := defaultPod()
|
privPod := defaultPod()
|
||||||
var priv bool = true
|
var priv = true
|
||||||
privPod.Spec.Containers[0].SecurityContext.Privileged = &priv
|
privPod.Spec.Containers[0].SecurityContext.Privileged = &priv
|
||||||
|
|
||||||
capsPSP := defaultPSP()
|
capsPSP := defaultPSP()
|
||||||
@ -1275,7 +1275,7 @@ func defaultNamedPSP(name string) *policy.PodSecurityPolicy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func defaultPod() *api.Pod {
|
func defaultPod() *api.Pod {
|
||||||
var notPriv bool = false
|
var notPriv = false
|
||||||
return &api.Pod{
|
return &api.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Annotations: map[string]string{},
|
Annotations: map[string]string{},
|
||||||
@ -1299,7 +1299,7 @@ func defaultPod() *api.Pod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func defaultV1Pod() *v1.Pod {
|
func defaultV1Pod() *v1.Pod {
|
||||||
var notPriv bool = false
|
var notPriv = false
|
||||||
return &v1.Pod{
|
return &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Annotations: map[string]string{},
|
Annotations: map[string]string{},
|
||||||
|
Loading…
Reference in New Issue
Block a user