-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Create Hello World program with Kotlin #381
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
Conversation
|
/assign @mattmoor |
|
/ok-to-test |
grantr
left a comment
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.
| } | ||
| ``` | ||
|
|
||
| 3. Create a new file, `build.gradle` and copy the following setting |
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.
Can you mention the switch back to the root directory for this and later files?
|
|
||
| 4. To find the IP address for your service, use | ||
| `kubectl get svc knative-ingressgateway -n istio-system` to get the ingress IP for your | ||
| cluster. If your cluster is new, it may take sometime for the service to get asssigned |
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.
typo: assigned
| ```shell | ||
| kubectl get svc knative-ingressgateway -n istio-system | ||
|
|
||
| NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE |
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.
The output of the command should be in a separate shell block so users can copy the entire command block without interpreting its contents.
| 5. To find the URL for your service, use | ||
| ``` | ||
| kubectl get ksvc helloworld-kotlin -o=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain | ||
| NAME DOMAIN |
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.
Separate shell block
|
|
||
| ```shell | ||
| curl -H "Host: helloworld-kotlin.default.example.com" http://{IP_ADDRESS} | ||
| Hello World: Kotlin Sample v1 |
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.
Separate shell block
|
/unassign @grantr |
|
/lgtm |
|
|
||
| CMD ["gradle"] | ||
|
|
||
| ENV GRADLE_HOME /opt/gradle |
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.
@pzmrzy is there a reason for not using gradle official image(s) ? (as it really does the same thing https://github.com/keeganwitt/docker-gradle/blob/bd6b0605196488734d8d61d6a00a4ca96846d2e7/jdk8/Dockerfile)
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.
@vdemeester I think no, I did't find this before, I just search on github for a gradle docker image
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.
@pzmrzy I guess we can do a follow-up to use an official image then 😉
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.
@vdemeester Just update the image and test again
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.
@pzmrzy Can we use the official gradle image for this? Lines 1-34 can be replaced by:
FROM gradle
|
@pzmrzy Let's see what we can do to get this in ;) Can you resolve the merge conflicts first? /assign |
imikushin
left a comment
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.
/lgtm
|
@samodell Can you approve? |
|
@RichieEscarez Can you take another look at this? It's been a while |
|
Hey @imikushin -- we recently merged in some updates to the Hello World samples; they've been rewritten so they aren't hard coded to listen on port 8080. See this issue for more information: #456 It looks to me like your sample is hard-coded to listen on port 8080? (I'm definitely not a Kotlin expert, so let me know if that's not the case.) The "Hello World" sections were also slightly revamped; see the changes on lines 4-5 in the README of this PR for an example: https://github.com/knative/docs/pull/462/files#diff-99942f6b9d4f507ea57838988d5f8cbc |
| revisionTemplate: | ||
| spec: | ||
| container: | ||
| image: docker.io/{username}/helloworld-kotlin |
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.
docker.io/ should probably be omitted:
I saw image pull errors with docker.io/imikushin/helloworld-kotlin, but imikushin/helloworld-kotlin worked just fine 🤷♂️
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 works fine for me with docker.io, other samples also have this.
|
@samodell Just updated! |
samodell
left a comment
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.
A few more changes.
| @@ -0,0 +1,213 @@ | |||
| # Hello World - Kotlin sample | |||
|
|
|||
| A simple web app written in Kotlin using Ktor that you can use for testing. | |||
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.
Suggestion: add a link to more info about the Ktor framework
| an external IP address. | ||
|
|
||
| ```shell | ||
| kubectl get svc knative-ingressgateway -n istio-system |
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 ended up reverting the changes that exposed the short names (svc, for example) because they're not in the 0.1 release. To fix, replace "svc" and "ksvc" with "services.serving.knative.dev" and delete the Note about the short names, further down.
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.
Thanks for the comment, just updated.
| curl -H "Host: helloworld-kotlin.default.example.com" http://{IP_ADDRESS} | ||
| ``` | ||
| ```shell | ||
| Hello World: Kotlin Sample v1 |
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.
The other changes made above mean this output should now be "Hello Kotlin Sample v1".
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: imikushin, pzmrzy, samodell, vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/lgtm |
Proposed Changes