-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kubernetes typeDefs Revision alpha1 (WIP) #1582
Closed
justinlevi
wants to merge
3
commits into
uselagoon:master
from
justinlevi:feature/kubernetes-typeDefs
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
// @flow | ||
|
||
const gql = require('./util/gql'); | ||
|
||
// TODO: Split up this file | ||
|
@@ -102,6 +100,7 @@ const typeDefs = gql` | |
ZAR | ||
} | ||
|
||
|
||
type File { | ||
id: Int | ||
filename: String | ||
|
@@ -163,16 +162,47 @@ const typeDefs = gql` | |
billingSoftware: String | ||
} | ||
|
||
type Openshift { | ||
# Alpha - Kubernetes may have different fields - Just for discussion | ||
type Kubernetes { | ||
id: Int | ||
name: String | ||
consoleUrl: String | ||
name: String # Must be unique | ||
# type: ClusterType | ||
environments: [Environment] #namespaces | ||
api: String | ||
token: String | ||
routerPattern: String | ||
projectUser: String | ||
sshHost: String | ||
sshPort: String | ||
autoGeneratedIngressPattern: String | ||
remoteShellHost: String | ||
remoteShellPort: String | ||
created: String | ||
|
||
#NOTES: We need to teach people to use kubernetes even though it's an openshift | ||
|
||
# Can we derive these based on the Cluster Type, branch, name? | ||
|
||
customSettings: JSON | ||
|
||
# """ | ||
# Which internal Lagoon System is responsible for deploying | ||
# 'lagoon_kubernetesBuildDeploy' | 'lagoon_openshiftBuildDeploy' | ||
# """ | ||
|
||
# # TODO - TURN TO ENUMS - convert to a single field | ||
# activeSystemsDeploy: String | ||
# """ | ||
# Which internal Lagoon System is responsible for promoting | ||
# 'lagoon_kubernetesBuildDeploy' | 'lagoon_openshiftBuildDeploy' | ||
# """ | ||
# activeSystemsPromote: String | ||
# """ | ||
# Which internal Lagoon System is responsible for promoting | ||
# 'lagoon_kubernetesBuildDeploy' | 'lagoon_openshiftBuildDeploy' | ||
# """ | ||
# activeSystemsRemove: String | ||
# """ | ||
# Which internal Lagoon System is responsible for tasks | ||
# 'lagoon_kubernetesBuildDeploy' | 'lagoon_openshiftBuildDeploy' | ||
# """ | ||
# activeSystemsTask: String | ||
} | ||
|
||
type NotificationMicrosoftTeams { | ||
|
@@ -209,6 +239,14 @@ const typeDefs = gql` | |
|
||
union Notification = NotificationRocketChat | NotificationSlack | NotificationMicrosoftTeams | NotificationEmail | ||
|
||
|
||
type KubernetesEnvironmentMap { | ||
environmentType: EnvironmentType | ||
kubernetes: Kubernetes | ||
} | ||
|
||
# Someday... would like to suppor one project deploy in multiple places (clusters) | ||
|
||
""" | ||
Lagoon Project (like a git repository) | ||
""" | ||
|
@@ -250,26 +288,6 @@ const typeDefs = gql` | |
""" | ||
notifications(type: NotificationType): [Notification] | ||
""" | ||
Which internal Lagoon System is responsible for deploying | ||
Currently only 'lagoon_openshiftBuildDeploy' exists | ||
""" | ||
activeSystemsDeploy: String | ||
""" | ||
Which internal Lagoon System is responsible for promoting | ||
Currently only 'lagoon_openshiftBuildDeploy' exists | ||
""" | ||
activeSystemsPromote: String | ||
""" | ||
Which internal Lagoon System is responsible for promoting | ||
Currently only 'lagoon_openshiftRemove' exists | ||
""" | ||
activeSystemsRemove: String | ||
""" | ||
Which internal Lagoon System is responsible for tasks | ||
Currently only 'lagoon_openshiftJob' exists | ||
""" | ||
activeSystemsTask: String | ||
""" | ||
Which branches should be deployed, can be one of: | ||
- \`true\` - all branches are deployed | ||
- \`false\` - no branches are deployed | ||
|
@@ -296,14 +314,16 @@ const typeDefs = gql` | |
Should storage for this environment be calculated (\`1\` or \`0\`) | ||
""" | ||
storageCalc: Int | ||
|
||
""" | ||
Reference to OpenShift Object this Project should be deployed to | ||
Environment > Cluster | ||
""" | ||
openshift: Openshift | ||
kubernetesMap: [KubernetesMap] | ||
|
||
""" | ||
Pattern of OpenShift Project/Namespace that should be generated, default: \`$\{project}-$\{environmentname}\` | ||
Kubernetes Namespace pattern that should be generated, default: \`$\{project}-$\{environmentname}\` | ||
""" | ||
openshiftProjectPattern: String | ||
kubernetesNamespacePattern: String | ||
""" | ||
How many environments can be deployed at one timeout | ||
""" | ||
|
@@ -330,7 +350,7 @@ const typeDefs = gql` | |
""" | ||
envVariables: [EnvKeyValue] | ||
""" | ||
Which groups are directly linked to project | ||
Groups linked to a project | ||
""" | ||
groups: [GroupInterface] | ||
} | ||
|
@@ -344,14 +364,22 @@ const typeDefs = gql` | |
""" | ||
id: Int | ||
""" | ||
Name of this Environment | ||
Name of this Environment (not unique) | ||
""" | ||
name: String | ||
""" | ||
Unique Name (auto generated) environmentName.projectName.kubernetesName (ex. pr-104.drupal-example.ch1.amazee.io) | ||
""" | ||
uniqueName: String | ||
""" | ||
Reference to the Project Object | ||
""" | ||
project: Project | ||
""" | ||
Reference to the Kubernetes Object | ||
""" | ||
kubernetes: Kubernetes | ||
""" | ||
Which Deployment Type this environment is, can be \`branch\`, \`pullrequest\`, \`promote\` | ||
""" | ||
deployType: String | ||
|
@@ -374,9 +402,13 @@ const typeDefs = gql` | |
""" | ||
Which Environment Type this environment is, can be \`production\`, \`development\` | ||
""" | ||
environmentType: String | ||
environmentType: EnvironmentType | ||
""" | ||
Kubernetes Namespace | ||
""" | ||
kubernetesNamespace: String | ||
""" | ||
Name of the OpenShift Project/Namespace this environment is deployed into | ||
(DEPRECATED as of 2.0) Name of the OpenShift Project/Namespace this environment is deployed into | ||
""" | ||
openshiftProjectName: String | ||
""" | ||
|
@@ -502,7 +534,9 @@ const typeDefs = gql` | |
input DeleteEnvironmentInput { | ||
name: String! | ||
project: String! | ||
execute: Boolean | ||
execute: Boolean # TODO: change to two separate mutations | ||
# Anywhere you can delete anything, change the execute thing | ||
# Internal - deleteEnvironmentFromOpenshift | ||
} | ||
|
||
type Query { | ||
|
@@ -515,23 +549,27 @@ const typeDefs = gql` | |
""" | ||
projectByName(name: String!): Project | ||
""" | ||
Returns Project Object by a display name | ||
""" | ||
projectByDisplayName(name: String!): Project | ||
""" | ||
Returns Group Object by a given name | ||
""" | ||
groupByName(name: String!): Group | ||
""" | ||
Returns Project Object by a given gitUrl (only the first one if there are multiple) | ||
""" | ||
projectByGitUrl(gitUrl: String!): Project | ||
environmentById(name: String!, project: Int!): Environment | ||
""" | ||
Returns Environment Object by a given names | ||
""" | ||
environmentByName(name: String!, project: Int!): Environment | ||
""" | ||
Returns Environment Object by a given openshiftProjectName | ||
Returns Environment Object by a Cluster Name | ||
""" | ||
environmentByOpenshiftProjectName( | ||
openshiftProjectName: String! | ||
): Environment | ||
userCanSshToEnvironment( | ||
openshiftProjectName: String | ||
): Environment | ||
environmentsByClusterName(name: String!): [Environment] | ||
userCanSshToEnvironment(deploymentTargetName: String): Environment | ||
deploymentByRemoteId(id: String): Deployment | ||
taskByRemoteId(id: String): Task | ||
""" | ||
|
@@ -541,7 +579,7 @@ const typeDefs = gql` | |
""" | ||
Returns all OpenShift Objects | ||
""" | ||
allOpenshifts: [Openshift] | ||
allDeploymentTargets: [Openshift | Kubernetes] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. returns |
||
""" | ||
Returns all Environments matching given filter (all if no filter defined) | ||
""" | ||
|
@@ -605,8 +643,8 @@ const typeDefs = gql` | |
name: String! | ||
gitUrl: String! | ||
subfolder: String | ||
openshift: Int! | ||
openshiftProjectPattern: String | ||
deploymentTarget: DeploymentTarget | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. deploymentTarget is id or name |
||
namespaceEnvironment: String | ||
activeSystemsDeploy: String | ||
activeSystemsPromote: String | ||
activeSystemsRemove: String | ||
|
@@ -630,7 +668,7 @@ const typeDefs = gql` | |
deployHeadRef: String | ||
deployTitle: String | ||
environmentType: EnvType! | ||
openshiftProjectName: String! | ||
deploymentTargetName: String! | ||
} | ||
|
||
input AddOrUpdateEnvironmentStorageInput { | ||
|
@@ -741,7 +779,7 @@ const typeDefs = gql` | |
patch: UpdateTaskPatchInput! | ||
} | ||
|
||
input AddOpenshiftInput { | ||
input AddDeploymentTargetInput { | ||
id: Int | ||
name: String! | ||
consoleUrl: String! | ||
|
@@ -752,7 +790,7 @@ const typeDefs = gql` | |
sshPort: String | ||
} | ||
|
||
input DeleteOpenshiftInput { | ||
input DeleteDeploymentTargetInput { | ||
name: String! | ||
} | ||
|
||
|
@@ -847,8 +885,8 @@ const typeDefs = gql` | |
autoIdle: Int | ||
storageCalc: Int | ||
pullrequests: String | ||
openshift: Int | ||
openshiftProjectPattern: String | ||
deploymentTarget: DeploymentTarget | ||
namespaceEnvironment: String | ||
developmentEnvironmentsLimit: Int | ||
} | ||
|
||
|
@@ -857,7 +895,7 @@ const typeDefs = gql` | |
patch: UpdateProjectPatchInput! | ||
} | ||
|
||
input UpdateOpenshiftPatchInput { | ||
input UpdateDeploymentTargetPatchInput { | ||
name: String | ||
consoleUrl: String | ||
token: String | ||
|
@@ -867,9 +905,9 @@ const typeDefs = gql` | |
sshPort: String | ||
} | ||
|
||
input UpdateOpenshiftInput { | ||
input UpdateDeploymentTargetInput { | ||
id: Int! | ||
patch: UpdateOpenshiftPatchInput! | ||
patch: UpdateDeploymentTargetPatchInput! | ||
} | ||
|
||
input UpdateNotificationMicrosoftTeamsPatchInput { | ||
|
@@ -931,7 +969,7 @@ const typeDefs = gql` | |
deployHeadRef: String | ||
deployTitle: String | ||
environmentType: EnvType | ||
openshiftProjectName: String | ||
deploymentTargetName: String | ||
route: String | ||
routes: String | ||
monitoringUrls: String | ||
|
@@ -1120,10 +1158,10 @@ const typeDefs = gql` | |
input: RemoveNotificationFromProjectInput! | ||
): Project | ||
removeAllNotificationsFromAllProjects: String | ||
addOpenshift(input: AddOpenshiftInput!): Openshift | ||
updateOpenshift(input: UpdateOpenshiftInput!): Openshift | ||
deleteOpenshift(input: DeleteOpenshiftInput!): String | ||
deleteAllOpenshifts: String | ||
addDeploymentTarget(input: AddDeploymentTargetInput!): DeploymentTarget | ||
updateDeploymentTarget(input: UpdateDeploymentTargetInput!): DeploymentTarget | ||
deleteDeploymentTarget(input: DeleteDeploymentTargetInput!): String | ||
deleteAllDeploymentTargets: String | ||
addProject(input: AddProjectInput!): Project | ||
updateProject(input: UpdateProjectInput!): Project | ||
deleteProject(input: DeleteProjectInput!): String | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deploymentTargetName
>name
assuming above unique name change is applied