-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from benjamin-wright/refactor
- Swap out cockroach for standard postgres - Version updates - Simplify generic state management to avoid needing pointer references - Use migrations image, to promote bundling migrations into images instead of loading etcd with them in CRDs - Simplify kube clients and split out resource types into their own packages
- Loading branch information
Showing
102 changed files
with
4,472 additions
and
4,070 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
export KUBECONFIG=$(pwd)/.scratch/kubeconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.scratch | ||
dist | ||
*.tgz | ||
*.tgz | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/benjamin-wright/db-operator/pkg/postgres/config" | ||
"github.com/benjamin-wright/db-operator/pkg/postgres/migrations" | ||
"github.com/rs/zerolog" | ||
"github.com/rs/zerolog/log" | ||
) | ||
|
||
func main() { | ||
zerolog.SetGlobalLevel(zerolog.InfoLevel) | ||
path, ok := os.LookupEnv("POSTGRES_MIGRATIONS_PATH") | ||
if !ok { | ||
path = "/migrations" | ||
} | ||
|
||
log.Info().Msgf("loading migrations from %s", path) | ||
m, err := migrations.LoadMigrations(path) | ||
if err != nil { | ||
log.Fatal().Err(err).Msg("failed to load migrations") | ||
} | ||
|
||
cfg, err := config.FromEnv() | ||
if err != nil { | ||
log.Fatal().Err(err).Msg("failed to load config from env") | ||
} | ||
|
||
client, err := migrations.New(cfg) | ||
if err != nil { | ||
log.Fatal().Err(err).Msg("failed to create client") | ||
} | ||
|
||
log.Info().Msg("initializing client") | ||
err = client.Init() | ||
if err != nil { | ||
log.Fatal().Err(err).Msg("failed to init client") | ||
} | ||
|
||
log.Info().Msg("running migrations") | ||
err = client.Run(m) | ||
if err != nil { | ||
log.Fatal().Err(err).Msg("failed to run migrations") | ||
} | ||
|
||
log.Info().Msg("migrations complete") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
FROM scratch | ||
|
||
COPY app /app | ||
ARG BINARY_NAME | ||
|
||
COPY ${BINARY_NAME} /app | ||
|
||
ENTRYPOINT [ "/app" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.