Add HostNetworkSources capability to limit use of HostNetwork.

This commit is contained in:
Victor Marmol
2015-03-24 16:09:16 -07:00
parent d9cd7a78f7
commit cf7e2756b5
8 changed files with 173 additions and 6 deletions

View File

@@ -16,7 +16,11 @@ limitations under the License.
package kubelet
import "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
import (
"fmt"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
)
const ConfigSourceAnnotationKey = "kubernetes.io/config.source"
const ConfigMirrorAnnotationKey = "kubernetes.io/config.mirror"
@@ -64,3 +68,22 @@ type PodUpdate struct {
Op PodOperation
Source string
}
// Gets all validated sources from the specified sources.
func GetValidatedSources(sources []string) ([]string, error) {
validated := make([]string, 0, len(sources))
for _, source := range sources {
switch source {
case AllSource:
return []string{FileSource, HTTPSource, ApiserverSource}, nil
case FileSource, HTTPSource, ApiserverSource:
validated = append(validated, source)
break
case "":
break
default:
return []string{}, fmt.Errorf("unknown pod source %q", source)
}
}
return validated, nil
}