Skip to content

Commit

Permalink
Merge branch 'master' of github.com:schemahero/schemahero
Browse files Browse the repository at this point in the history
  • Loading branch information
marccampbell committed May 19, 2019
2 parents ded6d93 + b16061e commit 2816f7d
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -22,6 +22,6 @@ after_success:

deploy:
provider: script
script: make docker-login
script: make docker-login snapshot-release
on:
branch: master
2 changes: 1 addition & 1 deletion config/default/manager/manager.yaml
Expand Up @@ -44,7 +44,7 @@ spec:
containers:
- command:
- /manager
image: schemahero/schemahero:latest
image: schemahero/schemahero-manager:latest
imagePullPolicy: Always
name: manager
env:
Expand Down
2 changes: 1 addition & 1 deletion config/default/manager_image_patch.yaml
Expand Up @@ -7,5 +7,5 @@ spec:
template:
spec:
containers:
- image: schemahero/schemahero:latest
- image: schemahero/schemahero-manager:latest
name: manager
2 changes: 1 addition & 1 deletion deploy/.goreleaser.snapshot.yml
Expand Up @@ -48,7 +48,7 @@ archives:
dockers:
- dockerfile: ./deploy/Dockerfile.schemahero
image_templates:
- "schemahero/schemahero-manager:alpha"
- "schemahero/schemahero:alpha"
binaries:
- schemahero
- dockerfile: ./deploy/Dockerfile.manager
Expand Down
24 changes: 24 additions & 0 deletions docs/release/README.md
@@ -0,0 +1,24 @@
# SchemaHero Release Strategy

There are 2 images that are used in the SchemaHero Operator:

schemahero/schemahero and `schemahero/schemahero-manager`.

The -manager image is the controller and manager for the operator. It runs in the cluster and handles the reconciliation of any deployed custom resources. When a database is deployed, the code to connect and monitor the connection is in the schemahero container. Both of these container images are built from this repo.

The reason for this separation is to allow an easy way to run a schemahero binary also. This is useful in dev environment and migrations.

These two images are tagged and released at the same time.

## Alpha

There is an `:alpha` tag of these iamges. This is the latest commit to master. It may or may not be stable. It's not recommded to run `:alpha` on a production system.

## Latest

The `:latest` image points to the last stable release of the images.

## major.minor.patch

The `:x.y.z` tag points to a specific, immutable revision. These are created when a tag is pushed. These are the most stable versions of SchemaHero and recommended to use in production.

6 changes: 6 additions & 0 deletions hack/deps.sh
Expand Up @@ -9,3 +9,9 @@ mv kubebuilder_${version}_linux_${arch} kubebuilder && sudo mv kubebuilder /usr/

# Install kind
GO111MODULE="on" go get -u sigs.k8s.io/kind@65abdce

# Install kustomize
opsys=linux # or darwin, or windows
curl -L -O "https://github.com/kubernetes-sigs/kustomize/releases/download/v2.0.3/kustomize_2.0.3_linux_amd64"
sudo mv kustomize_2.0.3_linux_amd64 /usr/local/bin/kustomize
sudo chmod u+x /usr/local/bin/kustomize
4 changes: 2 additions & 2 deletions integration/Makefile
Expand Up @@ -12,8 +12,8 @@ integration-test-image:
cd .. && curl -sL https://git.io/goreleaser | bash -s -- --snapshot --rm-dist --config deploy/.goreleaser.integration.yml
docker tag schemahero/schemahero:integration-test replreg.is/$(SCHEMAHERO_IMAGE_NAME):1h
docker tag schemahero/schemahero-manager:integration-test replreg.is/$(MANAGER_IMAGE_NAME):1h
docker push replreg.is/$(SCHEMAHERO_IMAGE_NAME):1h
docker push replreg.is/$(MANAGER_IMAGE_NAME):1h
docker push replreg.is/$(SCHEMAHERO_IMAGE_NAME):1h || true
docker push replreg.is/$(MANAGER_IMAGE_NAME):1h || true

.PHONY: build
build: GO111MODULE = "on"
Expand Down
65 changes: 31 additions & 34 deletions pkg/apis/databases/v1alpha1/database_types_test.go
Expand Up @@ -18,41 +18,38 @@ package v1alpha1

import (
"testing"

"github.com/onsi/gomega"
"golang.org/x/net/context"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)

func TestStorageDatabase(t *testing.T) {
key := types.NamespacedName{
Name: "foo",
Namespace: "default",
}
created := &Database{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: "default",
}}
g := gomega.NewGomegaWithT(t)

// Test Create
fetched := &Database{}
g.Expect(c.Create(context.TODO(), created)).NotTo(gomega.HaveOccurred())

g.Expect(c.Get(context.TODO(), key, fetched)).NotTo(gomega.HaveOccurred())
g.Expect(fetched).To(gomega.Equal(created))

// Test Updating the Labels
updated := fetched.DeepCopy()
updated.Labels = map[string]string{"hello": "world"}
g.Expect(c.Update(context.TODO(), updated)).NotTo(gomega.HaveOccurred())

g.Expect(c.Get(context.TODO(), key, fetched)).NotTo(gomega.HaveOccurred())
g.Expect(fetched).To(gomega.Equal(updated))

// Test Delete
g.Expect(c.Delete(context.TODO(), fetched)).NotTo(gomega.HaveOccurred())
g.Expect(c.Get(context.TODO(), key, fetched)).To(gomega.HaveOccurred())
// This test is unreliable because of https://github.com/kubernetes-sigs/kubebuilder/issues/655

// key := types.NamespacedName{
// Name: "foo",
// Namespace: "default",
// }
// created := &Database{
// ObjectMeta: metav1.ObjectMeta{
// Name: "foo",
// Namespace: "default",
// }}
// g := gomega.NewGomegaWithT(t)

// // Test Create
// fetched := &Database{}
// g.Expect(c.Create(context.TODO(), created)).NotTo(gomega.HaveOccurred())

// g.Expect(c.Get(context.TODO(), key, fetched)).NotTo(gomega.HaveOccurred())
// g.Expect(fetched).To(gomega.Equal(created))

// // Test Updating the Labels
// updated := fetched.DeepCopy()
// updated.Labels = map[string]string{"hello": "world"}
// g.Expect(c.Update(context.TODO(), updated)).NotTo(gomega.HaveOccurred())

// g.Expect(c.Get(context.TODO(), key, fetched)).NotTo(gomega.HaveOccurred())
// g.Expect(fetched).To(gomega.Equal(updated))

// // Test Delete
// g.Expect(c.Delete(context.TODO(), fetched)).NotTo(gomega.HaveOccurred())
// g.Expect(c.Get(context.TODO(), key, fetched)).To(gomega.HaveOccurred())
}
2 changes: 1 addition & 1 deletion pkg/controller/database/postgres.go
Expand Up @@ -13,7 +13,7 @@ import (
)

func (r *ReconcileDatabase) ensurePostgresWatch(instance *databasesv1alpha1.Database) error {
imageName := "schemahero/schemahero"
imageName := "schemahero/schemahero:alpha"
if instance.SchemaHero != nil {
if instance.SchemaHero.Image != "" {
imageName = instance.SchemaHero.Image
Expand Down

0 comments on commit 2816f7d

Please sign in to comment.