Skip to content

Commit

Permalink
Merge from origin branch
Browse files Browse the repository at this point in the history
Merge branch 'issue1037UnitTestPassword' of https://github.com/buhongw7583c/azure-service-operator into issue1037UnitTestPassword
  • Loading branch information
buhongw7583c committed May 14, 2020
2 parents da4a022 + 4d324bd commit 21ccf92
Show file tree
Hide file tree
Showing 55 changed files with 829 additions and 373 deletions.
14 changes: 8 additions & 6 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ resources:
kind: PostgreSQLDatabase
version: v1alpha1
- group: azure
kind: PostgreSQLFirewallRule
version: v1alpha1
kind: PostgreSQLVNetRule
version: v1alpha1
- group: azure
kind: PostgreSQLVNetRule
kind: PostgreSQLFirewallRule
version: v1alpha1
- group: azure
kind: APIMgmtAPI
Expand Down Expand Up @@ -93,14 +92,14 @@ resources:
kind: AzureVirtualMachine
version: v1alpha1
- group: azure
version: v1alpha1
kind: AzureSQLManagedUser
- group: azure
version: v1alpha1
kind: AzureLoadBalancer
- group: azure
kind: AzureLoadBalancer
version: v1alpha1
- group: azure
kind: AzureVMScaleSet
version: v1alpha1
- group: azure
kind: AzureSqlServer
version: v1beta1
Expand All @@ -116,4 +115,7 @@ resources:
- group: azure
kind: BlobContainer
version: v1alpha2
- group: azure
kind: MySQLServer
version: v1alpha2
version: "2"
44 changes: 43 additions & 1 deletion api/v1alpha1/azuresqldatabase_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,46 @@

package v1alpha1

func (*AzureSqlDatabase) Hub() {}
import (
"github.com/Azure/azure-service-operator/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)

func (src *AzureSqlDatabase) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*v1beta1.AzureSqlDatabase)

// ObjectMeta
dst.ObjectMeta = src.ObjectMeta

// Spec
dst.Spec.ResourceGroup = src.Spec.ResourceGroup
dst.Spec.Location = src.Spec.Location
dst.Spec.Server = src.Spec.Server
dst.Spec.Edition = v1beta1.DBEdition(src.Spec.Edition)
dst.Spec.DbName = src.Spec.DbName

// Status
dst.Status = v1beta1.ASOStatus(src.Status)

return nil
}

func (dst *AzureSqlDatabase) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*v1beta1.AzureSqlDatabase)

// ObjectMeta
dst.ObjectMeta = src.ObjectMeta

// Spec
dst.Spec.ResourceGroup = src.Spec.ResourceGroup
dst.Spec.Location = src.Spec.Location
dst.Spec.Server = src.Spec.Server
dst.Spec.Edition = DBEdition(src.Spec.Edition)
dst.Spec.DbName = src.Spec.DbName

// Status
dst.Status = ASOStatus(src.Status)

return nil

}
1 change: 0 additions & 1 deletion api/v1alpha1/azuresqldatabase_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ type AzureSqlDatabaseSpec struct {

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion

// AzureSqlDatabase is the Schema for the azuresqldatabases API
// +kubebuilder:printcolumn:name="Provisioned",type="string",JSONPath=".status.provisioned"
Expand Down
52 changes: 51 additions & 1 deletion api/v1alpha1/azuresqlfailovergroup_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,54 @@

package v1alpha1

func (*AzureSqlFailoverGroup) Hub() {}
import (
"github.com/Azure/azure-service-operator/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)

func (src *AzureSqlFailoverGroup) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*v1beta1.AzureSqlFailoverGroup)

// ObjectMeta
dst.ObjectMeta = src.ObjectMeta

// Spec
dst.Spec.ResourceGroup = src.Spec.ResourceGroup
dst.Spec.Location = src.Spec.Location
dst.Spec.Server = src.Spec.Server
dst.Spec.FailoverGracePeriod = src.Spec.FailoverGracePeriod
dst.Spec.FailoverPolicy = v1beta1.ReadWriteEndpointFailoverPolicy(src.Spec.FailoverPolicy)
dst.Spec.SecondaryServer = src.Spec.SecondaryServer
dst.Spec.SecondaryServerResourceGroup = src.Spec.SecondaryServerResourceGroup
dst.Spec.DatabaseList = src.Spec.DatabaseList
dst.Spec.KeyVaultToStoreSecrets = src.Spec.KeyVaultToStoreSecrets

// Status
dst.Status = v1beta1.ASOStatus(src.Status)

return nil
}

