-
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.
Teams, Namespace, and Gateway types/struct definitions
ThoughtWorks-DPS/lab-api-teams/#2 Signed-off-by: Bryan Oliver <[email protected]>
- Loading branch information
0 parents
commit 0dc469b
Showing
11 changed files
with
107 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# lab-api-teams |
Empty file.
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,3 @@ | ||
module twdps.io/lab-api-teams | ||
|
||
go 1.20 |
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,18 @@ | ||
package domain | ||
|
||
// gw-id: subdomain of gateway, e.g., dev.api.twdps.io | ||
// gw-cert-managed: is this a supported gateway, cert-manager to manage? | ||
// gw-custom-cert: where the customer supplies the cert? | ||
// gw-ingress: ingress-gateway to attach | ||
|
||
type Gateway struct { | ||
GatewayID string `json:"gatewayID"` | ||
GatewayCertManaged bool `json:"gatewayCertManaged"` | ||
GatewayCustomCert string `json:"gatewayCustomCert"` | ||
GatewayIngress string `json:"gatewayIngress"` | ||
} | ||
|
||
type GatewayRepository interface { | ||
GetGateways() ([]Gateway, error) | ||
GetGatewayByID(id string) (Gateway, error) | ||
} |
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,39 @@ | ||
package domain | ||
|
||
// ns-type: [ normal | master | standard | custom ] | ||
// normal: the ns definition is a normal, team ns desired state definition. Normal | ||
// namespaces are subject of the sync action. | ||
// master: ns definition not associated with any team. The master record contains | ||
// the default values used for ram, cpu, in-or-out of mesh. | ||
// standard: The standard ns records represent the default namespaces provisioned | ||
// for a new team at creation. | ||
// custom: Teams my define custom namespace. By convention this is the equivalent | ||
// of creating an 'optional' standard entry. All teams can view the list of custom | ||
// ns and choose to adopt it as well as define a new one. | ||
// ns-team: team-id used by normal ns entries | ||
// ns-id: name to append to team-id [dev | qa | etc] | ||
// ns-ram: k8s resource | ||
// [pool resource] In the master record, define the default amount of ram/cpu to assign | ||
// to new ns (typically a number like 1/5 of the amount of the teams pool from the team | ||
// record | ||
// ns-cpu: k8s resource [pool resource like ram] | ||
// ns-in-mesh: istio managed? boolean, true by default | ||
// ns-cluster-location: name of cluster where the ns resides TODO - discuss if this is needed | ||
// ns-from-default: was this created at onboarding from defaults? | ||
|
||
type Namespace struct { | ||
NamespaceType string `json:"namespaceType"` // normal, master, standard, custom | ||
NamespaceTeamID string `json:"namespaceTeamID"` // ID from teams API | ||
NamespaceID string `json:"namesapceID"` // Dev, QA, etc | ||
NamespaceRam int `json:"namespaceRam"` | ||
NamespaceCpu int `json:"namespaceCpu"` | ||
NamespaceInMesh bool `json:"namespaceInMesh"` | ||
NamespaceFromDefault bool `json:"namespaceFromDefault"` | ||
} | ||
|
||
type NamespacesRepository interface { | ||
GetNamespaces() ([]Namespace, error) | ||
GetStandardNamespaces() ([]Namespace, error) | ||
GetCustomNamespaces() ([]Namespace, error) | ||
GetMasterNamespaces() ([]Namespace, error) | ||
} |
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,46 @@ | ||
package domain | ||
|
||
// team-type: [ normal | master | admin ] | ||
// team-id: (team github name) | ||
// team-description: freeform | ||
// team-ram: integer | ||
// In the master record this | ||
// represents the default pool | ||
// size to assign to teams. | ||
// team-cpu: integer | ||
// team-integrations: json | ||
// list of the supported integrations the | ||
// team wants the platform to maintain on their | ||
// behalf. | ||
// team-ram-limit: only admin edit. | ||
// in master this is the max | ||
// self-managed resource limit | ||
// team-cpu-limit: only admin edit. | ||
// in master this is the max | ||
// self-managed resource limit | ||
// team-marked-for-deletion: | ||
// [ requested | pending | done ] | ||
|
||
type Team struct { | ||
TeamType string `json:"teamType"` | ||
TeamID string `json:"teamID"` | ||
TeamDescription string `json:"teamDescription"` | ||
TeamRAM int `json:"teamRAM"` | ||
TeamCPU int `json:"teamCPU"` | ||
TeamRamLimit int `json:"teamRamLimit"` | ||
TeamCpuLimit int `json:"teamCPULimit"` | ||
TeamMarkedForDeletion string `json:"teamMarkedForDeletion"` | ||
TeamIntegrations []TeamIntegration `json:"teamIntegrations"` | ||
} | ||
|
||
type TeamIntegration struct { | ||
IntegrationName string `json:"integrationName"` | ||
} | ||
|
||
type TeamsRepository interface { | ||
GetTeams() ([]Team, error) | ||
GetTeam(id string) (Team, error) | ||
AddTeam(newTeam Team) error | ||
UpdateTeam(team Team) error | ||
RemoveTeam(id string) (Team, error) | ||
} |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.