Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
frodopwns committed Oct 30, 2019
2 parents 98b19db + acc3a61 commit bfab9cc
Show file tree
Hide file tree
Showing 21 changed files with 28 additions and 56 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/aso_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ type ASOStatus struct {
Provisioned bool `json:"provisioned,omitempty"`
State string `json:"state,omitempty"`
Message string `json:"message,omitempty"`
}
}
4 changes: 2 additions & 2 deletions api/v1alpha1/azuresqlaction_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ type AzureSqlAction struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec AzureSqlActionSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Spec AzureSqlActionSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/azuresqldatabase_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ type AzureSqlDatabase struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec AzureSqlDatabaseSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Spec AzureSqlDatabaseSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/azuresqlfirewallrule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ type AzureSqlFirewallRule struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec AzureSqlFirewallRuleSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Spec AzureSqlFirewallRuleSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
8 changes: 2 additions & 6 deletions api/v1alpha1/azuresqlserver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ type AzureSqlServer struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec AzureSqlServerSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Spec AzureSqlServerSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand All @@ -57,7 +57,3 @@ func init() {
func (s *AzureSqlServer) IsSubmitted() bool {
return s.Status.Provisioned || s.Status.Provisioning
}

func (s *AzureSqlServer) IsProvisioned() bool {
return s.Status.Provisioned
}
4 changes: 2 additions & 2 deletions api/v1alpha1/consumergroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ type ConsumerGroup struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ConsumerGroupSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Spec ConsumerGroupSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/cosmosdb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ type CosmosDB struct {
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec CosmosDBSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Output CosmosDBOutput `json:"output,omitempty"`
AdditionalResources CosmosDBAdditionalResources `json:"additionalResources,omitempty"`
}
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/eventhub_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ type Eventhub struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec EventhubSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Spec EventhubSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/eventhubnamespace_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ type EventhubNamespace struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec EventhubNamespaceSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Spec EventhubNamespaceSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/rediscache_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ type RedisCache struct {
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec RedisCacheSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Output RedisCacheOutput `json:"output,omitempty"`
AdditionalResources RedisCacheAdditionalResources `json:"additionalResources,omitempty"`
}
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/resourcegroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ type ResourceGroup struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ResourceGroupSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Spec ResourceGroupSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/storage_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ type Storage struct {
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec StorageSpec `json:"spec,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Status ASOStatus `json:"status,omitempty"`
Output StorageOutput `json:"output,omitempty"`
AdditionalResources StorageAdditionalResources `json:"additionalResources,omitempty"`
}
Expand Down
24 changes: 0 additions & 24 deletions controllers/azuresqlserver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,32 +115,8 @@ func (r *AzureSqlServerReconciler) Reconcile(req ctrl.Request) (ctrl.Result, err
}
}

// Re-create secret if server is provisioned but secret doesn't exist
if instance.IsProvisioned() {
name := instance.ObjectMeta.Name

secret := &v1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: instance.Namespace,
},
Type: "Opaque",
}

if err := r.Get(context.Background(), types.NamespacedName{Name: name, Namespace: instance.Namespace}, secret); err != nil {
r.Log.Info("Error", "ReconcileSecret", "Server exists but secret does not, recreating now")

// Add admin credentials to "data" block in secret

// CreateOrUpdate secret
}

}

if !instance.IsSubmitted() {
r.Recorder.Event(&instance, v1.EventTypeNormal, "Submitting", "starting resource reconciliation")
// TODO: Add error handling for cases where username or password are invalid:
// https://docs.microsoft.com/en-us/rest/api/sql/servers/createorupdate#response
if err := r.reconcileExternal(&instance); err != nil {
catch := []string{
errhelp.ParentNotFoundErrorCode,
Expand Down
2 changes: 1 addition & 1 deletion controllers/azuresqlserver_controller_finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"context"
"fmt"

v1 "k8s.io/api/core/v1"
azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
helpers "github.com/Azure/azure-service-operator/pkg/helpers"
v1 "k8s.io/api/core/v1"
)

const AzureSQLServerFinalizerName = "azuresqlserver.finalizers.azure.com"
Expand Down
2 changes: 1 addition & 1 deletion controllers/consumergroup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import (
"time"

"github.com/go-logr/logr"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/tools/record"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
v1 "k8s.io/api/core/v1"

azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
eventhubsresourcemanager "github.com/Azure/azure-service-operator/pkg/resourcemanager/eventhubs"
Expand Down
2 changes: 1 addition & 1 deletion controllers/consumergroup_controller_finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"context"
"fmt"

v1 "k8s.io/api/core/v1"
azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
v1 "k8s.io/api/core/v1"
)

const consumerGroupFinalizerName = "consumergroup.finalizers.com"
Expand Down
2 changes: 1 addition & 1 deletion controllers/cosmosdb_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import (
"github.com/Azure/azure-service-operator/pkg/errhelp"
"github.com/Azure/azure-service-operator/pkg/helpers"
"github.com/Azure/azure-service-operator/pkg/resourcemanager/cosmosdbs"
"k8s.io/client-go/tools/record"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/tools/record"
)

const cosmosDBFinalizerName = "cosmosdb.finalizers.azure.com"
Expand Down
2 changes: 1 addition & 1 deletion controllers/eventhubnamespace_controller_finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"context"
"fmt"

v1 "k8s.io/api/core/v1"
azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
v1 "k8s.io/api/core/v1"
)

const eventhubNamespaceFinalizerName = "eventhubnamespace.finalizers.com"
Expand Down
2 changes: 1 addition & 1 deletion controllers/keyvault_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import (
"github.com/Azure/go-autorest/autorest/to"
"github.com/go-logr/logr"
"github.com/pkg/errors"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/tools/record"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
v1 "k8s.io/api/core/v1"
)

const keyVaultFinalizerName = "keyvault.finalizers.azure.com"
Expand Down
2 changes: 1 addition & 1 deletion controllers/rediscache_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import (
"github.com/Azure/azure-service-operator/pkg/errhelp"
"github.com/Azure/azure-service-operator/pkg/helpers"
"github.com/Azure/azure-service-operator/pkg/resourcemanager/rediscaches"
"k8s.io/client-go/tools/record"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/tools/record"
)

const redisCacheFinalizerName = "rediscache.finalizers.azure.com"
Expand Down
2 changes: 1 addition & 1 deletion controllers/storage_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import (
"github.com/Azure/azure-service-operator/pkg/errhelp"
"github.com/Azure/azure-service-operator/pkg/helpers"
"github.com/Azure/azure-service-operator/pkg/resourcemanager/storages"
"k8s.io/client-go/tools/record"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/tools/record"
)

const storageFinalizerName = "storage.finalizers.azure.com"
Expand Down

0 comments on commit bfab9cc

Please # to comment.