func (dst *AzureSqlFailoverGroup) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*v1beta1.AzureSqlFailoverGroup)

// ObjectMeta
dst.ObjectMeta = src.ObjectMeta

// Spec
dst.Spec.ResourceGroup = src.Spec.ResourceGroup
dst.Spec.Location = src.Spec.Location
dst.Spec.Server = src.Spec.Server
dst.Spec.FailoverGracePeriod = src.Spec.FailoverGracePeriod
dst.Spec.FailoverPolicy = ReadWriteEndpointFailoverPolicy(src.Spec.FailoverPolicy)
dst.Spec.SecondaryServer = src.Spec.SecondaryServer
dst.Spec.SecondaryServerResourceGroup = src.Spec.SecondaryServerResourceGroup
dst.Spec.DatabaseList = src.Spec.DatabaseList
dst.Spec.KeyVaultToStoreSecrets = src.Spec.KeyVaultToStoreSecrets

// Status
dst.Status = ASOStatus(src.Status)

return nil

}
1 change: 0 additions & 1 deletion api/v1alpha1/azuresqlfailovergroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type AzureSqlFailoverGroupSpec struct {

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion

// AzureSqlFailoverGroup is the Schema for the azuresqlfailovergroups API
// +kubebuilder:printcolumn:name="Provisioned",type="string",JSONPath=".status.provisioned"
Expand Down
42 changes: 41 additions & 1 deletion api/v1alpha1/azuresqlfirewallrule_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,44 @@

package v1alpha1

func (*AzureSqlFirewallRule) Hub() {}
import (
"github.com/Azure/azure-service-operator/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)

func (src *AzureSqlFirewallRule) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*v1beta1.AzureSqlFirewallRule)

// ObjectMeta
dst.ObjectMeta = src.ObjectMeta

// Spec
dst.Spec.ResourceGroup = src.Spec.ResourceGroup
dst.Spec.Server = src.Spec.Server
dst.Spec.StartIPAddress = src.Spec.StartIPAddress
dst.Spec.EndIPAddress = src.Spec.EndIPAddress

// Status
dst.Status = v1beta1.ASOStatus(src.Status)

return nil
}

func (dst *AzureSqlFirewallRule) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*v1beta1.AzureSqlFirewallRule)

// ObjectMeta
dst.ObjectMeta = src.ObjectMeta

// Spec
dst.Spec.ResourceGroup = src.Spec.ResourceGroup
dst.Spec.Server = src.Spec.Server
dst.Spec.StartIPAddress = src.Spec.StartIPAddress
dst.Spec.EndIPAddress = src.Spec.EndIPAddress

// Status
dst.Status = ASOStatus(src.Status)

return nil

}
1 change: 0 additions & 1 deletion api/v1alpha1/azuresqlfirewallrule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type AzureSqlFirewallRuleSpec struct {

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion

// AzureSqlFirewallRule is the Schema for the azuresqlfirewallrules API
// +kubebuilder:printcolumn:name="Provisioned",type="string",JSONPath=".status.provisioned"
Expand Down
40 changes: 39 additions & 1 deletion api/v1alpha1/azuresqlserver_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,42 @@

package v1alpha1

func (*AzureSqlServer) Hub() {}
import (
"github.com/Azure/azure-service-operator/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)

func (src *AzureSqlServer) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*v1beta1.AzureSqlServer)

// ObjectMeta
dst.ObjectMeta = src.ObjectMeta

// Spec
dst.Spec.ResourceGroup = src.Spec.ResourceGroup
dst.Spec.Location = src.Spec.Location
dst.Spec.KeyVaultToStoreSecrets = src.Spec.KeyVaultToStoreSecrets

// Status
dst.Status = v1beta1.ASOStatus(src.Status)

return nil
}

func (dst *AzureSqlServer) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*v1beta1.AzureSqlServer)

// ObjectMeta
dst.ObjectMeta = src.ObjectMeta

// Spec
dst.Spec.ResourceGroup = src.Spec.ResourceGroup
dst.Spec.Location = src.Spec.Location
dst.Spec.KeyVaultToStoreSecrets = src.Spec.KeyVaultToStoreSecrets

// Status
dst.Status = ASOStatus(src.Status)

