diff --git a/Makefile b/Makefile index 660ff399a18..a8cb0fd7b8b 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,18 @@ CRD_OPTIONS ?= "crd:trivialVersions=true" all: manager +# Generate test certs for development +generate-test-certs: + echo "[req]" > config.txt + echo "distinguished_name = req_distinguished_name" >> config.txt + echo "[req_distinguished_name]" >> config.txt + echo "[SAN]" >> config.txt + echo "subjectAltName=DNS:azureoperator-webhook-service.azureoperator-system.svc.cluster.local" >> config.txt + openssl req -x509 -days 730 -out tls.crt -keyout tls.key -newkey rsa:4096 -subj "/CN=azureoperator-webhook-service.azureoperator-system" -config config.txt -nodes + rm -rf /tmp/k8s-webhook-server + mkdir -p /tmp/k8s-webhook-server/serving-certs + mv tls.* /tmp/k8s-webhook-server/serving-certs/ + # Run API unittests api-test: generate fmt vet manifests TEST_USE_EXISTING_CLUSTER=false go test -v -coverprofile=coverage.txt -covermode count ./api/... 2>&1 | tee testlogs.txt diff --git a/PROJECT b/PROJECT index d85f8f6b0fd..56e319e160e 100644 --- a/PROJECT +++ b/PROJECT @@ -3,35 +3,35 @@ domain: microsoft.com repo: github.com/Azure/azure-service-operator resources: - group: azure - version: v1alpha1 + version: v1 kind: Storage - group: azure - version: v1alpha1 + version: v1 kind: CosmosDB - group: azure - version: v1alpha1 + version: v1 kind: RedisCache - group: azure - version: v1alpha1 + version: v1 kind: Eventhub - group: azure - version: v1alpha1 + version: v1 kind: ResourceGroup - group: azure - version: v1alpha1 + version: v1 kind: EventhubNamespace - group: azure - version: v1alpha1 + version: v1 kind: SqlServer - group: azure - version: v1alpha1 + version: v1 kind: SqlDatabase - group: azure - version: v1alpha1 + version: v1 kind: SqlFirewallRule - group: azure - version: v1alpha1 + version: v1 kind: KeyVault - group: azure - version: v1alpha1 + version: v1 kind: ConsumerGroup diff --git a/api/v1alpha1/consumergroup_types.go b/api/v1/consumergroup_types.go similarity index 99% rename from api/v1alpha1/consumergroup_types.go rename to api/v1/consumergroup_types.go index 9d93ead5478..d7dd1c5de99 100644 --- a/api/v1alpha1/consumergroup_types.go +++ b/api/v1/consumergroup_types.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( helpers "github.com/Azure/azure-service-operator/pkg/helpers" diff --git a/api/v1alpha1/consumergroup_types_test.go b/api/v1/consumergroup_types_test.go similarity index 99% rename from api/v1alpha1/consumergroup_types_test.go rename to api/v1/consumergroup_types_test.go index 9940afd85fa..6d326e40322 100644 --- a/api/v1alpha1/consumergroup_types_test.go +++ b/api/v1/consumergroup_types_test.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( . "github.com/onsi/ginkgo" diff --git a/api/v1alpha1/cosmosdb_types.go b/api/v1/cosmosdb_types.go similarity index 99% rename from api/v1alpha1/cosmosdb_types.go rename to api/v1/cosmosdb_types.go index cc745e62085..292e54e3529 100644 --- a/api/v1alpha1/cosmosdb_types.go +++ b/api/v1/cosmosdb_types.go @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE */ -package v1alpha1 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/api/v1alpha1/eventhub_types.go b/api/v1/eventhub_types.go similarity index 99% rename from api/v1alpha1/eventhub_types.go rename to api/v1/eventhub_types.go index 5b3429ca170..45cc87fb822 100644 --- a/api/v1alpha1/eventhub_types.go +++ b/api/v1/eventhub_types.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( helpers "github.com/Azure/azure-service-operator/pkg/helpers" diff --git a/api/v1alpha1/eventhub_types_test.go b/api/v1/eventhub_types_test.go similarity index 99% rename from api/v1alpha1/eventhub_types_test.go rename to api/v1/eventhub_types_test.go index b833e7b19c8..09db200b33b 100644 --- a/api/v1alpha1/eventhub_types_test.go +++ b/api/v1/eventhub_types_test.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( . "github.com/onsi/ginkgo" diff --git a/api/v1alpha1/eventhub_webhook.go b/api/v1/eventhub_webhook.go similarity index 99% rename from api/v1alpha1/eventhub_webhook.go rename to api/v1/eventhub_webhook.go index 09345b76500..363ea839e10 100644 --- a/api/v1alpha1/eventhub_webhook.go +++ b/api/v1/eventhub_webhook.go @@ -1,4 +1,4 @@ -package v1alpha1 +package v1 import ( eventhubsmanager "github.com/Azure/azure-service-operator/pkg/resourcemanager/eventhubs" diff --git a/api/v1alpha1/eventhubnamespace_types.go b/api/v1/eventhubnamespace_types.go similarity index 99% rename from api/v1alpha1/eventhubnamespace_types.go rename to api/v1/eventhubnamespace_types.go index 9b16720cfb0..3ebc7db3e31 100644 --- a/api/v1alpha1/eventhubnamespace_types.go +++ b/api/v1/eventhubnamespace_types.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( helpers "github.com/Azure/azure-service-operator/pkg/helpers" diff --git a/api/v1alpha1/eventhubnamespace_types_test.go b/api/v1/eventhubnamespace_types_test.go similarity index 99% rename from api/v1alpha1/eventhubnamespace_types_test.go rename to api/v1/eventhubnamespace_types_test.go index cabe587ce8a..b69871198d9 100644 --- a/api/v1alpha1/eventhubnamespace_types_test.go +++ b/api/v1/eventhubnamespace_types_test.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( . "github.com/onsi/ginkgo" diff --git a/api/v1alpha1/eventhubnamespace_webhook.go b/api/v1/eventhubnamespace_webhook.go similarity index 99% rename from api/v1alpha1/eventhubnamespace_webhook.go rename to api/v1/eventhubnamespace_webhook.go index e9c99bc21a9..2fce158ca06 100644 --- a/api/v1alpha1/eventhubnamespace_webhook.go +++ b/api/v1/eventhubnamespace_webhook.go @@ -1,4 +1,4 @@ -package v1alpha1 +package v1 import ( resoucegroupsresourcemanager "github.com/Azure/azure-service-operator/pkg/resourcemanager/resourcegroups" diff --git a/api/v1alpha1/groupversion_info.go b/api/v1/groupversion_info.go similarity index 89% rename from api/v1alpha1/groupversion_info.go rename to api/v1/groupversion_info.go index 29c6dc9997f..39a37cfc9c4 100644 --- a/api/v1alpha1/groupversion_info.go +++ b/api/v1/groupversion_info.go @@ -13,10 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package v1alpha1 contains API Schema definitions for the azure v1alpha1 API group +// Package v1 contains API Schema definitions for the azure v1 API group // +kubebuilder:object:generate=true // +groupName=azure.microsoft.com -package v1alpha1 +package v1 import ( "k8s.io/apimachinery/pkg/runtime/schema" @@ -25,7 +25,7 @@ import ( var ( // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "azure.microsoft.com", Version: "v1alpha1"} + GroupVersion = schema.GroupVersion{Group: "azure.microsoft.com", Version: "v1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} diff --git a/api/v1alpha1/keyvault_types.go b/api/v1/keyvault_types.go similarity index 99% rename from api/v1alpha1/keyvault_types.go rename to api/v1/keyvault_types.go index 74956394274..c671ab60ee1 100644 --- a/api/v1alpha1/keyvault_types.go +++ b/api/v1/keyvault_types.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/api/v1alpha1/rediscache_types.go b/api/v1/rediscache_types.go similarity index 99% rename from api/v1alpha1/rediscache_types.go rename to api/v1/rediscache_types.go index cca75ded42c..826d42ed068 100644 --- a/api/v1alpha1/rediscache_types.go +++ b/api/v1/rediscache_types.go @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE */ -package v1alpha1 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/api/v1alpha1/resourcegroup_types.go b/api/v1/resourcegroup_types.go similarity index 99% rename from api/v1alpha1/resourcegroup_types.go rename to api/v1/resourcegroup_types.go index caf0b3c94e4..02b93849435 100644 --- a/api/v1alpha1/resourcegroup_types.go +++ b/api/v1/resourcegroup_types.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( helpers "github.com/Azure/azure-service-operator/pkg/helpers" diff --git a/api/v1alpha1/resourcegroup_types_test.go b/api/v1/resourcegroup_types_test.go similarity index 99% rename from api/v1alpha1/resourcegroup_types_test.go rename to api/v1/resourcegroup_types_test.go index d7b0ed638b7..931cb9113c9 100644 --- a/api/v1alpha1/resourcegroup_types_test.go +++ b/api/v1/resourcegroup_types_test.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( . "github.com/onsi/ginkgo" diff --git a/api/v1alpha1/sqldatabase_types.go b/api/v1/sqldatabase_types.go similarity index 99% rename from api/v1alpha1/sqldatabase_types.go rename to api/v1/sqldatabase_types.go index d890a8b1f4a..19ce0cdaf88 100644 --- a/api/v1alpha1/sqldatabase_types.go +++ b/api/v1/sqldatabase_types.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( sql "github.com/Azure/azure-service-operator/pkg/resourcemanager/sqlclient" diff --git a/api/v1alpha1/sqldatabase_types_test.go b/api/v1/sqldatabase_types_test.go similarity index 99% rename from api/v1alpha1/sqldatabase_types_test.go rename to api/v1/sqldatabase_types_test.go index bb6fa20690c..ea7b9c1308d 100644 --- a/api/v1alpha1/sqldatabase_types_test.go +++ b/api/v1/sqldatabase_types_test.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( . "github.com/onsi/ginkgo" diff --git a/api/v1alpha1/sqlfirewallrule_types.go b/api/v1/sqlfirewallrule_types.go similarity index 99% rename from api/v1alpha1/sqlfirewallrule_types.go rename to api/v1/sqlfirewallrule_types.go index e9999b5bf45..2828d8f4b22 100644 --- a/api/v1alpha1/sqlfirewallrule_types.go +++ b/api/v1/sqlfirewallrule_types.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/api/v1alpha1/sqlserver_types.go b/api/v1/sqlserver_types.go similarity index 91% rename from api/v1alpha1/sqlserver_types.go rename to api/v1/sqlserver_types.go index d45bf34e1b7..8747d004ce7 100644 --- a/api/v1alpha1/sqlserver_types.go +++ b/api/v1/sqlserver_types.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -26,8 +26,9 @@ import ( type SqlServerSpec 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"` + Location string `json:"location"` + ResourceGroup string `json:"resourcegroup,omitempty"` + AllowAzureServiceAccess bool `json:"allowazureserviceaccess,omitempty"` } // SqlServerStatus defines the observed state of SqlServer diff --git a/api/v1alpha1/sqlserver_types_test.go b/api/v1/sqlserver_types_test.go similarity index 93% rename from api/v1alpha1/sqlserver_types_test.go rename to api/v1/sqlserver_types_test.go index e6dfcbcda7d..6c4a257cf6e 100644 --- a/api/v1alpha1/sqlserver_types_test.go +++ b/api/v1/sqlserver_types_test.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( . "github.com/onsi/ginkgo" @@ -59,8 +59,9 @@ var _ = Describe("SqlServer", func() { Namespace: "default", }, Spec: SqlServerSpec{ - Location: "westus", - ResourceGroup: "foo-resourcegroup", + Location: "westus", + ResourceGroup: "foo-resourcegroup", + AllowAzureServiceAccess: true, }} By("creating an API obj") diff --git a/api/v1alpha1/storage_types.go b/api/v1/storage_types.go similarity index 99% rename from api/v1alpha1/storage_types.go rename to api/v1/storage_types.go index 5346f06f9a1..4a32f9f737b 100644 --- a/api/v1alpha1/storage_types.go +++ b/api/v1/storage_types.go @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE */ -package v1alpha1 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/api/v1alpha1/suite_test.go b/api/v1/suite_test.go similarity index 99% rename from api/v1alpha1/suite_test.go rename to api/v1/suite_test.go index 07e12954bc2..61223b29b96 100644 --- a/api/v1alpha1/suite_test.go +++ b/api/v1/suite_test.go @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( "path/filepath" diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go similarity index 99% rename from api/v1alpha1/zz_generated.deepcopy.go rename to api/v1/zz_generated.deepcopy.go index 5d9e128930a..203e7b8e13b 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -17,7 +17,7 @@ limitations under the License. // autogenerated by controller-gen object, do not modify manually -package v1alpha1 +package v1 import ( "k8s.io/apimachinery/pkg/runtime" diff --git a/config/crd/bases/azure.microsoft.com_consumergroups.yaml b/config/crd/bases/azure.microsoft.com_consumergroups.yaml index d05a7bd0021..8d00e1f0cd1 100644 --- a/config/crd/bases/azure.microsoft.com_consumergroups.yaml +++ b/config/crd/bases/azure.microsoft.com_consumergroups.yaml @@ -421,7 +421,7 @@ spec: type: object type: object versions: - - name: v1alpha1 + - name: v1 served: true storage: true status: diff --git a/config/crd/bases/azure.microsoft.com_cosmosdbs.yaml b/config/crd/bases/azure.microsoft.com_cosmosdbs.yaml index 80e52edfd7c..ed4c39e607a 100644 --- a/config/crd/bases/azure.microsoft.com_cosmosdbs.yaml +++ b/config/crd/bases/azure.microsoft.com_cosmosdbs.yaml @@ -454,7 +454,7 @@ spec: type: object type: object versions: - - name: v1alpha1 + - name: v1 served: true storage: true status: diff --git a/config/crd/bases/azure.microsoft.com_eventhubnamespaces.yaml b/config/crd/bases/azure.microsoft.com_eventhubnamespaces.yaml index ba065330c19..346ff0b08cf 100644 --- a/config/crd/bases/azure.microsoft.com_eventhubnamespaces.yaml +++ b/config/crd/bases/azure.microsoft.com_eventhubnamespaces.yaml @@ -443,7 +443,7 @@ spec: type: object type: object versions: - - name: v1alpha1 + - name: v1 served: true storage: true status: diff --git a/config/crd/bases/azure.microsoft.com_eventhubs.yaml b/config/crd/bases/azure.microsoft.com_eventhubs.yaml index 039b2257b1a..c32d7775287 100644 --- a/config/crd/bases/azure.microsoft.com_eventhubs.yaml +++ b/config/crd/bases/azure.microsoft.com_eventhubs.yaml @@ -519,7 +519,7 @@ spec: type: object type: object versions: - - name: v1alpha1 + - name: v1 served: true storage: true status: diff --git a/config/crd/bases/azure.microsoft.com_keyvaults.yaml b/config/crd/bases/azure.microsoft.com_keyvaults.yaml index 81124aaf9aa..15646f3d192 100644 --- a/config/crd/bases/azure.microsoft.com_keyvaults.yaml +++ b/config/crd/bases/azure.microsoft.com_keyvaults.yaml @@ -419,7 +419,7 @@ spec: type: object type: object versions: - - name: v1alpha1 + - name: v1 served: true storage: true status: diff --git a/config/crd/bases/azure.microsoft.com_rediscaches.yaml b/config/crd/bases/azure.microsoft.com_rediscaches.yaml index bb7c8ca986d..ede9cc107fa 100644 --- a/config/crd/bases/azure.microsoft.com_rediscaches.yaml +++ b/config/crd/bases/azure.microsoft.com_rediscaches.yaml @@ -459,7 +459,7 @@ spec: type: object type: object versions: - - name: v1alpha1 + - name: v1 served: true storage: true status: diff --git a/config/crd/bases/azure.microsoft.com_resourcegroups.yaml b/config/crd/bases/azure.microsoft.com_resourcegroups.yaml index 70d0ebcd56a..34ed824ad8f 100644 --- a/config/crd/bases/azure.microsoft.com_resourcegroups.yaml +++ b/config/crd/bases/azure.microsoft.com_resourcegroups.yaml @@ -421,7 +421,7 @@ spec: type: object type: object versions: - - name: v1alpha1 + - name: v1 served: true storage: true status: diff --git a/config/crd/bases/azure.microsoft.com_sqldatabases.yaml b/config/crd/bases/azure.microsoft.com_sqldatabases.yaml index 6512315c6cb..5b0408a8169 100644 --- a/config/crd/bases/azure.microsoft.com_sqldatabases.yaml +++ b/config/crd/bases/azure.microsoft.com_sqldatabases.yaml @@ -430,7 +430,7 @@ spec: type: object type: object versions: - - name: v1alpha1 + - name: v1 served: true storage: true status: diff --git a/config/crd/bases/azure.microsoft.com_sqlfirewallrules.yaml b/config/crd/bases/azure.microsoft.com_sqlfirewallrules.yaml index 3e89a3c96d4..64463bcb3da 100644 --- a/config/crd/bases/azure.microsoft.com_sqlfirewallrules.yaml +++ b/config/crd/bases/azure.microsoft.com_sqlfirewallrules.yaml @@ -403,14 +403,16 @@ spec: properties: endipaddress: type: string - server: + location: description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run "make" to regenerate code after modifying this file' type: string + resourcegroup: + type: string startipaddress: type: string required: - - server + - location type: object status: description: SqlFirewallRuleStatus defines the observed state of SqlFirewallRule @@ -425,7 +427,7 @@ spec: type: object type: object versions: - - name: v1alpha1 + - name: v1 served: true storage: true status: diff --git a/config/crd/bases/azure.microsoft.com_sqlservers.yaml b/config/crd/bases/azure.microsoft.com_sqlservers.yaml index 1409674b2ad..aabf1fe9115 100644 --- a/config/crd/bases/azure.microsoft.com_sqlservers.yaml +++ b/config/crd/bases/azure.microsoft.com_sqlservers.yaml @@ -427,7 +427,7 @@ spec: type: object type: object versions: - - name: v1alpha1 + - name: v1 served: true storage: true status: diff --git a/config/crd/bases/azure.microsoft.com_storages.yaml b/config/crd/bases/azure.microsoft.com_storages.yaml index 0cf9afea732..36bd1ce2c1f 100644 --- a/config/crd/bases/azure.microsoft.com_storages.yaml +++ b/config/crd/bases/azure.microsoft.com_storages.yaml @@ -482,7 +482,7 @@ spec: type: object type: object versions: - - name: v1alpha1 + - name: v1 served: true storage: true status: diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index d21ebbd2867..11a2c57bdaf 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -9,15 +9,7 @@ rules: - apiGroups: - azure.microsoft.com resources: - - consumergroups/status - verbs: - - get - - patch - - update -- apiGroups: - - azure.microsoft.com - resources: - - eventhubs + - cosmosdbs verbs: - create - delete @@ -37,7 +29,7 @@ rules: - apiGroups: - azure.microsoft.com resources: - - eventhubs/status + - keyvaults/status verbs: - get - patch @@ -45,7 +37,7 @@ rules: - apiGroups: - azure.microsoft.com resources: - - keyvaults/status + - resourcegroups/status verbs: - get - patch @@ -53,39 +45,30 @@ rules: - apiGroups: - azure.microsoft.com resources: - - sqldatabases + - sqldatabases/status verbs: - - create - - delete - get - - list - patch - update - - watch - apiGroups: - - azure.microsoft.com + - "" resources: - - storages/status + - events verbs: - - get - - patch - - update + - create + - watch - apiGroups: - - apps + - azure.microsoft.com resources: - - deployments + - rediscaches/status verbs: - - create - - delete - get - - list - patch - update - - watch - apiGroups: - - apps + - azure.microsoft.com resources: - - deployments/status + - consumergroups/status verbs: - get - patch @@ -93,7 +76,7 @@ rules: - apiGroups: - azure.microsoft.com resources: - - rediscaches + - eventhubs verbs: - create - delete @@ -105,30 +88,31 @@ rules: - apiGroups: - azure.microsoft.com resources: - - rediscaches/status + - eventhubnamespaces verbs: + - create + - delete - get + - list - patch - update + - watch - apiGroups: - azure.microsoft.com resources: - - sqlservers/status + - keyvaults verbs: + - create + - delete - get + - list - patch - update -- apiGroups: - - "" - resources: - - events - verbs: - - create - watch - apiGroups: - azure.microsoft.com resources: - - storages + - sqlfirewallrules verbs: - create - delete @@ -148,7 +132,7 @@ rules: - apiGroups: - azure.microsoft.com resources: - - consumergroups + - storages verbs: - create - delete @@ -160,19 +144,23 @@ rules: - apiGroups: - azure.microsoft.com resources: - - cosmosdbs + - sqlservers/status + verbs: + - get + - patch + - update +- apiGroups: + - apps + resources: + - deployments/status verbs: - - create - - delete - get - - list - patch - update - - watch - apiGroups: - azure.microsoft.com resources: - - eventhubnamespaces + - consumergroups verbs: - create - delete @@ -184,7 +172,7 @@ rules: - apiGroups: - azure.microsoft.com resources: - - keyvaults + - sqlservers verbs: - create - delete @@ -196,14 +184,15 @@ rules: - apiGroups: - azure.microsoft.com resources: - - events + - storages/status verbs: - - create + - get - patch + - update - apiGroups: - - azure.microsoft.com + - "" resources: - - resourcegroups + - secrets verbs: - create - delete @@ -215,15 +204,14 @@ rules: - apiGroups: - azure.microsoft.com resources: - - resourcegroups/status + - events verbs: - - get + - create - patch - - update - apiGroups: - azure.microsoft.com resources: - - sqldatabases/status + - eventhubs/status verbs: - get - patch @@ -231,7 +219,7 @@ rules: - apiGroups: - azure.microsoft.com resources: - - sqlfirewallrules + - rediscaches verbs: - create - delete @@ -243,7 +231,7 @@ rules: - apiGroups: - azure.microsoft.com resources: - - sqlservers + - sqldatabases verbs: - create - delete @@ -253,9 +241,9 @@ rules: - update - watch - apiGroups: - - "" + - apps resources: - - secrets + - deployments verbs: - create - delete @@ -272,3 +260,15 @@ rules: - get - patch - update +- apiGroups: + - azure.microsoft.com + resources: + - resourcegroups + verbs: + - create + - delete + - get + - list + - patch + - update + - watch diff --git a/config/samples/azure_v1alpha1_consumergroup.yaml b/config/samples/azure_v1_consumergroup.yaml similarity index 83% rename from config/samples/azure_v1alpha1_consumergroup.yaml rename to config/samples/azure_v1_consumergroup.yaml index 6a3e7e93e35..076bf32c357 100644 --- a/config/samples/azure_v1alpha1_consumergroup.yaml +++ b/config/samples/azure_v1_consumergroup.yaml @@ -1,4 +1,4 @@ -apiVersion: azure.microsoft.com/v1alpha1 +apiVersion: azure.microsoft.com/v1 kind: ConsumerGroup metadata: name: consumergroup-sample-1 diff --git a/config/samples/azure_v1alpha1_cosmosdb.yaml b/config/samples/azure_v1_cosmosdb.yaml similarity index 83% rename from config/samples/azure_v1alpha1_cosmosdb.yaml rename to config/samples/azure_v1_cosmosdb.yaml index 6578a255cb6..0741c205517 100644 --- a/config/samples/azure_v1alpha1_cosmosdb.yaml +++ b/config/samples/azure_v1_cosmosdb.yaml @@ -1,4 +1,4 @@ -apiVersion: azure.microsoft.com/v1alpha1 +apiVersion: azure.microsoft.com/v1 kind: CosmosDB metadata: name: cosmosdb-sample1908xyzkj diff --git a/config/samples/azure_v1_eventhub.yaml b/config/samples/azure_v1_eventhub.yaml new file mode 100644 index 00000000000..5c57b014ab1 --- /dev/null +++ b/config/samples/azure_v1_eventhub.yaml @@ -0,0 +1,18 @@ +apiVersion: azure.microsoft.com/v1 +kind: Eventhub +metadata: + name: eventhub-sample-2307-09 +spec: + location: "westus" + resourceGroup: "resourcegroup-sample-1907" + namespace: "eventhubnamespace-sample-6" + properties: + messageRetentionInDays: 7 + partitionCount: 2 + authorizationRule: + name : "RootManageSharedAccessKey" + rights: + - "Listen" + - "Manage" + - "Send" + secretname: "secret-stream-eventhub-sample" diff --git a/config/samples/azure_v1alpha1_eventhub_capture.yaml b/config/samples/azure_v1_eventhub_capture.yaml similarity index 95% rename from config/samples/azure_v1alpha1_eventhub_capture.yaml rename to config/samples/azure_v1_eventhub_capture.yaml index bc0901f2a82..a074c643e2e 100644 --- a/config/samples/azure_v1alpha1_eventhub_capture.yaml +++ b/config/samples/azure_v1_eventhub_capture.yaml @@ -1,4 +1,4 @@ -apiVersion: azure.microsoft.com/v1alpha1 +apiVersion: azure.microsoft.com/v1 kind: Eventhub metadata: name: eventhub-sample-2307-10-capture diff --git a/config/samples/azure_v1_eventhubnamespace.yaml b/config/samples/azure_v1_eventhubnamespace.yaml new file mode 100644 index 00000000000..83b61d10c53 --- /dev/null +++ b/config/samples/azure_v1_eventhubnamespace.yaml @@ -0,0 +1,15 @@ +apiVersion: azure.microsoft.com/v1 +kind: EventhubNamespace +metadata: + name: eventhubnamespace-sample-6 +spec: + location: "westus" + resourceGroup: "resourcegroup-sample-1907" + sku: + name: "Standard" + tier: "Standard" + capacity: 1 + properties: + isAutoInflateEnabled: false + maximumThroughputUnits: 0 + kafkaEnabled: false diff --git a/config/samples/azure_v1_keyvault.yaml b/config/samples/azure_v1_keyvault.yaml new file mode 100644 index 00000000000..d8c31d4d289 --- /dev/null +++ b/config/samples/azure_v1_keyvault.yaml @@ -0,0 +1,7 @@ +apiVersion: azure.microsoft.com/v1 +kind: KeyVault +metadata: + name: keyvaultsample123 +spec: + resourceGroup: resourcegroup-sample-6 + location: westus diff --git a/config/samples/azure_v1alpha1_rediscache.yaml b/config/samples/azure_v1_rediscache.yaml similarity index 84% rename from config/samples/azure_v1alpha1_rediscache.yaml rename to config/samples/azure_v1_rediscache.yaml index c328889cd0d..a78959b3dfd 100644 --- a/config/samples/azure_v1alpha1_rediscache.yaml +++ b/config/samples/azure_v1_rediscache.yaml @@ -1,4 +1,4 @@ -apiVersion: azure.microsoft.com/v1alpha1 +apiVersion: azure.microsoft.com/v1 kind: RedisCache metadata: name: rediscache-sample1908xyzkj diff --git a/config/samples/azure_v1_resourcegroup.yaml b/config/samples/azure_v1_resourcegroup.yaml new file mode 100644 index 00000000000..fe67d8499f0 --- /dev/null +++ b/config/samples/azure_v1_resourcegroup.yaml @@ -0,0 +1,6 @@ +apiVersion: azure.microsoft.com/v1 +kind: ResourceGroup +metadata: + name: resourcegroup-sample-1907 +spec: + location: "westus" diff --git a/config/samples/azure_v1_sqldatabase.yaml b/config/samples/azure_v1_sqldatabase.yaml new file mode 100644 index 00000000000..960d6f7b712 --- /dev/null +++ b/config/samples/azure_v1_sqldatabase.yaml @@ -0,0 +1,9 @@ +apiVersion: azure.microsoft.com/v1 +kind: SqlDatabase +metadata: + name: sqldatabase-sample +spec: + location: westus + resourcegroup: resourcegroup-sample-1907 + edition: 0 + server: sqlserver-sample diff --git a/config/samples/azure_v1alpha1_sqlfirewallrule.yaml b/config/samples/azure_v1_sqlfirewallrule.yaml similarity index 62% rename from config/samples/azure_v1alpha1_sqlfirewallrule.yaml rename to config/samples/azure_v1_sqlfirewallrule.yaml index 8b926bb409a..c8587326db4 100644 --- a/config/samples/azure_v1alpha1_sqlfirewallrule.yaml +++ b/config/samples/azure_v1_sqlfirewallrule.yaml @@ -1,8 +1,8 @@ -apiVersion: azure.microsoft.com/v1alpha1 +apiVersion: azure.microsoft.com/v1 kind: SqlFirewallRule metadata: name: sqlfirewallrule-sample spec: - server: sqlserver-sample987 + server: sqlserver-sample startipaddress: 1.1.1.1 endipaddress: 6.6.6.6 diff --git a/config/samples/azure_v1_sqlserver.yaml b/config/samples/azure_v1_sqlserver.yaml new file mode 100644 index 00000000000..9da047d5282 --- /dev/null +++ b/config/samples/azure_v1_sqlserver.yaml @@ -0,0 +1,8 @@ +apiVersion: azure.microsoft.com/v1 +kind: SqlServer +metadata: + name: sqlserver-sample +spec: + location: "westus" + resourcegroup: "resourcegroup-sample-1907" + allowazureserviceaccess: true diff --git a/config/samples/azure_v1alpha1_storage.yaml b/config/samples/azure_v1_storage.yaml similarity index 84% rename from config/samples/azure_v1alpha1_storage.yaml rename to config/samples/azure_v1_storage.yaml index 0edbf6e9df5..88a1d9c1671 100644 --- a/config/samples/azure_v1alpha1_storage.yaml +++ b/config/samples/azure_v1_storage.yaml @@ -1,4 +1,4 @@ -apiVersion: azure.microsoft.com/v1alpha1 +apiVersion: azure.microsoft.com/v1 kind: Storage metadata: name: storagesample1908xyzkj diff --git a/config/samples/azure_v1alpha1_sqldatabase.yaml b/config/samples/azure_v1alpha1_sqldatabase.yaml deleted file mode 100644 index d7e44e1fb21..00000000000 --- a/config/samples/azure_v1alpha1_sqldatabase.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: azure.microsoft.com/v1alpha1 -kind: SqlDatabase -metadata: - name: sqldatabase-sample -spec: - location: westus - resourcegroup: Janani-testRG - edition: 0 - server: sqlserver-sample987 diff --git a/config/samples/azure_v1alpha1_sqlserver.yaml b/config/samples/azure_v1alpha1_sqlserver.yaml deleted file mode 100644 index ab4ec7bcc5b..00000000000 --- a/config/samples/azure_v1alpha1_sqlserver.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: azure.microsoft.com/v1alpha1 -kind: SqlServer -metadata: - name: sqlserver-sample987 -spec: - location: "westus" - resourcegroup: "Janani-testRG" diff --git a/controllers/consumergroup_controller.go b/controllers/consumergroup_controller.go index 3d7e895833e..f6988cee06e 100644 --- a/controllers/consumergroup_controller.go +++ b/controllers/consumergroup_controller.go @@ -30,7 +30,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/reconcile" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" eventhubsresourcemanager "github.com/Azure/azure-service-operator/pkg/resourcemanager/eventhubs" ) @@ -49,7 +49,7 @@ func (r *ConsumerGroupReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro ctx := context.Background() log := r.Log.WithValues("consumergroup", req.NamespacedName) - var instance azurev1alpha1.ConsumerGroup + var instance azurev1.ConsumerGroup if err := r.Get(ctx, req.NamespacedName, &instance); err != nil { log.Error(err, "unable to fetch consumergroup") // we'll ignore not-found errors, since they can't be fixed by an immediate @@ -95,11 +95,11 @@ func (r *ConsumerGroupReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro func (r *ConsumerGroupReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&azurev1alpha1.ConsumerGroup{}). + For(&azurev1.ConsumerGroup{}). Complete(r) } -func (r *ConsumerGroupReconciler) createConsumerGroup(instance *azurev1alpha1.ConsumerGroup) error { +func (r *ConsumerGroupReconciler) createConsumerGroup(instance *azurev1.ConsumerGroup) error { ctx := context.Background() var err error @@ -112,7 +112,7 @@ func (r *ConsumerGroupReconciler) createConsumerGroup(instance *azurev1alpha1.Co instance.Status.Provisioning = true //get owner instance - var ownerInstance azurev1alpha1.Eventhub + var ownerInstance azurev1.Eventhub eventhubNamespacedName := types.NamespacedName{Name: eventhubName, Namespace: instance.Namespace} err = r.Get(ctx, eventhubNamespacedName, &ownerInstance) @@ -123,7 +123,7 @@ func (r *ConsumerGroupReconciler) createConsumerGroup(instance *azurev1alpha1.Co //set owner reference for consumer group if it exists references := []metav1.OwnerReference{ metav1.OwnerReference{ - APIVersion: "v1alpha1", + APIVersion: "v1", Kind: "Eventhub", Name: ownerInstance.GetName(), UID: ownerInstance.GetUID(), @@ -166,7 +166,7 @@ func (r *ConsumerGroupReconciler) createConsumerGroup(instance *azurev1alpha1.Co } -func (r *ConsumerGroupReconciler) deleteConsumerGroup(instance *azurev1alpha1.ConsumerGroup) error { +func (r *ConsumerGroupReconciler) deleteConsumerGroup(instance *azurev1.ConsumerGroup) error { ctx := context.Background() consumergroupName := instance.ObjectMeta.Name diff --git a/controllers/consumergroup_controller_finalizer.go b/controllers/consumergroup_controller_finalizer.go index 19f65562ada..99cc3883fd8 100644 --- a/controllers/consumergroup_controller_finalizer.go +++ b/controllers/consumergroup_controller_finalizer.go @@ -20,12 +20,12 @@ import ( "context" "fmt" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" ) const consumerGroupFinalizerName = "consumergroup.finalizers.com" -func (r *ConsumerGroupReconciler) addFinalizer(instance *azurev1alpha1.ConsumerGroup) error { +func (r *ConsumerGroupReconciler) addFinalizer(instance *azurev1.ConsumerGroup) error { instance.AddFinalizer(consumerGroupFinalizerName) err := r.Update(context.Background(), instance) if err != nil { @@ -35,7 +35,7 @@ func (r *ConsumerGroupReconciler) addFinalizer(instance *azurev1alpha1.ConsumerG return nil } -func (r *ConsumerGroupReconciler) handleFinalizer(instance *azurev1alpha1.ConsumerGroup) error { +func (r *ConsumerGroupReconciler) handleFinalizer(instance *azurev1.ConsumerGroup) error { if instance.HasFinalizer(consumerGroupFinalizerName) { // our finalizer is present, so lets handle our external dependency if err := r.deleteExternalDependency(instance); err != nil { @@ -51,7 +51,7 @@ func (r *ConsumerGroupReconciler) handleFinalizer(instance *azurev1alpha1.Consum return nil } -func (r *ConsumerGroupReconciler) deleteExternalDependency(instance *azurev1alpha1.ConsumerGroup) error { +func (r *ConsumerGroupReconciler) deleteExternalDependency(instance *azurev1.ConsumerGroup) error { return r.deleteConsumerGroup(instance) } diff --git a/controllers/consumergroup_controller_test.go b/controllers/consumergroup_controller_test.go index dbf956f7436..2c28c80456e 100644 --- a/controllers/consumergroup_controller_test.go +++ b/controllers/consumergroup_controller_test.go @@ -18,7 +18,7 @@ package controllers import ( "context" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" helpers "github.com/Azure/azure-service-operator/pkg/helpers" "time" @@ -61,12 +61,12 @@ var _ = Describe("ConsumerGroup Controller", func() { var err error // Create the consumer group object and expect the Reconcile to be created - consumerGroupInstance := &azurev1alpha1.ConsumerGroup{ + consumerGroupInstance := &azurev1.ConsumerGroup{ ObjectMeta: metav1.ObjectMeta{ Name: consumerGroupName, Namespace: "default", }, - Spec: azurev1alpha1.ConsumerGroupSpec{ + Spec: azurev1.ConsumerGroupSpec{ NamespaceName: ehnName, ResourceGroupName: rgName, EventhubName: ehName, diff --git a/controllers/cosmosdb_controller.go b/controllers/cosmosdb_controller.go index 9eafeab7dd7..4691d0619df 100644 --- a/controllers/cosmosdb_controller.go +++ b/controllers/cosmosdb_controller.go @@ -35,7 +35,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" "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" @@ -61,7 +61,7 @@ func (r *CosmosDBReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { log := r.Log.WithValues("cosmosdb", req.NamespacedName) // Fetch the CosmosDB instance - var instance azurev1alpha1.CosmosDB + var instance azurev1.CosmosDB requeueAfter, err := strconv.Atoi(os.Getenv("REQUEUE_AFTER")) if err != nil { @@ -118,7 +118,7 @@ func (r *CosmosDBReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { return ctrl.Result{}, nil } -func (r *CosmosDBReconciler) addFinalizer(instance *azurev1alpha1.CosmosDB) error { +func (r *CosmosDBReconciler) addFinalizer(instance *azurev1.CosmosDB) error { helpers.AddFinalizer(instance, cosmosDBFinalizerName) err := r.Update(context.Background(), instance) if err != nil { @@ -128,7 +128,7 @@ func (r *CosmosDBReconciler) addFinalizer(instance *azurev1alpha1.CosmosDB) erro return nil } -func (r *CosmosDBReconciler) reconcileExternal(instance *azurev1alpha1.CosmosDB) error { +func (r *CosmosDBReconciler) reconcileExternal(instance *azurev1.CosmosDB) error { ctx := context.Background() location := instance.Spec.Location name := instance.ObjectMeta.Name @@ -168,7 +168,7 @@ func (r *CosmosDBReconciler) reconcileExternal(instance *azurev1alpha1.CosmosDB) return nil } -func (r *CosmosDBReconciler) deleteExternal(instance *azurev1alpha1.CosmosDB) error { +func (r *CosmosDBReconciler) deleteExternal(instance *azurev1.CosmosDB) error { ctx := context.Background() name := instance.ObjectMeta.Name groupName := instance.Spec.ResourceGroupName @@ -190,7 +190,7 @@ func (r *CosmosDBReconciler) deleteExternal(instance *azurev1alpha1.CosmosDB) er // SetupWithManager sets up the controller functions func (r *CosmosDBReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&azurev1alpha1.CosmosDB{}). + For(&azurev1.CosmosDB{}). Complete(r) } diff --git a/controllers/eventhub_controller.go b/controllers/eventhub_controller.go index 51aedd07c16..9b31540f5ea 100644 --- a/controllers/eventhub_controller.go +++ b/controllers/eventhub_controller.go @@ -24,7 +24,7 @@ import ( "github.com/Azure/go-autorest/autorest/to" model "github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" "github.com/Azure/azure-service-operator/pkg/errhelp" "github.com/Azure/azure-service-operator/pkg/helpers" @@ -61,7 +61,7 @@ func (r *EventhubReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { log := r.Log.WithValues("eventhub", req.NamespacedName) // your logic here - var instance azurev1alpha1.Eventhub + var instance azurev1.Eventhub if err := r.Get(ctx, req.NamespacedName, &instance); err != nil { log.Info("Unable to retrieve eventhub resource", "err", err.Error()) @@ -113,11 +113,11 @@ func (r *EventhubReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { // SetupWithManager binds the reconciler to a manager instance func (r *EventhubReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&azurev1alpha1.Eventhub{}). + For(&azurev1.Eventhub{}). Complete(r) } -func (r *EventhubReconciler) reconcileExternal(instance *azurev1alpha1.Eventhub) error { +func (r *EventhubReconciler) reconcileExternal(instance *azurev1.Eventhub) error { ctx := context.Background() var err error @@ -138,7 +138,7 @@ func (r *EventhubReconciler) reconcileExternal(instance *azurev1alpha1.Eventhub) instance.Status.Provisioning = true //get owner instance - var ownerInstance azurev1alpha1.EventhubNamespace + var ownerInstance azurev1.EventhubNamespace eventhubNamespacedName := types.NamespacedName{Name: eventhubNamespace, Namespace: instance.Namespace} err = r.Get(ctx, eventhubNamespacedName, &ownerInstance) @@ -149,7 +149,7 @@ func (r *EventhubReconciler) reconcileExternal(instance *azurev1alpha1.Eventhub) //set owner reference for eventhub if it exists references := []metav1.OwnerReference{ metav1.OwnerReference{ - APIVersion: "v1alpha1", + APIVersion: "v1", Kind: "EventhubNamespace", Name: ownerInstance.GetName(), UID: ownerInstance.GetUID(), @@ -203,7 +203,7 @@ func (r *EventhubReconciler) reconcileExternal(instance *azurev1alpha1.Eventhub) const storageAccountResourceFmt = "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" -func getCaptureDescriptionPtr(captureDescription azurev1alpha1.CaptureDescription) *model.CaptureDescription { +func getCaptureDescriptionPtr(captureDescription azurev1.CaptureDescription) *model.CaptureDescription { // add capture details var capturePtr *model.CaptureDescription @@ -230,7 +230,7 @@ func getCaptureDescriptionPtr(captureDescription azurev1alpha1.CaptureDescriptio return capturePtr } -func (r *EventhubReconciler) deleteEventhub(instance *azurev1alpha1.Eventhub) error { +func (r *EventhubReconciler) deleteEventhub(instance *azurev1.Eventhub) error { ctx := context.Background() @@ -247,7 +247,7 @@ func (r *EventhubReconciler) deleteEventhub(instance *azurev1alpha1.Eventhub) er return nil } -func (r *EventhubReconciler) createOrUpdateAccessPolicyEventHub(resourcegroup string, eventhubNamespace string, eventhubName string, instance *azurev1alpha1.Eventhub) error { +func (r *EventhubReconciler) createOrUpdateAccessPolicyEventHub(resourcegroup string, eventhubNamespace string, eventhubName string, instance *azurev1.Eventhub) error { var err error ctx := context.Background() @@ -271,7 +271,7 @@ func (r *EventhubReconciler) createOrUpdateAccessPolicyEventHub(resourcegroup st return nil } -func (r *EventhubReconciler) listAccessKeysAndCreateSecrets(resourcegroup string, eventhubNamespace string, eventhubName string, secretName string, authorizationRuleName string, instance *azurev1alpha1.Eventhub) error { +func (r *EventhubReconciler) listAccessKeysAndCreateSecrets(resourcegroup string, eventhubNamespace string, eventhubName string, secretName string, authorizationRuleName string, instance *azurev1.Eventhub) error { var err error var result model.AccessKeys @@ -314,7 +314,7 @@ func (r *EventhubReconciler) createEventhubSecrets( eventhubNamespace string, secretName string, sharedAccessKey string, - instance *azurev1alpha1.Eventhub) error { + instance *azurev1.Eventhub) error { csecret := &v1.Secret{ TypeMeta: metav1.TypeMeta{ @@ -354,7 +354,7 @@ func (r *EventhubReconciler) createEventhubSecrets( return nil } -func (r *EventhubReconciler) getEventhubSecrets(name string, instance *azurev1alpha1.Eventhub) error { +func (r *EventhubReconciler) getEventhubSecrets(name string, instance *azurev1.Eventhub) error { var err error secret := &v1.Secret{} diff --git a/controllers/eventhub_controller_finalizer.go b/controllers/eventhub_controller_finalizer.go index f4be8fd1d6c..a6656a5c2db 100644 --- a/controllers/eventhub_controller_finalizer.go +++ b/controllers/eventhub_controller_finalizer.go @@ -20,13 +20,13 @@ import ( "context" "fmt" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" "github.com/Azure/azure-service-operator/pkg/errhelp" ) const eventhubFinalizerName = "eventhub.finalizers.com" -func (r *EventhubReconciler) addFinalizer(instance *azurev1alpha1.Eventhub) error { +func (r *EventhubReconciler) addFinalizer(instance *azurev1.Eventhub) error { instance.AddFinalizer(eventhubFinalizerName) err := r.Update(context.Background(), instance) if err != nil { @@ -36,7 +36,7 @@ func (r *EventhubReconciler) addFinalizer(instance *azurev1alpha1.Eventhub) erro return nil } -func (r *EventhubReconciler) handleFinalizer(instance *azurev1alpha1.Eventhub) error { +func (r *EventhubReconciler) handleFinalizer(instance *azurev1.Eventhub) error { if instance.HasFinalizer(eventhubFinalizerName) { // our finalizer is present, so lets handle our external dependency if err := r.deleteExternalDependency(instance); err != nil { @@ -53,7 +53,7 @@ func (r *EventhubReconciler) handleFinalizer(instance *azurev1alpha1.Eventhub) e return nil } -func (r *EventhubReconciler) deleteExternalDependency(instance *azurev1alpha1.Eventhub) error { +func (r *EventhubReconciler) deleteExternalDependency(instance *azurev1.Eventhub) error { return r.deleteEventhub(instance) } diff --git a/controllers/eventhub_controller_test.go b/controllers/eventhub_controller_test.go index 8f10e2d41e1..eb30564bef7 100644 --- a/controllers/eventhub_controller_test.go +++ b/controllers/eventhub_controller_test.go @@ -17,10 +17,9 @@ package controllers import ( "context" - "time" - - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" "github.com/Azure/azure-service-operator/pkg/helpers" + "time" eventhubsmanager "github.com/Azure/azure-service-operator/pkg/resourcemanager/eventhubs" @@ -66,16 +65,16 @@ var _ = Describe("EventHub Controller", func() { eventhubName := "t-eh-" + helpers.RandomString(10) // Create the EventHub object and expect the Reconcile to be created - eventhubInstance := &azurev1alpha1.Eventhub{ + eventhubInstance := &azurev1.Eventhub{ ObjectMeta: metav1.ObjectMeta{ Name: eventhubName, Namespace: "default", }, - Spec: azurev1alpha1.EventhubSpec{ + Spec: azurev1.EventhubSpec{ Location: "westus", Namespace: "t-ns-dev-eh-" + helpers.RandomString(10), ResourceGroup: "t-rg-dev-eh-" + helpers.RandomString(10), - Properties: azurev1alpha1.EventhubProperties{ + Properties: azurev1.EventhubProperties{ MessageRetentionInDays: 7, PartitionCount: 2, }, @@ -100,20 +99,20 @@ var _ = Describe("EventHub Controller", func() { var err error // Create the EventHub object and expect the Reconcile to be created - eventhubInstance := &azurev1alpha1.Eventhub{ + eventhubInstance := &azurev1.Eventhub{ ObjectMeta: metav1.ObjectMeta{ Name: eventhubName, Namespace: "default", }, - Spec: azurev1alpha1.EventhubSpec{ + Spec: azurev1.EventhubSpec{ Location: "westus", Namespace: ehnName, ResourceGroup: rgName, - Properties: azurev1alpha1.EventhubProperties{ + Properties: azurev1.EventhubProperties{ MessageRetentionInDays: 7, PartitionCount: 2, }, - AuthorizationRule: azurev1alpha1.EventhubAuthorizationRule{ + AuthorizationRule: azurev1.EventhubAuthorizationRule{ Name: "RootManageSharedAccessKey", Rights: []string{"Listen"}, }, @@ -187,20 +186,20 @@ var _ = Describe("EventHub Controller", func() { var err error // Create the EventHub object and expect the Reconcile to be created - eventhubInstance := &azurev1alpha1.Eventhub{ + eventhubInstance := &azurev1.Eventhub{ ObjectMeta: metav1.ObjectMeta{ Name: eventhubName, Namespace: "default", }, - Spec: azurev1alpha1.EventhubSpec{ + Spec: azurev1.EventhubSpec{ Location: rgLocation, Namespace: ehnName, ResourceGroup: rgName, - Properties: azurev1alpha1.EventhubProperties{ + Properties: azurev1.EventhubProperties{ MessageRetentionInDays: 7, PartitionCount: 2, }, - AuthorizationRule: azurev1alpha1.EventhubAuthorizationRule{ + AuthorizationRule: azurev1.EventhubAuthorizationRule{ Name: "RootManageSharedAccessKey", Rights: []string{"Listen"}, }, @@ -279,24 +278,24 @@ var _ = Describe("EventHub Controller", func() { var err error // Create the EventHub object and expect the Reconcile to be created - eventHubInstance := &azurev1alpha1.Eventhub{ + eventHubInstance := &azurev1.Eventhub{ ObjectMeta: metav1.ObjectMeta{ Name: eventHubName, Namespace: "default", }, - Spec: azurev1alpha1.EventhubSpec{ + Spec: azurev1.EventhubSpec{ Location: rgLocation, Namespace: ehnName, ResourceGroup: rgName, - Properties: azurev1alpha1.EventhubProperties{ + Properties: azurev1.EventhubProperties{ MessageRetentionInDays: 7, PartitionCount: 2, - CaptureDescription: azurev1alpha1.CaptureDescription{ - Destination: azurev1alpha1.Destination{ + CaptureDescription: azurev1.CaptureDescription{ + Destination: azurev1.Destination{ ArchiveNameFormat: "{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}", BlobContainer: bcName, Name: "EventHubArchive.AzureBlockBlob", - StorageAccount: azurev1alpha1.StorageAccount{ + StorageAccount: azurev1.StorageAccount{ ResourceGroup: rgName, AccountName: saName, }, diff --git a/controllers/eventhubnamespace_controller.go b/controllers/eventhubnamespace_controller.go index 9ccabe54948..ede2773458d 100644 --- a/controllers/eventhubnamespace_controller.go +++ b/controllers/eventhubnamespace_controller.go @@ -20,7 +20,7 @@ import ( "fmt" "time" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" "github.com/Azure/azure-service-operator/pkg/errhelp" "github.com/Azure/azure-service-operator/pkg/helpers" eventhubsresourcemanager "github.com/Azure/azure-service-operator/pkg/resourcemanager/eventhubs" @@ -49,7 +49,7 @@ func (r *EventhubNamespaceReconciler) Reconcile(req ctrl.Request) (ctrl.Result, ctx := context.Background() log := r.Log.WithValues("eventhubnamespace", req.NamespacedName) - var instance azurev1alpha1.EventhubNamespace + var instance azurev1.EventhubNamespace if err := r.Get(ctx, req.NamespacedName, &instance); err != nil { log.Info("Unable to retrieve eventhub namespace resource", "err", err.Error()) // we'll ignore not-found errors, since they can't be fixed by an immediate @@ -96,11 +96,11 @@ func (r *EventhubNamespaceReconciler) Reconcile(req ctrl.Request) (ctrl.Result, //SetupWithManager sets up the functions for the controller func (r *EventhubNamespaceReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&azurev1alpha1.EventhubNamespace{}). + For(&azurev1.EventhubNamespace{}). Complete(r) } -func (r *EventhubNamespaceReconciler) reconcileExternal(instance *azurev1alpha1.EventhubNamespace) error { +func (r *EventhubNamespaceReconciler) reconcileExternal(instance *azurev1.EventhubNamespace) error { ctx := context.Background() var err error @@ -113,7 +113,7 @@ func (r *EventhubNamespaceReconciler) reconcileExternal(instance *azurev1alpha1. instance.Status.Provisioning = true //get owner instance - var ownerInstance azurev1alpha1.ResourceGroup + var ownerInstance azurev1.ResourceGroup resourceGroupNamespacedName := types.NamespacedName{Name: resourcegroup, Namespace: instance.Namespace} err = r.Get(ctx, resourceGroupNamespacedName, &ownerInstance) @@ -168,7 +168,7 @@ func (r *EventhubNamespaceReconciler) reconcileExternal(instance *azurev1alpha1. } -func (r *EventhubNamespaceReconciler) deleteEventhubNamespace(instance *azurev1alpha1.EventhubNamespace) error { +func (r *EventhubNamespaceReconciler) deleteEventhubNamespace(instance *azurev1.EventhubNamespace) error { ctx := context.Background() diff --git a/controllers/eventhubnamespace_controller_finalizer.go b/controllers/eventhubnamespace_controller_finalizer.go index 73d25b24647..0b8bf6b3a9d 100644 --- a/controllers/eventhubnamespace_controller_finalizer.go +++ b/controllers/eventhubnamespace_controller_finalizer.go @@ -20,12 +20,12 @@ import ( "context" "fmt" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" ) const eventhubNamespaceFinalizerName = "eventhubnamespace.finalizers.com" -func (r *EventhubNamespaceReconciler) addFinalizer(instance *azurev1alpha1.EventhubNamespace) error { +func (r *EventhubNamespaceReconciler) addFinalizer(instance *azurev1.EventhubNamespace) error { instance.AddFinalizer(eventhubNamespaceFinalizerName) err := r.Update(context.Background(), instance) if err != nil { @@ -35,7 +35,7 @@ func (r *EventhubNamespaceReconciler) addFinalizer(instance *azurev1alpha1.Event return nil } -func (r *EventhubNamespaceReconciler) handleFinalizer(instance *azurev1alpha1.EventhubNamespace) error { +func (r *EventhubNamespaceReconciler) handleFinalizer(instance *azurev1.EventhubNamespace) error { if instance.HasFinalizer(eventhubNamespaceFinalizerName) { // our finalizer is present, so lets handle our external dependency if err := r.deleteExternalDependency(instance); err != nil { @@ -51,7 +51,7 @@ func (r *EventhubNamespaceReconciler) handleFinalizer(instance *azurev1alpha1.Ev return nil } -func (r *EventhubNamespaceReconciler) deleteExternalDependency(instance *azurev1alpha1.EventhubNamespace) error { +func (r *EventhubNamespaceReconciler) deleteExternalDependency(instance *azurev1.EventhubNamespace) error { return r.deleteEventhubNamespace(instance) } diff --git a/controllers/eventhubnamespace_controller_test.go b/controllers/eventhubnamespace_controller_test.go index a6692dc26d7..39f5ffd203e 100644 --- a/controllers/eventhubnamespace_controller_test.go +++ b/controllers/eventhubnamespace_controller_test.go @@ -18,7 +18,7 @@ package controllers import ( "context" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" helpers "github.com/Azure/azure-service-operator/pkg/helpers" "time" @@ -55,15 +55,16 @@ var _ = Describe("EventHubNamespace Controller", func() { It("should fail to create eventhubnamespace if resourcegroup doesn't exist", func() { + resourceGroupName := "t-rg-dev-eh-" + helpers.RandomString(10) eventhubNamespaceName := "t-ns-dev-eh-" + helpers.RandomString(10) // Create the EventHubNamespace object and expect the Reconcile to be created - eventhubNamespaceInstance := &azurev1alpha1.EventhubNamespace{ + eventhubNamespaceInstance := &azurev1.EventhubNamespace{ ObjectMeta: metav1.ObjectMeta{ Name: eventhubNamespaceName, Namespace: "default", }, - Spec: azurev1alpha1.EventhubNamespaceSpec{ + Spec: azurev1.EventhubNamespaceSpec{ Location: rgLocation, ResourceGroup: resourceGroupName, }, @@ -87,12 +88,12 @@ var _ = Describe("EventHubNamespace Controller", func() { var err error // Create the Eventhub namespace object and expect the Reconcile to be created - eventhubNamespaceInstance := &azurev1alpha1.EventhubNamespace{ + eventhubNamespaceInstance := &azurev1.EventhubNamespace{ ObjectMeta: metav1.ObjectMeta{ Name: eventhubNamespaceName, Namespace: "default", }, - Spec: azurev1alpha1.EventhubNamespaceSpec{ + Spec: azurev1.EventhubNamespaceSpec{ Location: rgLocation, ResourceGroup: rgName, }, diff --git a/controllers/keyvault_controller.go b/controllers/keyvault_controller.go index 54c45e380e1..1aa0d9a20db 100644 --- a/controllers/keyvault_controller.go +++ b/controllers/keyvault_controller.go @@ -22,7 +22,7 @@ import ( "strconv" "time" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" "github.com/Azure/azure-service-operator/pkg/errhelp" helpers "github.com/Azure/azure-service-operator/pkg/helpers" "github.com/Azure/azure-service-operator/pkg/resourcemanager/keyvaults" @@ -50,7 +50,7 @@ func (r *KeyVaultReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { ctx := context.Background() log := r.Log.WithValues("keyvault", req.NamespacedName) - var instance azurev1alpha1.KeyVault + var instance azurev1.KeyVault requeueAfter, err := strconv.Atoi(os.Getenv("REQUEUE_AFTER")) if err != nil { @@ -102,7 +102,7 @@ func (r *KeyVaultReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { return ctrl.Result{}, nil } -func (r *KeyVaultReconciler) addFinalizer(instance *azurev1alpha1.KeyVault) error { +func (r *KeyVaultReconciler) addFinalizer(instance *azurev1.KeyVault) error { helpers.AddFinalizer(instance, keyVaultFinalizerName) err := r.Update(context.Background(), instance) if err != nil { @@ -112,7 +112,7 @@ func (r *KeyVaultReconciler) addFinalizer(instance *azurev1alpha1.KeyVault) erro return nil } -func (r *KeyVaultReconciler) reconcileExternal(instance *azurev1alpha1.KeyVault) error { +func (r *KeyVaultReconciler) reconcileExternal(instance *azurev1.KeyVault) error { ctx := context.Background() location := instance.Spec.Location name := instance.ObjectMeta.Name @@ -150,7 +150,7 @@ func (r *KeyVaultReconciler) reconcileExternal(instance *azurev1alpha1.KeyVault) return nil } -func (r *KeyVaultReconciler) deleteExternal(instance *azurev1alpha1.KeyVault) error { +func (r *KeyVaultReconciler) deleteExternal(instance *azurev1.KeyVault) error { ctx := context.Background() name := instance.ObjectMeta.Name groupName := instance.Spec.ResourceGroupName @@ -172,6 +172,6 @@ func (r *KeyVaultReconciler) deleteExternal(instance *azurev1alpha1.KeyVault) er // SetupWithManager sets up the controller functions func (r *KeyVaultReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&azurev1alpha1.KeyVault{}). + For(&azurev1.KeyVault{}). Complete(r) } diff --git a/controllers/rediscache_controller.go b/controllers/rediscache_controller.go index 90d4d32a4a0..ff0e0808938 100644 --- a/controllers/rediscache_controller.go +++ b/controllers/rediscache_controller.go @@ -35,7 +35,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" "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" @@ -60,7 +60,7 @@ func (r *RedisCacheReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) log := r.Log.WithValues("rediscache", req.NamespacedName) // Fetch the Redis Cache instance - var instance azurev1alpha1.RedisCache + var instance azurev1.RedisCache requeueAfter, err := strconv.Atoi(os.Getenv("REQUEUE_AFTER")) if err != nil { @@ -117,7 +117,7 @@ func (r *RedisCacheReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) return ctrl.Result{}, nil } -func (r *RedisCacheReconciler) addFinalizer(instance *azurev1alpha1.RedisCache) error { +func (r *RedisCacheReconciler) addFinalizer(instance *azurev1.RedisCache) error { helpers.AddFinalizer(instance, redisCacheFinalizerName) err := r.Update(context.Background(), instance) if err != nil { @@ -127,7 +127,7 @@ func (r *RedisCacheReconciler) addFinalizer(instance *azurev1alpha1.RedisCache) return nil } -func (r *RedisCacheReconciler) reconcileExternal(instance *azurev1alpha1.RedisCache) error { +func (r *RedisCacheReconciler) reconcileExternal(instance *azurev1.RedisCache) error { ctx := context.Background() location := instance.Spec.Location name := instance.ObjectMeta.Name @@ -167,7 +167,7 @@ func (r *RedisCacheReconciler) reconcileExternal(instance *azurev1alpha1.RedisCa return nil } -func (r *RedisCacheReconciler) deleteExternal(instance *azurev1alpha1.RedisCache) error { +func (r *RedisCacheReconciler) deleteExternal(instance *azurev1.RedisCache) error { ctx := context.Background() name := instance.ObjectMeta.Name groupName := instance.Spec.ResourceGroupName @@ -189,7 +189,7 @@ func (r *RedisCacheReconciler) deleteExternal(instance *azurev1alpha1.RedisCache // SetupWithManager sets up the controller functions func (r *RedisCacheReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&azurev1alpha1.RedisCache{}). + For(&azurev1.RedisCache{}). Complete(r) } diff --git a/controllers/resourcegroup_controller.go b/controllers/resourcegroup_controller.go index af56b9018fb..15596fc9e62 100644 --- a/controllers/resourcegroup_controller.go +++ b/controllers/resourcegroup_controller.go @@ -18,7 +18,7 @@ package controllers import ( "fmt" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" resoucegroupsresourcemanager "github.com/Azure/azure-service-operator/pkg/resourcemanager/resourcegroups" "context" @@ -45,7 +45,7 @@ func (r *ResourceGroupReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro ctx := context.Background() log := r.Log.WithValues("resourcegroup", req.NamespacedName) - var instance azurev1alpha1.ResourceGroup + var instance azurev1.ResourceGroup if err := r.Get(ctx, req.NamespacedName, &instance); err != nil { log.Info("Unable to retrieve resourcegroup resource", "err", err.Error()) // we'll ignore not-found errors, since they can't be fixed by an immediate @@ -85,11 +85,11 @@ func (r *ResourceGroupReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro // SetupWithManager function sets up the functions with the controller func (r *ResourceGroupReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&azurev1alpha1.ResourceGroup{}). + For(&azurev1.ResourceGroup{}). Complete(r) } -func (r *ResourceGroupReconciler) reconcileExternal(instance *azurev1alpha1.ResourceGroup) error { +func (r *ResourceGroupReconciler) reconcileExternal(instance *azurev1.ResourceGroup) error { ctx := context.Background() var err error @@ -132,7 +132,7 @@ func (r *ResourceGroupReconciler) reconcileExternal(instance *azurev1alpha1.Reso } -func (r *ResourceGroupReconciler) deleteResourceGroup(instance *azurev1alpha1.ResourceGroup) error { +func (r *ResourceGroupReconciler) deleteResourceGroup(instance *azurev1.ResourceGroup) error { ctx := context.Background() resourcegroup := instance.ObjectMeta.Name diff --git a/controllers/resourcegroup_controller_finalizer.go b/controllers/resourcegroup_controller_finalizer.go index 0088b0d0451..27b2bdd6c49 100644 --- a/controllers/resourcegroup_controller_finalizer.go +++ b/controllers/resourcegroup_controller_finalizer.go @@ -20,12 +20,12 @@ import ( "context" "fmt" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" ) const resouceGroupFinalizerName = "resoucegroup.finalizers.com" -func (r *ResourceGroupReconciler) addFinalizer(instance *azurev1alpha1.ResourceGroup) error { +func (r *ResourceGroupReconciler) addFinalizer(instance *azurev1.ResourceGroup) error { instance.AddFinalizer(resouceGroupFinalizerName) err := r.Update(context.Background(), instance) if err != nil { @@ -35,7 +35,7 @@ func (r *ResourceGroupReconciler) addFinalizer(instance *azurev1alpha1.ResourceG return nil } -func (r *ResourceGroupReconciler) handleFinalizer(instance *azurev1alpha1.ResourceGroup) error { +func (r *ResourceGroupReconciler) handleFinalizer(instance *azurev1.ResourceGroup) error { if instance.HasFinalizer(resouceGroupFinalizerName) { // our finalizer is present, so lets handle our external dependency if err := r.deleteExternalDependency(instance); err != nil { @@ -51,7 +51,7 @@ func (r *ResourceGroupReconciler) handleFinalizer(instance *azurev1alpha1.Resour return nil } -func (r *ResourceGroupReconciler) deleteExternalDependency(instance *azurev1alpha1.ResourceGroup) error { +func (r *ResourceGroupReconciler) deleteExternalDependency(instance *azurev1.ResourceGroup) error { return r.deleteResourceGroup(instance) } diff --git a/controllers/resourcegroup_controller_test.go b/controllers/resourcegroup_controller_test.go index 39cf9c8542d..34eda19fbd3 100644 --- a/controllers/resourcegroup_controller_test.go +++ b/controllers/resourcegroup_controller_test.go @@ -20,7 +20,7 @@ import ( "context" "time" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" helpers "github.com/Azure/azure-service-operator/pkg/helpers" . "github.com/onsi/ginkgo" @@ -54,12 +54,12 @@ var _ = Describe("ResourceGroup Controller", func() { var err error // Create the Resourcegroup object and expect the Reconcile to be created - resourceGroupInstance := &azurev1alpha1.ResourceGroup{ + resourceGroupInstance := &azurev1.ResourceGroup{ ObjectMeta: metav1.ObjectMeta{ Name: resourceGroupName, Namespace: "default", }, - Spec: azurev1alpha1.ResourceGroupSpec{ + Spec: azurev1.ResourceGroupSpec{ Location: tc.ResourceGroupLocation, }, } diff --git a/controllers/sqldatabase_controller.go b/controllers/sqldatabase_controller.go index aceb93f332a..3abce7dc042 100644 --- a/controllers/sqldatabase_controller.go +++ b/controllers/sqldatabase_controller.go @@ -33,7 +33,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" ) const SQLDatabaseFinalizerName = "sqldatabase.finalizers.azure.com" @@ -53,7 +53,7 @@ func (r *SqlDatabaseReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) ctx := context.Background() log := r.Log.WithValues("sqldatabase", req.NamespacedName) - var instance azurev1alpha1.SqlDatabase + var instance azurev1.SqlDatabase if err := r.Get(ctx, req.NamespacedName, &instance); err != nil { log.Info("Unable to retrieve sql-database resource", "err", err.Error()) @@ -113,11 +113,11 @@ func (r *SqlDatabaseReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) func (r *SqlDatabaseReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&azurev1alpha1.SqlDatabase{}). + For(&azurev1.SqlDatabase{}). Complete(r) } -func (r *SqlDatabaseReconciler) reconcileExternal(instance *azurev1alpha1.SqlDatabase) error { +func (r *SqlDatabaseReconciler) reconcileExternal(instance *azurev1.SqlDatabase) error { ctx := context.Background() location := instance.Spec.Location server := instance.Spec.Server @@ -142,7 +142,7 @@ func (r *SqlDatabaseReconciler) reconcileExternal(instance *azurev1alpha1.SqlDat //get owner instance of SqlServer r.Recorder.Event(instance, "Normal", "UpdatingOwner", "Updating owner SqlServer instance") - var ownerInstance azurev1alpha1.SqlServer + var ownerInstance azurev1.SqlServer sqlServerNamespacedName := types.NamespacedName{Name: server, Namespace: instance.Namespace} err := r.Get(ctx, sqlServerNamespacedName, &ownerInstance) @@ -191,7 +191,7 @@ func (r *SqlDatabaseReconciler) reconcileExternal(instance *azurev1alpha1.SqlDat return nil } -func (r *SqlDatabaseReconciler) deleteExternal(instance *azurev1alpha1.SqlDatabase) error { +func (r *SqlDatabaseReconciler) deleteExternal(instance *azurev1.SqlDatabase) error { ctx := context.Background() dbname := instance.ObjectMeta.Name groupName := instance.Spec.ResourceGroup @@ -221,7 +221,7 @@ func (r *SqlDatabaseReconciler) deleteExternal(instance *azurev1alpha1.SqlDataba return nil } -func (r *SqlDatabaseReconciler) addFinalizer(instance *azurev1alpha1.SqlDatabase) error { +func (r *SqlDatabaseReconciler) addFinalizer(instance *azurev1.SqlDatabase) error { helpers.AddFinalizer(instance, SQLDatabaseFinalizerName) err := r.Update(context.Background(), instance) if err != nil { diff --git a/controllers/sqlfirewallrule_controller.go b/controllers/sqlfirewallrule_controller.go index 2869f833315..145d05a040b 100644 --- a/controllers/sqlfirewallrule_controller.go +++ b/controllers/sqlfirewallrule_controller.go @@ -31,7 +31,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" ) const SQLFirewallRuleFinalizerName = "sqlfirewallrule.finalizers.azure.com" @@ -52,7 +52,7 @@ func (r *SqlFirewallRuleReconciler) Reconcile(req ctrl.Request) (ctrl.Result, er log := r.Log.WithValues("sqlfirewallrule", req.NamespacedName) // your logic here - var instance azurev1alpha1.SqlFirewallRule + var instance azurev1.SqlFirewallRule if err := r.Get(ctx, req.NamespacedName, &instance); err != nil { log.Info("Unable to retrieve sql-firewall-rule resource", "err", err.Error()) @@ -112,11 +112,11 @@ func (r *SqlFirewallRuleReconciler) Reconcile(req ctrl.Request) (ctrl.Result, er func (r *SqlFirewallRuleReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&azurev1alpha1.SqlFirewallRule{}). + For(&azurev1.SqlFirewallRule{}). Complete(r) } -func (r *SqlFirewallRuleReconciler) reconcileExternal(instance *azurev1alpha1.SqlFirewallRule) error { +func (r *SqlFirewallRuleReconciler) reconcileExternal(instance *azurev1.SqlFirewallRule) error { ctx := context.Background() ruleName := instance.ObjectMeta.Name server := instance.Spec.Server @@ -127,7 +127,7 @@ func (r *SqlFirewallRuleReconciler) reconcileExternal(instance *azurev1alpha1.Sq // get owner instance of SqlServer r.Recorder.Event(instance, "Normal", "UpdatingOwner", "Updating owner SqlServer instance") - var ownerInstance azurev1alpha1.SqlServer + var ownerInstance azurev1.SqlServer sqlServerNamespacedName := types.NamespacedName{Name: server, Namespace: instance.Namespace} err := r.Get(ctx, sqlServerNamespacedName, &ownerInstance) if err != nil { @@ -184,13 +184,13 @@ func (r *SqlFirewallRuleReconciler) reconcileExternal(instance *azurev1alpha1.Sq return nil } -func (r *SqlFirewallRuleReconciler) deleteExternal(instance *azurev1alpha1.SqlFirewallRule) error { +func (r *SqlFirewallRuleReconciler) deleteExternal(instance *azurev1.SqlFirewallRule) error { ctx := context.Background() ruleName := instance.ObjectMeta.Name server := instance.Spec.Server //get owner instance of SqlServer - var ownerInstance azurev1alpha1.SqlServer + var ownerInstance azurev1.SqlServer sqlServerNamespacedName := types.NamespacedName{Name: server, Namespace: instance.Namespace} err := r.Get(ctx, sqlServerNamespacedName, &ownerInstance) if err != nil { @@ -222,7 +222,7 @@ func (r *SqlFirewallRuleReconciler) deleteExternal(instance *azurev1alpha1.SqlFi return nil } -func (r *SqlFirewallRuleReconciler) addFinalizer(instance *azurev1alpha1.SqlFirewallRule) error { +func (r *SqlFirewallRuleReconciler) addFinalizer(instance *azurev1.SqlFirewallRule) error { helpers.AddFinalizer(instance, SQLFirewallRuleFinalizerName) err := r.Update(context.Background(), instance) if err != nil { diff --git a/controllers/sqlserver_controller.go b/controllers/sqlserver_controller.go index d698ad1b104..4a1e0361f5a 100644 --- a/controllers/sqlserver_controller.go +++ b/controllers/sqlserver_controller.go @@ -32,7 +32,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -53,8 +53,7 @@ type SqlServerReconciler struct { func (r *SqlServerReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { ctx := context.Background() log := r.Log.WithValues("sqlserver", req.NamespacedName) - - var instance azurev1alpha1.SqlServer + var instance azurev1.SqlServer if err := r.Get(ctx, req.NamespacedName, &instance); err != nil { log.Info("Unable to retrieve sql-server resource", "err", err.Error()) @@ -162,11 +161,11 @@ func (r *SqlServerReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { func (r *SqlServerReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&azurev1alpha1.SqlServer{}). + For(&azurev1.SqlServer{}). Complete(r) } -func (r *SqlServerReconciler) reconcileExternal(instance *azurev1alpha1.SqlServer) error { +func (r *SqlServerReconciler) reconcileExternal(instance *azurev1.SqlServer) error { ctx := context.Background() location := instance.Spec.Location name := instance.ObjectMeta.Name @@ -219,7 +218,7 @@ func (r *SqlServerReconciler) reconcileExternal(instance *azurev1alpha1.SqlServe return nil } -func (r *SqlServerReconciler) verifyExternal(instance *azurev1alpha1.SqlServer) error { +func (r *SqlServerReconciler) verifyExternal(instance *azurev1.SqlServer) error { ctx := context.Background() location := instance.Spec.Location name := instance.ObjectMeta.Name @@ -247,6 +246,15 @@ func (r *SqlServerReconciler) verifyExternal(instance *azurev1alpha1.SqlServer) r.Recorder.Event(instance, "Normal", "Checking", fmt.Sprintf("instance in %s state", instance.Status.State)) if instance.Status.State == "Ready" { + + if instance.Spec.AllowAzureServiceAccess == true { + // Add firewall rule to allow azure service access + _, err := sdkClient.CreateOrUpdateSQLFirewallRule("AllowAzureAccess", "0.0.0.0", "0.0.0.0") + if err != nil { + r.Recorder.Event(instance, "Warning", "Failed", "Unable to add firewall rule to SQL server") + return errhelp.NewAzureError(err) + } + } instance.Status.Provisioned = true instance.Status.Provisioning = false } @@ -260,7 +268,7 @@ func (r *SqlServerReconciler) verifyExternal(instance *azurev1alpha1.SqlServer) return errhelp.NewAzureError(err) } -func (r *SqlServerReconciler) deleteExternal(instance *azurev1alpha1.SqlServer) error { +func (r *SqlServerReconciler) deleteExternal(instance *azurev1.SqlServer) error { ctx := context.Background() name := instance.ObjectMeta.Name groupName := instance.Spec.ResourceGroup @@ -283,7 +291,7 @@ func (r *SqlServerReconciler) deleteExternal(instance *azurev1alpha1.SqlServer) return nil } -func (r *SqlServerReconciler) GetOrPrepareSecret(instance *azurev1alpha1.SqlServer) *v1.Secret { +func (r *SqlServerReconciler) GetOrPrepareSecret(instance *azurev1.SqlServer) *v1.Secret { name := instance.ObjectMeta.Name secret := &v1.Secret{ diff --git a/controllers/sqlserver_controller_finalizer.go b/controllers/sqlserver_controller_finalizer.go index a336ee5288a..595cc8a9565 100644 --- a/controllers/sqlserver_controller_finalizer.go +++ b/controllers/sqlserver_controller_finalizer.go @@ -20,13 +20,13 @@ import ( "context" "fmt" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" helpers "github.com/Azure/azure-service-operator/pkg/helpers" ) const SQLServerFinalizerName = "sqlserver.finalizers.azure.com" -func (r *SqlServerReconciler) addFinalizer(instance *azurev1alpha1.SqlServer) error { +func (r *SqlServerReconciler) addFinalizer(instance *azurev1.SqlServer) error { helpers.AddFinalizer(instance, SQLServerFinalizerName) err := r.Update(context.Background(), instance) if err != nil { diff --git a/controllers/storage_controller.go b/controllers/storage_controller.go index 5fbbb38cea1..d96ce920007 100644 --- a/controllers/storage_controller.go +++ b/controllers/storage_controller.go @@ -35,7 +35,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" "github.com/Azure/azure-service-operator/pkg/errhelp" helpers "github.com/Azure/azure-service-operator/pkg/helpers" "github.com/Azure/azure-service-operator/pkg/resourcemanager/storages" @@ -61,7 +61,7 @@ func (r *StorageReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { log := r.Log.WithValues("storage", req.NamespacedName) // Fetch the Storage instance - var instance azurev1alpha1.Storage + var instance azurev1.Storage requeueAfter, err := strconv.Atoi(os.Getenv("REQUEUE_AFTER")) if err != nil { @@ -120,7 +120,7 @@ func (r *StorageReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { return ctrl.Result{}, nil } -func (r *StorageReconciler) addFinalizer(instance *azurev1alpha1.Storage) error { +func (r *StorageReconciler) addFinalizer(instance *azurev1.Storage) error { helpers.AddFinalizer(instance, storageFinalizerName) err := r.Update(context.Background(), instance) if err != nil { @@ -130,7 +130,7 @@ func (r *StorageReconciler) addFinalizer(instance *azurev1alpha1.Storage) error return nil } -func (r *StorageReconciler) reconcileExternal(instance *azurev1alpha1.Storage) error { +func (r *StorageReconciler) reconcileExternal(instance *azurev1.Storage) error { ctx := context.Background() location := instance.Spec.Location name := instance.ObjectMeta.Name @@ -172,7 +172,7 @@ func (r *StorageReconciler) reconcileExternal(instance *azurev1alpha1.Storage) e return nil } -func (r *StorageReconciler) deleteExternal(instance *azurev1alpha1.Storage) error { +func (r *StorageReconciler) deleteExternal(instance *azurev1.Storage) error { ctx := context.Background() name := instance.ObjectMeta.Name groupName := instance.Spec.ResourceGroupName @@ -194,7 +194,7 @@ func (r *StorageReconciler) deleteExternal(instance *azurev1alpha1.Storage) erro // SetupWithManager sets up the controller functions func (r *StorageReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&azurev1alpha1.Storage{}). + For(&azurev1.Storage{}). Complete(r) } diff --git a/controllers/suite_test.go b/controllers/suite_test.go index ce549a07783..f8bf259b0b5 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -27,7 +27,7 @@ import ( "github.com/Azure/azure-service-operator/pkg/resourcemanager/storages" "k8s.io/client-go/rest" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" resourcemanagerconfig "github.com/Azure/azure-service-operator/pkg/resourcemanager/config" "github.com/Azure/azure-service-operator/pkg/resourcemanager/eventhubs" resoucegroupsresourcemanager "github.com/Azure/azure-service-operator/pkg/resourcemanager/resourcegroups" @@ -49,11 +49,6 @@ import ( // http://onsi.github.io/ginkgo/ to learn more about Ginkgo. var testEnv *envtest.Environment -var resourceGroupName string -var resourcegroupLocation string -var eventhubNamespaceName string -var eventhubName string -var namespaceLocation string type TestContext struct { Cfg rest.Config @@ -72,12 +67,7 @@ var tc TestContext func TestAPIs(t *testing.T) { t.Parallel() RegisterFailHandler(Fail) - resourceGroupName = "t-rg-dev-controller-" + helpers.RandomString(10) - resourcegroupLocation = "westus" - eventhubNamespaceName = "t-ns-dev-eh-ns-" + helpers.RandomString(10) - eventhubName = "t-eh-dev-sample-" + helpers.RandomString(10) - namespaceLocation = "westus" RunSpecsWithDefaultAndCustomReporters(t, "Controller Suite", []Reporter{envtest.NewlineReporter{}}) @@ -122,7 +112,7 @@ var _ = SynchronizedBeforeSuite(func() []byte { Expect(cfg).ToNot(BeNil()) - err = azurev1alpha1.AddToScheme(scheme.Scheme) + err = azurev1.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) var k8sManager ctrl.Manager @@ -191,7 +181,7 @@ var _ = SynchronizedBeforeSuite(func() []byte { _, err = eventhubs.CreateHub(context.Background(), resourceGroupName, eventhubNamespaceName, eventhubName, int32(7), int32(1), nil) // Create the Storage Account and Container - _, err = storages.CreateStorage(context.Background(), resourceGroupName, storageAccountName, resourcegroupLocation, azurev1alpha1.StorageSku{ + _, err = storages.CreateStorage(context.Background(), resourceGroupName, storageAccountName, resourcegroupLocation, azurev1.StorageSku{ Name: "Standard_LRS", }, "Storage", map[string]*string{}, "", nil) @@ -224,7 +214,7 @@ var _ = SynchronizedBeforeSuite(func() []byte { err = helpers.FromByteArray(r, &tc) Expect(err).ToNot(HaveOccurred()) - err = azurev1alpha1.AddToScheme(scheme.Scheme) + err = azurev1.AddToScheme(scheme.Scheme) Expect(err).ToNot(HaveOccurred()) k8sClient, err := client.New(&tc.Cfg, client.Options{Scheme: scheme.Scheme}) diff --git a/docs/azuresql/azuresql.md b/docs/azuresql/azuresql.md index c49bc34010f..94942fe31b8 100644 --- a/docs/azuresql/azuresql.md +++ b/docs/azuresql/azuresql.md @@ -22,7 +22,7 @@ You can use the YAML files in the `config/samples` folder to create the resource For instance, this is the sample YAML for the Azure SQL server. ```yaml - apiVersion: azure.microsoft.com/v1alpha1 + apiVersion: azure.microsoft.com/v1 kind: SqlServer metadata: name: sqlserver-sample @@ -48,7 +48,7 @@ kubectl apply -f config/samples/azure_v1_sqlserver.yaml Below is the sample YAML for SQL database ```yaml -apiVersion: azure.microsoft.com/v1alpha1 +apiVersion: azure.microsoft.com/v1 kind: SqlDatabase metadata: name: sqldatabase-sample @@ -114,8 +114,8 @@ Name: sqlserver-sample234 Namespace: default Labels: Annotations: kubectl.kubernetes.io/last-applied-configuration: - {"apiVersion":"azure.microsoft.com/v1alpha1","kind":"SqlServer","metadata":{"annotations":{},"name":"sqlserver-sample234","namespace":"default"}... -API Version: azure.microsoft.com/v1alpha1 + {"apiVersion":"azure.microsoft.com/v1","kind":"SqlServer","metadata":{"annotations":{},"name":"sqlserver-sample234","namespace":"default"}... +API Version: azure.microsoft.com/v1 Kind: SqlServer Metadata: Creation Timestamp: 2019-09-26T21:30:56Z @@ -123,7 +123,7 @@ Metadata: sqlserver.finalizers.azure.com Generation: 1 Resource Version: 20001 - Self Link: /apis/azure.microsoft.com/v1alpha1/namespaces/default/sqlservers/sqlserver-sample234 + Self Link: /apis/azure.microsoft.com/v1/namespaces/default/sqlservers/sqlserver-sample234 UID: ed1c5d1d-e0a4-11e9-9ee8-52a5c765e9d7 Spec: Allowazureserviceaccess: true diff --git a/docs/resourcegroup/resourcegroup.md b/docs/resourcegroup/resourcegroup.md index 0e26f717359..a629088a422 100644 --- a/docs/resourcegroup/resourcegroup.md +++ b/docs/resourcegroup/resourcegroup.md @@ -11,7 +11,7 @@ You can use the YAML files in the `config/samples` folder to create the resource Here is the sample YAML file for creating a Resource group. ```yaml -apiVersion: azure.microsoft.com/v1alpha1 +apiVersion: azure.microsoft.com/v1 kind: ResourceGroup metadata: name: resourcegroup-sample-1907 diff --git a/go.sum b/go.sum index a4557544bbe..a10f7a154d1 100644 --- a/go.sum +++ b/go.sum @@ -158,7 +158,6 @@ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= diff --git a/main.go b/main.go index 44c784d5875..a365913aca2 100644 --- a/main.go +++ b/main.go @@ -22,7 +22,7 @@ import ( "os" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" "github.com/Azure/azure-service-operator/controllers" resourcemanagerconfig "github.com/Azure/azure-service-operator/pkg/resourcemanager/config" @@ -44,9 +44,9 @@ var ( func init() { - azurev1alpha1.AddToScheme(scheme) + azurev1.AddToScheme(scheme) kscheme.AddToScheme(scheme) - _ = azurev1alpha1.AddToScheme(scheme) + _ = azurev1.AddToScheme(scheme) // +kubebuilder:scaffold:scheme } @@ -156,13 +156,14 @@ func main() { setupLog.Error(err, "unable to create controller", "controller", "RedisCache") os.Exit(1) } + if !resourcemanagerconfig.Declarative() { - if err = (&azurev1alpha1.EventhubNamespace{}).SetupWebhookWithManager(mgr); err != nil { + if err = (&azurev1.EventhubNamespace{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "EventhubNamespace") os.Exit(1) } - if err = (&azurev1alpha1.Eventhub{}).SetupWebhookWithManager(mgr); err != nil { + if err = (&azurev1.Eventhub{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "Eventhub") os.Exit(1) } diff --git a/pkg/resourcemanager/cosmosdbs/cosmosdbs.go b/pkg/resourcemanager/cosmosdbs/cosmosdbs.go index f634c4ab7f7..c36eb096fea 100644 --- a/pkg/resourcemanager/cosmosdbs/cosmosdbs.go +++ b/pkg/resourcemanager/cosmosdbs/cosmosdbs.go @@ -6,7 +6,7 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2015-04-08/documentdb" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" "github.com/Azure/azure-service-operator/pkg/resourcemanager/config" "github.com/Azure/azure-service-operator/pkg/resourcemanager/iam" "github.com/Azure/go-autorest/autorest/to" @@ -27,8 +27,8 @@ func getCosmosDBClient() documentdb.DatabaseAccountsClient { func CreateCosmosDB(ctx context.Context, groupName string, cosmosDBName string, location string, - kind azurev1alpha1.CosmosDBKind, - dbType azurev1alpha1.CosmosDBDatabaseAccountOfferType, + kind azurev1.CosmosDBKind, + dbType azurev1.CosmosDBDatabaseAccountOfferType, tags map[string]*string) (documentdb.DatabaseAccount, error) { cosmosDBClient := getCosmosDBClient() diff --git a/pkg/resourcemanager/rediscaches/rediscaches.go b/pkg/resourcemanager/rediscaches/rediscaches.go index 7da9bcefb64..8ebe0e2df29 100644 --- a/pkg/resourcemanager/rediscaches/rediscaches.go +++ b/pkg/resourcemanager/rediscaches/rediscaches.go @@ -7,7 +7,7 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis" - azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" + azurev1 "github.com/Azure/azure-service-operator/api/v1" "github.com/Azure/azure-service-operator/pkg/resourcemanager/config" "github.com/Azure/azure-service-operator/pkg/resourcemanager/iam" "github.com/Azure/go-autorest/autorest/to" @@ -29,7 +29,7 @@ func CreateRedisCache(ctx context.Context, groupName string, redisCacheName string, location string, - sku azurev1alpha1.RedisCacheSku, + sku azurev1.RedisCacheSku, enableNonSSLPort bool, tags map[string]*string) (redis.ResourceType, error) { redisClient := getRedisCacheClient() diff --git a/pkg/resourcemanager/storages/blob_containers_test.go b/pkg/resourcemanager/storages/blob_containers_test.go index e4e3733c831..c9555b79f73 100644 --- a/pkg/resourcemanager/storages/blob_containers_test.go +++ b/pkg/resourcemanager/storages/blob_containers_test.go @@ -18,7 +18,7 @@ package storages import ( "context" - apiv1 "github.com/Azure/azure-service-operator/api/v1alpha1" + apiv1 "github.com/Azure/azure-service-operator/api/v1" "github.com/Azure/azure-service-operator/pkg/helpers" "github.com/Azure/azure-service-operator/pkg/resourcemanager/config" . "github.com/onsi/ginkgo" diff --git a/pkg/resourcemanager/storages/storages.go b/pkg/resourcemanager/storages/storages.go index 0d91c70f9cf..ebcf23cd426 100644 --- a/pkg/resourcemanager/storages/storages.go +++ b/pkg/resourcemanager/storages/storages.go @@ -7,7 +7,7 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-04-01/storage" - apiv1 "github.com/Azure/azure-service-operator/api/v1alpha1" + apiv1 "github.com/Azure/azure-service-operator/api/v1" "github.com/Azure/azure-service-operator/pkg/resourcemanager/config" "github.com/Azure/azure-service-operator/pkg/resourcemanager/iam" "github.com/Azure/go-autorest/autorest" diff --git a/pkg/resourcemanager/storages/storages_test.go b/pkg/resourcemanager/storages/storages_test.go index 1e696372648..d2ab3b27c54 100644 --- a/pkg/resourcemanager/storages/storages_test.go +++ b/pkg/resourcemanager/storages/storages_test.go @@ -18,7 +18,7 @@ package storages import ( "context" - apiv1 "github.com/Azure/azure-service-operator/api/v1alpha1" + apiv1 "github.com/Azure/azure-service-operator/api/v1" "github.com/Azure/azure-service-operator/pkg/resourcemanager/config" "github.com/Azure/go-autorest/autorest/to" "time"