-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'cloud-suffix' of https://github.com/jananivMS/azure-ser…
…vice-operator into cloud-suffix
- Loading branch information
Showing
68 changed files
with
2,277 additions
and
434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! | ||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
||
// AzureVirtualMachineSpec defines the desired state of AzureVirtualMachine | ||
type AzureVirtualMachineSpec struct { | ||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
Location string `json:"location"` | ||
ResourceGroup string `json:"resourceGroup"` | ||
VMSize string `json:"vmSize"` | ||
OSType OSType `json:"osType"` | ||
AdminUserName string `json:"adminUserName"` | ||
SSHPublicKeyData string `json:"sshPublicKeyData,omitempty"` | ||
NetworkInterfaceName string `json:"networkInterfaceName"` | ||
PlatformImageURN string `json:"platformImageURN"` | ||
} | ||
|
||
type OSType string | ||
|
||
const ( | ||
// Windows ... | ||
Windows OSType = "Windows" | ||
// Linux ... | ||
Linux OSType = "Linux" | ||
) | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
|
||
// AzureVirtualMachine is the Schema for the azurevirtualmachines API | ||
type AzureVirtualMachine struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec AzureVirtualMachineSpec `json:"spec,omitempty"` | ||
Status ASOStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// AzureVirtualMachineList contains a list of AzureVirtualMachine | ||
type AzureVirtualMachineList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []AzureVirtualMachine `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&AzureVirtualMachine{}, &AzureVirtualMachineList{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
|
||
"golang.org/x/net/context" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
) | ||
|
||
// These tests are written in BDD-style using Ginkgo framework. Refer to | ||
// http://onsi.github.io/ginkgo to learn more. | ||
|
||
var _ = Describe("AzureVirtualMachine", func() { | ||
var ( | ||
key types.NamespacedName | ||
created, fetched *AzureVirtualMachine | ||
) | ||
|
||
BeforeEach(func() { | ||
// Add any setup steps that needs to be executed before each test | ||
}) | ||
|
||
AfterEach(func() { | ||
// Add any teardown steps that needs to be executed after each test | ||
}) | ||
|
||
// Add Tests for OpenAPI validation (or additonal CRD features) specified in | ||
// your API definition. | ||
// Avoid adding tests for vanilla CRUD operations because they would | ||
// test Kubernetes API server, which isn't the goal here. | ||
Context("Create API", func() { | ||
|
||
It("should create an object successfully", func() { | ||
|
||
key = types.NamespacedName{ | ||
Name: "foo", | ||
Namespace: "default", | ||
} | ||
created = &AzureVirtualMachine{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "foo", | ||
Namespace: "default", | ||
}, | ||
Spec: AzureVirtualMachineSpec{ | ||
Location: "westus", | ||
ResourceGroup: "foo-vm", | ||
VMSize: "test", | ||
OSType: OSType("Linux"), | ||
AdminUserName: "test", | ||
SSHPublicKeyData: "test", | ||
NetworkInterfaceName: "test", | ||
PlatformImageURN: "w:x:y:z", | ||
}} | ||
|
||
By("creating an API obj") | ||
Expect(k8sClient.Create(context.TODO(), created)).To(Succeed()) | ||
|
||
fetched = &AzureVirtualMachine{} | ||
Expect(k8sClient.Get(context.TODO(), key, fetched)).To(Succeed()) | ||
Expect(fetched).To(Equal(created)) | ||
|
||
By("deleting the created object") | ||
Expect(k8sClient.Delete(context.TODO(), created)).To(Succeed()) | ||
Expect(k8sClient.Get(context.TODO(), key, created)).ToNot(Succeed()) | ||
}) | ||
|
||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# The following patch adds a directive for certmanager to inject CA into the CRD | ||
# CRD conversion requires k8s 1.13 or later. | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) | ||
name: azurevirtualmachines.azure.microsoft.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# The following patch enables conversion webhook for CRD | ||
# CRD conversion requires k8s 1.13 or later. | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: azurevirtualmachines.azure.microsoft.com | ||
spec: | ||
conversion: | ||
strategy: Webhook | ||
webhookClientConfig: | ||
# this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, | ||
# but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) | ||
caBundle: Cg== | ||
service: | ||
namespace: system | ||
name: webhook-service | ||
path: /convert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: azure.microsoft.com/v1alpha1 | ||
kind: AzureVirtualMachine | ||
metadata: | ||
name: hpfvm20 | ||
spec: | ||
location: SouthCentralUS | ||
resourceGroup: resourcegroup-azure-operators | ||
vmSize: Standard_DS1_v2 | ||
osType: Linux | ||
adminUserName: azureuser | ||
# SSH public key to be used with VM (eg cat ~/.ssh/id_rsa.pub) | ||
sshPublicKeyData: "{ssh public key}" | ||
networkInterfaceName: hpfnic20 | ||
platformImageURN: Canonical:UbuntuServer:16.04-LTS:latest |
Oops, something went wrong.