Skip to content
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

Adding guestbook example with latest json format for v1beta3 api #4460

Merged
merged 14 commits into from
Feb 24, 2015

Conversation

sub-mod
Copy link
Contributor

@sub-mod sub-mod commented Feb 16, 2015

Support guestbook example json files to work with v3 api

@derekwaynecarr
Copy link
Member

Can I ask why this change is needed?

This basically means users will not be able to run this same example in another Kubernetes namespace. The kubectl client will insert the namespace value from the current-context when omitted in the file, but when present, it errors if the context differs.

I don't think we should do this change.

@sub-mod
Copy link
Contributor Author

sub-mod commented Feb 17, 2015

I was just trying to give a working example of guestbook with latest k8-code and v3 api.I couldn't find one with latest format which worked on v3 api.
These json files have the latest json format .I agree hardcoding "default" can cause problems in other namespace.I gave "default" as the namespace just as an example so that the files were complete with all the data.But it was not really required since namespace field value can be fetched from the URI.
btw I was using curl instead of kubectl.

If it is worth to have this example , I have updated the json files and removed the namespace field from all the files.Else please feel free to mark this PR as Closed with no change.

@sub-mod sub-mod changed the title Adding guestbook example with namespace Adding guestbook example with latest json format for v1beta3 api Feb 17, 2015
@nikhiljindal
Copy link
Contributor

@derekwaynecarr: Can I assigne this to you?

@bgrant0607
Copy link
Member

We need a v1beta3 example. I'll take a look.

@bgrant0607 bgrant0607 self-assigned this Feb 18, 2015
@@ -0,0 +1,32 @@
{
"apiVersion": "v1beta3",
"kind": "Pod",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redis-master should be a 1-pod replication controller. See #4267

@bgrant0607
Copy link
Member

Please look at #1603 and the other issues/PRs cited.

Also, I'd like to take advantage of kubectl's multi-object capabilities. At least all objects relating to a particular microservice (e.g., frontend) should be in the same file.

@bgrant0607
Copy link
Member

"name": "frontend-controller",
"labels": {
"name": "frontend",
"uses": "redisslave,redis-master",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"uses" is not a pattern I want to endorse. Please remove it.

@bgrant0607
Copy link
Member

FYI, no email is sent when you push changes. You need to comment on the PR in order for someone to notice. Looking now.

@@ -115,6 +115,14 @@ func TestExampleObjectSchemas(t *testing.T) {
"redis-master-service": &api.Service{},
"redis-slave-service": &api.Service{},
},
"../examples/guestbook/guestbook_ns": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have renamed the example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bgrant0607 I have added it in a new folder called guestbook_ns.
If changes look good , I will merge with guestbook folder

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bgrant0607 please let me know if it looks ok?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You introduced the following directories:

examples/guestbook-go/guestbook-go_v3/
examples/guestbook/guestbook_ns/

They should be consistent. Also, the guestbook_ns example no longer uses namespace, and guestbook doesn't really need to be in the subdirectory names.

Both examples should be tested here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest creating v1beta3 subdirectories in each example, with a short README.md just stating that it's a v1beta3 version of the example, and explaining that v1beta3 needs to be enabled.

In a couple weeks we'll promote these to the top level and eliminate the v1beta1 examples.

@sub-mod
Copy link
Contributor Author

sub-mod commented Feb 23, 2015

@bgrant0607 I have made the changes, please let me know if it looks ok

"port": 3000,
"containerPort": "http-server",
"protocol": "TCP",
"createExternalLoadBalancer": true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not creating an external load balancer in the existing examples because it's not supported by all cloud providers.

},
"template": {
"metadata": {
"name": "guestbook",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this name is ignored:
https://github.com/GoogleCloudPlatform/kubernetes/blob/master/pkg/controller/replication_controller.go#L70

I'm guessing we're not validating that name isn't specified due to legacy v1beta1/2 support.

Can you confirm, @smarterclayton?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct - argument for validating the versioned structs, not the internal.

On Feb 23, 2015, at 5:33 PM, Brian Grant notifications@github.com wrote:

In examples/guestbook-go/v1beta3/guestbook-controller.json:

I'm guessing we're not validating that name isn't specified due to legacy v1beta1/2 support.

Can you confirm, @smarterclayton?


Reply to this email directly or view it on GitHub.

"image": "gurpartap/redis",
"ports": [
{
"name": "redis-server",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the port names everywhere, or eliminate them everywhere.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If some of the port names are required, I'm ok with leaving them as is for now.

@bgrant0607
Copy link
Member

LGTM. Will merge on green. Thanks.

@bgrant0607 bgrant0607 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 23, 2015
@bgrant0607
Copy link
Member

Shippable failures were 2 different flakes. Merging.

bgrant0607 added a commit that referenced this pull request Feb 24, 2015
Adding guestbook example with latest json format for v1beta3 api
@bgrant0607 bgrant0607 merged commit 754a2a8 into kubernetes:master Feb 24, 2015
@sub-mod sub-mod deleted the guestbook_ns branch February 25, 2015 21:10
The web front end interacts with the redis master via javascript redis API calls.

The v1beta3 API is not enabled by default. The kube-apiserver process needs to run with the --runtime_config=api/v1beta3 argument. Use the following command to enable it:
$sudo sed -i 's|KUBE_API_ARGS="|KUBE_API_ARGS="--runtime_config=api/v1beta3 |' /etc/kubernetes/apiserver
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work for me. Where should I run it? On master? On my local machine?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this in /etc/kubernetes/apiserver where apiserver is running
KUBE_API_ARGS="--runtime_config=api/v1beta3"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants