Skip to content

Commit

Permalink
Merge branch 'master' into azure-keyvault-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jananivMS authored Apr 2, 2020
2 parents 077bad3 + 0c3cd28 commit 78f1b21
Show file tree
Hide file tree
Showing 41 changed files with 1,301 additions and 1,351 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,17 @@ This project maintains [releases of the Azure Service Operator](https://github.c
1. [Resource Group](/docs/resourcegroup/resourcegroup.md)
2. [EventHub](/docs/eventhub/eventhub.md)
3. [Azure SQL](/docs/azuresql/azuresql.md)

For more information on troubleshooting resources, refer to [this](/docs/viewresources.md) link
4. [Azure Keyvault](/docs/keyvault/keyvault.md)
5. [Azure Rediscache](/docs/rediscache/rediscache.md)
6. [Storage Account](/docs/storage/storageaccount.md)
7. [Blob container](/docs/storage/blobcontainer.md)
8. [Azure Database for PostgreSQL](/docs/postgresql/postgresql.md)
9. [Virtual Network](/docs/virtualnetwork/virtualnetwork.md)
10.[Application Insights](/docs/appinsights/appinsights.md)
11.[API Management](/docs/apimgmt/apimgmt.md)
12.[Cosmos DB](/docs/cosmosdb/cosmosdb.md)

For more information on deploying, troubleshooting & deleting resources, refer to [this](/docs/customresource.md) link

## Building the operators

Expand Down
36 changes: 36 additions & 0 deletions config/samples/azure_v1alpha1_postgresql_everything.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: azure.microsoft.com/v1alpha1
kind: PostgreSQLServer
metadata:
name: postgresqlserver-sample
spec:
location: southcentralus
resourceGroup: resourcegroup-azure-operators
serverVersion: "10"
sslEnforcement: Enabled
sku:
name: B_Gen5_2
tier: Basic
family: Gen5
size: "51200"
capacity: 2
# Use the field below to optionally specify a different keyvault
# to store the server admin credential secrets in
#keyVaultToStoreSecrets: asoSecretKeyVault
---
apiVersion: azure.microsoft.com/v1alpha1
kind: PostgreSQLDatabase
metadata:
name: postgresqldatabase-sample
spec:
resourceGroup: resourcegroup-azure-operators
server: postgresqlserver-sample
---
apiVersion: azure.microsoft.com/v1alpha1
kind: PostgreSQLFirewallRule
metadata:
name: postgresqlfirewallrule-sample
spec:
resourceGroup: resourcegroup-azure-operators
server: postgresqlserver-sample
startIpAddress: 0.0.0.0
endIpAddress: 0.0.0.0
1 change: 0 additions & 1 deletion controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ func setup() error {
scheme.Scheme,
)
redisCacheManager := resourcemanagerrediscaches.NewAzureRedisCacheManager(
ctrl.Log.WithName("rediscachemanager").WithName("RedisCache"),
secretClient,
scheme.Scheme,
)
Expand Down
2 changes: 1 addition & 1 deletion devops/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ steps:
env:
BUILD_ID: $(Build.BuildId)
inputs:
azureSubscription: 'Az Internal Consumption'
azureSubscription: 'CSE AmWest Sub - ASO'
scriptType: bash
scriptLocation: inlineScript
workingDirectory: '$(MODULE_PATH)'
Expand Down
Empty file added docs/apimgmt/apimgmt.md
Empty file.
Empty file added docs/appinsights/appinsights.md
Empty file.
148 changes: 0 additions & 148 deletions docs/azuredatalakegen2/azuredatalakegen2.md

This file was deleted.

31 changes: 2 additions & 29 deletions docs/azuresql/azuresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ The Azure SQL operator suite consists of the following operators.
5. Azure SQL failover group - Deploys a failover group on a specified Azure SQL server given the secondary server and the databases to failover
6. Azure SQL User - Creates an user on the specified Azure SQL database and stores the username/password as secrets

## Deploying SQL Resources

First, you need to have the Azure Service Operator deployed in your cluster.

You can follow the steps from the [project root](../../README.md) to deploy a release or build a [development version locally](/docs/development.md).

You can use the YAML files in the `config/samples` folder to create the resources.

### Azure SQL server

Here is a [sample YAML](/config/samples/azure_v1alpha1_azuresqlserver.yaml) for the Azure SQL server.
Expand Down Expand Up @@ -150,30 +142,11 @@ The default secret name prefix in Key Vault is `azuresqluser-<serverName>-<azure
Additionally, some client libraries support connecting directly to Key Vault to retrieve secrets. Users can set the `keyVaultSecretFormats` parameter so that explicit connection strings for their desired formats are added to the Key Vault. Each secret will be named after the secret prefix followed by the format name, for example: `azuresqluser-<serverName>-<azureSqlDatabaseName>-adonet`.
Here is a [sample YAML](/config/samples/azure_v1alpha1_azuresqluser.yaml) for creating a database user


The `name` is used to generate the username on the database. The exact name is not used but rather a UUID is appended to this to make it unique. `server` and `dbname` qualify the database on which you want to create the user on. `adminsecret` is the name of the secret where the username and password will be stored. `roles` specify the security roles that this user should have on the specified database.

## View and Troubleshoot SQL Resources

You can view your created Azure SQL resources using the steps [here](viewresources.md)

## Delete a SQL Resource

To delete an existing resource from Kubernetes and Azure, use the following command.

```shell
kubectl delete <Kind> <instancename>
```

For instance, deleting the above SqlServer instance would look like this.

```shell
kubectl delete AzureSqlServer sqlserver-sample
```

The following message should appear:
## Deploy, view and delete resources

`azuresqlserver.azure.microsoft.com sqlserver-sample deleted.`
You can follow the steps [here](/docs/customresource.md) to deploy, view and delete resources.

## Demo

Expand Down
Empty file added docs/cosmosdb/cosmosdb.md
Empty file.
49 changes: 42 additions & 7 deletions docs/viewresources.md → docs/customresource.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,56 @@
## View and Troubleshoot Custom Resources
# Deploy, View and Delete Resources

## Deploy Custom Resource

You can follow the steps [here](/docs/development.md) to run the operator locally or follow the steps [here](/docs/deploy.md) to deploy to a real Kubernetes cluster.

You can use the YAML files in the `config/samples` folder to create the resources using the following command.

```
kubectl apply -f <YAML file>
```

### Tags in Azure

When deploying resources using the YAML files, you can specify as labels any tags you want to add to the resource in Azure.
If the labels contain characters that are not allowed as tags in Azure (<,>,\,/,%,?), those characters will be replaced by a period(.) and added as Azure tags.

## View and Troubleshoot Custom Resource

To view your created custom resource, run the following command:

```shell
```
kubectl get <CRD>
```

where CRD is the Custom Resource Definition name or `Kind` for the resource.

For instance, you can get the Azure SQL servers provisioned using the command

```shell
```
kubectl get AzureSqlServer
```

You should see the AzureSqlServer instances as below

```shell
```
NAME AGE
sqlserver-sample 1h
```

If you want to see more details about a particular resource instance such as the `Status` or `Events`, you can use the below command

```shell
```
kubectl describe <Kind> <instance name>
```

For instance, the below command is used to get more details about the `sqlserver-sample` instance

```shell
```
kubectl describe AzureSqlServer sqlserver-sample
```

```shell
```
Name: sqlserver-sample234
Namespace: default
Labels: <none>
Expand Down Expand Up @@ -70,6 +87,24 @@ The `Status` section gives you the current state of the resource, it's `State` a

The `Events` have a chronological record of what occurred through the process of provisioning the resource.

## Delete Resource

To delete an existing resource from Kubernetes and Azure, use the following command.

```
kubectl delete <Kind> <instancename>
```

For instance, deleting a AzureSqlServer instance would look like this.

```
kubectl delete azuresqlserver sqlserver-sample
```

The following message should appear:

`azuresqlserver.azure.microsoft.com sqlserver-sample deleted.`

## Delete Kubernetes instances without deleting Azure resources

In some cases, like when you setup a new Kubernetes cluster with the same CRDs and want to take down the older cluster, you might need to delete the Kubernetes instances without impacting the Azure resources (as these are still tracked by CRDs in a different cluster)
Expand Down
Loading

0 comments on commit 78f1b21

Please sign in to comment.