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 Azure Express Route Circuit. #259

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
9 changes: 9 additions & 0 deletions apis/network/v1alpha3/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@ var (
SubnetGroupVersionKind = SchemeGroupVersion.WithKind(SubnetKind)
)

// ExpressRouteCircuits type metadata.
var (
ExpressRouteCircuitsKind = reflect.TypeOf(ExpressRouteCircuits{}).Name()
ExpressRouteCircuitsGroupKind = schema.GroupKind{Group: Group, Kind: ExpressRouteCircuitsKind}.String()
ExpressRouteCircuitsKindAPIVersion = ExpressRouteCircuitsKind + "." + SchemeGroupVersion.String()
ExpressRouteCircuitsGroupVersionKind = SchemeGroupVersion.WithKind(ExpressRouteCircuitsKind)
)

func init() {
SchemeBuilder.Register(&VirtualNetwork{}, &VirtualNetworkList{})
SchemeBuilder.Register(&Subnet{}, &SubnetList{})
SchemeBuilder.Register(&ExpressRouteCircuits{}, &ExpressRouteCircuitsList{})
}
101 changes: 101 additions & 0 deletions apis/network/v1alpha3/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,104 @@ type SubnetList struct {
metav1.ListMeta `json:"metadata,omitempty"`
Items []Subnet `json:"items"`
}

