Skip to content

Commit

Permalink
Merge branch 'master' into issue#946#pgreSqlReplica
Browse files Browse the repository at this point in the history
  • Loading branch information
jananivMS authored Apr 30, 2020
2 parents 130ecbe + b8c8ed1 commit edfaab1
Show file tree
Hide file tree
Showing 13 changed files with 277 additions and 178 deletions.
8 changes: 4 additions & 4 deletions api/v1alpha1/cosmosdb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type CosmosDBSpec struct {
Properties CosmosDBProperties `json:"properties,omitempty"`
VirtualNetworkRules *[]CosmosDBVirtualNetworkRule `json:"virtualNetworkRules,omitempty"`
KeyVaultToStoreSecrets string `json:"keyVaultToStoreSecrets,omitempty"`
Locations *[]CosmosDBLocation `json:"locations,omitempty"`
IPRules *[]string `json:"ipRules,omitempty"`
}

Expand Down Expand Up @@ -66,13 +67,12 @@ const (
CosmosDBDatabaseAccountOfferTypeStandard CosmosDBDatabaseAccountOfferType = "Standard"
)

/*
// CosmosDBLocation defines one or more locations for geo-redundancy and high availability
type CosmosDBLocation struct {
FailoverPriority int `json:"failoverPriority,omitempty"`
LocationName string `json:"locationName,omitempty"`
LocationName string `json:"locationName"`
FailoverPriority int32 `json:"failoverPriority"`
IsZoneRedundant bool `json:"isZoneRedundant,omitempty"`
}
*/

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/mysqlvnetrule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ type MySQLVNetRuleSpec struct {
// +kubebuilder:object:root=true

// MySQLVNetRule is the Schema for the mysqlvnetrules API
// +kubebuilder:printcolumn:name="Provisioned",type="string",JSONPath=".status.provisioned"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message"
type MySQLVNetRule struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/postgresqlvnetrule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ type PostgreSQLVNetRuleSpec struct {
// +kubebuilder:object:root=true

// PostgreSQLVNetRule is the Schema for the PostgreSQLVNetRules API
// +kubebuilder:printcolumn:name="Provisioned",type="string",JSONPath=".status.provisioned"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message"
type PostgreSQLVNetRule struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
15 changes: 12 additions & 3 deletions config/samples/azure_v1alpha1_cosmosdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ spec:
resourceGroup: resourcegroup-azure-operators
properties:
databaseAccountOfferType: Standard
enableMultipleWriteLocations: false

# optionally turn on multi-region writes
# enableMultipleWriteLocations: true

# Optionally set the capabilities name to the following options: (the default is SQL)
# "EnableCassandra", "EnableTable", "EnableGremlin", "EnableMongo"
# NOTE: If using "EnableMongo" kind must be set to MongoDB for this to take effect
#capabilities:
# - name: "EnableCassandra"


# optionally set the mongoDBVersion to "3.2" or "3.6", if omitted the default is "3.2"
# NOTE: kind must be set to MongoDB for this to take effect
# mongoDBVersion: "3.6"
Expand All @@ -34,4 +35,12 @@ spec:
# # the ips in this rule are needed to access your db from the portal
# - 104.42.195.92,40.76.54.131,52.176.6.30,52.169.50.45,52.187.184.26
# # add additional ips you would like to grant access
# - 73.153.28.188
# - 1.2.3.4

# optionally configure multiple regions and availability zone redundancy
# locations:
# - locationName: eastus
# failoverPriority: 0
# isZoneRedundant: true
# - locationName: westus
# failoverPriority: 1
48 changes: 48 additions & 0 deletions config/samples/azure_v1alpha1_cosmosdb_prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: azure.microsoft.com/v1alpha1
kind: CosmosDB
metadata:
name: cosmosdb-sample-2
labels:
CosmosAccountType: Production
spec:
kind: GlobalDocumentDB
location: eastus
resourceGroup: resourcegroup-azure-operators
properties:
databaseAccountOfferType: Standard

# turn on multi-region writes for production
enableMultipleWriteLocations: true

# Optionally set the capabilities name to the following options: (the default is SQL)
# "EnableCassandra", "EnableTable", "EnableGremlin", "EnableMongo"
# NOTE: If using "EnableMongo" kind must be set to MongoDB for this to take effect
#capabilities:
# - name: "EnableCassandra"

# optionally set the mongoDBVersion to "3.2" or "3.6", if omitted the default is "3.2"
# NOTE: kind must be set to MongoDB for this to take effect
# mongoDBVersion: "3.6"

# enable virtual network rules if configured below
# isVirtualNetworkFilterEnabled: true

# optionally restrict access to specific virtual networks
# virtualNetworkRules:
# - subnetId: /subscriptions/{subscription_id}/resourceGroups/{resourcegroup}/providers/Microsoft.Network/virtualNetworks/{vnet_name}/subnets/{subnet_name}
# ignoreMissingServiceEndpoint: false

# optionally configure different CIDR IP ranges for allowed-list, omitting allows all or falls back to vNetRules
ipRules:
# the ips in this rule are needed to access your db from the portal
- 104.42.195.92,40.76.54.131,52.176.6.30,52.169.50.45,52.187.184.26
# # add additional ips you would like to grant access
# - 1.2.3.4

# configure multiple regions and availability zone redundancy
locations:
- locationName: eastus
failoverPriority: 0
isZoneRedundant: true
- locationName: westus
failoverPriority: 1
112 changes: 56 additions & 56 deletions controllers/eventhub_storageaccount_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,63 +55,63 @@ func TestEventHubControllerNoNamespace(t *testing.T) {
EnsureDelete(ctx, t, tc, eventhubInstance)
}

func TestEventHubControllerCreateAndDeleteCustomSecret(t *testing.T) {
t.Parallel()
defer PanicRecover(t)
ctx := context.Background()

// Add any setup steps that needs to be executed before each test
rgName := tc.resourceGroupName
rgLocation := tc.resourceGroupLocation
ehnName := GenerateTestResourceNameWithRandom("eh-ns", 10)
eventhubName := GenerateTestResourceNameWithRandom("eh-customsec", 10)
secretName := "secret-" + eventhubName

// Create EventhubNamespace instance as prereq
eventhubNamespaceInstance := &azurev1alpha1.EventhubNamespace{
ObjectMeta: metav1.ObjectMeta{
Name: ehnName,
Namespace: "default",
},
Spec: azurev1alpha1.EventhubNamespaceSpec{
Location: rgLocation,
ResourceGroup: rgName,
},
}
// func TestEventHubControllerCreateAndDeleteCustomSecret(t *testing.T) {
// t.Parallel()
// defer PanicRecover(t)
// ctx := context.Background()

// // Add any setup steps that needs to be executed before each test
// rgName := tc.resourceGroupName
// rgLocation := tc.resourceGroupLocation
// ehnName := GenerateTestResourceNameWithRandom("eh-ns", 10)
// eventhubName := GenerateTestResourceNameWithRandom("eh-customsec", 10)
// secretName := "secret-" + eventhubName

// // Create EventhubNamespace instance as prereq
// eventhubNamespaceInstance := &azurev1alpha1.EventhubNamespace{
// ObjectMeta: metav1.ObjectMeta{
// Name: ehnName,
// Namespace: "default",
// },
// Spec: azurev1alpha1.EventhubNamespaceSpec{
// Location: rgLocation,
// ResourceGroup: rgName,
// },
// }

// EnsureInstance(ctx, t, tc, eventhubNamespaceInstance)

// // Create the EventHub object and expect the Reconcile to be created
// eventhubInstance := &azurev1alpha1.Eventhub{
// ObjectMeta: metav1.ObjectMeta{
// Name: eventhubName,
// Namespace: "default",
// },
// Spec: azurev1alpha1.EventhubSpec{
// Location: rgLocation,
// Namespace: ehnName,
// ResourceGroup: rgName,
// Properties: azurev1alpha1.EventhubProperties{
// MessageRetentionInDays: 7,
// PartitionCount: 2,
// },
// AuthorizationRule: azurev1alpha1.EventhubAuthorizationRule{
// Name: "RootManageSharedAccessKey",
// Rights: []string{"Listen"},
// },
// SecretName: secretName,
// },
// }

// EnsureInstance(ctx, t, tc, eventhubInstance)

// EnsureSecretsWithValue(ctx, t, tc, eventhubInstance, tc.secretClient, secretName, eventhubInstance.Namespace, "eventhubName", eventhubName)

// EnsureDelete(ctx, t, tc, eventhubInstance)

// EnsureDelete(ctx, t, tc, eventhubNamespaceInstance)
// }

EnsureInstance(ctx, t, tc, eventhubNamespaceInstance)

// Create the EventHub object and expect the Reconcile to be created
eventhubInstance := &azurev1alpha1.Eventhub{
ObjectMeta: metav1.ObjectMeta{
Name: eventhubName,
Namespace: "default",
},
Spec: azurev1alpha1.EventhubSpec{
Location: rgLocation,
Namespace: ehnName,
ResourceGroup: rgName,
Properties: azurev1alpha1.EventhubProperties{
MessageRetentionInDays: 7,
PartitionCount: 2,
},
AuthorizationRule: azurev1alpha1.EventhubAuthorizationRule{
Name: "RootManageSharedAccessKey",
Rights: []string{"Listen"},
},
SecretName: secretName,
},
}

EnsureInstance(ctx, t, tc, eventhubInstance)

EnsureSecretsWithValue(ctx, t, tc, eventhubInstance, tc.secretClient, secretName, eventhubInstance.Namespace, "eventhubName", eventhubName)

EnsureDelete(ctx, t, tc, eventhubInstance)

EnsureDelete(ctx, t, tc, eventhubNamespaceInstance)

}
func TestEventHubControllerCreateAndDeleteCustomKeyVault(t *testing.T) {
t.Parallel()
defer PanicRecover(t)
Expand Down
1 change: 1 addition & 0 deletions pkg/errhelp/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const (
SubnetHasServiceEndpointWithInvalidServiceName = "SubnetHasServiceEndpointWithInvalidServiceName"
InvalidAddressPrefixFormat = "InvalidAddressPrefixFormat"
FeatureNotSupportedForEdition = "FeatureNotSupportedForEdition"
VirtualNetworkRuleBadRequest = "VirtualNetworkRuleBadRequest"
)

func NewAzureError(err error) error {
Expand Down
Loading

0 comments on commit edfaab1

Please sign in to comment.