Skip to content

Commit

Permalink
Merge pull request #671 from integr8ly/mgdapi-3425-gcp
Browse files Browse the repository at this point in the history
MGDAPI-5372 - Add GCP Support
  • Loading branch information
openshift-merge-robot authored Mar 23, 2023
2 parents f2bab57 + 4a31dcd commit 21edd76
Show file tree
Hide file tree
Showing 947 changed files with 457,523 additions and 21,599 deletions.
1 change: 1 addition & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ coverage:
- "**/*_moq.go"
- "pkg/providers/types.go"
- "pkg/client/fake"
- "pkg/providers/gcp/gcpiface"

status:
project:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
build/_output
build/_test
TMP_SA_KUBECONFIG

# gcp creds
creds.json

# Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode
### Emacs ###
# -*- mode: gitignore; -*-
Expand Down
47 changes: 18 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ UPGRADE ?= true
CHANNEL ?= rhmi
REDIS_NODE_SIZE ?= ""
REDIS_NAME ?= example-redis
# openshift/aws/gcp
PROVIDER ?= openshift

SHELL=/bin/bash

Expand Down Expand Up @@ -91,40 +93,27 @@ cluster/prepare: kustomize setup/service_account
-oc new-project $(NAMESPACE) || true
-oc label namespace $(NAMESPACE) monitoring-key=middleware
-oc apply -f ./config/samples/cloud_resource_config.yaml -n $(NAMESPACE)
-oc apply -f ./config/samples/cloud_resource_openshift_strategies.yaml -n $(NAMESPACE)
-oc apply -f ./config/samples/cloud_resources_aws_strategies.yaml -n $(NAMESPACE)
-oc apply -f ./config/samples/cloud_resources_$(PROVIDER)_strategies.yaml -n $(NAMESPACE)
$(KUSTOMIZE) build config/crd | oc apply -f -

.PHONY: cluster/seed/workshop/blobstorage
cluster/seed/workshop/blobstorage:
@cat config/samples/integreatly_v1alpha1_blobstorage.yaml | sed "s/type: REPLACE_ME/type: workshop/g" | oc apply -f - -n $(NAMESPACE)
.PHONY: cluster/seed/blobstorage
cluster/seed/blobstorage:
@cat config/samples/integreatly_v1alpha1_blobstorage.yaml | sed "s/type: REPLACE_ME/type: $(PROVIDER)/g" | oc apply -f - -n $(NAMESPACE)

.PHONY: cluster/seed/managed/blobstorage
cluster/seed/managed/blobstorage:
@cat config/samples/integreatly_v1alpha1_blobstorage.yaml | sed "s/type: REPLACE_ME/type: managed/g" | oc apply -f - -n $(NAMESPACE)
.PHONY: cluster/seed/redis
cluster/seed/redis:
@cat config/samples/integreatly_v1alpha1_redis.yaml | sed "s/name: REPLACE_ME/name: $(REDIS_NAME)/g" | sed "s/type: REPLACE_ME/type: $(PROVIDER)/g" | sed "s/size: REPLACE_ME/size: $(REDIS_NODE_SIZE)/g" | oc apply -f - -n $(NAMESPACE)

.PHONY: cluster/seed/workshop/redis
cluster/seed/workshop/redis:
@cat config/samples/integreatly_v1alpha1_redis.yaml | sed "s/name: REPLACE_ME/name: $(REDIS_NAME)/g" | sed "s/type: REPLACE_ME/type: workshop/g" | sed "s/size: REPLACE_ME/size: $(REDIS_NODE_SIZE)/g" | oc apply -f - -n $(NAMESPACE)

.PHONY: cluster/seed/managed/redis
cluster/seed/managed/redis:
@cat config/samples/integreatly_v1alpha1_redis.yaml | sed "s/name: REPLACE_ME/name: $(REDIS_NAME)/g" | sed "s/type: REPLACE_ME/type: managed/g" | sed "s/size: REPLACE_ME/size: $(REDIS_NODE_SIZE)/g" | oc apply -f - -n $(NAMESPACE)

.PHONY: cluster/seed/managed/redissnapshot
cluster/seed/managed/redissnapshot:
.PHONY: cluster/seed/redissnapshot
cluster/seed/redissnapshot:
@cat config/samples/integreatly_v1alpha1_redissnapshot.yaml | sed "s/resourceName: REPLACE_ME/resourceName: example-redis/g" | oc apply -f - -n $(NAMESPACE)

.PHONY: cluster/seed/workshop/postgres
cluster/seed/workshop/postgres:
@cat config/samples/integreatly_v1alpha1_postgres.yaml | sed "s/type: REPLACE_ME/type: workshop/g" | oc apply -f - -n $(NAMESPACE)

.PHONY: cluster/seed/managed/postgres
cluster/seed/managed/postgres:
@cat config/samples/integreatly_v1alpha1_postgres.yaml | sed "s/type: REPLACE_ME/type: managed/g" | oc apply -f - -n $(NAMESPACE)
.PHONY: cluster/seed/postgres
cluster/seed/postgres:
@cat config/samples/integreatly_v1alpha1_postgres.yaml | sed "s/type: REPLACE_ME/type: $(PROVIDER)/g" | oc apply -f - -n $(NAMESPACE)

