Skip to content

Commit

Permalink
#52 fix password encoding in elasticsearch user resource (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
xco-sk authored Apr 13, 2023
1 parent b8f952a commit b0fdc62
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions charts/eck-custom-resources-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ maintainers:
email: [email protected]
url: https://github.com/xco-sk
type: application
version: 0.5.2
appVersion: 0.5.2
version: 0.5.3
appVersion: 0.5.3
2 changes: 1 addition & 1 deletion charts/eck-custom-resources-operator/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Helm chart for eck-custom-resources

![Version: 0.5.2](https://img.shields.io/badge/Version-0.5.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.5.2](https://img.shields.io/badge/AppVersion-0.5.2-informational?style=flat-square)
![Version: 0.5.3](https://img.shields.io/badge/Version-0.5.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.5.3](https://img.shields.io/badge/AppVersion-0.5.3-informational?style=flat-square)

Helm chart for eck-custom-resources operator

Expand Down
2 changes: 1 addition & 1 deletion config/samples/es.eck_v1alpha1_elasticsearchuser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: elasticsearchuser-secret
type: Opaque
data:
elasticsearchuser-sample: c2FtcGxlLnBhc3N3b3JkCg==
elasticsearchuser-sample: c2FtcGxlLnBhc3N3b3Jk

---
apiVersion: es.eck.github.com/v1alpha1
Expand Down
5 changes: 3 additions & 2 deletions utils/elasticsearch/user_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package elasticsearch
import (
"context"
"encoding/json"
"strings"

"github.com/elastic/go-elasticsearch/v8"
"github.com/xco-sk/eck-custom-resources/apis/es.eck/v1alpha1"
"github.com/xco-sk/eck-custom-resources/utils"
k8sv1 "k8s.io/api/core/v1"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"strings"
)

func DeleteUser(esClient *elasticsearch.Client, userName string) (ctrl.Result, error) {
Expand All @@ -36,7 +37,7 @@ func UpsertUser(esClient *elasticsearch.Client, cli client.Client, ctx context.C
return ctrl.Result{}, unmarshallErr
}

userBody["password"] = password
userBody["password"] = string(password)
userWithPassword, marshallErr := json.Marshal(userBody)
if marshallErr != nil {
return ctrl.Result{}, marshallErr
Expand Down

0 comments on commit b0fdc62

Please sign in to comment.