Skip to content

Commit

Permalink
Resolved merge conflicts and updated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hardikdr committed Sep 10, 2018
2 parents 671b976 + 2d1ad4c commit 9277250
Show file tree
Hide file tree
Showing 33 changed files with 711 additions and 466 deletions.
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://git.k8s.io/community/contributors/devel/pull-requests.md#the-pr-submit-process and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/devel/pull-requests.md#best-practices-for-faster-reviews
3. Follow the instructions for writing a release note: https://git.k8s.io/community/contributors/devel/pull-requests.md#write-release-notes-if-needed
4. If the PR is unfinished, see how to mark it: https://github.com/kubernetes/community/blob/master/contributors/devel/pull-requests.md#marking-unfinished-pull-requests
1. If this is your first time, read our contributor guidelines https://git.k8s.io/community/contributors/guide/pull-requests.md#the-pull-request-submit-process and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
3. Follow the instructions for writing a release note: https://git.k8s.io/community/contributors/guide/release-notes.md
4. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
5. If this PR changes image versions, please title this PR "Bump <image name> from x.x.x to y.y.y."
-->

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ depend:

bazel run //:gazelle

generate: genapi genconversion genclientset gendeepcopy
generate: genapi genconversion genclientset gendeepcopy genopenapi

genapi: depend
go build -o $$GOPATH/bin/apiregister-gen sigs.k8s.io/cluster-api/vendor/github.com/kubernetes-incubator/apiserver-builder/cmd/apiregister-gen
Expand Down Expand Up @@ -62,7 +62,7 @@ STATIC_API_DIRS += k8s.io/apimachinery/pkg/util/intstr
STATIC_API_DIRS += k8s.io/api/core/v1

# Automatically extract vendored apis under vendor/k8s.io/api.
VENDOR_API_DIRS := $(shell find vendor/k8s.io/api -type d | grep -E 'v\d+(alpha\d+|beta\d+)*' | sed -e 's/^vendor\///')
VENDOR_API_DIRS := $(shell find vendor/k8s.io/api -type d | grep -E 'v[[:digit:]]+(alpha[[:digit:]]+|beta[[:digit:]]+)*' | sed -e 's/^vendor\///')

empty:=
comma:=,
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Google Group for access to documents and calendars.
* Weekly on Wednesdays @ 10:00 PT on [Zoom][zoomMeeting]
* Previous meetings: \[ [notes][notes] | [recordings][recordings] \]

* Provider implementer office hours
* Weekly on Mondays @ 09:30 PT and Tuesdays @ 12:00 PT on [Zoom][zoomMeeting]
* Previous meetings: \[ [notes][implementerNotes] \]

