Allow root CA to be added through config maps
This commit is contained in:
parent
30fe11eccf
commit
ae4a00b4bc
16 changed files with 516 additions and 48 deletions
|
@ -50,6 +50,7 @@ type Client interface {
|
|||
GetSecret(namespace, name string) (*corev1.Secret, bool, error)
|
||||
GetEndpointSlicesForService(namespace, serviceName string) ([]*discoveryv1.EndpointSlice, error)
|
||||
GetNodes() ([]*corev1.Node, bool, error)
|
||||
GetConfigMap(namespace, name string) (*corev1.ConfigMap, bool, error)
|
||||
}
|
||||
|
||||
// TODO: add tests for the clientWrapper (and its methods) itself.
|
||||
|
@ -227,6 +228,10 @@ func (c *clientWrapper) WatchAll(namespaces []string, stopCh <-chan struct{}) (<
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_, err = factoryKube.Core().V1().ConfigMaps().Informer().AddEventHandler(eventHandler)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
factorySecret := kinformers.NewSharedInformerFactoryWithOptions(c.csKube, resyncPeriod, kinformers.WithNamespace(ns), kinformers.WithTweakListOptions(notOwnedByHelm))
|
||||
_, err = factorySecret.Core().V1().Secrets().Informer().AddEventHandler(eventHandler)
|
||||
|
@ -478,6 +483,17 @@ func (c *clientWrapper) GetSecret(namespace, name string) (*corev1.Secret, bool,
|
|||
return secret, exist, err
|
||||
}
|
||||
|
||||
// GetConfigMap returns the named config map from the given namespace.
|
||||
func (c *clientWrapper) GetConfigMap(namespace, name string) (*corev1.ConfigMap, bool, error) {
|
||||
if !c.isWatchedNamespace(namespace) {
|
||||
return nil, false, fmt.Errorf("failed to get config map %s/%s: namespace is not within watched namespaces", namespace, name)
|
||||
}
|
||||
|
||||
configMap, err := c.factoriesKube[c.lookupNamespace(namespace)].Core().V1().ConfigMaps().Lister().ConfigMaps(namespace).Get(name)
|
||||
exist, err := translateNotFoundError(err)
|
||||
return configMap, exist, err
|
||||
}
|
||||
|
||||
func (c *clientWrapper) GetNodes() ([]*corev1.Node, bool, error) {
|
||||
nodes, err := c.clusterScopeFactory.Core().V1().Nodes().Lister().List(labels.Everything())
|
||||
exist, err := translateNotFoundError(err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue