This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
66d14c7
commit 5d549e5
Showing
21 changed files
with
901 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
spec_version: '0.1.0' | ||
dtCreds: dynatrace | ||
attachRules: | ||
tagRule: | ||
- meTypes: | ||
- SERVICE | ||
tags: | ||
- context: CONTEXTLESS | ||
key: keptn_project | ||
value: myproject | ||
- context: CONTEXTLESS | ||
key: keptn_service | ||
value: myservice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,54 @@ | ||
package common | ||
|
||
import ( | ||
"errors" | ||
"os" | ||
|
||
"k8s.io/client-go/kubernetes" | ||
"k8s.io/client-go/rest" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
var RunLocal = (os.Getenv("env") == "runlocal") | ||
var RunLocalTest = (os.Getenv("env") == "runlocaltest") | ||
|
||
func GetKubernetesClient() (*kubernetes.Clientset, error) { | ||
if RunLocal || RunLocalTest { | ||
return nil, nil | ||
} | ||
|
||
config, err := rest.InClusterConfig() | ||
if err != nil { | ||
return nil, err | ||
} | ||
return kubernetes.NewForConfig(config) | ||
} | ||
|
||
/** | ||
* Returns the Keptn Domain stored in the keptn-domainconfigmap | ||
*/ | ||
func GetKeptnDomain() (string, error) { | ||
kubeAPI, err := GetKubernetesClient() | ||
if kubeAPI == nil || err != nil { | ||
return "", err | ||
} | ||
|
||
keptnDomainCM, errCM := kubeAPI.CoreV1().ConfigMaps("keptn").Get("keptn-domain", metav1.GetOptions{}) | ||
if errCM != nil { | ||
return "", errors.New("Could not retrieve keptn-domain ConfigMap: " + errCM.Error()) | ||
} | ||
|
||
keptnDomain := keptnDomainCM.Data["app_domain"] | ||
return keptnDomain, nil | ||
} | ||
|
||
/** | ||
* Returns the endpoint to the configuration-service | ||
*/ | ||
func GetConfigurationServiceURL() string { | ||
if os.Getenv("CONFIGURATION_SERVICE_URL") != "" { | ||
return os.Getenv("CONFIGURATION_SERVICE_URL") | ||
} | ||
return "configuration-service.keptn.svc.cluster.local:8080" | ||
} |
Oops, something went wrong.