* Chat with us on [Slack](http://slack.k8s.io/): #cluster-api

## Provider Implementations
Expand All @@ -36,13 +40,13 @@ are also sponsored by SIG-cluster-lifecycle:
* Azure, https://github.com/platform9/azure-provider
* GCE, https://github.com/kubernetes-sigs/cluster-api-provider-gcp
* OpenStack, https://github.com/kubernetes-sigs/cluster-api-provider-openstack
* vSphere, https://github.com/roberthbailey/cluster-api-provider-vsphere
* vSphere, https://github.com/kubernetes-sigs/cluster-api-provider-vsphere

## Getting Started
### Prerequisites
* `kubectl` is required, see [here](http://kubernetes.io/docs/user-guide/prereqs/).
* `clusterctl` is a SIG-cluster-lifecycle sponsored tool to manage Cluster API clusters. See [here](clusterctl)

## How to use the API

To see how to build tooling on top of the Cluster API, please check out a few examples below:
Expand All @@ -54,3 +58,4 @@ To see how to build tooling on top of the Cluster API, please check out a few ex
[notes]: https://docs.google.com/document/d/16ils69KImmE94RlmzjWDrkmFZysgB2J4lGnYMRN89WM/edit
[recordings]: https://www.youtube.com/playlist?list=PL69nYSiGNLP29D0nYgAGWt1ZFqS9Z7lw4
[zoomMeeting]: https://zoom.us/j/166836624
[implementerNotes]: https://docs.google.com/document/d/1IZ2-AZhe4r3CYiJuttyciS7bGZTTx4iMppcA8_Pr3xE/edit
2 changes: 1 addition & 1 deletion clusterctl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Read the [experience doc here](https://docs.google.com/document/d/1-sYb3EdkRga49

## Getting Started

**Due to the [limitations](#Limitations) described below, you must currently compile and run a `clusterctl` binary
**Due to the [limitations](#limitations) described below, you must currently compile and run a `clusterctl` binary
from your chosen [provider implementation](../README.md#provider-implementations) rather than using the binary from
this repository.**

Expand Down
5 changes: 1 addition & 4 deletions clusterctl/clusterdeployer/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ go_library(
name = "go_default_library",
srcs = [
"clientfactory.go",
"clusterapiserver.go",
"clusterapiservertemplate.go",
"clusterclient.go",
"clusterdeployer.go",
"providercomponentsstorefactory.go",
Expand All @@ -17,14 +15,13 @@ go_library(
"//pkg/apis/cluster/v1alpha1:go_default_library",
"//pkg/client/clientset_generated/clientset:go_default_library",
"//pkg/clientcmd:go_default_library",
"//pkg/deployer:go_default_library",
"//pkg/util:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
"//vendor/k8s.io/client-go/util/cert:go_default_library",
"//vendor/k8s.io/client-go/util/cert/triple:go_default_library",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
srcs = ["externalbootstrapcluster.go"],
importpath = "sigs.k8s.io/cluster-api/clusterctl/clusterdeployer/externalclusterprovisioner",
srcs = ["exisingcluster.go"],
importpath = "sigs.k8s.io/cluster-api/clusterctl/clusterdeployer/bootstrap/existing",
visibility = ["//visibility:public"],
)

go_test(
name = "go_default_test",
srcs = ["externalbootstrapcluster_test.go"],
srcs = ["existingcluster_test.go"],
embed = [":go_default_library"],
)
68 changes: 68 additions & 0 deletions clusterctl/clusterdeployer/bootstrap/existing/exisingcluster.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package existing

import (
"fmt"
"io/ioutil"
"os"
)

// Represents an existing cluster being used for bootstrapping, should not be able to
// actually delete or create, but can point to actual kubeconfig file.
type ExistingCluster struct {
kubeconfigPath string
kubeconfigFile string
}

// NewExistingCluster creates a new existing k8s bootstrap cluster object
// We should clean up any lingering resources when clusterctl is complete.
// TODO https://github.com/kubernetes-sigs/cluster-api/issues/448
func NewExistingCluster(kubeconfigPath string) (*ExistingCluster, error) {
if _, err := os.Stat(kubeconfigPath); os.IsNotExist(err) {
return nil, fmt.Errorf("file at %s does not exist", kubeconfigPath)
}

return &ExistingCluster{kubeconfigPath: kubeconfigPath}, nil
}

// Create implements clusterdeployer.ClusterProvisioner interface
func (e *ExistingCluster) Create() error {
// noop
return nil
}

// Delete implements clusterdeployer.ClusterProvisioner interface
func (e *ExistingCluster) Delete() error {
// noop
return nil
}

// GetKubeconfig implements clusterdeployer.ClusterProvisioner interface
func (e *ExistingCluster) GetKubeconfig() (string, error) {

if e.kubeconfigFile == "" {
b, err := ioutil.ReadFile(e.kubeconfigPath)
if err != nil {
return "", err
}

e.kubeconfigFile = string(b)
}

return e.kubeconfigFile, nil
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
package externalclusterprovisioner
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package existing

import (
"testing"
"os"
"io/ioutil"
"os"
"testing"
)

func TestGetKubeconfig(t *testing.T) {
Expand All @@ -14,16 +30,16 @@ func TestGetKubeconfig(t *testing.T) {
}
defer os.Remove(f)

t.Run("invalid path given", func(t *testing.T){
_, err = NewExternalCluster("")
t.Run("invalid path given", func(t *testing.T) {
_, err = NewExistingCluster("")
if err == nil {
t.Fatal("Should not be able create External Cluster Provisioner.")
}
})

t.Run("file exists", func(t *testing.T) {

ec, err := NewExternalCluster(f)
ec, err := NewExistingCluster(f)
if err != nil {
t.Fatal("Should be able create External Cluster Provisioner.")
}
Expand All @@ -47,4 +63,4 @@ func createTempFile(contents string) (string, error) {
defer f.Close()
f.WriteString(contents)
return f.Name(), nil
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["minikube.go"],
importpath = "sigs.k8s.io/cluster-api/clusterctl/clusterdeployer/minikube",
importpath = "sigs.k8s.io/cluster-api/clusterctl/clusterdeployer/bootstrap/minikube",
visibility = ["//visibility:public"],
deps = ["//vendor/github.com/golang/glog:go_default_library"],
)
Expand Down
Loading

0 comments on commit 9277250

Please sign in to comment.