forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Namespace Mapping Configuration (#3)
* add namepace configuration * add namespace files * remove unused var * update propeller executor config * use propeller executor configuration * to lowercase * fix conflicts * update namespace test * remove namespaceMapping variable * fix compile issues * add project-domain option and remove incorrect log messages * upd mock configuration provider * update unit tests * Merge logs on task execution event updates (#18) * use fallthrough * Correct Lint Errors and Add Documentation on Pre-Commit (#19) * README update * Fix lint errors * add namepace configuration * add namespace files * remove unused var * update propeller executor config * use propeller executor configuration * to lowercase * fix conflicts * update namespace test * remove namespaceMapping variable * fix compile issues * add project-domain option and remove incorrect log messages * upd mock configuration provider * update unit tests * use fallthrough * fix conflicts * fix more conflicts * lint * remove duplicate package * fix lint errors
- Loading branch information
1 parent
b1012f4
commit 5ba9e89
Showing
19 changed files
with
254 additions
and
30 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,24 @@ | ||
package common | ||
|
||
import "fmt" | ||
|
||
type NamespaceMapping int | ||
|
||
const namespaceFormat = "%s-%s" | ||
|
||
const ( | ||
ProjectDomain NamespaceMapping = iota | ||
Domain NamespaceMapping = iota | ||
) | ||
|
||
// GetNamespaceName returns kubernetes namespace name | ||
func GetNamespaceName(mapping NamespaceMapping, project, domain string) string { | ||
switch mapping { | ||
case Domain: | ||
return domain | ||
case ProjectDomain: | ||
fallthrough | ||
default: | ||
return fmt.Sprintf(namespaceFormat, project, domain) | ||
} | ||
} |
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,25 @@ | ||
package common | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGetNamespaceName(t *testing.T) { | ||
testCases := []struct { | ||
mapping NamespaceMapping | ||
project string | ||
domain string | ||
want string | ||
}{ | ||
{ProjectDomain, "project", "production", "project-production"}, | ||
{20 /*Dummy enum value that is not supported*/, "project", "development", "project-development"}, | ||
{Domain, "project", "production", "production"}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
got := GetNamespaceName(tc.mapping, tc.project, tc.domain) | ||
assert.Equal(t, got, tc.want) | ||
} | ||
} |
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
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
11 changes: 11 additions & 0 deletions
11
flyteadmin/pkg/runtime/interfaces/namespace_configuration.go
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,11 @@ | ||
package interfaces | ||
|
||
import "github.com/lyft/flyteadmin/pkg/common" | ||
|
||
type NamespaceMappingConfig struct { | ||
Mapping string `json:"mapping"` | ||
} | ||
|
||
type NamespaceMappingConfiguration interface { | ||
GetNamespaceMappingConfig() common.NamespaceMapping | ||
} |
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
Oops, something went wrong.