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

Adds support for provisioning single master clusters on Azure through clusterctl #2

Merged
merged 17 commits into from
Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
generatedconfigs/
.env
kubeconfig
minikube.kubeconfig
.travis.yml
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
*.test
.idea/
.env
exampleconfigs/provider-components.yaml
minikube.kubeconfig
generatedconfigs/
generatedconfigs/
sshkey*
kubeconfig
23 changes: 11 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
language: go
go:
- 1.10.x
- 1.10.2
jobs:
include:
- stage: Unit Tests
script: travis_wait 50 go test github.com/platform9/azure-provider -test.timeout 0 -x -v -run "^TestParseProviderConfig|TestBase64Encoding|TestGetStartupScript|TestGetIPUnit|TestCreateGroupUnit|TestCheckResourceGroupExistsUnit|TestNewMachineActuator$"
script: go test github.com/platform9/azure-provider/cloud/azure/actuators/machine -test.timeout 0 -v -run "^TestParseProviderConfig|TestBase64Encoding|TestGetStartupScript|Test(\w)*Unit|TestNewMachineActuator$"
- stage: Integration Tests
script: travis_wait 50 go test github.com/platform9/azure-provider -test.timeout 0 -x -run ^TestCreate$
- script: travis_wait 50 go test github.com/platform9/azure-provider -test.timeout 0 -x -run ^TestUpdate$
- script: travis_wait 50 go test github.com/platform9/azure-provider -test.timeout 0 -x -run ^TestDelete$
- script: travis_wait 50 go test github.com/platform9/azure-provider -test.timeout 0 -x -run ^TestExists$
- script: travis_wait 50 go test github.com/platform9/azure-provider -test.timeout 0 -x -run ^TestCreateOrUpdateDeployment$
- script: travis_wait 50 go test github.com/platform9/azure-provider -test.timeout 0 -x -run ^TestCreateOrUpdateDeploymentWExisting$
- script: travis_wait 50 go test github.com/platform9/azure-provider -test.timeout 0 -x -run ^TestVMIfExists$
- script: travis_wait 50 go test github.com/platform9/azure-provider -test.timeout 0 -x -run ^TestDeleteSingleVM$
- script: travis_wait 50 go test github.com/platform9/azure-provider -test.timeout 0 -x -run ^TestCreateGroup$
- script: travis_wait 50 go test github.com/platform9/azure-provider -test.timeout 0 -x -run ^TestGetIP$
script: travis_wait 50 go test github.com/platform9/azure-provider/cloud/azure/actuators/machine -test.timeout 0 -v -run ^TestCreate$
- script: travis_wait 50 go test github.com/platform9/azure-provider/cloud/azure/actuators/machine -test.timeout 0 -v -run ^TestUpdate$
- script: travis_wait 50 go test github.com/platform9/azure-provider/cloud/azure/actuators/machine -test.timeout 0 -v -run ^TestDelete$
- script: travis_wait 50 go test github.com/platform9/azure-provider/cloud/azure/actuators/machine -test.timeout 0 -v -run ^TestExists$
- script: travis_wait 50 go test github.com/platform9/azure-provider/cloud/azure/actuators/machine -test.timeout 0 -v -run ^TestCreateOrUpdateDeployment$
- script: travis_wait 50 go test github.com/platform9/azure-provider/cloud/azure/actuators/machine -test.timeout 0 -v -run ^TestCreateOrUpdateDeploymentWExisting$
- script: travis_wait 50 go test github.com/platform9/azure-provider/cloud/azure/actuators/machine -test.timeout 0 -v -run ^TestVMIfExists$
- script: travis_wait 50 go test github.com/platform9/azure-provider/cloud/azure/actuators/machine -test.timeout 0 -v -run ^TestCreateGroup$
- script: travis_wait 50 go test github.com/platform9/azure-provider/cloud/azure/actuators/machine -test.timeout 0 -v -run ^TestGetIP$

notifications:
slack:
Expand Down
27 changes: 25 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GOCMD=go
REPO=github.com/platform9/azure-provider
REPO=github.com/platform9/azure-provider/cloud/azure/actuators/machine
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
TESTFLAGS=-test.timeout 0 -v
Expand All @@ -8,7 +8,7 @@ GOGET=$(GOCMD) get


unit_test:
$(GOTEST) -run "^TestParseProviderConfig|TestBase64Encoding|TestGetStartupScript|TestGetIPUnit|TestCreateGroupUnit|TestCheckResourceGroupExistsUnit|TestNewMachineActuator"
$(GOTEST) -run "^TestParseProviderConfig|TestBase64Encoding|TestGetStartupScript|Test(\w)*Unit|TestNewMachineActuator"

