Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
5d19597f
Commit
5d19597f
authored
May 19, 2015
by
Whit Morriss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add juju action to start petstore example
This is @chuckbutler's work, with some small fixes `juju action do kubernetes-master/0 petstore` launches the example code
parent
10339d72
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
88 additions
and
2 deletions
+88
-2
local.yaml
cluster/juju/bundles/local.yaml
+6
-1
actions.yaml
cluster/juju/charms/trusty/kubernetes-master/actions.yaml
+3
-0
parse_get_pods
...harms/trusty/kubernetes-master/actions/lib/parse_get_pods
+17
-0
petstore
...ter/juju/charms/trusty/kubernetes-master/actions/petstore
+40
-0
hooks.py
cluster/juju/charms/trusty/kubernetes-master/hooks/hooks.py
+5
-0
metadata.yaml
cluster/juju/charms/trusty/kubernetes-master/metadata.yaml
+2
-0
juju.md
docs/getting-started-guides/juju.md
+15
-1
No files found.
cluster/juju/bundles/local.yaml
View file @
5d19597f
...
@@ -18,7 +18,8 @@ kubernetes-local:
...
@@ -18,7 +18,8 @@ kubernetes-local:
"
gui-x"
:
"
0"
"
gui-x"
:
"
0"
"
gui-y"
:
"
0"
"
gui-y"
:
"
0"
flannel-docker
:
flannel-docker
:
charm
:
cs:trusty/flannel-docker
charm
:
flannel-docker
branch
:
https://github.com/chuckbutler/flannel-docker-charm.git
annotations
:
annotations
:
"
gui-x"
:
"
0"
"
gui-x"
:
"
0"
"
gui-y"
:
"
300"
"
gui-y"
:
"
300"
...
@@ -35,8 +36,12 @@ kubernetes-local:
...
@@ -35,8 +36,12 @@ kubernetes-local:
relations
:
relations
:
-
-
"
flannel-docker:network"
-
-
"
flannel-docker:network"
-
"
docker:network"
-
"
docker:network"
-
-
"
flannel-docker:network"
-
"
kubernetes-master:network"
-
-
"
flannel-docker:docker-host"
-
-
"
flannel-docker:docker-host"
-
"
docker:juju-info"
-
"
docker:juju-info"
-
-
"
flannel-docker:docker-host"
-
"
kubernetes-master:juju-info"
-
-
"
flannel-docker:db"
-
-
"
flannel-docker:db"
-
"
etcd:client"
-
"
etcd:client"
-
-
"
kubernetes:docker-host"
-
-
"
kubernetes:docker-host"
...
...
cluster/juju/charms/trusty/kubernetes-master/actions.yaml
0 → 100644
View file @
5d19597f
petstore
:
description
:
Deploy the Kubernetes Petstore app
cluster/juju/charms/trusty/kubernetes-master/actions/lib/parse_get_pods
0 → 100755
View file @
5d19597f
#!/usr/bin/env python
import
json
import
sys
def
parse_pod_output
():
out
=
sys
.
stdin
.
readlines
()
foo
=
json
.
loads
(
' '
.
join
(
out
))
for
item
in
foo
[
'items'
]:
name_slugs
=
set
(
item
[
'metadata'
][
'name'
]
.
split
(
'-'
))
if
'fectrl'
in
name_slugs
:
if
item
[
'status'
][
'phase'
]
==
"Running"
:
print
item
[
'status'
][
'podIP'
]
if
__name__
==
"__main__"
:
parse_pod_output
()
cluster/juju/charms/trusty/kubernetes-master/actions/petstore
0 → 100755
View file @
5d19597f
#!/bin/bash
set
-eux
export
KUBE_MASTER_IP
=
0.0.0.0
export
KUBERNETES_MASTER
=
http://
$KUBE_MASTER_IP
# The test is a bit spammy with files, head over to /tmp to discard when done
cd
/tmp
# Need to update the script with the proposed IP of the web-head pod
# Currently its set to 10.1.4.89
sed
-i
's/pass_http=0/exit 0/'
/opt/kubernetes/examples/k8petstore/k8petstore.sh
/opt/kubernetes/examples/k8petstore/k8petstore.sh
# Loop until the daemon has come online
counter
=
0
KUBE_POD_STATUS
=
"Pending"
while
[
"
$KUBE_POD_STATUS
"
==
"Pending"
]
do
if
[[
counter
-eq
200
]]
;
then
echo
"Pod failed to come online. Timeout reached"
exit
1
fi
CUR_STATUS
=
$(
kubectl get pods
-o
json |
$CHARM_DIR
/actions/lib/parse_get_pods
)
if
[
!
-z
"
$CUR_STATUS
"
]
;
then
KUBE_POD_STATUS
=
$CUR_STATUS
fi
sleep
1
counter+
=
1
done
sed
-i
's/exit 0/pass_http=0/'
/opt/kubernetes/examples/k8petstore/k8petstore.sh
sed
-i
"s/PUBLIC_IP=
\"
10.1.4.89
\"
/PUBLIC_IP=
\"
$KUBE_POD_STATUS
\"
/"
/opt/kubernetes/examples/k8petstore/k8petstore.sh
/opt/kubernetes/examples/k8petstore/k8petstore.sh
# Return execution to the CHARM_DIR for further actions
cd
$CHARM_DIR
cluster/juju/charms/trusty/kubernetes-master/hooks/hooks.py
View file @
5d19597f
...
@@ -141,6 +141,11 @@ def relation_changed():
...
@@ -141,6 +141,11 @@ def relation_changed():
# Send api endpoint to minions
# Send api endpoint to minions
notify_minions
()
notify_minions
()
@hooks.hook
(
'network-relation-changed'
)
def
network_relation_changed
():
relation_id
=
hookenv
.
relation_id
()
hookenv
.
relation_set
(
relation_id
,
ignore_errors
=
True
)
def
notify_minions
():
def
notify_minions
():
print
(
"Notify minions."
)
print
(
"Notify minions."
)
...
...
cluster/juju/charms/trusty/kubernetes-master/metadata.yaml
View file @
5d19597f
...
@@ -17,3 +17,5 @@ provides:
...
@@ -17,3 +17,5 @@ provides:
requires
:
requires
:
etcd
:
etcd
:
interface
:
etcd
interface
:
etcd
network
:
interface
:
overlay-network
docs/getting-started-guides/juju.md
View file @
5d19597f
...
@@ -5,7 +5,6 @@ wide number of clouds, supporting service orchestration once the bundle of
...
@@ -5,7 +5,6 @@ wide number of clouds, supporting service orchestration once the bundle of
services has been deployed.
services has been deployed.
### Prerequisites
### Prerequisites
> Note: If you're running kube-up, on ubuntu - all of the dependencies
> Note: If you're running kube-up, on ubuntu - all of the dependencies
...
@@ -165,8 +164,23 @@ We can add minion units like so:
...
@@ -165,8 +164,23 @@ We can add minion units like so:
juju add-unit docker # creates unit docker/2, kubernetes/2, docker-flannel/2
juju add-unit docker # creates unit docker/2, kubernetes/2, docker-flannel/2
## Launch the "petstore" example app
The petstore example is available as a
[
juju action
](
https://jujucharms.com/docs/devel/actions
)
.
juju action do kubernetes-master/0
Note: this example includes curl statements to exercise the app.
## Tear down cluster
## Tear down cluster
./kube-down.sh
or
juju destroy-environment --force `juju env`
juju destroy-environment --force `juju env`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment