-
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 'master' into bug-cosmos-secretname
- Loading branch information
Showing
45 changed files
with
2,013 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// 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. | ||
|
||
// AzureLoadBalancerSpec defines the desired state of AzureLoadBalancer | ||
type AzureLoadBalancerSpec 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"` | ||
PublicIPAddressName string `json:"publicIPAddressName"` | ||
BackendAddressPoolName string `json:"backendAddressPoolName"` | ||
InboundNatPoolName string `json:"inboundNatPoolName"` | ||
FrontendPortRangeStart int `json:"frontendPortRangeStart"` | ||
FrontendPortRangeEnd int `json:"frontendPortRangeEnd"` | ||
BackendPort int `json:"backendPort"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
|
||
// AzureLoadBalancer is the Schema for the azureloadbalancers API | ||
// +kubebuilder:printcolumn:name="Provisioned",type="string",JSONPath=".status.provisioned" | ||
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message" | ||
type AzureLoadBalancer struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec AzureLoadBalancerSpec `json:"spec,omitempty"` | ||
Status ASOStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// AzureLoadBalancerList contains a list of AzureLoadBalancer | ||
type AzureLoadBalancerList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []AzureLoadBalancer `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&AzureLoadBalancer{}, &AzureLoadBalancerList{}) | ||
} |
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("AzureLoadBalancer", func() { | ||
var ( | ||
key types.NamespacedName | ||
created, fetched *AzureLoadBalancer | ||
) | ||
|
||
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 = &AzureLoadBalancer{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "foo", | ||
Namespace: "default", | ||
}, | ||
Spec: AzureLoadBalancerSpec{ | ||
Location: "westus", | ||
ResourceGroup: "testlb", | ||
PublicIPAddressName: "test", | ||
BackendAddressPoolName: "test", | ||
InboundNatPoolName: "test", | ||
FrontendPortRangeStart: 1000, | ||
FrontendPortRangeEnd: 2000, | ||
BackendPort: 3000, | ||
}} | ||
|
||
By("creating an API obj") | ||
Expect(k8sClient.Create(context.TODO(), created)).To(Succeed()) | ||
|
||
fetched = &AzureLoadBalancer{} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// 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. | ||
|
||
// AzureVMScaleSetSpec defines the desired state of AzureVMScaleSet | ||
type AzureVMScaleSetSpec 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"` | ||
Capacity int `json:"capacity"` | ||
OSType OSType `json:"osType"` | ||
AdminUserName string `json:"adminUserName"` | ||
SSHPublicKeyData string `json:"sshPublicKeyData,omitempty"` | ||
PlatformImageURN string `json:"platformImageURN"` | ||
VirtualNetworkName string `json:"virtualNetworkName"` | ||
SubnetName string `json:"subnetName"` | ||
LoadBalancerName string `json:"loadBalancerName"` | ||
BackendAddressPoolName string `json:"backendAddressPoolName"` | ||
InboundNatPoolName string `json:"inboundNatPoolName"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
|
||
// AzureVMScaleSet is the Schema for the azurevmscalesets API | ||
// +kubebuilder:printcolumn:name="Provisioned",type="string",JSONPath=".status.provisioned" | ||
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message" | ||
type AzureVMScaleSet struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec AzureVMScaleSetSpec `json:"spec,omitempty"` | ||
Status ASOStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// AzureVMScaleSetList contains a list of AzureVMScaleSet | ||
type AzureVMScaleSetList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []AzureVMScaleSet `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&AzureVMScaleSet{}, &AzureVMScaleSetList{}) | ||
} |
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,79 @@ | ||
// 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("AzureVMScaleSet", func() { | ||
var ( | ||
key types.NamespacedName | ||
created, fetched *AzureVMScaleSet | ||
) | ||
|
||
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 = &AzureVMScaleSet{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "foo", | ||
Namespace: "default", | ||
}, | ||
Spec: AzureVMScaleSetSpec{ | ||
Location: "westus", | ||
ResourceGroup: "foo-vm", | ||
VMSize: "test", | ||
Capacity: 2, | ||
OSType: OSType("Linux"), | ||
AdminUserName: "test", | ||
SSHPublicKeyData: "test", | ||
PlatformImageURN: "w:x:y:z", | ||
VirtualNetworkName: "test", | ||
SubnetName: "test", | ||
LoadBalancerName: "test", | ||
BackendAddressPoolName: "test", | ||
InboundNatPoolName: "test", | ||
}} | ||
|
||
By("creating an API obj") | ||
Expect(k8sClient.Create(context.TODO(), created)).To(Succeed()) | ||
|
||
fetched = &AzureVMScaleSet{} | ||
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
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: azureloadbalancers.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,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: azurevmscalesets.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: azureloadbalancers.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,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: azurevmscalesets.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,13 @@ | ||
apiVersion: azure.microsoft.com/v1alpha1 | ||
kind: AzureLoadBalancer | ||
metadata: | ||
name: lb-sample-01 | ||
spec: | ||
location: SouthCentralUS | ||
resourceGroup: resourcegroup-azure-operators | ||
publicIPAddressName: lb-pip-sample-01 | ||
backendAddressPoolName: test | ||
inboundNatPoolName: test | ||
frontendPortRangeStart: 1001 | ||
frontendPortRangeEnd: 2000 | ||
backendPort: 3000 |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
apiVersion: azure.microsoft.com/v1alpha1 | ||
kind: AzureNetworkInterface | ||
metadata: | ||
name: azurenetworkinterface-sample18 | ||
name: nic-sample-01 | ||
spec: | ||
location: westus | ||
location: SouthCentralUS | ||
resourceGroup: resourcegroup-azure-operators | ||
vnetName: vnet-sample-hpf-1 | ||
subnetName: test2 | ||
publicIPAddressName: azurepublicipaddress-sample-7 | ||
vnetName: vnet-sample-01 | ||
subnetName: test1 | ||
publicIPAddressName: nic-pip-sample-01 |
Oops, something went wrong.