mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	reduce merge logging
This commit is contained in:
		@@ -208,12 +208,11 @@ func defaultHostNetworkPorts(containers *[]Container) {
 | 
			
		||||
// defaultSecurityContext performs the downward and upward merges of a pod definition
 | 
			
		||||
func defaultSecurityContext(container *Container) {
 | 
			
		||||
	if container.SecurityContext == nil {
 | 
			
		||||
		glog.V(4).Infof("creating security context for container %s", container.Name)
 | 
			
		||||
		glog.V(5).Infof("creating security context for container %s", container.Name)
 | 
			
		||||
		container.SecurityContext = &SecurityContext{}
 | 
			
		||||
	}
 | 
			
		||||
	// if there are no capabilities defined on the SecurityContext then copy the container settings
 | 
			
		||||
	if container.SecurityContext.Capabilities == nil {
 | 
			
		||||
		glog.V(4).Infof("downward merge of container.Capabilities for container %s", container.Name)
 | 
			
		||||
		container.SecurityContext.Capabilities = &container.Capabilities
 | 
			
		||||
	} else {
 | 
			
		||||
		// if there are capabilities defined on the security context and the container setting is
 | 
			
		||||
@@ -222,17 +221,14 @@ func defaultSecurityContext(container *Container) {
 | 
			
		||||
		// there are settings in both then don't touch it, the converter will error if they don't
 | 
			
		||||
		// match
 | 
			
		||||
		if len(container.Capabilities.Add) == 0 {
 | 
			
		||||
			glog.V(4).Infof("upward merge of container.Capabilities.Add for container %s", container.Name)
 | 
			
		||||
			container.Capabilities.Add = container.SecurityContext.Capabilities.Add
 | 
			
		||||
		}
 | 
			
		||||
		if len(container.Capabilities.Drop) == 0 {
 | 
			
		||||
			glog.V(4).Infof("upward merge of container.Capabilities.Drop for container %s", container.Name)
 | 
			
		||||
			container.Capabilities.Drop = container.SecurityContext.Capabilities.Drop
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	// if there are no privileged settings on the security context then copy the container settings
 | 
			
		||||
	if container.SecurityContext.Privileged == nil {
 | 
			
		||||
		glog.V(4).Infof("downward merge of container.Privileged for container %s", container.Name)
 | 
			
		||||
		container.SecurityContext.Privileged = &container.Privileged
 | 
			
		||||
	} else {
 | 
			
		||||
		// we don't have a good way to know if container.Privileged was set or just defaulted to false
 | 
			
		||||
@@ -240,7 +236,6 @@ func defaultSecurityContext(container *Container) {
 | 
			
		||||
		// container is set to false and assume that the Privileged field was left off the container
 | 
			
		||||
		// definition and not an intentional mismatch
 | 
			
		||||
		if *container.SecurityContext.Privileged && !container.Privileged {
 | 
			
		||||
			glog.V(4).Infof("upward merge of container.Privileged for container %s", container.Name)
 | 
			
		||||
			container.Privileged = *container.SecurityContext.Privileged
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -209,12 +209,11 @@ func defaultHostNetworkPorts(containers *[]Container) {
 | 
			
		||||
// defaultSecurityContext performs the downward and upward merges of a pod definition
 | 
			
		||||
func defaultSecurityContext(container *Container) {
 | 
			
		||||
	if container.SecurityContext == nil {
 | 
			
		||||
		glog.V(4).Infof("creating security context for container %s", container.Name)
 | 
			
		||||
		glog.V(5).Infof("creating security context for container %s", container.Name)
 | 
			
		||||
		container.SecurityContext = &SecurityContext{}
 | 
			
		||||
	}
 | 
			
		||||
	// if there are no capabilities defined on the SecurityContext then copy the container settings
 | 
			
		||||
	if container.SecurityContext.Capabilities == nil {
 | 
			
		||||
		glog.V(4).Infof("downward merge of container.Capabilities for container %s", container.Name)
 | 
			
		||||
		container.SecurityContext.Capabilities = &container.Capabilities
 | 
			
		||||
	} else {
 | 
			
		||||
		// if there are capabilities defined on the security context and the container setting is
 | 
			
		||||
@@ -223,17 +222,14 @@ func defaultSecurityContext(container *Container) {
 | 
			
		||||
		// there are settings in both then don't touch it, the converter will error if they don't
 | 
			
		||||
		// match
 | 
			
		||||
		if len(container.Capabilities.Add) == 0 {
 | 
			
		||||
			glog.V(4).Infof("upward merge of container.Capabilities.Add for container %s", container.Name)
 | 
			
		||||
			container.Capabilities.Add = container.SecurityContext.Capabilities.Add
 | 
			
		||||
		}
 | 
			
		||||
		if len(container.Capabilities.Drop) == 0 {
 | 
			
		||||
			glog.V(4).Infof("upward merge of container.Capabilities.Drop for container %s", container.Name)
 | 
			
		||||
			container.Capabilities.Drop = container.SecurityContext.Capabilities.Drop
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	// if there are no privileged settings on the security context then copy the container settings
 | 
			
		||||
	if container.SecurityContext.Privileged == nil {
 | 
			
		||||
		glog.V(4).Infof("downward merge of container.Privileged for container %s", container.Name)
 | 
			
		||||
		container.SecurityContext.Privileged = &container.Privileged
 | 
			
		||||
	} else {
 | 
			
		||||
		// we don't have a good way to know if container.Privileged was set or just defaulted to false
 | 
			
		||||
@@ -241,7 +237,6 @@ func defaultSecurityContext(container *Container) {
 | 
			
		||||
		// container is set to false and assume that the Privileged field was left off the container
 | 
			
		||||
		// definition and not an intentional mismatch
 | 
			
		||||
		if *container.SecurityContext.Privileged && !container.Privileged {
 | 
			
		||||
			glog.V(4).Infof("upward merge of container.Privileged for container %s", container.Name)
 | 
			
		||||
			container.Privileged = *container.SecurityContext.Privileged
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -171,12 +171,11 @@ func defaultHostNetworkPorts(containers *[]Container) {
 | 
			
		||||
// defaultSecurityContext performs the downward and upward merges of a pod definition
 | 
			
		||||
func defaultSecurityContext(container *Container) {
 | 
			
		||||
	if container.SecurityContext == nil {
 | 
			
		||||
		glog.V(4).Infof("creating security context for container %s", container.Name)
 | 
			
		||||
		glog.V(5).Infof("creating security context for container %s", container.Name)
 | 
			
		||||
		container.SecurityContext = &SecurityContext{}
 | 
			
		||||
	}
 | 
			
		||||
	// if there are no capabilities defined on the SecurityContext then copy the container settings
 | 
			
		||||
	if container.SecurityContext.Capabilities == nil {
 | 
			
		||||
		glog.V(4).Infof("downward merge of container.Capabilities for container %s", container.Name)
 | 
			
		||||
		container.SecurityContext.Capabilities = &container.Capabilities
 | 
			
		||||
	} else {
 | 
			
		||||
		// if there are capabilities defined on the security context and the container setting is
 | 
			
		||||
@@ -185,17 +184,14 @@ func defaultSecurityContext(container *Container) {
 | 
			
		||||
		// there are settings in both then don't touch it, the converter will error if they don't
 | 
			
		||||
		// match
 | 
			
		||||
		if len(container.Capabilities.Add) == 0 {
 | 
			
		||||
			glog.V(4).Infof("upward merge of container.Capabilities.Add for container %s", container.Name)
 | 
			
		||||
			container.Capabilities.Add = container.SecurityContext.Capabilities.Add
 | 
			
		||||
		}
 | 
			
		||||
		if len(container.Capabilities.Drop) == 0 {
 | 
			
		||||
			glog.V(4).Infof("upward merge of container.Capabilities.Drop for container %s", container.Name)
 | 
			
		||||
			container.Capabilities.Drop = container.SecurityContext.Capabilities.Drop
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	// if there are no privileged settings on the security context then copy the container settings
 | 
			
		||||
	if container.SecurityContext.Privileged == nil {
 | 
			
		||||
		glog.V(4).Infof("downward merge of container.Privileged for container %s", container.Name)
 | 
			
		||||
		container.SecurityContext.Privileged = &container.Privileged
 | 
			
		||||
	} else {
 | 
			
		||||
		// we don't have a good way to know if container.Privileged was set or just defaulted to false
 | 
			
		||||
@@ -203,7 +199,6 @@ func defaultSecurityContext(container *Container) {
 | 
			
		||||
		// container is set to false and assume that the Privileged field was left off the container
 | 
			
		||||
		// definition and not an intentional mismatch
 | 
			
		||||
		if *container.SecurityContext.Privileged && !container.Privileged {
 | 
			
		||||
			glog.V(4).Infof("upward merge of container.Privileged for container %s", container.Name)
 | 
			
		||||
			container.Privileged = *container.SecurityContext.Privileged
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user