Skip to content

Commit

Permalink
Add support for AWS RDS and GCP CloudSQL
Browse files Browse the repository at this point in the history
Signed-off-by: Jared Watts <jbw976@gmail.com>
  • Loading branch information
jbw976 committed Sep 19, 2018
1 parent fb0108f commit dc02755
Show file tree
Hide file tree
Showing 31 changed files with 1,429 additions and 271 deletions.
53 changes: 52 additions & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
required = [
"github.com/aws/aws-sdk-go-v2",
"github.com/emicklei/go-restful",
"github.com/onsi/ginkgo", # for test framework
"github.com/onsi/gomega", # for test matchers
"google.golang.org/api/sqladmin/v1beta4",
"golang.org/x/oauth2/google",
"k8s.io/client-go/plugin/pkg/client/auth/gcp", # for development against gcp
"k8s.io/code-generator/cmd/deepcopy-gen", # for go generate
"sigs.k8s.io/controller-tools/cmd/controller-gen", # for crd/rbac generation
Expand All @@ -12,12 +15,15 @@ required = [
"sigs.k8s.io/controller-runtime/pkg/runtime/signals",
"sigs.k8s.io/controller-runtime/pkg/source",
"sigs.k8s.io/testing_frameworks/integration", # for integration testing
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1",
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1",
]

[prune]
go-tests = true

[[constraint]]
name = "github.com/aws/aws-sdk-go-v2"
version = "v2.0.0-preview.4"

# STANZAS BELOW ARE GENERATED AND MAY BE WRITTEN - DO NOT MODIFY BELOW THIS LINE.

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ More details about API versioning and status in Kubernetes can be found on the K
* **Stable:** Features will appear in released software for many subsequent versions and support for upgrading between versions will be provided with software automation in the vast majority of scenarios.


Name | Details | API Group | Status
-----|---------|-----------|-------
| Name | Details | API Group | Status |
| ----- | --------- | ----------- | -------- |
| AWS Database | Database storage services in AWS | database.aws.conductor.io/v1alpha1 | Alpha |
| GCP Database | Database storage services in GCP | database.gcp.conductor.io/v1alpha1 | Alpha |

### Official Releases

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,47 @@ spec:
metadata:
type: object
spec:
properties:
backupretentionperiod:
format: int64
type: integer
class:
type: string
encrypted:
type: boolean
engine:
type: string
iops:
format: int64
type: integer
masterPasswordSecretRef:
type: object
masterUsername:
type: string
multiaz:
type: boolean
publicaccess:
type: boolean
size:
format: int64
type: integer
storagetype:
type: string
required:
- masterUsername
- masterPasswordSecretRef
- engine
- class
- size
type: object
status:
properties:
message:
type: string
providerID:
type: string
state:
type: string
type: object
version: v1alpha1
status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,32 @@ spec:
metadata:
type: object
spec:
properties:
databaseVersion:
type: string
projectID:
type: string
region:
type: string
storageType:
type: string
tier:
type: string
required:
- projectID
- tier
- region
- databaseVersion
- storageType
type: object
status:
properties:
message:
type: string
providerID:
type: string
state:
type: string
type: object
version: v1alpha1
status:
Expand Down
36 changes: 13 additions & 23 deletions cluster/charts/conductor/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,19 @@ metadata:
heritage: {{ .Release.Service }}
rules:
- apiGroups:
- apps
- ""
resources:
- deployments
- nodes
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- rds.aws.conductor.io
- ""
resources:
- instances
- secrets
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- apps
resources:
Expand All @@ -45,14 +35,14 @@ rules:
- patch
- delete
- apiGroups:
- cloudsql.gcp.conductor.io
- database.aws.conductor.io
resources:
- instances
- "*"
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- "*"
- apiGroups:
- database.gcp.conductor.io
resources:
- "*"
verbs:
- "*"
18 changes: 0 additions & 18 deletions cluster/charts/conductor/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ template "name" . }}-admin
labels:
app: {{ template "name" . }}
chart: {{ template "chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: {{ template "name" . }}
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ template "name" . }}
labels:
Expand Down
6 changes: 6 additions & 0 deletions cluster/charts/conductor/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ spec:
requests:
cpu: 100m
memory: 20Mi
env:
# The pod namespace to pass with the downward API
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
25 changes: 25 additions & 0 deletions cluster/examples/aws/database/v1alpha1/rdsinstance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v1
kind: Secret
metadata:
name: rds-secret
type: Opaque
data:
rdsPassword: cGFzc3dvcmRvcnNvbWV0aGluZw==
---
apiVersion: database.aws.conductor.io/v1alpha1
kind: RDSInstance
metadata:
name: rdssample
spec:
class: db.t2.small # type of the db instance
engine: postgres # what engine to use postgres, mysql, aurora-postgresql etc.
masterUsername: postgres # Database username
masterPasswordSecretRef: # reference to secret that contains database master password
name: rds-secret # the name of the secret
key: rdsPassword # the name of the key in the secret data that contains the password
size: 10 # size in GB of underlying storage volume
storagetype: gp2 # type of the underlying storage
backupretentionperiod: 10 # days to keep backup, 0 means diable
encrypted: true # should the database be encrypted
#iops: 1000 # number of iops
multiaz: true # multi AZ support
11 changes: 11 additions & 0 deletions cluster/examples/gcp/database/v1alpha1/cloudsqlinstance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: database.gcp.conductor.io/v1alpha1
kind: CloudsqlInstance
metadata:
labels:
name: cloudsql-sample-01398
spec:
projectID: long-disk-191221
tier: db-n1-standard-1
region: us-west2
databaseVersion: MYSQL_5_7
storageType: PD_SSD
2 changes: 1 addition & 1 deletion cmd/conductor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func main() {
log.Fatal(err)
}

log.Printf("Starting the Cmd.")
log.Printf("Starting the manager.")

// Start the Cmd
log.Fatal(mgr.Start(signals.SetupSignalHandler()))
Expand Down
9 changes: 0 additions & 9 deletions config/samples/aws/rds_v1alpha1_instance.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions config/samples/gcp/cloudsql_v1alpha1_instance.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions config/samples/gcp/cloudsql_v1alpha1_user.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# User Guides

* [Troubleshooting](troubleshooting.md)
Loading

0 comments on commit dc02755

Please sign in to comment.