Skip to content

Commit

Permalink
Merge pull request #349 from aka-msft/fix/azure-sql-renames
Browse files Browse the repository at this point in the history
Rename SQL resources to AzureSQL
  • Loading branch information
aka-msft committed Oct 14, 2019
2 parents 92da9a1 + cecbaa2 commit 2da53fd
Show file tree
Hide file tree
Showing 27 changed files with 233 additions and 233 deletions.
8 changes: 4 additions & 4 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ resources:
kind: EventhubNamespace
- group: azure
version: v1alpha1
kind: SqlServer
kind: AzureSqlServer
- group: azure
version: v1alpha1
kind: SqlDatabase
kind: AzureSqlDatabase
- group: azure
version: v1alpha1
kind: SqlFirewallRule
kind: AzureSqlFirewallRule
- group: azure
version: v1alpha1
kind: KeyVault
Expand All @@ -37,4 +37,4 @@ resources:
kind: ConsumerGroup
- group: azure
version: v1alpha1
kind: SqlAction
kind: AzureSqlAction
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ import (
// 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.

// SqlActionSpec defines the desired state of SqlAction
type SqlActionSpec struct {
// AzureSqlActionSpec defines the desired state of AzureSqlAction
type AzureSqlActionSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
ResourceGroup string `json:"resourcegroup"`
ActionName string `json:"actionname"`
ServerName string `json:"servername"`
}

// SqlActionStatus defines the observed state of SqlAction
type SqlActionStatus struct {
// AzureSqlActionStatus defines the observed state of AzureSqlAction
type AzureSqlActionStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Provisioning bool `json:"provisioning,omitempty"`
Expand All @@ -43,28 +43,28 @@ type SqlActionStatus struct {
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// SqlAction is the Schema for the sqlactions API
type SqlAction struct {
// AzureSqlAction is the Schema for the azuresqlactions API
type AzureSqlAction struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec SqlActionSpec `json:"spec,omitempty"`
Status SqlActionStatus `json:"status,omitempty"`
Spec AzureSqlActionSpec `json:"spec,omitempty"`
Status AzureSqlActionStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// SqlActionList contains a list of SqlAction
type SqlActionList struct {
// AzureSqlActionList contains a list of AzureSqlAction
type AzureSqlActionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []SqlAction `json:"items"`
Items []AzureSqlAction `json:"items"`
}

func init() {
SchemeBuilder.Register(&SqlAction{}, &SqlActionList{})
SchemeBuilder.Register(&AzureSqlAction{}, &AzureSqlActionList{})
}

func (s *SqlAction) IsSubmitted() bool {
func (s *AzureSqlAction) IsSubmitted() bool {
return s.Status.Provisioned || s.Status.Provisioning
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (

// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// SqlDatabaseSpec defines the desired state of SqlDatabase
type SqlDatabaseSpec struct {
// AzureSqlDatabaseSpec defines the desired state of AzureSqlDatabase
type AzureSqlDatabaseSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
Location string `json:"location"`
Expand All @@ -32,8 +32,8 @@ type SqlDatabaseSpec struct {
Edition sql.DBEdition `json:"edition"`
}

// SqlDatabaseStatus defines the observed state of SqlDatabase
type SqlDatabaseStatus struct {
// AzureSqlDatabaseStatus defines the observed state of AzureSqlDatabase
type AzureSqlDatabaseStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Provisioning bool `json:"provisioning,omitempty"`
Expand All @@ -42,28 +42,28 @@ type SqlDatabaseStatus struct {

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// SqlDatabase is the Schema for the sqldatabases API
type SqlDatabase struct {
// AzureSqlDatabase is the Schema for the azuresqldatabases API
type AzureSqlDatabase struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec SqlDatabaseSpec `json:"spec,omitempty"`
Status SqlDatabaseStatus `json:"status,omitempty"`
Spec AzureSqlDatabaseSpec `json:"spec,omitempty"`
Status AzureSqlDatabaseStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// SqlDatabaseList contains a list of SqlDatabase
type SqlDatabaseList struct {
// AzureSqlDatabaseList contains a list of AzureSqlDatabase
type AzureSqlDatabaseList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []SqlDatabase `json:"items"`
Items []AzureSqlDatabase `json:"items"`
}

func init() {
SchemeBuilder.Register(&SqlDatabase{}, &SqlDatabaseList{})
SchemeBuilder.Register(&AzureSqlDatabase{}, &AzureSqlDatabaseList{})
}

func (s *SqlDatabase) IsSubmitted() bool {
func (s *AzureSqlDatabase) IsSubmitted() bool {
return s.Status.Provisioned
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import (
// These tests are written in BDD-style using Ginkgo framework. Refer to
// http://onsi.github.io/ginkgo to learn more.

var _ = Describe("SqlDatabase", func() {
var _ = Describe("AzureSqlDatabase", func() {
var (
key types.NamespacedName
created, fetched *SqlDatabase
created, fetched *AzureSqlDatabase
)

BeforeEach(func() {
Expand All @@ -53,12 +53,12 @@ var _ = Describe("SqlDatabase", func() {
Name: "foo",
Namespace: "default",
}
created = &SqlDatabase{
created = &AzureSqlDatabase{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: "default",
},
Spec: SqlDatabaseSpec{
Spec: AzureSqlDatabaseSpec{
Location: "westus",
ResourceGroup: "foo-resourcegroup",
Server: "sqlsrvsample",
Expand All @@ -68,7 +68,7 @@ var _ = Describe("SqlDatabase", func() {
By("creating an API obj")
Expect(k8sClient.Create(context.TODO(), created)).To(Succeed())

fetched = &SqlDatabase{}
fetched = &AzureSqlDatabase{}
Expect(k8sClient.Get(context.TODO(), key, fetched)).To(Succeed())
Expect(fetched).To(Equal(created))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
// 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.

// SqlFirewallRuleSpec defines the desired state of SqlFirewallRule
type SqlFirewallRuleSpec struct {
// AzureSqlFirewallRuleSpec defines the desired state of AzureSqlFirewallRule
type AzureSqlFirewallRuleSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
ResourceGroup string `json:"resourcegroup,omitempty"`
Expand All @@ -32,8 +32,8 @@ type SqlFirewallRuleSpec struct {
EndIPAddress string `json:"endipaddress,omitempty"`
}

// SqlFirewallRuleStatus defines the observed state of SqlFirewallRule
type SqlFirewallRuleStatus struct {
// AzureSqlFirewallRuleStatus defines the observed state of AzureSqlFirewallRule
type AzureSqlFirewallRuleStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Provisioning bool `json:"provisioning,omitempty"`
Expand All @@ -42,28 +42,28 @@ type SqlFirewallRuleStatus struct {

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// SqlFirewallRule is the Schema for the sqlfirewallrules API
type SqlFirewallRule struct {
// AzureSqlFirewallRule is the Schema for the azuresqlfirewallrules API
type AzureSqlFirewallRule struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec SqlFirewallRuleSpec `json:"spec,omitempty"`
Status SqlFirewallRuleStatus `json:"status,omitempty"`
Spec AzureSqlFirewallRuleSpec `json:"spec,omitempty"`
Status AzureSqlFirewallRuleStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// SqlFirewallRuleList contains a list of SqlFirewallRule
type SqlFirewallRuleList struct {
// AzureSqlFirewallRuleList contains a list of AzureSqlFirewallRule
type AzureSqlFirewallRuleList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []SqlFirewallRule `json:"items"`
Items []AzureSqlFirewallRule `json:"items"`
}

func init() {
SchemeBuilder.Register(&SqlFirewallRule{}, &SqlFirewallRuleList{})
SchemeBuilder.Register(&AzureSqlFirewallRule{}, &AzureSqlFirewallRuleList{})
}

func (s *SqlFirewallRule) IsSubmitted() bool {
func (s *AzureSqlFirewallRule) IsSubmitted() bool {
return s.Status.Provisioning || s.Status.Provisioned
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ import (
// 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.

// SqlServerSpec defines the desired state of SqlServer
type SqlServerSpec struct {
// AzureSqlServerSpec defines the desired state of AzureSqlServer
type AzureSqlServerSpec 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,omitempty"`
}

// SqlServerStatus defines the observed state of SqlServer
type SqlServerStatus struct {
// AzureSqlServerStatus defines the observed state of AzureSqlServer
type AzureSqlServerStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Provisioning bool `json:"provisioning,omitempty"`
Expand All @@ -42,32 +42,32 @@ type SqlServerStatus struct {

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// SqlServer is the Schema for the sqlservers API
type SqlServer struct {
// AzureSqlServer is the Schema for the azuresqlservers API
type AzureSqlServer struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec SqlServerSpec `json:"spec,omitempty"`
Status SqlServerStatus `json:"status,omitempty"`
Spec AzureSqlServerSpec `json:"spec,omitempty"`
Status AzureSqlServerStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// SqlServerList contains a list of SqlServer
type SqlServerList struct {
// AzureSqlServerList contains a list of AzureSqlServer
type AzureSqlServerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []SqlServer `json:"items"`
Items []AzureSqlServer `json:"items"`
}

func init() {
SchemeBuilder.Register(&SqlServer{}, &SqlServerList{})
SchemeBuilder.Register(&AzureSqlServer{}, &AzureSqlServerList{})
}

func (s *SqlServer) IsSubmitted() bool {
func (s *AzureSqlServer) IsSubmitted() bool {
return s.Status.Provisioned || s.Status.Provisioning
}

func (s *SqlServer) IsProvisioned() bool {
func (s *AzureSqlServer) IsProvisioned() bool {
return s.Status.Provisioned
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import (
// These tests are written in BDD-style using Ginkgo framework. Refer to
// http://onsi.github.io/ginkgo to learn more.

var _ = Describe("SqlServer", func() {
var _ = Describe("AzureSqlServer", func() {
var (
key types.NamespacedName
created, fetched *SqlServer
created, fetched *AzureSqlServer
)

BeforeEach(func() {
Expand All @@ -53,20 +53,20 @@ var _ = Describe("SqlServer", func() {
Name: "foo",
Namespace: "default",
}
created = &SqlServer{
created = &AzureSqlServer{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: "default",
},
Spec: SqlServerSpec{
Spec: AzureSqlServerSpec{
Location: "westus",
ResourceGroup: "foo-resourcegroup",
}}

By("creating an API obj")
Expect(k8sClient.Create(context.TODO(), created)).To(Succeed())

fetched = &SqlServer{}
fetched = &AzureSqlServer{}
Expect(k8sClient.Get(context.TODO(), key, fetched)).To(Succeed())
Expect(fetched).To(Equal(created))

Expand Down
24 changes: 12 additions & 12 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ resources:
- bases/azure.microsoft.com_eventhubnamespaces.yaml
- bases/azure.microsoft.com_consumergroups.yaml
- bases/azure.microsoft.com_keyvaults.yaml
- bases/azure.microsoft.com_sqlservers.yaml
- bases/azure.microsoft.com_sqldatabases.yaml
- bases/azure.microsoft.com_sqlfirewallrules.yaml
- bases/azure.microsoft.com_sqlactions.yaml
- bases/azure.microsoft.com_azuresqlservers.yaml
- bases/azure.microsoft.com_azuresqldatabases.yaml
- bases/azure.microsoft.com_azuresqlfirewallrules.yaml
- bases/azure.microsoft.com_azuresqlactions.yaml
# +kubebuilder:scaffold:crdkustomizeresource

patches:
Expand All @@ -23,10 +23,10 @@ patches:
#- patches/webhook_in_eventhubnamespaces.yaml
#- patches/webhook_in_consumergroups.yaml
#- patches/webhook_in_keyvaults.yaml
#- patches/webhook_in_sqlservers.yaml
#- patches/webhook_in_sqldatabases.yaml
#- patches/webhook_in_sqlfirewallrules.yaml
#- patches/webhook_in_sqlactions.yaml
#- patches/webhook_in_azuresqlservers.yaml
#- patches/webhook_in_azuresqldatabases.yaml
#- patches/webhook_in_azuresqlfirewallrules.yaml
#- patches/webhook_in_azuresqlactions.yaml
# +kubebuilder:scaffold:crdkustomizewebhookpatch

# [CAINJECTION] patches here are for enabling the CA injection for each CRD
Expand All @@ -35,10 +35,10 @@ patches:
#- patches/cainjection_in_eventhubnamespaces.yaml
#- patches/cainjection_in_consumergroups.yaml
#- patches/cainjection_in_keyvaults.yaml
#- patches/cainjection_in_sqlservers.yaml
#- patches/cainjection_in_sqldatabases.yaml
#- patches/cainjection_in_sqlfirewallrules.yaml
#- patches/cainjection_in_sqlactions.yaml
#- patches/cainjection_in_azuresqlservers.yaml
#- patches/cainjection_in_azuresqldatabases.yaml
#- patches/cainjection_in_azuresqlfirewallrules.yaml
#- patches/cainjection_in_azuresqlactions.yaml
# +kubebuilder:scaffold:crdkustomizecainjectionpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ kind: CustomResourceDefinition
metadata:
annotations:
certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
name: sqlactions.azure.microsoft.com
name: azuresqlactions.azure.microsoft.com
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ kind: CustomResourceDefinition
metadata:
annotations:
certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
name: sqlfirewallrules.azure.microsoft.com
name: azuresqldatabases.azure.microsoft.com
Loading

0 comments on commit 2da53fd

Please sign in to comment.