Skip to content

Commit

Permalink
add READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
matteo-magni committed Sep 27, 2022
1 parent 765db87 commit 83e3f53
Show file tree
Hide file tree
Showing 9 changed files with 175 additions and 13 deletions.
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@
This repository contains sample [Carvel Packages](https://carvel.dev/kapp-controller/docs/v0.38.0/packaging/) that create [Service Instances](https://docs.vmware.com/en/Services-Toolkit-for-VMware-Tanzu-Application-Platform/0.7/svc-tlk/GUID-api_projection_and_resource_replication-terminology_and_apis.html#terminology) (e.g. Databases, Message queues, caches etc) that are compatible with [Tanzu Application Platform (TAP)](https://docs.vmware.com/en/Services-Toolkit-for-VMware-Tanzu-Application-Platform/index.html).

## Prerequisites

These reference packages are compatible with the following:

* A Kubernetes Cluster with at least [Tanzu Application Platform](https://docs.vmware.com/en/Services-Toolkit-for-VMware-Tanzu-Application-Platform/index.html) 1.2.0 or higher.
* A Kubernetes Cluster configured with [Cluster Essentials for VMware Tanzu](https://network.tanzu.vmware.com/products/tanzu-cluster-essentials/) 1.2.0 or higher. This explicitly relies on:
* [carvel kapp-controller](https://github.com/vmware-tanzu/carvel-kapp-controller/)
* [carvel secretgen-controller](https://github.com/vmware-tanzu/carvel-secretgen-controller/)(`>=0.9.0`)
* [carvel kapp-controller](https://github.com/vmware-tanzu/carvel-kapp-controller/)
* [carvel secretgen-controller](https://github.com/vmware-tanzu/carvel-secretgen-controller/)(`>=0.9.0`)

## Quick start

Add the PackageRepository to your Kubernetes cluster:

```shell
tanzu package repository add tap-reference-service-packages \
--url ghcr.io/vmware-tanzu/tanzu-application-platform-reference-service-packages:0.0.2 \
--url ghcr.io/vmware-tanzu/tanzu-application-platform-reference-service-packages:0.0.3 \
-n tanzu-package-repo-global
```

Expand All @@ -35,12 +37,14 @@ Follow the instructions for a specific Service Instance below:

## Service Instances

| Type | Resource(s) | Description | Status |
| ------------------ | ---------------------------------- | -------------------------- | ---------------- |
| [Amazon RDS] | DBInstance | Create RDS instances | 🚧 Experimental |
| [Google Cloud SQL] | SQLInstance, SQLDatabase, SQLUser | Create Cloud SQL instances | 🚧 Experimental |
| Type | Resource(s) | Description | Status |
| ------------------------------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------- | ---------------- |
| [Amazon RDS] | DBInstance | Create RDS instances | 🚧 Experimental |
| [Azure FlexibleServer for PostgreSQL] | ResourceGroup, FlexibleServer, FlexibleServersDatabase, FlexibleServersFirewallRule | Create FlexibleServer for PostgreSQL instances | 🚧 Experimental |
| [Google Cloud SQL] | SQLInstance, SQLDatabase, SQLUser | Create Cloud SQL instances | 🚧 Experimental |

[Amazon RDS]: ./amazon/ack/rds/README.md
[Azure FlexibleServer for PostgreSQL]: ./azure/aso/README.md
[Google Cloud SQL]: ./google/config-connector/cloudsql/README.md

## Building the Package Repository
Expand All @@ -64,9 +68,9 @@ imgpkg push -b ${REPO_HOST}:${TAG} -f repository
## Contributing

The tanzu-application-platform-reference-service-packages project team welcomes contributions from the community. Before you start working with this project please
read and sign our Contributor License Agreement (https://cla.vmware.com/cla/1/preview). If you wish to contribute code and you have not signed our
Contributor Licence Agreement (CLA), our bot will prompt you to do so when you open a Pull Request. For more detailed information, refer to
[CONTRIBUTING.md](CONTRIBUTING.md).
read and sign our Contributor License Agreement (<https://cla.vmware.com/cla/1/preview>). If you wish to contribute code and you have not signed our
Contributor Licence Agreement (CLA), our bot will prompt you to do so when you open a Pull Request. For more detailed information, refer to [CONTRIBUTING.md](CONTRIBUTING.md).

## License

See [LICENSE](./LICENSE)
2 changes: 1 addition & 1 deletion amazon/ack/rds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Status: Experimental

## Use

For detailed instructions follow the guide [Services Toolkit Documentation on RDS using ACK](https://docs.vmware.com/en/draft/Services-Toolkit-for-VMware-Tanzu-Application-Platform/0.7/svc-tlk/GUID-usecases-consuming_aws_rds_with_ack.html)
For detailed instructions follow the guide [Services Toolkit Documentation on RDS using ACK](https://docs.vmware.com/en/Services-Toolkit-for-VMware-Tanzu-Application-Platform/0.7/svc-tlk/GUID-usecases-consuming_aws_rds_with_ack.html)

## Bundle

Expand Down
5 changes: 5 additions & 0 deletions azure/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Azure

See:

- [Azure Service Operator for FlexibleServer](./psql/README.md)
30 changes: 30 additions & 0 deletions azure/aso/psql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Azure Service Operator - FlexibleServer for PostgreSQL

Status: Experimental

## Description

This is a [Carvel Package] using the [Azure Service Operator v2] to manage Azure FlexibleServer for PostrgreSQL instances.

[Azure Service Operator v2]: https://github.com/Azure/azure-service-operator/blob/v2.0.0-beta.2/README.md
[Carvel Package]: https://carvel.dev/kapp-controller/docs/develop/packaging/

## Use

For detailed instructions, follow the guide [Services Toolkit Documentation on FlexibleServer using ASO v2](https://docs.vmware.com/en/Services-Toolkit-for-VMware-Tanzu-Application-Platform/0.7/svc-tlk/GUID-usecases-consuming_azure_flexibleserver_psql_with_azure_operator.html)

## Bundle

For more information on customizing the bundle see [here][bundle], specifically
the [values-schema]. Alternatively you can also see the configuration options
with the tanzu CLI once the [package repo has been installed][repo-install] on
your cluster:

```sh
tanzu package available get \
--values-schema psql.azure.references.services.apps.tanzu.vmware.com/0.0.1-alpha
```

[bundle]: ../../../bundles/azure/aso/psql
[values-schema]: ../../../bundles/azure/aso/psql/bundle/config/00-schema.yml
[repo-install]: ../../../README.md#quick-start
40 changes: 40 additions & 0 deletions azure/aso/psql/package-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: packaging.carvel.dev/v1alpha1
kind: PackageInstall
metadata:
name: psql-1
namespace: psql-1
spec:
serviceAccountName: psql-install
packageRef:
refName: psql.azure.references.services.apps.tanzu.vmware.com
versionSelection:
constraints: 0.16.0
values:
- secretRef:
name: psql-1-values
---
apiVersion: v1
kind: Secret
metadata:
name: psql-1-values
namespace: psql-1
stringData:
values.yml: |
name: psql-1
namespace: psql-1
create_namespace: false
aso_controller_namespace: azureserviceoperator-system
resource_group:
name: psql-1
use_existing_resource_group: false
server:
version: "13"
administrator_name: trpadmin
instance_type: Standard_D4s_v3
instance_tier: GeneralPurpose
instance_storage_size_gb: 128
database:
name: testdb
firewall_rules:
- startIpAddress: 0.0.0.0
endIpAddress: 0.0.0.0
44 changes: 44 additions & 0 deletions azure/aso/psql/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: psql-install
namespace: psql-1
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: psql-install
namespace: psql-1
rules:
- apiGroups: ["dbforpostgresql.azure.com"]
resources: ["flexibleservers","flexibleserversdatabases","flexibleserversfirewallrules"]
verbs: ["*"]
- apiGroups: ["resources.azure.com"]
resources: ["resourcegroups"]
verbs: ["*"]
- apiGroups: ["secretgen.carvel.dev", "secretgen.k14s.io"]
resources: ["secrettemplates","passwords"]
verbs: ["*"]
- apiGroups: [""]
resources: ["serviceaccounts","configmaps"]
verbs: ["*"]
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get", "list"]
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["roles","rolebindings"]
verbs: ["*"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: psql-install
namespace: psql-1
subjects:
- kind: ServiceAccount
name: psql-install
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: psql-install
34 changes: 34 additions & 0 deletions bundles/azure/aso/psql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Azure Service Operator - FlexibleServer for PostgreSQL

Status: Experimental

## Use

For detailed instructions, follow the guide [Services Toolkit Documentation on FlexibleServer using ASO v2](https://docs.vmware.com/en/Services-Toolkit-for-VMware-Tanzu-Application-Platform/0.7/svc-tlk/GUID-usecases-consuming_azure_flexibleserver_psql_with_azure_operator.html)

## Customize

To customize the configuration of this Package Bundle modify the contents of `bundle` directory and follow the [Build](#build) steps.

## Build

>**Note**: This will be automated in the future
To alter this Package, modify the contents and perform the following steps to build the Package Bundle image. These steps use the following:

* [kbld](https://carvel.dev/kbld)
* [imgpkg](https://carvel.dev/imgpkg)

1. Build a new Package bundle image:

```sh
export REPO_HOST=<YOUR_IMAGE_REPO> #! e.g. ghcr.io/vmware-tanzu/tanzu-application-platform-reference-service-packages
export BUNDLE_TAG=<YOUR_BUNDLE_TAG> #! e.g. latest

pushd bundle
kbld -f config/ --imgpkg-lock-output=.imgpkg/images.yml
imgpkg push -b ${REPO_HOST}/psql.azure.references.services.apps.tanzu.vmware.com:$BUNDLE_TAG -f .
popd
```

1. Take the SHA produced by `imgpkg` and update `repository/packages/azure/psql/package.yml` by modifying `template.spec.fetch[0].imgpkgBundle.image` value.
6 changes: 4 additions & 2 deletions packagerepo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ apiVersion: packaging.carvel.dev/v1alpha1
kind: PackageRepository
metadata:
name: tap-reference-service-packages
namespace: tanzu-package-repo-global #! note this may be different in kapp was not installed through cluster-essentials
namespace: tanzu-package-repo-global #! NOTE this may be different if kapp was not installed through cluster-essentials
#! the kapp-controller global namespace can be obtained as follows
#! kubectl -n kapp-controller get deployment kapp-controller -o json | jq -r '.spec.template.spec.containers[]|select(.name=="kapp-controller").args[]|select(.|startswith("-packaging-global-namespace"))|split("=")[1]'
spec:
fetch:
imgpkgBundle:
image: ghcr.io/vmware-tanzu/tanzu-application-platform-reference-service-packages:0.0.2
image: ghcr.io/vmware-tanzu/tanzu-application-platform-reference-service-packages:0.0.3
3 changes: 3 additions & 0 deletions repository/.imgpkg/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ images:
- annotations:
kbld.carvel.dev/id: ghcr.io/vmware-tanzu/tanzu-application-platform-reference-service-packages/psql.aws.references.services.apps.tanzu.vmware.com@sha256:01481af67e9be08c466e7d98eb1e2e0e904a4965d289d793c41d316aeef59332
image: ghcr.io/vmware-tanzu/tanzu-application-platform-reference-service-packages/psql.aws.references.services.apps.tanzu.vmware.com@sha256:01481af67e9be08c466e7d98eb1e2e0e904a4965d289d793c41d316aeef59332
- annotations:
kbld.carvel.dev/id: ghcr.io/vmware-tanzu/tanzu-application-platform-reference-service-packages/psql.azure.references.services.apps.tanzu.vmware.com@sha256:c8342f48fce1c27d84a51efb923eefee077ea4b457a3df109598363068641dd9
image: ghcr.io/vmware-tanzu/tanzu-application-platform-reference-service-packages/psql.azure.references.services.apps.tanzu.vmware.com@sha256:c8342f48fce1c27d84a51efb923eefee077ea4b457a3df109598363068641dd9
- annotations:
kbld.carvel.dev/id: ghcr.io/vmware-tanzu/tanzu-application-platform-reference-service-packages/psql.google.references.services.apps.tanzu.vmware.com@sha256:9fc1a2767adac504e06d6eb8c9b2cbecc887ad605e3652401f26dc101abd1c6d
image: ghcr.io/vmware-tanzu/tanzu-application-platform-reference-service-packages/psql.google.references.services.apps.tanzu.vmware.com@sha256:9fc1a2767adac504e06d6eb8c9b2cbecc887ad605e3652401f26dc101abd1c6d
Expand Down

0 comments on commit 83e3f53

Please sign in to comment.