return nil

}
1 change: 0 additions & 1 deletion api/v1alpha1/azuresqlserver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ type AzureSqlServerSpec struct {

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion

// AzureSqlServer is the Schema for the azuresqlservers API
// +kubebuilder:printcolumn:name="Provisioned",type="string",JSONPath=".status.provisioned"
Expand Down
42 changes: 41 additions & 1 deletion api/v1alpha1/blobcontainer_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,44 @@

package v1alpha1

func (*BlobContainer) Hub() {}
import (
"github.com/Azure/azure-service-operator/api/v1alpha2"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)

func (src *BlobContainer) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*v1alpha2.BlobContainer)

// ObjectMeta
dst.ObjectMeta = src.ObjectMeta

// Spec
dst.Spec.ResourceGroup = src.Spec.ResourceGroup
dst.Spec.Location = src.Spec.Location
dst.Spec.AccountName = src.Spec.AccountName
dst.Spec.AccessLevel = src.Spec.AccessLevel

// Status
dst.Status = v1alpha2.ASOStatus(src.Status)

return nil
}

func (dst *BlobContainer) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*v1alpha2.BlobContainer)

// ObjectMeta
dst.ObjectMeta = src.ObjectMeta

// Spec
dst.Spec.ResourceGroup = src.Spec.ResourceGroup
dst.Spec.Location = src.Spec.Location
dst.Spec.AccountName = src.Spec.AccountName
dst.Spec.AccessLevel = src.Spec.AccessLevel

// Status
dst.Status = ASOStatus(src.Status)

return nil

}
1 change: 0 additions & 1 deletion api/v1alpha1/blobcontainer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ type BlobContainerSpec struct {

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion

// BlobContainer is the Schema for the blobcontainers API
// +kubebuilder:printcolumn:name="Provisioned",type="string",JSONPath=".status.provisioned"
Expand Down
70 changes: 70 additions & 0 deletions api/v1alpha1/mysqlserver_conversion.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

package v1alpha1

import (
"github.com/Azure/azure-service-operator/api/v1alpha2"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)

func (src *MySQLServer) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*v1alpha2.MySQLServer)

// ObjectMeta
dst.ObjectMeta = src.ObjectMeta

// Spec
dst.Spec.ResourceGroup = src.Spec.ResourceGroup
dst.Spec.Location = src.Spec.Location
dst.Spec.Sku = v1alpha2.AzureDBsSQLSku{
Name: src.Spec.Sku.Name,
Tier: v1alpha2.SkuTier(src.Spec.Sku.Tier),
Capacity: src.Spec.Sku.Capacity,
Size: src.Spec.Sku.Size,
Family: src.Spec.Sku.Family,
}

dst.Spec.ServerVersion = v1alpha2.ServerVersion(src.Spec.ServerVersion)
dst.Spec.SSLEnforcement = v1alpha2.SslEnforcementEnum(src.Spec.SSLEnforcement)
dst.Spec.CreateMode = src.Spec.CreateMode
dst.Spec.ReplicaProperties = v1alpha2.ReplicaProperties(src.Spec.ReplicaProperties)
dst.Spec.KeyVaultToStoreSecrets = src.Spec.KeyVaultToStoreSecrets

// New Spec
//dst.Spec.StorageProfile = nil

// Status
dst.Status = v1alpha2.ASOStatus(src.Status)

return nil
}

func (dst *MySQLServer) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*v1alpha2.MySQLServer)

// ObjectMeta
dst.ObjectMeta = src.ObjectMeta

// Spec
dst.Spec.ResourceGroup = src.Spec.ResourceGroup
dst.Spec.Location = src.Spec.Location
dst.Spec.Sku = AzureDBsSQLSku{
Name: src.Spec.Sku.Name,
Tier: SkuTier(src.Spec.Sku.Tier),
Capacity: src.Spec.Sku.Capacity,
Size: src.Spec.Sku.Size,
Family: src.Spec.Sku.Family,
}
dst.Spec.ServerVersion = ServerVersion(src.Spec.ServerVersion)
dst.Spec.SSLEnforcement = SslEnforcementEnum(src.Spec.SSLEnforcement)
dst.Spec.CreateMode = src.Spec.CreateMode
dst.Spec.ReplicaProperties = ReplicaProperties(src.Spec.ReplicaProperties)
dst.Spec.KeyVaultToStoreSecrets = src.Spec.KeyVaultToStoreSecrets

// Status
dst.Status = ASOStatus(src.Status)

return nil

}
Loading

0 comments on commit 21ccf92

Please sign in to comment.