Skip to content

Commit

Permalink
support for atlas query, status update, OLM basics
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyary committed Apr 28, 2021
1 parent 2714fc1 commit dae65cf
Show file tree
Hide file tree
Showing 25 changed files with 846 additions and 41 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
#
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
# dbaas.redhat.com/dbaas-operator-bundle:$VERSION and dbaas.redhat.com/dbaas-operator-catalog:$VERSION.
IMAGE_TAG_BASE ?= dbaas.redhat.com/dbaas-operator
IMAGE_TAG_BASE ?= quay.io/ecosystem-appeng/dbaas-operator

# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)

# Image URL to use all building/pushing image targets
IMG ?= controller:latest
IMG ?= $(IMAGE_TAG_BASE):latest
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"

Expand Down Expand Up @@ -174,7 +174,7 @@ endif
BUNDLE_IMGS ?= $(BUNDLE_IMG)

# The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0).
CATALOG_IMG ?= $(IMAGE_TAG_BASE)-catalog:v$(VERSION)
CATALOG_IMG ?= $(IMAGE_TAG_BASE)-index:v$(VERSION)

# Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image.
ifneq ($(origin CATALOG_BASE_IMG), undefined)
Expand Down
57 changes: 52 additions & 5 deletions api/v1/dbaasservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,28 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// DBaaSServiceSpec defines the desired state of DBaaSService
type DBaaSServiceSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of DBaaSService. Edit dbaasservice_types.go to remove/update
Foo string `json:"foo,omitempty"`
// Provider is the name of the database provider whom we wish to connect with
Provider DatabaseProvider `json:"provider"`

// CredentialsSecretName indicates the name of the secret storing the vendor-specific connection credentials
CredentialsSecretName string `json:"credentialsSecretName"`

// CredentialsSecretName indicates the namespace of the secret storing the vendor-specific connection credentials
CredentialsSecretNamespace string `json:"credentialsSecretNamespace"`
}

// DBaaSServiceStatus defines the observed state of DBaaSService
type DBaaSServiceStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Projects reflects the list of entities returned from querying the DB provider
Projects []DBaaSProject `json:"projects,omitempty"`
}

//+kubebuilder:object:root=true
Expand All @@ -59,6 +65,47 @@ type DBaaSServiceList struct {
Items []DBaaSService `json:"items"`
}

type DatabaseProvider struct {
Name string `json:"name"`
}

type DBaaSProject struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Clusters []DBaaSCluster `json:"clusters,omitempty"`
Users []DBaaSDatabaseUser `json:"users,omitempty"`
}

type DBaaSProjectList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []DBaaSProject `json:"items"`
}

type DBaaSCluster struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
CloudProviderName string `json:"cloudProvider,omitempty"`
CloudRegion string `json:"cloudRegion,omitempty"`
InstanceSizeName string `json:"instanceSizeName,omitempty"`
}

type DBaaSClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []DBaaSClusterList `json:"items"`
}

type DBaaSDatabaseUser struct {
Name string `json:"name,omitempty"`
}

type DBaaSDatabaseUserList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []DBaaSDatabaseUser `json:"items"`
}

func init() {
SchemeBuilder.Register(&DBaaSService{}, &DBaaSServiceList{})
}
4 changes: 2 additions & 2 deletions api/v1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

// Package v1 contains API Schema definitions for the dbaas v1 API group
//+kubebuilder:object:generate=true
//+groupName=dbaas.dbaas.redhat.com
//+groupName=dbaas.redhat.com
package v1

import (
Expand All @@ -26,7 +26,7 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "dbaas.dbaas.redhat.com", Version: "v1"}
GroupVersion = schema.GroupVersion{Group: "dbaas.redhat.com", Version: "v1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down
150 changes: 149 additions & 1 deletion api/v1/zz_generated.deepcopy.go

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

20 changes: 20 additions & 0 deletions bundle.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM scratch

# Core bundle labels.
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=dbaas-operator
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.6.1+git
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3

# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/

# Copy files to locations specified by labels.
COPY bundle/manifests /manifests/
COPY bundle/metadata /metadata/
COPY bundle/tests/scorecard /tests/scorecard/
41 changes: 41 additions & 0 deletions bundle/manifests/dbaas-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
annotations:
alm-examples: '[]'
capabilities: Basic Install
operators.operatorframework.io/builder: operator-sdk-v1.6.1+git
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
name: dbaas-operator.v0.0.1
namespace: placeholder
spec:
apiservicedefinitions: {}
customresourcedefinitions: {}
description: DBaaS Operator
displayName: DBaaS Operator
icon:
- base64data: ""
mediatype: ""
install:
spec:
deployments: []
strategy: deployment
installModes:
- supported: true
type: OwnNamespace
- supported: false
type: SingleNamespace
- supported: false
type: MultiNamespace
- supported: false
type: AllNamespaces
keywords:
- dbaas
links:
- name: Dbaas Operator
url: https://dbaas-operator.domain
maturity: alpha
provider:
name: Red Hat
url: https://www.redhat.com
version: 0.0.1
14 changes: 14 additions & 0 deletions bundle/metadata/annotations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
annotations:
# Core bundle annotations.
operators.operatorframework.io.bundle.mediatype.v1: registry+v1
operators.operatorframework.io.bundle.manifests.v1: manifests/
operators.operatorframework.io.bundle.metadata.v1: metadata/
operators.operatorframework.io.bundle.package.v1: dbaas-operator
operators.operatorframework.io.bundle.channels.v1: alpha
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.builder: operator-sdk-v1.6.1+git
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3

# Annotations for testing.
operators.operatorframework.io.test.mediatype.v1: scorecard+v1
operators.operatorframework.io.test.config.v1: tests/scorecard/
Loading

0 comments on commit dae65cf

Please sign in to comment.