summaryrefslogtreecommitdiff
path: root/vendor/k8s.io/kubernetes/pkg/capabilities
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-03-26 18:26:55 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-27 18:09:12 +0000
commitaf64e10400f8533a0c48ecdf5ab9b7fbf329e14e (patch)
tree59160e3841b440dd35189c724bbb4375a7be173b /vendor/k8s.io/kubernetes/pkg/capabilities
parent26d7e3c7b85e28c4e42998c90fdcc14079f13eef (diff)
downloadpodman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.tar.gz
podman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.tar.bz2
podman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.zip
Vendor in lots of kubernetes stuff to shrink image size
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #554 Approved by: mheon
Diffstat (limited to 'vendor/k8s.io/kubernetes/pkg/capabilities')
-rw-r--r--vendor/k8s.io/kubernetes/pkg/capabilities/capabilities.go27
1 files changed, 14 insertions, 13 deletions
diff --git a/vendor/k8s.io/kubernetes/pkg/capabilities/capabilities.go b/vendor/k8s.io/kubernetes/pkg/capabilities/capabilities.go
index be721a785..0da7b9c8b 100644
--- a/vendor/k8s.io/kubernetes/pkg/capabilities/capabilities.go
+++ b/vendor/k8s.io/kubernetes/pkg/capabilities/capabilities.go
@@ -46,16 +46,17 @@ type PrivilegedSources struct {
HostIPCSources []string
}
-// TODO: Clean these up into a singleton
-var once sync.Once
-var lock sync.Mutex
-var capabilities *Capabilities
+var capInstance struct {
+ once sync.Once
+ lock sync.Mutex
+ capabilities *Capabilities
+}
// Initialize the capability set. This can only be done once per binary, subsequent calls are ignored.
func Initialize(c Capabilities) {
// Only do this once
- once.Do(func() {
- capabilities = &c
+ capInstance.once.Do(func() {
+ capInstance.capabilities = &c
})
}
@@ -70,17 +71,17 @@ func Setup(allowPrivileged bool, privilegedSources PrivilegedSources, perConnect
// SetForTests sets capabilities for tests. Convenience method for testing. This should only be called from tests.
func SetForTests(c Capabilities) {
- lock.Lock()
- defer lock.Unlock()
- capabilities = &c
+ capInstance.lock.Lock()
+ defer capInstance.lock.Unlock()
+ capInstance.capabilities = &c
}
// Returns a read-only copy of the system capabilities.
func Get() Capabilities {
- lock.Lock()
- defer lock.Unlock()
+ capInstance.lock.Lock()
+ defer capInstance.lock.Unlock()
// This check prevents clobbering of capabilities that might've been set via SetForTests
- if capabilities == nil {
+ if capInstance.capabilities == nil {
Initialize(Capabilities{
AllowPrivileged: false,
PrivilegedSources: PrivilegedSources{
@@ -90,5 +91,5 @@ func Get() Capabilities {
},
})
}
- return *capabilities
+ return *capInstance.capabilities
}