// ExpressRouteCircuitsPropertiesFormat defines properties of a ExpressRouteCircuits.
type ExpressRouteCircuitsPropertiesFormat struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
type ExpressRouteCircuitsPropertiesFormat struct {
type ExpressRouteCircuitPropertiesFormat struct {

The corresponding model type name in azure-sdk-for-go is singular: network.ExpressRouteCircuitPropertiesFormat.

Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: We may consider adding the currently missing fields like ExpressRouteCircuitPropertiesFormat.BandwidthInGbps, ExpressRouteCircuitPropertiesFormat.Peerings, etc.


// ServiceProviderName - Flag denoting service provider name.
ServiceProviderName *string `json:"serviceProviderName,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Per https://github.com/crossplane/crossplane/blob/master/design/one-pager-managed-resource-api-design.md, please mark the optional fields (pointer types with the omitempty serialization tag) with // +optional:

Suggested change
ServiceProviderName *string `json:"serviceProviderName,omitempty"`
// +optional
ServiceProviderName *string `json:"serviceProviderName,omitempty"`


// BandwidthInMbps - Flag denotes bandwithwidth in Mbps.
BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"`
// +optional
BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"`


// PeeringLocation - Flag denotes peering location.
PeeringLocation *string `json:"peeringLocation,omitempty"`
Comment on lines +234 to +240
Copy link
Collaborator

Choose a reason for hiding this comment

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

Per Crossplane MR API conventions document, we had better reflect the azure-sdk-for-go model of this resource for our high fidelity goal. I think we had better move these fields to their own struct, ExpressRouteCircuitServiceProviderProperties, reflecting its SDK model. This will also pay off when we add, for instance, the ExpressRouteCircuitPropertiesFormat.BandwidthInGbps in addition to the proposed ExpressRouteCircuitServiceProviderProperties.BandwidthInMbps.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
PeeringLocation *string `json:"peeringLocation,omitempty"`
// +optional
PeeringLocation *string `json:"peeringLocation,omitempty"`


// AllowClassicOperations - Flag denotes allow classic operations.
AllowClassicOperations *bool `json:"allowClassicOperations,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
AllowClassicOperations *bool `json:"allowClassicOperations,omitempty"`
// +optional
AllowClassicOperations *bool `json:"allowClassicOperations,omitempty"`


// GlobalReachEnabled - Flag denoting Global reach status.
GlobalReachEnabled *bool `json:"globalReachEnabled,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
GlobalReachEnabled *bool `json:"globalReachEnabled,omitempty"`
// +optional
GlobalReachEnabled *bool `json:"globalReachEnabled,omitempty"`

}

// SKU contains SKU in an ExpressRouteCircuit.
type SKU struct {
// Tier - The tier of the SKU. Possible values include: 'ExpressRouteCircuitSkuTierStandard', 'ExpressRouteCircuitSkuTierPremium', 'ExpressRouteCircuitSkuTierBasic', 'ExpressRouteCircuitSkuTierLocal'
Tier string `json:"tier,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is optional:

Suggested change
Tier string `json:"tier,omitempty"`
// +optional
Tier *string `json:"tier,omitempty"`

// Family - The family of the SKU. Possible values include: 'UnlimitedData', 'MeteredData'
Family string `json:"family,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is optional:

Suggested change
Family string `json:"family,omitempty"`
// +optional
Family *string `json:"family,omitempty"`

}

// A ExpressRouteCircuitsSpec defines the desired state of a ExpressRouteCircuits.
type ExpressRouteCircuitsSpec struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
type ExpressRouteCircuitsSpec struct {
type ExpressRouteCircuitSpec struct {

xpv1.ResourceSpec `json:",inline"`

// Location - Location of the ExpressRouteCircuit.
Location string `json:"location,omitempty"`

// SKU - SKU for ExpressRouteCircuit.
Sku SKU `json:"sku,omitempty"`

// Tags - Resource tags.
// +optional
Tags map[string]string `json:"tags,omitempty"`

// CircuitName - Name of the expressroutecircuit
CircuitName string `json:"circuitName,omitempty"`

// ResourceGroupName - Name of the ExpressRouteCircuits's resource group.
ResourceGroupName string `json:"resourceGroupName,omitempty"`

// ResourceGroupNameRef - Name of the ExpressRouteCircuits's resource group.
ResourceGroupNameRef string `json:"resourceGroupNameRef,omitempty"`

// ExpressRouteCircuitsPropertiesFormat - Properties of the subnet.
ExpressRouteCircuitsPropertiesFormat `json:"properties"`
}

// A ExpressRouteCircuitsStatus represents the observed state of a ExpressRouteCircuits.
type ExpressRouteCircuitsStatus struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
type ExpressRouteCircuitsStatus struct {
type ExpressRouteCircuitStatus struct {

xpv1.ResourceStatus `json:",inline"`

// State of this ExpressRouteCircuits.
State string `json:"state,omitempty"`

// A Message providing detail about the state of this ExpressRouteCircuits, if any.
Message string `json:"message,omitempty"`

// Etag - A unique string that changes whenever the resource is updated.
Etag string `json:"etag,omitempty"`

// ID of this ExpressRouteCircuits.
ID string `json:"id,omitempty"`

// Purpose - A string identifying the intention of use for this subnet based
// on delegations and other user-defined properties.
Purpose string `json:"purpose,omitempty"`
}

// +kubebuilder:object:root=true

// A ExpressRouteCircuits is a managed resource that represents an Azure ExpressRouteCircuits.
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
// +kubebuilder:printcolumn:name="STATE",type="string",JSONPath=".status.state"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,azure}
type ExpressRouteCircuits struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
type ExpressRouteCircuits struct {
type ExpressRouteCircuit struct {

metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ExpressRouteCircuitsSpec `json:"spec"`
Status ExpressRouteCircuitsStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// ExpressRouteCircuitsList contains a list of ExpressRouteCircuits items
type ExpressRouteCircuitsList struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
type ExpressRouteCircuitsList struct {
type ExpressRouteCircuitList struct {

metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ExpressRouteCircuits `json:"items"`
}
155 changes: 155 additions & 0 deletions apis/network/v1alpha3/zz_generated.deepcopy.go

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

56 changes: 56 additions & 0 deletions apis/network/v1alpha3/zz_generated.managed.go

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

9 changes: 9 additions & 0 deletions apis/network/v1alpha3/zz_generated.managedlist.go

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

18 changes: 18 additions & 0 deletions examples/network/expressroutecircuits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: network.azure.crossplane.io/v1alpha3
kind: ExpressRouteCircuits
metadata:
name: example-vn
spec:
resourceGroupName: test-exp
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
resourceGroupName: test-exp
resourceGroupName: example-rg

location: West US 2
properties:
allowClassicOperations: False
bandwidthInMbps: 50
globalReachEnabled: True
peeringLocation: Chennai2
serviceProviderName: Airtel
sku:
family: MeteredData
tier: Standard
providerConfigRef:
name: default
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
name: default
name: example

In the example manifests, for references to other resources for which an example manifest exists, the name in that manifest is used, and the example provider config name is example. This makes the life a bit easier when trying things out, and for conformance tests.

Loading