Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
#127 fix deployment of OneAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
bacherfl committed Apr 24, 2020
1 parent c1baceb commit f5d05fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
8 changes: 4 additions & 4 deletions pkg/lib/dynatrace.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const DefaultOperatorVersion = "v0.5.2"
const DefaultOperatorVersion = "v0.6.0"
const sliResourceURI = "dynatrace/sli.yaml"
const Throughput = "throughput"
const ErrorRate = "error_rate"
Expand Down Expand Up @@ -232,9 +232,9 @@ func (dt *DynatraceHelper) GetDTCredentials() (*DTCredentials, error) {

dtCreds := &DTCredentials{}

dtCreds.Tenant = string(secret.Data["DT_TENANT"])
dtCreds.ApiToken = string(secret.Data["DT_API_TOKEN"])
dtCreds.PaaSToken = string(secret.Data["DT_PAAS_TOKEN"])
dtCreds.Tenant = strings.Trim(string(secret.Data["DT_TENANT"]), "\n")
dtCreds.ApiToken = strings.Trim(string(secret.Data["DT_API_TOKEN"]), "\n")
dtCreds.PaaSToken = strings.Trim(string(secret.Data["DT_PAAS_TOKEN"]), "\n")

return dtCreds, nil
}
Expand Down
22 changes: 1 addition & 21 deletions pkg/lib/one_agent.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package lib

import (
"encoding/json"
"io/ioutil"
"net/http"
"os"
Expand Down Expand Up @@ -45,26 +44,7 @@ func (dt *DynatraceHelper) isDynatraceDeployed() bool {
}

func (dt *DynatraceHelper) deployDTOperator() error {
// get latest operator version
resp, err := http.Get("https://api.github.com/repos/dynatrace/dynatrace-oneagent-operator/releases/latest")
if err == nil {
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)

operatorInfo := &dtOperatorReleaseInfo{}

err = json.Unmarshal(body, operatorInfo)

if err == nil {
dt.OperatorTag = operatorInfo.TagName
}
}
if dt.OperatorTag != "" {
dt.Logger.Info("Deploying Dynatrace operator " + dt.OperatorTag)
} else {
dt.Logger.Info("Could not fetch latest Dynatrace operator version. Using " + DefaultOperatorVersion + " per default.")
dt.OperatorTag = DefaultOperatorVersion
}
dt.OperatorTag = DefaultOperatorVersion

platform := os.Getenv("PLATFORM")

Expand Down

0 comments on commit f5d05fd

Please sign in to comment.