-
Notifications
You must be signed in to change notification settings - Fork 88
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
Add GCP GKE support #209
Add GCP GKE support #209
Conversation
This has only been tested on OSX. No Windows machine available at the moment. I think it could work on Windows as well since I'm not using any shell commands. |
Updated PR to include the option to set the kubernetes cluster using Also, the FAKE tasks are structured so that the kubernetes specific ones can be used for any kubernetes cluster as long as |
Content/paket.dependencies
Outdated
@@ -64,4 +64,7 @@ group Build | |||
nuget Fake.IO.Zip | |||
github CompositionalIT/fshelpers src/FsHelpers/ArmHelper/ArmHelper.fs | |||
//#endif | |||
//#if (deploy == "gcp-kubernetes") | |||
nuget Fake.Tools.Git |
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.
we'll need to add new case to paket lock generation for this - I can add that afterwards
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.
sounds good, since I have no clue about how that part works.
Target.create "Publish" (fun _ -> | ||
let dockerTag = createDockerTag dockerImageName | ||
let pushArgs = sprintf "push %s" dockerTag | ||
runTool "docker" pushArgs "." |
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.
unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication
<- should be probably reflected in docs?
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.
I'll add, I guess I had already done that in my environment.
It shouldn't be too hard to add kubernetes support for azure and aws after this I guess. Not sure how that works on those platforms, but I imagine it is similar. |
Can you rebase on master? |
Yes, that was my plan all along :).
…On Tue, 15 Jan 2019 at 13:40, Tomasz Heimowski ***@***.***> wrote:
Can you rebase on master?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#209 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAemsI8Dfz1giz5Yk7z0mXwzg1BBi9yIks5vDcwngaJpZM4ZlFcP>
.
|
Content/build.fsx
Outdated
@@ -19,6 +19,10 @@ open Cit.Helpers.Arm | |||
open Cit.Helpers.Arm.Parameters | |||
open Microsoft.Azure.Management.ResourceManager.Fluent.Core | |||
//#endif | |||
//#if (deploy == "gcp-kubernetes") | |||
open System.Text.RegularExpressions | |||
open Fake.Tools.Git |
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.
Just thinking - is it really crucial to employ Git here? Can we find a different way to create a docker tag? Adding this dependency has 2 main drawbacks:
- it implies the user needs to actually create git repo and commit before testing out the deployment
- makes template a bit harder to maintain
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.
It can be solved with a version variable. The reason I added it is because I see it as a good example of how to version your docker container based on your git sha, which does make some things around versioning slightly simpler in some scenarios, and also deterministic.
If it adds a lot of complexity I can, of course, figure something else out. What do you think based on motivation to why I added it in the first place @theimowski?
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.
Yes I totally agree it's a go-to solution for deterministic tagging.
However in case of a template it's more steps for a user to try out functionality, and we strive to make the template as easy to use as possible and with minimal steps to deploy.
Can you push to Google Container Registry a docker image without tag (projectId/projectName
instead of projectId/projectName:tag
)?
If so maybe this could be the easiest way to start with. Otherwise - what would a "version variable" look like?
eb9654c
to
e1f1924
Compare
Rebased on master now. |
Yes, that is possible. But that might make the user confused when the try
to make changes and nothing happen since the tag is still the same. The
version could just be something simple as v1 used as rag for the container
image. I can make it as simple as possible and instead write something
about the more advanced tagging in the docs.
…On Thu, 17 Jan 2019 at 13:18, Tomasz Heimowski ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In Content/build.fsx
<#209 (comment)>
:
> @@ -19,6 +19,10 @@ open Cit.Helpers.Arm
open Cit.Helpers.Arm.Parameters
open Microsoft.Azure.Management.ResourceManager.Fluent.Core
//#endif
+//#if (deploy == "gcp-kubernetes")
+open System.Text.RegularExpressions
+open Fake.Tools.Git
Yes I totally agree it's a go-to solution for deterministic tagging.
However in case of a template it's more steps for a user to try out
functionality, and we strive to make the template as easy to use as
possible and with minimal steps to deploy.
Can you push to Google Container Registry a docker image without tag (
projectId/projectName instead of projectId/projectName:tag)?
If so maybe this could be the easiest way to start with. Otherwise - what
would a "version variable" look like?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#209 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAemsDzpLrGVdrfTR2pM4q9UyWAyfIcDks5vEGohgaJpZM4ZlFcP>
.
|
Please do - that would be my preference.
Is it really the case? I mean if you push the image with the same tag, doesn't it override the existing one in registry? I think that is what happens in case of Docker Hub for example. |
It overrides in the registry, yes, but I don’t think kubernetes consider
the image as new if it has the same tag.
…On Thu, 17 Jan 2019 at 17:04, Tomasz Heimowski ***@***.***> wrote:
I can make it as simple as possible and instead write something
about the more advanced tagging in the docs.
Please do - that would be my preference.
nothing happen since the tag is still the same
Is it really the case? I mean if you push the image with the same tag,
doesn't it override the existing one in registry? I think that is what
happens in case of Docker Hub for example.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#209 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAemsKr_Z-JUMGxGZbVXFqJdH8jMsIJ-ks5vEJ8ZgaJpZM4ZlFcP>
.
|
If it doesn't, let's just mention that in docs. For the template what really matters is the first-time deploy. |
I've applied the changes and also verified that it indeed work the way I said. I'll update the docs later this weekend to reflect the changes and also with the suggestion on how to use the git sha for versioning. |
Thanks for that. I'm aware we might not be contributing to "best practices" here, however IMO it's crucial to find a right balance between simplicity and correctness for this template. |
Fixes: #208
Docs: SAFE-Stack/docs#91
Adds support for kubernetes in general and Google Cloud Kubernetes Engine in particular.
The PR assumes two tools are pre-installed:
gcloud
- cli tool to interact with gcpkubectl
- cli tool to interact with kubernetesGiven the above is installed and that you have a gcp project and gke cluster running. You can test this out by running:
Again, this serves as a way to getting started and will suffice for smaller apps.