integration_test:
$(GOTEST) -run "^TestCreate|TestUpdate|TestDelete|TestExists|TestCreateOrUpdateDeployment|TestCreateOrUpdateDeploymentWExisting|TestVMIfExists|TestDeleteSingleVM|TestCreateGroup|TestGetIP"
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
4. Run `generate-yaml.sh` _Note: `generate-yaml.sh` creates an Azure service principal which will not be deleted automatically._
5. (Optional) Build a new version of `clusterctl` by running `cd clusterctl && go build && cd ..`
5. Use the configs generated in `generatedconfigs/` with `clusterctl`
* Example: `./clusterctl/clusterctl --provider azure -m generatedconfigs/machines.yaml -c generatedconfigs/cluster.yaml -p generatedconfigs/provider-components.yaml -a generatedconfigs/addons.yaml`
* Example: `./clusterctl/clusterctl create cluster --provider azure -m generatedconfigs/machines_no_node.yaml -c generatedconfigs/cluster.yaml -p generatedconfigs/provider-components.yaml`

## Creating and using controller images
1. [Install docker](https://docs.docker.com/install/#supported-platforms) and ensure docker works with `docker run hello-world`
2. Log into docker with `docker login`
3. Edit `cmd/azure-controller/Makefile` such that `PREFIX` is the logged in user, and `NAME` is the repository you wish to push your images to.
4. While in `cmd/azure-controller/`, run `make push` to create an image and push it to your Docker Hub repository.
5. Edit `generatedconfigs/provider-components.yaml` such that the images for `azure-machine-controller` and `azure-cluster-controller` refer to the images you just pushed, e.g. `meegul/azure-controller:0.0.17-dev`
3. Edit `cmd/machine-controller/Makefile` such that `PREFIX` is the logged in user, and `NAME` is the repository you wish to push your images to.
4. While in `cmd/machine-controller/`, run `make push` to create an image and push it to your Docker Hub repository.
5. Edit `generatedconfigs/provider-components.yaml` such that the images for `azure-machine-controller` and `azure-cluster-controller` refer to the images you just pushed, e.g. `platform9/cluster-api-azure-machine-controller:0.0.29-dev`


## Testing
Unit tests can be ran with `make unit_test`, and integration tests can be ran with `make integration_test`. However, keep in mind that the integration tests will take a significant amount of time (> 1 hour) and _**will create resources in Azure**_. The integration tests should clean up the created resources, but do not take this as a guarantee.
### Integration test notes
The integration tests require an azure service principal and use [environment based authentication](https://docs.microsoft.com/en-us/go/azure/azure-sdk-go-authorization#use-environment-based-authentication).
The integration tests require an azure service principal and uses [environment based authentication](https://docs.microsoft.com/en-us/go/azure/azure-sdk-go-authorization#use-environment-based-authentication).
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package azure_provider
package cluster

import (
"fmt"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@
"defaultValue": null,
"type":"string"
},
"vm_password": {
"defaultValue": null,
"type": "string"
},
"vm_size": {
"defaultValue": null,
"type": "string"
Expand All @@ -81,6 +77,10 @@
"startup_script": {
"defaultValue": null,
"type": "string"
},
"sshPublicKey": {
"defaultValue": null,
"type": "string"
}
},
"variables": {},
Expand Down Expand Up @@ -117,9 +117,16 @@
"osProfile": {
"computerName": "[parameters('virtualMachines_ClusterAPIVM_name')]",
"adminUsername": "[parameters('vm_user')]",
"adminPassword": "[parameters('vm_password')]",
"linuxConfiguration": {
"disablePasswordAuthentication": false
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', parameters('vm_user'), '/.ssh/authorized_keys')]",
"keyData": "[parameters('sshPublicKey')]"
}
]
}
},
"secrets": []
},
Expand Down Expand Up @@ -375,6 +382,28 @@
"[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroups_ClusterAPIVM_nsg_name'))]"
]
},
{
"type": "Microsoft.Network/networkSecurityGroups/securityRules",
"name": "[concat(parameters('networkSecurityGroups_ClusterAPIVM_nsg_name'), '/kubernetes')]",
"apiVersion": "2017-06-01",
"scale": null,
"properties": {
"provisioningState": "Succeeded",
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRange": "6443",
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this port for? Can you add a comment? Would this be something that a user might want to configure?

"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 1001,
"direction": "Inbound",
"sourceAddressPrefixes": [],
"destinationAddressPrefixes": []
},
"dependsOn": [
"[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroups_ClusterAPIVM_nsg_name'))]"
]
},
{
"type": "Microsoft.Network/virtualNetworks/subnets",
"name": "[concat(parameters('virtualNetworks_ClusterAPIVM_vnet_name'), '/', parameters('subnets_default_name'))]",
Expand Down
Loading