mirror of https://github.com/k3s-io/k3s
Rename cloudcfg to kubecfg
parent
61b00739a3
commit
c97c514742
12
README.md
12
README.md
|
@ -49,22 +49,22 @@ hack/dev-build-and-up.sh
|
|||
Once you have your instances up and running, the `build-go.sh` script sets up
|
||||
your Go workspace and builds the Go components.
|
||||
|
||||
The `cloudcfg.sh` script spins up two containers, running [Nginx](http://nginx.org/en/) and with port 80 mapped to 8080:
|
||||
The `kubecfg.sh` script spins up two containers, running [Nginx](http://nginx.org/en/) and with port 80 mapped to 8080:
|
||||
|
||||
```
|
||||
cd kubernetes
|
||||
hack/build-go.sh
|
||||
cluster/cloudcfg.sh -p 8080:80 run dockerfile/nginx 2 myNginx
|
||||
cluster/kubecfg.sh -p 8080:80 run dockerfile/nginx 2 myNginx
|
||||
```
|
||||
|
||||
To stop the containers:
|
||||
```
|
||||
cluster/cloudcfg.sh stop myNginx
|
||||
cluster/kubecfg.sh stop myNginx
|
||||
```
|
||||
|
||||
To delete the containers:
|
||||
```
|
||||
cluster/cloudcfg.sh rm myNginx
|
||||
cluster/kubecfg.sh rm myNginx
|
||||
```
|
||||
|
||||
### Running a container (more complete version)
|
||||
|
@ -75,7 +75,7 @@ Assuming you've run `hack/dev-build-and-up.sh` and `hack/build-go.sh`:
|
|||
|
||||
```
|
||||
cd kubernetes
|
||||
cluster/cloudcfg.sh -c api/examples/pod.json create /pods
|
||||
cluster/kubecfg.sh -c api/examples/pod.json create /pods
|
||||
```
|
||||
|
||||
Where pod.json contains something like:
|
||||
|
@ -112,7 +112,7 @@ cd kubernetes
|
|||
hack/local-up.sh
|
||||
```
|
||||
|
||||
This will build and start a lightweight local cluster, consisting of a master and a single minion. Type Control-C to shut it down. While it's running, you can use `hack/localcfg.sh` in place of `cluster/cloudcfg.sh` to talk to it.
|
||||
This will build and start a lightweight local cluster, consisting of a master and a single minion. Type Control-C to shut it down. While it's running, you can use `hack/localcfg.sh` in place of `cluster/kubecfg.sh` to talk to it.
|
||||
|
||||
## Where to go next?
|
||||
[Detailed example application](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/examples/guestbook/guestbook.md)
|
||||
|
|
|
@ -15,7 +15,7 @@ To build Kubernetes you need to have access to a Docker installation through eit
|
|||
* `make-binaries.sh`: This will compile all of the Kubernetes binaries in a Docker container
|
||||
* `run-tests.sh`: This will run the Kubernetes unit tests in a Docker container
|
||||
* `run-integration.sh`: This will build and run the integration test in a Docker container
|
||||
* `make-cross.sh`: This will make all cross-compiled binaries (currently just cloudcfg).
|
||||
* `make-cross.sh`: This will make all cross-compiled binaries (currently just kubecfg).
|
||||
* `copy-output.sh`: This will copy the contents of `output/build` from any remote Docker container to the local `output/build`. Right now this is only necessary on Mac OS X with `boot2docker`.
|
||||
* `make-clean.sh`: Clean out the contents of `output/build`.
|
||||
* `shell.sh`: Drop into a `bash` shell in a build container with a snapshot of the current repo code.
|
||||
|
|
|
@ -33,7 +33,7 @@ function make-binaries() {
|
|||
apiserver
|
||||
controller-manager
|
||||
kubelet
|
||||
cloudcfg
|
||||
kubecfg
|
||||
localkube"
|
||||
|
||||
ARCH_TARGET="${KUBE_TARGET}/${GOOS}/${GOARCH}"
|
||||
|
|
|
@ -21,7 +21,7 @@ set -e
|
|||
source $(dirname $0)/common.sh
|
||||
|
||||
readonly CROSS_BINARIES="
|
||||
cloudcfg
|
||||
kubecfg
|
||||
"
|
||||
|
||||
for platform in ${KUBE_CROSSPLATFORMS}; do
|
||||
|
|
|
@ -295,7 +295,7 @@ function push-images-to-gcs() {
|
|||
function package-tarballs() {
|
||||
mkdir -p "${RELEASE_DIR}"
|
||||
|
||||
# Find all of the built cloudcfg binaries
|
||||
# Find all of the built kubecfg binaries
|
||||
for platform in output/build/*/* ; do
|
||||
echo $platform
|
||||
local PLATFORM_TAG=$(echo $platform | awk -F / '{ printf "%s-%s", $3, $4 }')
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
source $(dirname $0)/util.sh
|
||||
|
||||
CLOUDCFG=$(dirname $0)/../output/go/cloudcfg
|
||||
CLOUDCFG=$(dirname $0)/../output/go/kubecfg
|
||||
if [ ! -x $CLOUDCFG ]; then
|
||||
echo "Could not find cloudcfg binary. Run hack/build-go.sh to build it."
|
||||
echo "Could not find kubecfg binary. Run hack/build-go.sh to build it."
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -27,7 +27,7 @@ import (
|
|||
"time"
|
||||
|
||||
kube_client "github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudcfg"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubecfg"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
@ -52,15 +52,15 @@ var (
|
|||
)
|
||||
|
||||
func usage() {
|
||||
fmt.Fprint(os.Stderr, `usage: cloudcfg -h [-c config/file.json] [-p :,..., :] <method>
|
||||
fmt.Fprint(os.Stderr, `usage: kubecfg -h [-c config/file.json] [-p :,..., :] <method>
|
||||
|
||||
Kubernetes REST API:
|
||||
cloudcfg [OPTIONS] get|list|create|delete|update <url>
|
||||
kubecfg [OPTIONS] get|list|create|delete|update <url>
|
||||
|
||||
Manage replication controllers:
|
||||
cloudcfg [OPTIONS] stop|rm|rollingupdate <controller>
|
||||
cloudcfg [OPTIONS] run <image> <replicas> <controller>
|
||||
cloudcfg [OPTIONS] resize <controller> <replicas>
|
||||
kubecfg [OPTIONS] stop|rm|rollingupdate <controller>
|
||||
kubecfg [OPTIONS] run <image> <replicas> <controller>
|
||||
kubecfg [OPTIONS] resize <controller> <replicas>
|
||||
|
||||
Options:
|
||||
`)
|
||||
|
@ -76,7 +76,7 @@ func readConfig(storage string) []byte {
|
|||
if err != nil {
|
||||
glog.Fatalf("Unable to read %v: %#v\n", *config, err)
|
||||
}
|
||||
data, err = cloudcfg.ToWireFormat(data, storage)
|
||||
data, err = kubecfg.ToWireFormat(data, storage)
|
||||
if err != nil {
|
||||
glog.Fatalf("Error parsing %v as an object for %v: %#v\n", *config, storage, err)
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ func main() {
|
|||
|
||||
var auth *kube_client.AuthInfo
|
||||
if secure {
|
||||
auth, err = cloudcfg.LoadAuthInfo(*authConfig)
|
||||
auth, err = kubecfg.LoadAuthInfo(*authConfig)
|
||||
if err != nil {
|
||||
glog.Fatalf("Error loading auth: %#v", err)
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ func main() {
|
|||
|
||||
if *proxy {
|
||||
glog.Info("Starting to serve on localhost:8001")
|
||||
server := cloudcfg.NewProxyServer(*www, *httpServer, auth)
|
||||
server := kubecfg.NewProxyServer(*www, *httpServer, auth)
|
||||
glog.Fatal(server.Serve())
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ func main() {
|
|||
func executeAPIRequest(method string, auth *kube_client.AuthInfo) bool {
|
||||
parseStorage := func() string {
|
||||
if len(flag.Args()) != 2 {
|
||||
glog.Fatal("usage: cloudcfg [OPTIONS] get|list|create|update|delete <url>")
|
||||
glog.Fatal("usage: kubecfg [OPTIONS] get|list|create|update|delete <url>")
|
||||
}
|
||||
return strings.Trim(flag.Arg(1), "/")
|
||||
}
|
||||
|
@ -172,13 +172,13 @@ func executeAPIRequest(method string, auth *kube_client.AuthInfo) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
var printer cloudcfg.ResourcePrinter
|
||||
var printer kubecfg.ResourcePrinter
|
||||
if *json {
|
||||
printer = &cloudcfg.IdentityPrinter{}
|
||||
printer = &kubecfg.IdentityPrinter{}
|
||||
} else if *yaml {
|
||||
printer = &cloudcfg.YAMLPrinter{}
|
||||
printer = &kubecfg.YAMLPrinter{}
|
||||
} else {
|
||||
printer = &cloudcfg.HumanReadablePrinter{}
|
||||
printer = &kubecfg.HumanReadablePrinter{}
|
||||
}
|
||||
|
||||
if err = printer.PrintObj(obj, os.Stdout); err != nil {
|
||||
|
@ -193,7 +193,7 @@ func executeAPIRequest(method string, auth *kube_client.AuthInfo) bool {
|
|||
func executeControllerRequest(method string, auth *kube_client.AuthInfo) bool {
|
||||
parseController := func() string {
|
||||
if len(flag.Args()) != 2 {
|
||||
glog.Fatal("usage: cloudcfg [OPTIONS] stop|rm|rollingupdate <controller>")
|
||||
glog.Fatal("usage: kubecfg [OPTIONS] stop|rm|rollingupdate <controller>")
|
||||
}
|
||||
return flag.Arg(1)
|
||||
}
|
||||
|
@ -203,14 +203,14 @@ func executeControllerRequest(method string, auth *kube_client.AuthInfo) bool {
|
|||
var err error
|
||||
switch method {
|
||||
case "stop":
|
||||
err = cloudcfg.StopController(parseController(), c)
|
||||
err = kubecfg.StopController(parseController(), c)
|
||||
case "rm":
|
||||
err = cloudcfg.DeleteController(parseController(), c)
|
||||
err = kubecfg.DeleteController(parseController(), c)
|
||||
case "rollingupdate":
|
||||
err = cloudcfg.Update(parseController(), c, *updatePeriod)
|
||||
err = kubecfg.Update(parseController(), c, *updatePeriod)
|
||||
case "run":
|
||||
if len(flag.Args()) != 4 {
|
||||
glog.Fatal("usage: cloudcfg [OPTIONS] run <image> <replicas> <controller>")
|
||||
glog.Fatal("usage: kubecfg [OPTIONS] run <image> <replicas> <controller>")
|
||||
}
|
||||
image := flag.Arg(1)
|
||||
replicas, err := strconv.Atoi(flag.Arg(2))
|
||||
|
@ -218,18 +218,18 @@ func executeControllerRequest(method string, auth *kube_client.AuthInfo) bool {
|
|||
if err != nil {
|
||||
glog.Fatalf("Error parsing replicas: %#v", err)
|
||||
}
|
||||
err = cloudcfg.RunController(image, name, replicas, c, *portSpec, *servicePort)
|
||||
err = kubecfg.RunController(image, name, replicas, c, *portSpec, *servicePort)
|
||||
case "resize":
|
||||
args := flag.Args()
|
||||
if len(args) < 3 {
|
||||
glog.Fatal("usage: cloudcfg resize <controller> <replicas>")
|
||||
glog.Fatal("usage: kubecfg resize <controller> <replicas>")
|
||||
}
|
||||
name := args[1]
|
||||
replicas, err := strconv.Atoi(args[2])
|
||||
if err != nil {
|
||||
glog.Fatalf("Error parsing replicas: %#v", err)
|
||||
}
|
||||
err = cloudcfg.ResizeController(name, replicas, c)
|
||||
err = kubecfg.ResizeController(name, replicas, c)
|
||||
default:
|
||||
return false
|
||||
}
|
|
@ -37,16 +37,16 @@ Create a file named `redis-master.json` describing a single pod, which runs a re
|
|||
}
|
||||
```
|
||||
|
||||
Once you have that pod file, you can create the redis pod in your Kubernetes cluster using the `cloudcfg` CLI:
|
||||
Once you have that pod file, you can create the redis pod in your Kubernetes cluster using the `kubecfg` CLI:
|
||||
|
||||
```shell
|
||||
$ cluster/cloudcfg.sh -c examples/guestbook/redis-master.json create /pods
|
||||
$ cluster/kubecfg.sh -c examples/guestbook/redis-master.json create /pods
|
||||
```
|
||||
|
||||
Once that's up you can list the pods in the cluster, to verify that the master is running:
|
||||
|
||||
```shell
|
||||
cluster/cloudcfg.sh list /pods
|
||||
cluster/kubecfg.sh list /pods
|
||||
```
|
||||
|
||||
You'll see a single redis master pod. It will also display the machine that the pod is running on.
|
||||
|
@ -87,10 +87,10 @@ The pod that you created in Step One has the label `name=redis-master`. The sele
|
|||
|
||||
This will cause all pods to see the redis master apparently running on localhost:10000.
|
||||
|
||||
Once you have that service description, you can create the service with the `cloudcfg` cli:
|
||||
Once you have that service description, you can create the service with the `kubecfg` cli:
|
||||
|
||||
```shell
|
||||
$ cluster/cloudcfg.sh -c examples/guestbook/redis-master-service.json create /services
|
||||
$ cluster/kubecfg.sh -c examples/guestbook/redis-master-service.json create /services
|
||||
Name Label Query Port
|
||||
---------- ---------- ----------
|
||||
redismaster name=redis-master 10000
|
||||
|
@ -127,7 +127,7 @@ Create a file named `redis-slave-controller.json` that contains:
|
|||
Then you can create the service by running:
|
||||
|
||||
```shell
|
||||
$ cluster/cloudcfg.sh -c examples/guestbook/redis-slave-controller.json create /replicationControllers
|
||||
$ cluster/kubecfg.sh -c examples/guestbook/redis-slave-controller.json create /replicationControllers
|
||||
Name Image(s) Selector Replicas
|
||||
---------- ---------- ---------- ----------
|
||||
redisSlaveController brendanburns/redis-slave name=redisslave 2
|
||||
|
@ -142,7 +142,7 @@ redis-server --slaveof $SERVICE_HOST $REDISMASTER_SERVICE_PORT
|
|||
Once that's up you can list the pods in the cluster, to verify that the master and slaves are running:
|
||||
|
||||
```shell
|
||||
$ cluster/cloudcfg.sh list /pods
|
||||
$ cluster/kubecfg.sh list /pods
|
||||
Name Image(s) Host Labels
|
||||
---------- ---------- ---------- ----------
|
||||
redis-master-2 dockerfile/redis kubernetes-minion-3.c.briandpe-api.internal name=redis-master
|
||||
|
@ -169,12 +169,12 @@ Just like the master, we want to have a service to proxy connections to the read
|
|||
}
|
||||
```
|
||||
|
||||
This time the selector for the service is `name=redis-slave`, because that identifies the pods running redis slaves. It may also be helpful to set labels on your service itself--as we've done here--to make it easy to locate them with the `cloudcfg -l "label=value" list sevices` command.
|
||||
This time the selector for the service is `name=redis-slave`, because that identifies the pods running redis slaves. It may also be helpful to set labels on your service itself--as we've done here--to make it easy to locate them with the `kubecfg -l "label=value" list sevices` command.
|
||||
|
||||
Now that you have created the service specification, create it in your cluster with the `cloudcfg` CLI:
|
||||
Now that you have created the service specification, create it in your cluster with the `kubecfg` CLI:
|
||||
|
||||
```shell
|
||||
$ cluster/cloudcfg.sh -c examples/guestbook/redis-slave-service.json create /services
|
||||
$ cluster/kubecfg.sh -c examples/guestbook/redis-slave-service.json create /services
|
||||
Name Label Query Port
|
||||
---------- ---------- ----------
|
||||
redisslave name=redisslave 10001
|
||||
|
@ -210,7 +210,7 @@ Create a file named `frontend-controller.json`:
|
|||
With this file, you can turn up your frontend with:
|
||||
|
||||
```shell
|
||||
$ cluster/cloudcfg.sh -c examples/guestbook/frontend-controller.json create /replicationControllers
|
||||
$ cluster/kubecfg.sh -c examples/guestbook/frontend-controller.json create /replicationControllers
|
||||
Name Image(s) Selector Replicas
|
||||
---------- ---------- ---------- ----------
|
||||
frontendController brendanburns/php-redis name=frontend 3
|
||||
|
@ -219,7 +219,7 @@ frontendController brendanburns/php-redis name=frontend 3
|
|||
Once that's up you can list the pods in the cluster, to verify that the master, slaves and frontends are running:
|
||||
|
||||
```shell
|
||||
$ cluster/cloudcfg.sh list /pods
|
||||
$ cluster/kubecfg.sh list /pods
|
||||
Name Image(s) Host Labels
|
||||
---------- ---------- ---------- ----------
|
||||
redis-master-2 dockerfile/redis kubernetes-minion-3.c.briandpe-api.internal name=redis-master
|
||||
|
|
|
@ -22,7 +22,7 @@ source $(dirname $0)/config-go.sh
|
|||
|
||||
cd "${KUBE_TARGET}"
|
||||
|
||||
BINARIES="proxy integration apiserver controller-manager kubelet cloudcfg localkube"
|
||||
BINARIES="proxy integration apiserver controller-manager kubelet kubecfg localkube"
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
BINARIES="$@"
|
||||
|
|
|
@ -35,7 +35,7 @@ set -e
|
|||
# Use testing config
|
||||
export KUBE_CONFIG_FILE="config-test.sh"
|
||||
export KUBE_REPO_ROOT="$(dirname $0)/.."
|
||||
export CLOUDCFG="${KUBE_REPO_ROOT}/cluster/cloudcfg.sh"
|
||||
export CLOUDCFG="${KUBE_REPO_ROOT}/cluster/kubecfg.sh"
|
||||
|
||||
source "${KUBE_REPO_ROOT}/cluster/util.sh"
|
||||
${KUBE_REPO_ROOT}/hack/build-go.sh
|
||||
|
|
|
@ -28,7 +28,7 @@ set -e
|
|||
(
|
||||
source $(dirname $0)/config-go.sh
|
||||
cd "${KUBE_TARGET}"
|
||||
BINARIES="cloudcfg localkube"
|
||||
BINARIES="kubecfg localkube"
|
||||
for b in $BINARIES; do
|
||||
echo "+++ Building ${b}"
|
||||
go build "${KUBE_GO_PACKAGE}"/cmd/${b}
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This file is exactly like cloudcfg.sh, but it talks to a local master
|
||||
# This file is exactly like kubecfg.sh, but it talks to a local master
|
||||
# (which you're assumed to be running with localkube.sh).
|
||||
|
||||
CLOUDCFG=$(dirname $0)/../output/go/cloudcfg
|
||||
CLOUDCFG=$(dirname $0)/../output/go/kubecfg
|
||||
if [ ! -x $CLOUDCFG ]; then
|
||||
echo "Could not find cloudcfg binary. Run hack/build-go.sh to build it."
|
||||
echo "Could not find kubecfg binary. Run hack/build-go.sh to build it."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package cloudcfg is a set of libraries that are used by the cloudcfg command line tool.
|
||||
// Package kubecfg is a set of libraries that are used by the kubecfg command line tool.
|
||||
// They are separated out into a library to support unit testing. Most functionality should
|
||||
// be included in this package, and the main cloudcfg should really just be an entry point.
|
||||
package cloudcfg
|
||||
// be included in this package, and the main kubecfg should really just be an entry point.
|
||||
package kubecfg
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cloudcfg
|
||||
package kubecfg
|
||||
|
||||
import (
|
||||
"encoding/json"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cloudcfg
|
||||
package kubecfg
|
||||
|
||||
import (
|
||||
"encoding/json"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cloudcfg
|
||||
package kubecfg
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cloudcfg
|
||||
package kubecfg
|
||||
|
||||
import (
|
||||
"testing"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cloudcfg
|
||||
package kubecfg
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cloudcfg
|
||||
package kubecfg
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cloudcfg
|
||||
package kubecfg
|
||||
|
||||
import (
|
||||
"encoding/json"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cloudcfg
|
||||
package kubecfg
|
||||
|
||||
import (
|
||||
"bytes"
|
|
@ -92,7 +92,7 @@ set_tag $RELEASE_FULL_TAG_PATH $RELEASE_FULL_PATH
|
|||
|
||||
echo "Release pushed ($RELEASE_PREFIX$RELEASE_NAME)."
|
||||
|
||||
# This isn't quite working right now. Need to figure out packaging the cloudcfg tool.
|
||||
# This isn't quite working right now. Need to figure out packaging the kubecfg tool.
|
||||
# echo " Launch with:"
|
||||
# echo
|
||||
# echo " curl -s -L ${RELEASE_FULL_PATH/gs:\/\//http://storage.googleapis.com/}/launch-kubernetes.sh | bash"
|
||||
|
|
Loading…
Reference in New Issue