.PHONY: cluster/seed/managed/postgressnapshot
cluster/seed/managed/postgressnapshot:
.PHONY: cluster/seed/postgressnapshot
cluster/seed/postgressnapshot:
@cat config/samples/integreatly_v1alpha1_postgressnapshot.yaml | sed "s/resourceName: REPLACE_ME/resourceName: example-postgres/g" | oc apply -f - -n $(NAMESPACE)

.PHONY: cluster/clean
Expand Down Expand Up @@ -220,13 +209,13 @@ code/audit:
gosec ./...

.PHONY: code/gen
code/gen: setup/moq vendor/fix apis/integreatly/v1alpha1/zz_generated.deepcopy.go apis/config/v1/zz_generated.deepcopy.go
code/gen: setup/moq vendor/fix apis/integreatly/v1alpha1/zz_generated.deepcopy.go
$(CONTROLLER_GEN) rbac:roleName=manager-role webhook paths="./..."
@go generate ./...

.PHONY: setup/moq
setup/moq:
go install github.com/matryer/moq@v0.2.7
go install github.com/matryer/moq@v0.3.0

.PHONY: create/olm/bundle
create/olm/bundle:
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ The operator expects two configmaps to exist in the namespace it is watching. Th
### Provider configmap
The `cloud-resource-config` configmap defines which provider should be used to provision a specific resource type. Different deployment types can contain different `resource type > provider` mappings.
An example can be seen [here](config/samples/cloud_resource_config.yaml).
For example, a `workshop` deployment type might choose to deploy a Postgres resource type in-cluster (`openshift`), while a `managed` deployment type might choose `AWS` to deploy an RDS instance instead.
For example, a `openshift` deployment type might choose to deploy a Postgres resource type in-cluster (`openshift`), while a `aws` deployment type might choose `AWS` to deploy an RDS instance instead.

### Strategy configmap
A config map object is expected to exist for each provider (Currently `AWS` or `Openshift`) that will be used by the operator.
Expand All @@ -105,7 +105,7 @@ An example of a Postgres custom resource can be seen [here](./config/samples/int
Each custom resource contains:
- A `secretRef`, containing the name of the secret that will be created by the operator with connection details to the resource
- A `tier`, in this case `production`, which means a production worthy Postgres instance will be deployed
- A `type`, in this case `managed`, which will resolve to a cloud provider specified in the `cloud-resource-config` configmap
- A `type`, in this case `openshift`, which will resolve to a cloud provider specified in the `cloud-resource-config` configmap

```yaml
spec:
Expand All @@ -114,8 +114,8 @@ spec:
name: example-postgres-sec
# i want a postgres storage of a development-level tier
tier: production
# i want a postgres storage for the type managed
type: managed
# i want a postgres storage for the type aws
type: aws
```
## Resource tagging
Expand All @@ -124,7 +124,7 @@ Postgres, Redis and Blobstorage resources are tagged with the following key valu
```bash
integreatly.org/clusterID: #clusterid
integreatly.org/product-name: #product name
integreatly.org/resource-type: #managed/workshop
integreatly.org/resource-type: #openshift/aws/gcp
integreatly.org/resource-name: #postgres/redis/blobstorage
```
Expand Down Expand Up @@ -338,7 +338,7 @@ Navigating to **Installed Operators** -> **Cloud Resource Operator** -> **Subscr
- `Provider` - A service on which a resource type is provisioned e.g. `aws`, `openshift`
- `Resource type` - Something that can be requested from the operator via a custom resource e.g. `blobstorage`, `redis`
- `Resource` - The result of a resource type created via a provider e.g. `S3 Bucket`, `Azure Blob`
- `Deployment type` - Groups mappings of resource types to providers (see [here](config/samples/cloud_resource_config.yaml)) e.g. `managed`, `workshop`. This provides a layer of abstraction, which allows the end user to not be concerned with _which_ provider is used to deploy the desired resource.
- `Deployment type` - Groups mappings of resource types to providers (see [here](config/samples/cloud_resource_config.yaml)) e.g. `openshift`, `aws`, `gcp`. This provides a layer of abstraction, which allows the end user to not be concerned with _which_ provider is used to deploy the desired resource.
- `Deployment tier` - Provides a layer of abstraction, which allows the end user to request a resource of a certain level (for example, a `production` worthy Postgres instance), without being concerned with provider-specific deployment details (such as storage capacity, for example).

### Design
Expand Down
4 changes: 2 additions & 2 deletions apis/addtoscheme_integreatly_v1alpha1.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package apis

import (
v1 "github.com/integr8ly/cloud-resource-operator/apis/config/v1"
"github.com/integr8ly/cloud-resource-operator/apis/integreatly/v1alpha1"
configv1 "github.com/openshift/api/config/v1"
creds "github.com/openshift/cloud-credential-operator/pkg/apis/cloudcredential/v1"
)

Expand All @@ -11,6 +11,6 @@ func init() {
AddToSchemes = append(
AddToSchemes,
v1alpha1.SchemeBuilder.AddToScheme,
v1.SchemeBuilder.AddToScheme,
configv1.Install,
creds.AddToScheme)
}
6 changes: 0 additions & 6 deletions apis/config/group.go

This file was deleted.

4 changes: 0 additions & 4 deletions apis/config/v1/doc.go

This file was deleted.

36 changes: 0 additions & 36 deletions apis/config/v1/groupversion_info.go

This file was deleted.

165 changes: 0 additions & 165 deletions apis/config/v1/infrastructure_types.go

This file was deleted.

Loading

0 comments on commit 21edd76

Please sign in to comment.