generated from ouzi-dev/bigbang
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make sure that the integration with the prometheus operator wor…
…ks (#30) * feat: make sure that the integration with the prometheus operator works * fix: pull image if not present
- Loading branch information
Showing
8 changed files
with
87 additions
and
6 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
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
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,17 @@ | ||
package env | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
const ServiceMonitorNamespaceEnvVar = "SERVICE_MONITOR_NAMESPACE" | ||
|
||
func GetServiceMonitorNamespace() (string, error) { | ||
ns, found := os.LookupEnv(ServiceMonitorNamespaceEnvVar) | ||
if !found { | ||
return "", fmt.Errorf("%s must be set", ServiceMonitorNamespaceEnvVar) | ||
} | ||
|
||
return ns, nil | ||
} |
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,24 @@ | ||
package env | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGetServiceMonitorNamespace(t *testing.T) { | ||
err := os.Unsetenv(ServiceMonitorNamespaceEnvVar) | ||
assert.NoError(t, err) | ||
|
||
ns, err := GetServiceMonitorNamespace() | ||
assert.Error(t, err) | ||
assert.Equal(t, "", ns) | ||
|
||
err = os.Setenv(ServiceMonitorNamespaceEnvVar, "namespace") | ||
assert.NoError(t, err) | ||
|
||
ns, err = GetServiceMonitorNamespace() | ||
assert.NoError(t, err) | ||
assert.Equal(t, "namespace", ns) | ||
} |