diff --git a/pkg/trait/knative_service_env.go b/pkg/trait/knative_service_env.go index e4817067a5..416d36c342 100644 --- a/pkg/trait/knative_service_env.go +++ b/pkg/trait/knative_service_env.go @@ -21,12 +21,11 @@ import ( "fmt" "strings" + "github.com/apache/camel-k/pkg/apis/camel/v1alpha1" "github.com/apache/camel-k/pkg/util" - + "github.com/apache/camel-k/pkg/util/envvar" "github.com/apache/camel-k/pkg/util/kubernetes" - "github.com/apache/camel-k/pkg/apis/camel/v1alpha1" - "github.com/apache/camel-k/pkg/util/envvar" serving "github.com/knative/serving/pkg/apis/serving/v1alpha1" ) @@ -44,12 +43,12 @@ func (t *knativeServiceTrait) bindToEnvVar(e *Environment, service *serving.Serv }) VisitConfigurations("configmap", e.IntegrationContext, e.Integration, func(cmName string) { - cm, err := kubernetes.GetConfigMap(e.C, e.Client, e.Integration.Namespace, cmName) + cm, err := kubernetes.GetConfigMap(e.C, e.Client, cmName, e.Integration.Namespace) if err != nil { t.L.Errorf(err, "failed to lookup ConfigMap %s", cmName) } if cm != nil { - err = util.ExtractApplicationProperties(cm.Data, func(key string, val string) { + err = util.ExtractApplicationPropertiesString(cm.Data, func(key string, val string) { properties[key] = val }) if err != nil { @@ -59,12 +58,12 @@ func (t *knativeServiceTrait) bindToEnvVar(e *Environment, service *serving.Serv }) VisitConfigurations("secret", e.IntegrationContext, e.Integration, func(secretName string) { - cm, err := kubernetes.GetSecret(e.C, e.Client, e.Integration.Namespace, secretName) + cm, err := kubernetes.GetSecret(e.C, e.Client, secretName, e.Integration.Namespace) if err != nil { t.L.Errorf(err, "failed to lookup Secret %s", secretName) } if cm != nil { - err = util.ExtractEncodedApplicationProperties(cm.Data, func(key string, val string) { + err = util.ExtractApplicationPropertiesBytes(cm.Data, func(key string, val string) { properties[key] = val }) if err != nil { diff --git a/pkg/util/util.go b/pkg/util/util.go index 519b9f6711..4ab515f778 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -18,7 +18,6 @@ limitations under the License. package util import ( - "encoding/base64" "os" "os/signal" "path" @@ -157,8 +156,8 @@ func FindAllDistinctStringSubmatch(data string, regexps ...*regexp.Regexp) []str return submatchs.List() } -// ExtractApplicationProperties -- -func ExtractApplicationProperties(data map[string]string, consumer func(string, string)) error { +// ExtractApplicationPropertiesString -- +func ExtractApplicationPropertiesString(data map[string]string, consumer func(string, string)) error { pstr, ok := data["application.properties"] if !ok { return nil @@ -176,18 +175,14 @@ func ExtractApplicationProperties(data map[string]string, consumer func(string, return nil } -// ExtractEncodedApplicationProperties -- -func ExtractEncodedApplicationProperties(data map[string][]byte, consumer func(string, string)) error { - encoded, ok := data["application.properties"] +// ExtractApplicationPropertiesBytes -- +func ExtractApplicationPropertiesBytes(data map[string][]byte, consumer func(string, string)) error { + pstr, ok := data["application.properties"] if !ok { return nil } - decoded, err := base64.StdEncoding.DecodeString(string(encoded)) - if err != nil { - return err - } - p, err := properties.Load(decoded, properties.UTF8) + p, err := properties.Load(pstr, properties.UTF8) if err != nil { return err }