Skip to content

Commit

Permalink
Merge pull request #83 from ciaranRoche/elasticache-snapshot
Browse files Browse the repository at this point in the history
Allow arbitrary redis and elasticache snapshots
  • Loading branch information
openshift-merge-robot committed Jan 16, 2020
2 parents 230b464 + 7781424 commit 31c13db
Show file tree
Hide file tree
Showing 41 changed files with 2,450 additions and 52 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ IMAGE_ORG=integreatly
IMAGE_NAME=cloud-resource-operator
MANIFEST_NAME=cloud-resources
NAMESPACE=cloud-resource-operator
PREV_VERSION=0.4.0
VERSION=0.5.0
PREV_VERSION=0.5.0
VERSION=0.6.0
COMPILE_TARGET=./tmp/_output/bin/$(IMAGE_NAME)
OPERATOR_SDK_VERSION=0.12.0

Expand Down Expand Up @@ -73,6 +73,8 @@ cluster/prepare:
oc create -f ./deploy/crds/integreatly_v1alpha1_smtpcredentialset_crd.yaml -n $(NAMESPACE)
oc create -f ./deploy/crds/integreatly_v1alpha1_redis_crd.yaml -n $(NAMESPACE)
oc create -f ./deploy/crds/integreatly_v1alpha1_postgres_crd.yaml -n $(NAMESPACE)
oc create -f ./deploy/crds/integreatly_v1alpha1_redissnapshot_crd.yaml -n $(NAMESPACE)
oc create -f ./deploy/crds/integreatly_v1alpha1_postgressnapshot_crd.yaml -n $(NAMESPACE)
oc create -f ./deploy/service_account.yaml -n $(NAMESPACE)
oc create -f ./deploy/role.yaml -n $(NAMESPACE)
oc create -f ./deploy/role_binding.yaml -n $(NAMESPACE)
Expand Down Expand Up @@ -117,6 +119,8 @@ cluster/clean:
oc delete -f ./deploy/crds/integreatly_v1alpha1_smtpcredentialset_crd.yaml -n $(NAMESPACE)
oc delete -f ./deploy/crds/integreatly_v1alpha1_redis_crd.yaml -n $(NAMESPACE)
oc delete -f ./deploy/crds/integreatly_v1alpha1_postgres_crd.yaml -n $(NAMESPACE)
oc delete -f ./deploy/crds/integreatly_v1alpha1_redissnapshot_crd.yaml -n $(NAMESPACE)
oc delete -f ./deploy/crds/integreatly_v1alpha1_postgressnapshot_crd.yaml -n $(NAMESPACE)
oc delete -f ./deploy/service_account.yaml -n $(NAMESPACE)
oc delete -f ./deploy/role.yaml -n $(NAMESPACE)
oc delete -f ./deploy/role_binding.yaml -n $(NAMESPACE)
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ Currently AWS resources are deployed into a separate Virtual Private Cloud (VPC)

The two VPCs should now be able to communicate with each other.

## Snapshots
The cloud resource operator supports the taking of arbitrary snapshots in the AWS provider for both `Postgres` and `Redis`. To take a snapshot you must create a `RedisSnapshot` or `PostgresSnapshot` resource, which should reference the `Redis` or `Postgres` resource you wish to create a snapshot of. The snapshot resource must also exist in the same namespace.
```
apiVersion: integreatly.org/v1alpha1
kind: RedisSnapshot
metadata:
name: my-redis-snapshot
spec:
# The redis resource name for the snapshot you want to take
resourceName: my-redis-resource
```
*Note* You may experience some downtime in the resource during the creation of the Snapshot

## Skip Create
The cloud resource operator continuously reconciles using the strat-config as a source of truth for the current state of the provisioned resources. Should these resources alter from the expected the state the operator will update the resources to match the expected state.

Expand Down
7 changes: 7 additions & 0 deletions deploy/crds/integreatly_v1alpha1_postgressnapshot_cr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: integreatly.org/v1alpha1
kind: PostgresSnapshot
metadata:
name: example-postgressnapshot
spec:
# The postgres resource name for the snapshot you want to take
resourceName: REPLACE_ME
52 changes: 52 additions & 0 deletions deploy/crds/integreatly_v1alpha1_postgressnapshot_crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: postgressnapshots.integreatly.org
spec:
group: integreatly.org
names:
kind: PostgresSnapshot
listKind: PostgresSnapshotList
plural: postgressnapshots
singular: postgressnapshot
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
resourceName:
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
Important: Run "operator-sdk generate k8s" to regenerate code after
modifying this file Add custom validation using kubebuilder tags:
https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html'
type: string
required:
- resourceName
type: object
status:
properties:
message:
type: string
phase:
type: string
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
7 changes: 7 additions & 0 deletions deploy/crds/integreatly_v1alpha1_redissnapshot_cr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: integreatly.org/v1alpha1
kind: RedisSnapshot
metadata:
name: example-redissnapshot
spec:
# The redis resource name for the snapshot you want to take
resourceName: REPLACE_ME
52 changes: 52 additions & 0 deletions deploy/crds/integreatly_v1alpha1_redissnapshot_crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: redissnapshots.integreatly.org
spec:
group: integreatly.org
names:
kind: RedisSnapshot
listKind: RedisSnapshotList
plural: redissnapshots
singular: redissnapshot
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
resourceName:
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
Important: Run "operator-sdk generate k8s" to regenerate code after
modifying this file Add custom validation using kubebuilder tags:
https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html'
type: string
required:
- resourceName
type: object
status:
properties:
message:
type: string
phase:
type: string
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: blobstorages.integreatly.org
spec:
group: integreatly.org
names:
kind: BlobStorage
listKind: BlobStorageList
plural: blobstorages
singular: blobstorage
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
secretRef:
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
skipCreate:
type: boolean
tier:
type: string
type:
type: string
required:
- type
- tier
- secretRef
type: object
status:
properties:
message:
type: string
phase:
type: string
provider:
type: string
secretRef:
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
strategy:
type: string
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: postgres.integreatly.org
spec:
group: integreatly.org
names:
kind: Postgres
listKind: PostgresList
plural: postgres
singular: postgres
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
secretRef:
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
skipCreate:
type: boolean
tier:
type: string
type:
type: string
required:
- type
- tier
- secretRef
type: object
status:
properties:
message:
type: string
phase:
type: string
provider:
type: string
secretRef:
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
strategy:
type: string
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: postgressnapshots.integreatly.org
spec:
group: integreatly.org
names:
kind: PostgresSnapshot
listKind: PostgresSnapshotList
plural: postgressnapshots
singular: postgressnapshot
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
resourceName:
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
Important: Run "operator-sdk generate k8s" to regenerate code after
modifying this file Add custom validation using kubebuilder tags:
https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html'
type: string
required:
- resourceName
type: object
status:
properties:
message:
type: string
phase:
type: string
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
Loading

0 comments on commit 31c13db

Please sign in to comment.