forked from redhat-developer/service-binding-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configmap.go
36 lines (32 loc) · 852 Bytes
/
configmap.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package annotations
import (
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
)
const ConfigMapValue = "binding:env:object:configmap"
// IsConfigMap returns true if the annotation value should trigger config map handler.
func IsConfigMap(s string) bool {
return ConfigMapValue == s
}
// NewConfigMapHandler constructs an annotation handler that can extract related data from config
// maps.
func NewConfigMapHandler(
client dynamic.Interface,
bindingInfo *BindingInfo,
resource unstructured.Unstructured,
restMapper meta.RESTMapper,
) (Handler, error) {
return NewResourceHandler(
client,
bindingInfo,
resource,
schema.GroupVersionResource{
Version: "v1",
Resource: "configmaps",
},
&dataPath,
restMapper,
)
}