From a18fb2c812ddb5859ee4b8c8fdc6419d84a2da74 Mon Sep 17 00:00:00 2001 From: Eric Sauer Date: Wed, 20 Feb 2019 22:28:19 -0500 Subject: [PATCH] Add a build for OpenShift (#13) * Add build workflow * Symlinking main.go * Trying to pull in a tag of operator sdk * Wrapping s2i script * Assemble moved to bin * Add GOBIN * Exit if dep install fails * Managing dependencies differently * trying to install dep with go * Stupid assemble script * Restoring curl command: * be explicit with gobin * Absolute path to dep * Debug * Use upstream assemble * Remove os import * Debug * Debug * Rename output binary * Convert build.yml to template, add deployment * Lock go-config to v0.8.0 * Fix resync misconfiguration * Change gobinary * Lock go-config to 0.7.0 * Change default config from yml to yaml * Improve error output when provider not found * Adding the necessary pieces to run locally * Add namespace param to rbac --- .gitignore | 5 +- .s2i/bin/assemble | 74 ++ Gopkg.lock | 1180 ------------------------------- Gopkg.toml | 8 +- README.adoc | 13 +- {tmp/build => build}/Dockerfile | 0 {tmp/build => build}/build.sh | 0 build/build.yml | 57 ++ cmd/cert-operator/main.go | 4 +- deploy/cr.yaml | 4 - deploy/crd.yaml | 13 - deploy/deployment.yaml | 69 ++ deploy/operator.yaml | 30 - deploy/rbac.yaml | 46 +- main.go | 1 + pkg/certs/main.go | 1 - pkg/stub/config.go | 14 +- pkg/stub/handler.go | 5 +- 18 files changed, 266 insertions(+), 1258 deletions(-) create mode 100644 .s2i/bin/assemble delete mode 100644 Gopkg.lock rename {tmp/build => build}/Dockerfile (100%) rename {tmp/build => build}/build.sh (100%) create mode 100644 build/build.yml delete mode 100644 deploy/cr.yaml delete mode 100644 deploy/crd.yaml create mode 100644 deploy/deployment.yaml delete mode 100644 deploy/operator.yaml create mode 120000 main.go diff --git a/.gitignore b/.gitignore index 19f98cb..e688fb5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,11 @@ # Temporary Build Files -tmp/_output -tmp/_test +build/_output +build/_test # Build dependencies vendor/ +Gopkg.lock # Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode diff --git a/.s2i/bin/assemble b/.s2i/bin/assemble new file mode 100644 index 0000000..a7bced2 --- /dev/null +++ b/.s2i/bin/assemble @@ -0,0 +1,74 @@ +#!/bin/bash + +# Install dep +export GOBIN=/opt/app-root/src/go/bin +mkdir -p $GOBIN +curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + +set -e + +pushd /tmp/src + +if [[ `go list -f {{.Incomplete}}` == "true" ]]; then + + INSTALL_URL=${INSTALL_URL:-$IMPORT_URL} + + if [[ ! -z "$IMPORT_URL" ]]; then + + popd + + echo "Assembling GOPATH" + + export GOPATH=`realpath $HOME/go` + + mkdir -p $GOPATH/src/$IMPORT_URL + + mv /tmp/src/* $GOPATH/src/$IMPORT_URL + + if [[ -d /tmp/artifacts/pkg ]]; then + + echo "Restoring previous build artifacts" + + mv /tmp/artifacts/pkg $GOPATH + + fi + + # Resolve dependencies, ignore if vendor present + + if [[ ! -d $GOPATH/src/$INSTALL_URL/vendor ]]; then + + echo "Resolving dependencies" + + pushd $GOPATH/src/$INSTALL_URL + + $GOBIN/dep ensure + + popd + + fi + + # lets build + + pushd $GOPATH/src/$INSTALL_URL + + echo "Building" + + go install -i $INSTALL_URL + + mv $GOPATH/bin/$BINARY_NAME /opt/app-root/gobinary + + popd + + exit + + fi + + exec /$STI_SCRIPTS_PATH/usage + +else + + go build -o /opt/app-root/gobinary + + popd + +fi diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index 29cf4aa..0000000 --- a/Gopkg.lock +++ /dev/null @@ -1,1180 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - branch = "master" - digest = "1:31d79eb3c6dc171d19c2cbd9800f3a9927dbcd7072df213716f411a712b99e01" - name = "bitbucket.org/atlassian/go-stride" - packages = ["pkg/stride"] - pruneopts = "" - revision = "78855f0a5d80b2683b11f3825a580a87e32a9f71" - -[[projects]] - digest = "1:289dd4d7abfb3ad2b5f728fbe9b1d5c1bf7d265a3eb9ef92869af1f7baba4c7a" - name = "github.com/BurntSushi/toml" - packages = ["."] - pruneopts = "" - revision = "b26d9c308763d68093482582cea63d69be07a0f0" - version = "v0.3.0" - -[[projects]] - branch = "master" - digest = "1:70608f7d47eeac2ca5ac53a98fd5cac9a4043555b1246fe2e29434d4670fcdcf" - name = "github.com/Gl4di4torRr/cert-operator" - packages = [ - "pkg/certs", - "pkg/notifier", - "pkg/notifier/slack", - "pkg/stub", - ] - pruneopts = "" - revision = "44206c8d93e98324d50fc93a8567846235d7c0bc" - -[[projects]] - digest = "1:8e47871087b94913898333f37af26732faaab30cdb41571136cf7aec9921dae7" - name = "github.com/PuerkitoBio/purell" - packages = ["."] - pruneopts = "" - revision = "0bcb03f4b4d0a9428594752bd2a3b9aa0a9d4bd4" - version = "v1.1.0" - -[[projects]] - branch = "master" - digest = "1:331a419049c2be691e5ba1d24342fc77c7e767a80c666a18fd8a9f7b82419c1c" - name = "github.com/PuerkitoBio/urlesc" - packages = ["."] - pruneopts = "" - revision = "de5bf2ad457846296e2031421a34e2568e304e35" - -[[projects]] - branch = "TPPSupport" - digest = "1:2460f1fa2e3e2cb75596b2e8198dec398669a7cd5925f5c7484a67296b01c80e" - name = "github.com/Venafi/govcert" - packages = [ - ".", - "embedded", - ] - pruneopts = "" - revision = "befc969237f37abd8ee9239dc2f6c6c996435dd1" - -[[projects]] - digest = "1:61c24bdb660a326b420d5422c4fd124041b4aac88e212c6ac75f3a57b0b9cada" - name = "github.com/agext/levenshtein" - packages = ["."] - pruneopts = "" - revision = "5f10fee965225ac1eecdc234c09daf5cd9e7f7b6" - version = "v1.2.1" - -[[projects]] - digest = "1:61b332fe3705f6309641695e2796582953eae64fdcc21c42701e5ebfde4b4c5f" - name = "github.com/apparentlymart/go-cidr" - packages = ["cidr"] - pruneopts = "" - revision = "b1115bf8e14a60131a196f908223e4506b0ddc35" - version = "v1.0.0" - -[[projects]] - digest = "1:88582b880b0505525e5df57a02651688aecd489c7919f8a642d9a092e282d24a" - name = "github.com/apparentlymart/go-textseg" - packages = ["textseg"] - pruneopts = "" - revision = "fb01f485ebef760e5ee06d55e1b07534dda2d295" - version = "v1.0.0" - -[[projects]] - branch = "master" - digest = "1:6154f2269b43b001bd4a213f957b90d2da26eb9648820981e2e79147231010fd" - name = "github.com/appscode/envconfig" - packages = ["."] - pruneopts = "" - revision = "183bbe643a2875eaa69c85627ac6b25813983203" - -[[projects]] - digest = "1:5680f8c40e48f07cb77aece3165a866aaf8276305258b3b70db8ec7ad6ddb78d" - name = "github.com/armon/go-radix" - packages = ["."] - pruneopts = "" - revision = "1a2de0c21c94309923825da3df33a4381872c795" - version = "v1.0.0" - -[[projects]] - digest = "1:4f4796d7e6e8a6c1b4d91d0c8a60e2a1b7420ab5148655635e807eaab3ee5ed9" - name = "github.com/aws/aws-sdk-go" - packages = [ - "aws", - "aws/awserr", - "aws/awsutil", - "aws/client", - "aws/client/metadata", - "aws/corehandlers", - "aws/credentials", - "aws/credentials/ec2rolecreds", - "aws/credentials/endpointcreds", - "aws/credentials/stscreds", - "aws/csm", - "aws/defaults", - "aws/ec2metadata", - "aws/endpoints", - "aws/request", - "aws/session", - "aws/signer/v4", - "internal/s3err", - "internal/sdkio", - "internal/sdkrand", - "internal/sdkuri", - "internal/shareddefaults", - "private/protocol", - "private/protocol/eventstream", - "private/protocol/eventstream/eventstreamapi", - "private/protocol/query", - "private/protocol/query/queryutil", - "private/protocol/rest", - "private/protocol/restxml", - "private/protocol/xml/xmlutil", - "service/s3", - "service/sts", - ] - pruneopts = "" - revision = "572272ee7c4503c8a32f79ec16b959c9e8a211c3" - version = "v1.15.55" - -[[projects]] - branch = "master" - digest = "1:c0bec5f9b98d0bc872ff5e834fac186b807b656683bd29cb82fb207a1513fabb" - name = "github.com/beorn7/perks" - packages = ["quantile"] - pruneopts = "" - revision = "3a771d992973f24aa725d07868b467d1ddfceafb" - -[[projects]] - branch = "master" - digest = "1:98e84060475ed245c3b355042afd43a74aa7d32efe50658f4f995977916f9fc3" - name = "github.com/bgentry/go-netrc" - packages = ["netrc"] - pruneopts = "" - revision = "9fd32a8b3d3d3f9d43c341bfe098430e07609480" - -[[projects]] - digest = "1:15ceb8ca7a71db4c426d8aef1909ea074f6840efa163490bb2798f475624e4ae" - name = "github.com/bgentry/speakeasy" - packages = ["."] - pruneopts = "" - revision = "4aabc24848ce5fd31929f7d1e4ea74d3709c14cd" - version = "v0.1.0" - -[[projects]] - digest = "1:512883404c2a99156e410e9880e3bb35ecccc0c07c1159eb204b5f3ef3c431b3" - name = "github.com/bitly/go-simplejson" - packages = ["."] - pruneopts = "" - revision = "aabad6e819789e569bd6aabf444c935aa9ba1e44" - version = "v0.5.0" - -[[projects]] - digest = "1:79421244ba5848aae4b0a5c41e633a04e4894cb0b164a219dc8c15ec7facb7f1" - name = "github.com/blang/semver" - packages = ["."] - pruneopts = "" - revision = "2ee87856327ba09384cabd113bc6b5d174e9ec0f" - version = "v3.5.1" - -[[projects]] - digest = "1:56c130d885a4aacae1dd9c7b71cfe39912c7ebc1ff7d2b46083c8812996dc43b" - name = "github.com/davecgh/go-spew" - packages = ["spew"] - pruneopts = "" - revision = "346938d642f2ec3594ed81d874461961cd0faa76" - version = "v1.1.0" - -[[projects]] - digest = "1:6098222470fe0172157ce9bbef5d2200df4edde17ee649c5d6e48330e4afa4c6" - name = "github.com/dgrijalva/jwt-go" - packages = ["."] - pruneopts = "" - revision = "06ea1031745cb8b3dab3f6a236daf2b0aa468b7e" - version = "v3.2.0" - -[[projects]] - digest = "1:8a34d7a37b8f07239487752e14a5faafcbbc718fc385ad429a2c4ac6f27a207f" - name = "github.com/emicklei/go-restful" - packages = [ - ".", - "log", - ] - pruneopts = "" - revision = "3eb9738c1697594ea6e71a7156a9bb32ed216cf0" - version = "v2.8.0" - -[[projects]] - digest = "1:e988ed0ca0d81f4d28772760c02ee95084961311291bdfefc1b04617c178b722" - name = "github.com/fatih/color" - packages = ["."] - pruneopts = "" - revision = "5b77d2a35fb0ede96d138fc9a99f5c9b6aef11b4" - version = "v1.7.0" - -[[projects]] - digest = "1:eb53021a8aa3f599d29c7102e65026242bdedce998a54837dc67f14b6a97c5fd" - name = "github.com/fsnotify/fsnotify" - packages = ["."] - pruneopts = "" - revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9" - version = "v1.4.7" - -[[projects]] - digest = "1:b13707423743d41665fd23f0c36b2f37bb49c30e94adb813319c44188a51ba22" - name = "github.com/ghodss/yaml" - packages = ["."] - pruneopts = "" - revision = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7" - version = "v1.0.0" - -[[projects]] - digest = "1:736253aac975cfc002b3c74034b8ff6becac84ed92e91b6147f6703834b890cc" - name = "github.com/go-ini/ini" - packages = ["."] - pruneopts = "" - revision = "9c8236e659b76e87bf02044d06fde8683008ff3e" - version = "v1.39.0" - -[[projects]] - digest = "1:e116a4866bffeec941056a1fcfd37e520fad1ee60e4e3579719f19a43c392e10" - name = "github.com/go-openapi/jsonpointer" - packages = ["."] - pruneopts = "" - revision = "3a0015ad55fa9873f41605d3e8f28cd279c32ab2" - version = "0.15.0" - -[[projects]] - digest = "1:3830527ef0f4f9b268d9286661c0f52f9115f8aefd9f45ee7352516f93489ac9" - name = "github.com/go-openapi/jsonreference" - packages = ["."] - pruneopts = "" - revision = "3fb327e6747da3043567ee86abd02bb6376b6be2" - version = "0.15.0" - -[[projects]] - digest = "1:6caee195f5da296689270037c5a25c0bc3cc6e54ae5a356e395aa8946356dbc9" - name = "github.com/go-openapi/spec" - packages = ["."] - pruneopts = "" - revision = "bce47c9386f9ecd6b86f450478a80103c3fe1402" - version = "0.15.0" - -[[projects]] - digest = "1:22da48dbccb0539f511efbbbdeba68081866892234e57a9d7c7f9848168ae30c" - name = "github.com/go-openapi/swag" - packages = ["."] - pruneopts = "" - revision = "2b0bd4f193d011c203529df626a65d63cb8a79e8" - version = "0.15.0" - -[[projects]] - digest = "1:6e73003ecd35f4487a5e88270d3ca0a81bc80dc88053ac7e4dcfec5fba30d918" - name = "github.com/gogo/protobuf" - packages = [ - "proto", - "sortkeys", - ] - pruneopts = "" - revision = "636bf0302bc95575d69441b25a2603156ffdddf1" - version = "v1.1.1" - -[[projects]] - branch = "master" - digest = "1:107b233e45174dbab5b1324201d092ea9448e58243ab9f039e4c0f332e121e3a" - name = "github.com/golang/glog" - packages = ["."] - pruneopts = "" - revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" - -[[projects]] - digest = "1:f958a1c137db276e52f0b50efee41a1a389dcdded59a69711f3e872757dab34b" - name = "github.com/golang/protobuf" - packages = [ - "proto", - "ptypes", - "ptypes/any", - "ptypes/duration", - "ptypes/timestamp", - ] - pruneopts = "" - revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265" - version = "v1.1.0" - -[[projects]] - branch = "master" - digest = "1:be28c0531a755f2178acf1e327e6f5a8a3968feb5f2567cdc968064253141751" - name = "github.com/google/btree" - packages = ["."] - pruneopts = "" - revision = "e89373fe6b4a7413d7acd6da1725b83ef713e6e4" - -[[projects]] - branch = "master" - digest = "1:754f77e9c839b24778a4b64422236d38515301d2baeb63113aa3edc42e6af692" - name = "github.com/google/gofuzz" - packages = ["."] - pruneopts = "" - revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1" - -[[projects]] - digest = "1:16b2837c8b3cf045fa2cdc82af0cf78b19582701394484ae76b2c3bc3c99ad73" - name = "github.com/googleapis/gnostic" - packages = [ - "OpenAPIv2", - "compiler", - "extensions", - ] - pruneopts = "" - revision = "7c663266750e7d82587642f65e60bc4083f1f84e" - version = "v0.2.0" - -[[projects]] - branch = "master" - digest = "1:009a1928b8c096338b68b5822d838a72b4d8520715c1463614476359f3282ec8" - name = "github.com/gregjones/httpcache" - packages = [ - ".", - "diskcache", - ] - pruneopts = "" - revision = "9cad4c3443a7200dd6400aef47183728de563a38" - -[[projects]] - digest = "1:8e3bd93036b4a925fe2250d3e4f38f21cadb8ef623561cd80c3c50c114b13201" - name = "github.com/hashicorp/errwrap" - packages = ["."] - pruneopts = "" - revision = "8a6fb523712970c966eefc6b39ed2c5e74880354" - version = "v1.0.0" - -[[projects]] - digest = "1:05334858a0cfb538622a066e065287f63f42bee26a7fda93a789674225057201" - name = "github.com/hashicorp/go-cleanhttp" - packages = ["."] - pruneopts = "" - revision = "e8ab9daed8d1ddd2d3c4efba338fe2eeae2e4f18" - version = "v0.5.0" - -[[projects]] - branch = "master" - digest = "1:fd15b3f6aac9d0fe68c6e38922282e0d2e88cd77b927ac3dd842e363645522c0" - name = "github.com/hashicorp/go-getter" - packages = [ - ".", - "helper/url", - ] - pruneopts = "" - revision = "4bda8fa99001c61db3cad96b421d4c12a81f256d" - -[[projects]] - digest = "1:72308fdd6d5ef61106a95be7ca72349a5565809042b6426a3cfb61d99483b824" - name = "github.com/hashicorp/go-multierror" - packages = ["."] - pruneopts = "" - revision = "886a7fbe3eb1c874d46f623bfa70af45f425b3d1" - version = "v1.0.0" - -[[projects]] - digest = "1:82f6c9a55c0bd9744064418f049d5232bb8b8cc45eb32e72c0adefaf158a0f9b" - name = "github.com/hashicorp/go-safetemp" - packages = ["."] - pruneopts = "" - revision = "c9a55de4fe06c920a71964b53cfe3dd293a3c743" - version = "v1.0.0" - -[[projects]] - digest = "1:d35e07e002ccc51cb01fa77e932ea62206c4d3b2fb0fa1f1b052885942108a96" - name = "github.com/hashicorp/go-uuid" - packages = ["."] - pruneopts = "" - revision = "de160f5c59f693fed329e73e291bb751fe4ea4dc" - version = "v1.0.0" - -[[projects]] - digest = "1:8c7fb7f81c06add10a17362abc1ae569ff9765a26c061c6b6e67c909f4f414db" - name = "github.com/hashicorp/go-version" - packages = ["."] - pruneopts = "" - revision = "b5a281d3160aa11950a6182bd9a9dc2cb1e02d50" - version = "v1.0.0" - -[[projects]] - branch = "master" - digest = "1:9c776d7d9c54b7ed89f119e449983c3f24c0023e75001d6092442412ebca6b94" - name = "github.com/hashicorp/golang-lru" - packages = [ - ".", - "simplelru", - ] - pruneopts = "" - revision = "0fb14efe8c47ae851c0034ed7a448854d3d34cf3" - -[[projects]] - branch = "master" - digest = "1:9b7c5846d70f425d7fe279595e32a20994c6075e87be03b5c367ed07280877c5" - name = "github.com/hashicorp/hcl" - packages = [ - ".", - "hcl/ast", - "hcl/parser", - "hcl/scanner", - "hcl/strconv", - "hcl/token", - "json/parser", - "json/scanner", - "json/token", - ] - pruneopts = "" - revision = "ef8a98b0bbce4a65b5aa4c368430a80ddc533168" - -[[projects]] - branch = "master" - digest = "1:0eab07ac1ecb50b98487702b59951e52a86444aff21db5a77a879055b61f4f82" - name = "github.com/hashicorp/hcl2" - packages = [ - "gohcl", - "hcl", - "hcl/hclsyntax", - "hcl/json", - "hcldec", - "hclparse", - ] - pruneopts = "" - revision = "3e4b7e0eb20ecc20e70dbd458f7a54daf0032830" - -[[projects]] - branch = "master" - digest = "1:f63bbfd54a9ebe0f15cd6597d58f404874fd20739faf56170879767db2fe69dc" - name = "github.com/hashicorp/hil" - packages = [ - ".", - "ast", - "parser", - "scanner", - ] - pruneopts = "" - revision = "fa9f258a92500514cc8e9c67020487709df92432" - -[[projects]] - digest = "1:51430c345f48c781f7f43146b574ec498c62c608bfff3715fef4c915d96ed4fc" - name = "github.com/hashicorp/logutils" - packages = ["."] - pruneopts = "" - revision = "a335183dfd075f638afcc820c90591ca3c97eba6" - version = "v1.0.0" - -[[projects]] - digest = "1:295d49be7c3c235ff597ace40c0662d2c2e715d126cebfb238b5d84cb95c6479" - name = "github.com/hashicorp/terraform" - packages = [ - "config", - "config/configschema", - "config/hcl2shim", - "config/module", - "dag", - "flatmap", - "helper/config", - "helper/hilmapstructure", - "helper/logging", - "helper/resource", - "httpclient", - "moduledeps", - "plugin/discovery", - "registry", - "registry/regsrc", - "registry/response", - "svchost", - "svchost/auth", - "svchost/disco", - "terraform", - "tfdiags", - "version", - ] - pruneopts = "" - revision = "6dfc4d748de9cda23835bc5704307ed45e839622" - version = "v0.11.8" - -[[projects]] - branch = "master" - digest = "1:f81c8d7354cc0c6340f2f7a48724ee6c2b3db3e918ecd441c985b4d2d97dd3e7" - name = "github.com/howeyc/gopass" - packages = ["."] - pruneopts = "" - revision = "bf9dde6d0d2c004a008c27aaee91170c786f6db8" - -[[projects]] - digest = "1:302c6eb8e669c997bec516a138b8fc496018faa1ece4c13e445a2749fbe079bb" - name = "github.com/imdario/mergo" - packages = ["."] - pruneopts = "" - revision = "9316a62528ac99aaecb4e47eadd6dc8aa6533d58" - version = "v0.3.5" - -[[projects]] - digest = "1:6f49eae0c1e5dab1dafafee34b207aeb7a42303105960944828c2079b92fc88e" - name = "github.com/jmespath/go-jmespath" - packages = ["."] - pruneopts = "" - revision = "0b12d6b5" - -[[projects]] - digest = "1:53ac4e911e12dde0ab68655e2006449d207a5a681f084974da2b06e5dbeaca72" - name = "github.com/json-iterator/go" - packages = ["."] - pruneopts = "" - revision = "ab8a2e0c74be9d3be70b3184d9acc634935ded82" - version = "1.1.4" - -[[projects]] - digest = "1:d26c006cbf54ca5c040463d5678013169e2bd91fb62c2f960ae283a1723d4278" - name = "github.com/juju/ratelimit" - packages = ["."] - pruneopts = "" - revision = "59fac5042749a5afb9af70e813da1dd5474f0167" - version = "1.0.1" - -[[projects]] - branch = "master" - digest = "1:7e9956922e349af0190afa0b6621befcd201072679d8e51a9047ff149f2afe93" - name = "github.com/mailru/easyjson" - packages = [ - "buffer", - "jlexer", - "jwriter", - ] - pruneopts = "" - revision = "efc7eb8984d6655c26b5c9d2e65c024e5767c37c" - -[[projects]] - digest = "1:9ea83adf8e96d6304f394d40436f2eb44c1dc3250d223b74088cc253a6cd0a1c" - name = "github.com/mattn/go-colorable" - packages = ["."] - pruneopts = "" - revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072" - version = "v0.0.9" - -[[projects]] - digest = "1:3140e04675a6a91d2a20ea9d10bdadf6072085502e6def6768361260aee4b967" - name = "github.com/mattn/go-isatty" - packages = ["."] - pruneopts = "" - revision = "6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c" - version = "v0.0.4" - -[[projects]] - digest = "1:63722a4b1e1717be7b98fc686e0b30d5e7f734b9e93d7dee86293b6deab7ea28" - name = "github.com/matttproud/golang_protobuf_extensions" - packages = ["pbutil"] - pruneopts = "" - revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c" - version = "v1.0.1" - -[[projects]] - digest = "1:5402d13e9e94c3c56445a17355d0d250cd79f6397854f3ab77d82131f6899ef0" - name = "github.com/micro/go-config" - packages = [ - ".", - "encoder", - "encoder/hcl", - "encoder/json", - "encoder/toml", - "encoder/xml", - "encoder/yaml", - "reader", - "reader/json", - "source", - "source/env", - "source/file", - "source/flag", - "source/memory", - ] - pruneopts = "" - revision = "3904282c3ef78454df3c3c0b880fb780778ad16a" - version = "v0.7.0" - -[[projects]] - digest = "1:bb7613fa9de3f211f6f09630e6c0a493285c1d2a162abf0d617bd522c3dd622a" - name = "github.com/mitchellh/cli" - packages = ["."] - pruneopts = "" - revision = "3d22a244be8aa6fb16ac24af0e195c08b7d973aa" - version = "v1.0.0" - -[[projects]] - digest = "1:ddc46aaac89d6465fd0b5fd13ab1931d0ff5c2863937e9fccdbc14c991b50c06" - name = "github.com/mitchellh/copystructure" - packages = ["."] - pruneopts = "" - revision = "9a1b6f44e8da0e0e374624fb0a825a231b00c537" - version = "v1.0.0" - -[[projects]] - digest = "1:096a8a9182648da3d00ff243b88407838902b6703fc12657f76890e08d1899bf" - name = "github.com/mitchellh/go-homedir" - packages = ["."] - pruneopts = "" - revision = "ae18d6b8b3205b561c79e8e5f69bff09736185f4" - version = "v1.0.0" - -[[projects]] - digest = "1:9adf43f9a17af07a6d587e3b493e2111ad8e07283d5cd58e44e70d23bf6dc644" - name = "github.com/mitchellh/go-testing-interface" - packages = ["."] - pruneopts = "" - revision = "6d0b8010fcc857872e42fc6c931227569016843c" - version = "v1.0.0" - -[[projects]] - digest = "1:713b341855f1480e4baca1e7c5434e1d266441340685ecbde32d59bdc065fb3f" - name = "github.com/mitchellh/go-wordwrap" - packages = ["."] - pruneopts = "" - revision = "9e67c67572bc5dd02aef930e2b0ae3c02a4b5a5c" - version = "v1.0.0" - -[[projects]] - digest = "1:387d79bfe8a4f0f300a22d65782108a94861eecfe652ffff30e8f91857ad81bb" - name = "github.com/mitchellh/hashstructure" - packages = ["."] - pruneopts = "" - revision = "a38c50148365edc8df43c1580c48fb2b3a1e9cd7" - version = "v1.0.0" - -[[projects]] - digest = "1:bcc46a0fbd9e933087bef394871256b5c60269575bb661935874729c65bbbf60" - name = "github.com/mitchellh/mapstructure" - packages = ["."] - pruneopts = "" - revision = "3536a929edddb9a5b34bd6861dc4a9647cb459fe" - version = "v1.1.2" - -[[projects]] - digest = "1:5584c8fba4fbaac85a65c9b86320fdfb6fdd5ce86b3f8fd7ddb5082d20567bd3" - name = "github.com/mitchellh/reflectwalk" - packages = ["."] - pruneopts = "" - revision = "eecee6c969c02c8cc2ae48e1e269843ae8590796" - version = "v1.0.0" - -[[projects]] - digest = "1:0c0ff2a89c1bb0d01887e1dac043ad7efbf3ec77482ef058ac423d13497e16fd" - name = "github.com/modern-go/concurrent" - packages = ["."] - pruneopts = "" - revision = "bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94" - version = "1.0.3" - -[[projects]] - digest = "1:e32bdbdb7c377a07a9a46378290059822efdce5c8d96fe71940d87cb4f918855" - name = "github.com/modern-go/reflect2" - packages = ["."] - pruneopts = "" - revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd" - version = "1.0.1" - -[[projects]] - digest = "1:8aeb4a73c41fd79a868943af3319dc9472172b21063deff6b4391872139f7728" - name = "github.com/openshift/api" - packages = ["route/v1"] - pruneopts = "" - revision = "0d921e363e951d89f583292c60d013c318df64dc" - version = "v3.9.0" - -[[projects]] - branch = "master" - digest = "1:fb45019d6126f1505ec28525f5114aa5b642e5fbca3eea9560d92faf7c622ab5" - name = "github.com/operator-framework/operator-sdk" - packages = [ - "pkg/k8sclient", - "pkg/sdk", - "pkg/util/k8sutil", - "version", - ] - pruneopts = "" - revision = "3ac731fc3bea56e357d3596f014ac5bb4a13a0bc" - -[[projects]] - digest = "1:63e142fc50307bcb3c57494913cfc9c12f6061160bdf97a678f78c71615f939b" - name = "github.com/pborman/uuid" - packages = ["."] - pruneopts = "" - revision = "e790cca94e6cc75c7064b1332e63811d4aae1a53" - version = "v1.1" - -[[projects]] - branch = "master" - digest = "1:c24598ffeadd2762552269271b3b1510df2d83ee6696c1e543a0ff653af494bc" - name = "github.com/petar/GoLLRB" - packages = ["llrb"] - pruneopts = "" - revision = "53be0d36a84c2a886ca057d34b6aa4468df9ccb4" - -[[projects]] - digest = "1:b46305723171710475f2dd37547edd57b67b9de9f2a6267cafdd98331fd6897f" - name = "github.com/peterbourgon/diskv" - packages = ["."] - pruneopts = "" - revision = "5f041e8faa004a95c88a202771f4cc3e991971e6" - version = "v2.0.1" - -[[projects]] - digest = "1:7365acd48986e205ccb8652cc746f09c8b7876030d53710ea6ef7d0bd0dcd7ca" - name = "github.com/pkg/errors" - packages = ["."] - pruneopts = "" - revision = "645ef00459ed84a119197bfb8d8205042c6df63d" - version = "v0.8.0" - -[[projects]] - digest = "1:f9a9cfc677652370ee728e544cc42810e5f7628ba511ae247fce94e64474bfa6" - name = "github.com/posener/complete" - packages = [ - ".", - "cmd", - "cmd/install", - "match", - ] - pruneopts = "" - revision = "dcda3199365ca2a5f24aea4c42aa56f6a197d117" - version = "v1.1.2" - -[[projects]] - digest = "1:4142d94383572e74b42352273652c62afec5b23f325222ed09198f46009022d1" - name = "github.com/prometheus/client_golang" - packages = [ - "prometheus", - "prometheus/promhttp", - ] - pruneopts = "" - revision = "c5b7fccd204277076155f10851dad72b76a49317" - version = "v0.8.0" - -[[projects]] - branch = "master" - digest = "1:185cf55b1f44a1bf243558901c3f06efa5c64ba62cfdcbb1bf7bbe8c3fb68561" - name = "github.com/prometheus/client_model" - packages = ["go"] - pruneopts = "" - revision = "5c3871d89910bfb32f5fcab2aa4b9ec68e65a99f" - -[[projects]] - branch = "master" - digest = "1:bfbc121ef802d245ef67421cff206615357d9202337a3d492b8f668906b485a8" - name = "github.com/prometheus/common" - packages = [ - "expfmt", - "internal/bitbucket.org/ww/goautoneg", - "model", - ] - pruneopts = "" - revision = "7600349dcfe1abd18d72d3a1770870d9800a7801" - -[[projects]] - branch = "master" - digest = "1:b694a6bdecdace488f507cff872b30f6f490fdaf988abd74d87ea56406b23b6e" - name = "github.com/prometheus/procfs" - packages = [ - ".", - "internal/util", - "nfs", - "xfs", - ] - pruneopts = "" - revision = "ae68e2d4c00fed4943b5f6698d504a5fe083da8a" - -[[projects]] - digest = "1:aed55b9be75ddc9942b4a19c2ca3c43d7c9d3f3c6b1ff372b0728c4df4037e6a" - name = "github.com/rs/zerolog" - packages = [ - ".", - "internal/cbor", - "internal/json", - "log", - ] - pruneopts = "" - revision = "77db4b4f350e31be66a57c332acb7721cf9ff9bb" - version = "v1.8.0" - -[[projects]] - digest = "1:8cf46b6c18a91068d446e26b67512cf16f1540b45d90b28b9533706a127f0ca6" - name = "github.com/sirupsen/logrus" - packages = ["."] - pruneopts = "" - revision = "c155da19408a8799da419ed3eeb0cb5db0ad5dbc" - version = "v1.0.5" - -[[projects]] - digest = "1:8e243c568f36b09031ec18dff5f7d2769dcf5ca4d624ea511c8e3197dc3d352d" - name = "github.com/spf13/pflag" - packages = ["."] - pruneopts = "" - revision = "583c0c0531f06d5278b7d917446061adc344b5cd" - version = "v1.0.1" - -[[projects]] - digest = "1:ee723e6a1962a196eeba1b24f82af61a4f60f8821d7aa96d48e787f8337bcffc" - name = "github.com/ulikunitz/xz" - packages = [ - ".", - "internal/hash", - "internal/xlog", - "lzma", - ] - pruneopts = "" - revision = "0c6b41e72360850ca4f98dc341fd999726ea007f" - version = "v0.5.4" - -[[projects]] - branch = "master" - digest = "1:05dcaab9f0a56047ec8180cce47f0905006db1e5709e2eeaae81c90244a86ff3" - name = "github.com/zclconf/go-cty" - packages = [ - "cty", - "cty/convert", - "cty/function", - "cty/function/stdlib", - "cty/gocty", - "cty/json", - "cty/set", - ] - pruneopts = "" - revision = "1f835aab79c29c842f2e8624541053e8ff618cd8" - -[[projects]] - branch = "master" - digest = "1:0773b5c3be42874166670a20aa177872edb450cd9fc70b1df97303d977702a50" - name = "golang.org/x/crypto" - packages = [ - "bcrypt", - "blowfish", - "cast5", - "openpgp", - "openpgp/armor", - "openpgp/elgamal", - "openpgp/errors", - "openpgp/packet", - "openpgp/s2k", - "ssh/terminal", - ] - pruneopts = "" - revision = "a2144134853fc9a27a7b1e3eb4f19f1a76df13c9" - -[[projects]] - branch = "master" - digest = "1:e97534348188848cd4a6b3f6323dc078da125419699c9d1fed4c338bef401545" - name = "golang.org/x/net" - packages = [ - "context", - "html", - "html/atom", - "http/httpguts", - "http2", - "http2/hpack", - "idna", - ] - pruneopts = "" - revision = "8887df42c721e930089d31b28391090a10a497d7" - -[[projects]] - branch = "master" - digest = "1:677e38cad6833ad266ec843739d167755eda1e6f2d8af1c63102b0426ad820db" - name = "golang.org/x/sys" - packages = [ - "unix", - "windows", - ] - pruneopts = "" - revision = "ac767d655b305d4e9612f5f6e33120b9176c4ad4" - -[[projects]] - digest = "1:5acd3512b047305d49e8763eef7ba423901e85d5dd2fd1e71778a0ea8de10bd4" - name = "golang.org/x/text" - packages = [ - "collate", - "collate/build", - "internal/colltab", - "internal/gen", - "internal/tag", - "internal/triegen", - "internal/ucd", - "language", - "secure/bidirule", - "transform", - "unicode/bidi", - "unicode/cldr", - "unicode/norm", - "unicode/rangetable", - "width", - ] - pruneopts = "" - revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" - version = "v0.3.0" - -[[projects]] - branch = "master" - digest = "1:1560e29f38cf9dd0699c4ca37b79668338f206b27c358e53f61c5cc529593b3b" - name = "golang.org/x/tools" - packages = [ - "go/ast/astutil", - "imports", - "internal/fastwalk", - ] - pruneopts = "" - revision = "32950ab3be12acf6d472893021373669979907ab" - -[[projects]] - digest = "1:75fb3fcfc73a8c723efde7777b40e8e8ff9babf30d8c56160d01beffea8a95a6" - name = "gopkg.in/inf.v0" - packages = ["."] - pruneopts = "" - revision = "d2d2541c53f18d2a059457998ce2876cc8e67cbf" - version = "v0.9.1" - -[[projects]] - digest = "1:f0620375dd1f6251d9973b5f2596228cc8042e887cd7f827e4220bc1ce8c30e2" - name = "gopkg.in/yaml.v2" - packages = ["."] - pruneopts = "" - revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183" - version = "v2.2.1" - -[[projects]] - digest = "1:684934999cc9fd4630699290aea572be2043d036d870a3ca09dd1be428e24591" - name = "k8s.io/api" - packages = [ - "admissionregistration/v1alpha1", - "admissionregistration/v1beta1", - "apps/v1", - "apps/v1beta1", - "apps/v1beta2", - "authentication/v1", - "authentication/v1beta1", - "authorization/v1", - "authorization/v1beta1", - "autoscaling/v1", - "autoscaling/v2beta1", - "batch/v1", - "batch/v1beta1", - "batch/v2alpha1", - "certificates/v1beta1", - "core/v1", - "events/v1beta1", - "extensions/v1beta1", - "networking/v1", - "policy/v1beta1", - "rbac/v1", - "rbac/v1alpha1", - "rbac/v1beta1", - "scheduling/v1alpha1", - "settings/v1alpha1", - "storage/v1", - "storage/v1alpha1", - "storage/v1beta1", - ] - pruneopts = "" - revision = "acf347b865f29325eb61f4cd2df11e86e073a5ee" - -[[projects]] - digest = "1:a3e91c6cbe31396cd53da6c83745f1278a3d4115eae2fffe953e8a059b8bc49c" - name = "k8s.io/apimachinery" - packages = [ - "pkg/api/errors", - "pkg/api/meta", - "pkg/api/resource", - "pkg/apis/meta/internalversion", - "pkg/apis/meta/v1", - "pkg/apis/meta/v1/unstructured", - "pkg/apis/meta/v1alpha1", - "pkg/conversion", - "pkg/conversion/queryparams", - "pkg/fields", - "pkg/labels", - "pkg/runtime", - "pkg/runtime/schema", - "pkg/runtime/serializer", - "pkg/runtime/serializer/json", - "pkg/runtime/serializer/protobuf", - "pkg/runtime/serializer/recognizer", - "pkg/runtime/serializer/streaming", - "pkg/runtime/serializer/versioning", - "pkg/selection", - "pkg/types", - "pkg/util/cache", - "pkg/util/clock", - "pkg/util/diff", - "pkg/util/errors", - "pkg/util/framer", - "pkg/util/intstr", - "pkg/util/json", - "pkg/util/net", - "pkg/util/runtime", - "pkg/util/sets", - "pkg/util/validation", - "pkg/util/validation/field", - "pkg/util/wait", - "pkg/util/yaml", - "pkg/version", - "pkg/watch", - "third_party/forked/golang/reflect", - ] - pruneopts = "" - revision = "19e3f5aa3adca672c153d324e6b7d82ff8935f03" - -[[projects]] - digest = "1:713cd56cccadb3ec900b1ea9beba9cfe9ce548f7bec52bb4c022df03c3b04007" - name = "k8s.io/client-go" - packages = [ - "discovery", - "discovery/cached", - "dynamic", - "kubernetes", - "kubernetes/scheme", - "kubernetes/typed/admissionregistration/v1alpha1", - "kubernetes/typed/admissionregistration/v1beta1", - "kubernetes/typed/apps/v1", - "kubernetes/typed/apps/v1beta1", - "kubernetes/typed/apps/v1beta2", - "kubernetes/typed/authentication/v1", - "kubernetes/typed/authentication/v1beta1", - "kubernetes/typed/authorization/v1", - "kubernetes/typed/authorization/v1beta1", - "kubernetes/typed/autoscaling/v1", - "kubernetes/typed/autoscaling/v2beta1", - "kubernetes/typed/batch/v1", - "kubernetes/typed/batch/v1beta1", - "kubernetes/typed/batch/v2alpha1", - "kubernetes/typed/certificates/v1beta1", - "kubernetes/typed/core/v1", - "kubernetes/typed/events/v1beta1", - "kubernetes/typed/extensions/v1beta1", - "kubernetes/typed/networking/v1", - "kubernetes/typed/policy/v1beta1", - "kubernetes/typed/rbac/v1", - "kubernetes/typed/rbac/v1alpha1", - "kubernetes/typed/rbac/v1beta1", - "kubernetes/typed/scheduling/v1alpha1", - "kubernetes/typed/settings/v1alpha1", - "kubernetes/typed/storage/v1", - "kubernetes/typed/storage/v1alpha1", - "kubernetes/typed/storage/v1beta1", - "pkg/version", - "rest", - "rest/watch", - "tools/auth", - "tools/cache", - "tools/clientcmd", - "tools/clientcmd/api", - "tools/clientcmd/api/latest", - "tools/clientcmd/api/v1", - "tools/metrics", - "tools/pager", - "tools/reference", - "transport", - "util/buffer", - "util/cert", - "util/flowcontrol", - "util/homedir", - "util/integer", - "util/workqueue", - ] - pruneopts = "" - revision = "9389c055a838d4f208b699b3c7c51b70f2368861" - -[[projects]] - digest = "1:0fef6a5a89ee800830fe0314e6aaf7ec3b99034ae09f0f081009b2b1bce2fd3a" - name = "k8s.io/code-generator" - packages = [ - "cmd/client-gen", - "cmd/client-gen/args", - "cmd/client-gen/generators", - "cmd/client-gen/generators/fake", - "cmd/client-gen/generators/scheme", - "cmd/client-gen/generators/util", - "cmd/client-gen/path", - "cmd/client-gen/types", - "cmd/conversion-gen", - "cmd/conversion-gen/generators", - "cmd/deepcopy-gen", - "cmd/defaulter-gen", - "cmd/informer-gen", - "cmd/informer-gen/generators", - "cmd/lister-gen", - "cmd/lister-gen/generators", - "cmd/openapi-gen", - ] - pruneopts = "" - revision = "91d3f6a57905178524105a085085901bb73bd3dc" - -[[projects]] - branch = "master" - digest = "1:38d0c4ac62d52d18f671b436ad51d780f078d9ebeb43a5c43a0375473b34136f" - name = "k8s.io/gengo" - packages = [ - "args", - "examples/deepcopy-gen/generators", - "examples/defaulter-gen/generators", - "examples/set-gen/sets", - "generator", - "namer", - "parser", - "types", - ] - pruneopts = "" - revision = "906d99f89cd644eecf75ab547b29bf9f876f0b59" - -[[projects]] - branch = "master" - digest = "1:a2f78b8fd86be41f2aa77404245aed4f4f410ac3aabc5f3bd9bd1fcc09076c53" - name = "k8s.io/kube-openapi" - packages = [ - "cmd/openapi-gen/args", - "pkg/common", - "pkg/generators", - "pkg/generators/rules", - "pkg/util/sets", - ] - pruneopts = "" - revision = "0cf8f7e6ed1d2e3d47d02e3b6e559369af24d803" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "bitbucket.org/atlassian/go-stride/pkg/stride", - "github.com/Gl4di4torRr/cert-operator/pkg/certs", - "github.com/Gl4di4torRr/cert-operator/pkg/notifier", - "github.com/Gl4di4torRr/cert-operator/pkg/notifier/slack", - "github.com/Gl4di4torRr/cert-operator/pkg/stub", - "github.com/Venafi/govcert", - "github.com/Venafi/govcert/embedded", - "github.com/appscode/envconfig", - "github.com/fsnotify/fsnotify", - "github.com/hashicorp/terraform/helper/resource", - "github.com/micro/go-config", - "github.com/micro/go-config/source/env", - "github.com/micro/go-config/source/file", - "github.com/micro/go-config/source/flag", - "github.com/micro/go-config/source/memory", - "github.com/openshift/api/route/v1", - "github.com/operator-framework/operator-sdk/pkg/sdk", - "github.com/operator-framework/operator-sdk/pkg/util/k8sutil", - "github.com/operator-framework/operator-sdk/version", - "github.com/pborman/uuid", - "github.com/sirupsen/logrus", - "k8s.io/api/core/v1", - "k8s.io/apimachinery/pkg/apis/meta/v1", - "k8s.io/apimachinery/pkg/runtime", - "k8s.io/apimachinery/pkg/runtime/schema", - "k8s.io/code-generator/cmd/client-gen", - "k8s.io/code-generator/cmd/conversion-gen", - "k8s.io/code-generator/cmd/deepcopy-gen", - "k8s.io/code-generator/cmd/defaulter-gen", - "k8s.io/code-generator/cmd/informer-gen", - "k8s.io/code-generator/cmd/lister-gen", - "k8s.io/code-generator/cmd/openapi-gen", - "k8s.io/gengo/args", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index fba5d9a..e6cd352 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -41,9 +41,13 @@ required = [ [[constraint]] name = "github.com/operator-framework/operator-sdk" # The version rule is used for a specific release and the master branch for in between releases. - branch = "master" - # version = "=v0.0.5" + #branch = "v0.0.5" + version = "v0.0.5" [[constraint]] name = "github.com/openshift/api" version = "3.9.0" + +[[constraint]] + name = "github.com/micro/go-config" + version = "0.7.0" diff --git a/README.adoc b/README.adoc index aad2edd..6e1b143 100644 --- a/README.adoc +++ b/README.adoc @@ -5,7 +5,7 @@ toc::[] == Prerequisites -* link:https://github.com/operator-framework/operator-sdk[Operator SDK] +* link:https://github.com/operator-framework/operator-sdk/tree/v0.0.6[Operator SDK v0.0.6] * link:https://golang.github.io/dep/docs/installation.html[Dep] == Installation @@ -21,7 +21,9 @@ dep ensure [source,bash] ---- oc login ... -oc apply -f deploy/rbac.yaml -n operators +oc new-project cert-operator +oc process -f deploy/rbac.yaml -p NAMESPACE=cert-operator | oc apply -f- +export OPERATOR_NAME=cert-operator operator-sdk up local ---- @@ -29,10 +31,9 @@ operator-sdk up local [source,bash] ---- -operator-sdk build quay.io/etsauer/cert-operator -docker push quay.io/etsauer/cert-operator -oc apply -f deploy/rbac.yaml -n operators -oc apply -f deploy/operator.yaml -n operators +oc process -f build/build.yml | oc apply -f- +oc process -f deploy/rbac.yaml -p NAMESPACE=cert-operator | oc apply -f- +oc apply -f deploy/deployment.yaml ---- == Configuration diff --git a/tmp/build/Dockerfile b/build/Dockerfile similarity index 100% rename from tmp/build/Dockerfile rename to build/Dockerfile diff --git a/tmp/build/build.sh b/build/build.sh similarity index 100% rename from tmp/build/build.sh rename to build/build.sh diff --git a/build/build.yml b/build/build.yml new file mode 100644 index 0000000..e642e43 --- /dev/null +++ b/build/build.yml @@ -0,0 +1,57 @@ +apiVersion: v1 +kind: Template +objects: +- apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + name: go-toolset-1.10-rhel7 + spec: + dockerImageRepository: registry.access.redhat.com/devtools/go-toolset-1.10-rhel7 +- apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + labels: + app: cert-operator + name: cert-operator + spec: + lookupPolicy: + local: true +- apiVersion: build.openshift.io/v1 + kind: BuildConfig + metadata: + labels: + build: cert-operator + app: cert-operator + name: cert-operator + spec: + failedBuildsHistoryLimit: 5 + nodeSelector: null + output: + to: + kind: ImageStreamTag + name: cert-operator:latest + source: + git: + uri: ${SOURCE_CODE_URL} + ref: ${SOURCE_CODE_REF} + type: Git + strategy: + sourceStrategy: + env: + - name: IMPORT_URL + value: github.com/redhat-cop/cert-operator + - name: BINARY_NAME + value: cert-operator + from: + kind: ImageStreamTag + name: go-toolset-1.10-rhel7:latest + type: Source + triggers: + - type: ConfigChange + - imageChange: {} + type: ImageChange +parameters: +- name: SOURCE_CODE_URL + value: https://github.com/redhat-cop/cert-operator +- name: SOURCE_CODE_REF + value: master diff --git a/cmd/cert-operator/main.go b/cmd/cert-operator/main.go index c952ebb..1cfe973 100644 --- a/cmd/cert-operator/main.go +++ b/cmd/cert-operator/main.go @@ -27,9 +27,9 @@ func main() { sdk.ExposeMetricsPort() logrus.Infof("Watching Routes on all Namespaces") - sdk.Watch("route.openshift.io/v1", "Route", "", 60) + sdk.Watch("route.openshift.io/v1", "Route", "", 1000000000) logrus.Infof("Watching Services on all Namespaces") - sdk.Watch("v1", "Service", "", 60) + sdk.Watch("v1", "Service", "", 1000000000) sdk.Handle(stub.NewHandler(conf)) sdk.Run(context.TODO()) } diff --git a/deploy/cr.yaml b/deploy/cr.yaml deleted file mode 100644 index 934f415..0000000 --- a/deploy/cr.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: "cache.example.com/v1alpha1" -kind: "Memcached" -metadata: - name: "example" diff --git a/deploy/crd.yaml b/deploy/crd.yaml deleted file mode 100644 index ab3f99f..0000000 --- a/deploy/crd.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: memcacheds.cache.example.com -spec: - group: cache.example.com - names: - kind: Memcached - listKind: MemcachedList - plural: memcacheds - singular: memcached - scope: Namespaced - version: v1alpha1 diff --git a/deploy/deployment.yaml b/deploy/deployment.yaml new file mode 100644 index 0000000..f0aab83 --- /dev/null +++ b/deploy/deployment.yaml @@ -0,0 +1,69 @@ +apiVersion: v1 +kind: List +items: +- apiVersion: v1 + kind: DeploymentConfig + metadata: + name: cert-operator + labels: + app: cert-operator + spec: + replicas: 1 + selector: + app: cert-operator + deploymentconfig: cert-operator + strategy: + activeDeadlineSeconds: 21600 + resources: {} + rollingParams: + intervalSeconds: 1 + maxSurge: 25% + maxUnavailable: 25% + timeoutSeconds: 600 + updatePeriodSeconds: 1 + type: Rolling + template: + metadata: + labels: + app: cert-operator + deploymentconfig: cert-operator + spec: + containers: + - name: cert-operator + image: cert-operator:latest + ports: + - containerPort: 60000 + name: metrics + imagePullPolicy: Always + env: + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: OPERATOR_NAME + value: "cert-operator" + volumeMounts: + - name: config-volume + mountPath: /etc/cert-operator + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - cert-operator + from: + kind: ImageStreamTag + name: cert-operator:latest + type: ImageChange + volumes: + - name: config-volume + configMap: + name: cert-operator-config +- apiVersion: v1 + kind: ConfigMap + metadata: + name: cert-operator-config + data: + config.yaml: | + provider: + kind: none diff --git a/deploy/operator.yaml b/deploy/operator.yaml deleted file mode 100644 index ff3e745..0000000 --- a/deploy/operator.yaml +++ /dev/null @@ -1,30 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: cert-operator -spec: - replicas: 1 - selector: - matchLabels: - name: cert-operator - template: - metadata: - labels: - name: cert-operator - spec: - containers: - - name: cert-operator - image: quay.io/etsauer/cert-operator - ports: - - containerPort: 60000 - name: metrics - command: - - cert-operator - imagePullPolicy: Always - env: - - name: WATCH_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: OPERATOR_NAME - value: "cert-operator" diff --git a/deploy/rbac.yaml b/deploy/rbac.yaml index 14bc4a0..d3cae28 100644 --- a/deploy/rbac.yaml +++ b/deploy/rbac.yaml @@ -1,11 +1,39 @@ --- - apiVersion: v1 -kind: ClusterRoleBinding -metadata: - name: cert-operator-cluster-reader -roleRef: - name: cluster-reader -subjects: -- kind: ServiceAccount - name: default +kind: Template +objects: + - apiVersion: v1 + kind: ClusterRole + metadata: + name: cert-operator-role + rules: + - apiGroups: + - "" + attributeRestrictions: null + resources: + - services + verbs: + - create + - apiVersion: v1 + kind: RoleBinding + metadata: + name: cert-operator + namespace: ${NAMESPACE} + roleRef: + name: cert-operator-role + subjects: + - kind: ServiceAccount + name: default + namespace: ${NAMESPACE} + - apiVersion: v1 + kind: ClusterRoleBinding + metadata: + name: cert-operator-cluster-reader + roleRef: + name: cluster-reader + subjects: + - kind: ServiceAccount + name: default + namespace: ${NAMESPACE} +parameters: + - name: NAMESPACE diff --git a/main.go b/main.go new file mode 120000 index 0000000..65b454c --- /dev/null +++ b/main.go @@ -0,0 +1 @@ +cmd/cert-operator/main.go \ No newline at end of file diff --git a/pkg/certs/main.go b/pkg/certs/main.go index d6a5801..ea8fa0c 100644 --- a/pkg/certs/main.go +++ b/pkg/certs/main.go @@ -5,7 +5,6 @@ import ( "crypto/rsa" "crypto/x509" "encoding/pem" - "os" "time" ) diff --git a/pkg/stub/config.go b/pkg/stub/config.go index 9fefbc0..3000011 100644 --- a/pkg/stub/config.go +++ b/pkg/stub/config.go @@ -11,6 +11,7 @@ package stub import ( "os" + "encoding/json" config "github.com/micro/go-config" "github.com/micro/go-config/source/env" @@ -39,7 +40,7 @@ type AnnotationConfig struct { } const ( - defaultConfigFile = "/etc/cert-operator/config.yml" + defaultConfigFile = "/etc/cert-operator/config.yaml" defaultProvider = "self-signed" defaultConfig = ` { @@ -100,10 +101,9 @@ func getConfigFile() (configFile string) { } func (c *Config) String() string { - var s string - // for _, element := range c.Notifiers { - // s += element.Name() + "\n" - // } - s += c.Provider.Kind - return s + out, err := json.Marshal(c) + if err != nil { + panic (err) + } + return string(out) } diff --git a/pkg/stub/handler.go b/pkg/stub/handler.go index 61c321f..ab0ec59 100644 --- a/pkg/stub/handler.go +++ b/pkg/stub/handler.go @@ -29,8 +29,9 @@ func NewHandler(config Config) sdk.Handler { logrus.Infof("Venafi Cert provider.") provider = new(certs.VenafiProvider) default: - panic("There was a problem detecting which provider to configure. " + - "Provider kind `" + config.Provider.Kind + "` is invalid.") + panic("There was a problem detecting which provider to configure. \n" + + "\tProvider kind `" + config.Provider.Kind + "` is invalid. \n" + + config.String()) } return &Handler{ config: config,