Browse Source

INITIAL COMMIT

pull/1/head
Vladimir Smagin 11 months ago
commit
2243205901
100 changed files with 31134 additions and 0 deletions
  1. +77
    -0
      .gitignore
  2. +922
    -0
      Gopkg.lock
  3. +75
    -0
      Gopkg.toml
  4. +15
    -0
      build/Dockerfile
  5. +12
    -0
      build/bin/entrypoint
  6. +13
    -0
      build/bin/user_setup
  7. +121
    -0
      cmd/manager/main.go
  8. +33
    -0
      deploy/operator.yaml
  9. +39
    -0
      deploy/role.yaml
  10. +11
    -0
      deploy/role_binding.yaml
  11. +4
    -0
      deploy/service_account.yaml
  12. +13
    -0
      pkg/apis/apis.go
  13. +18
    -0
      pkg/controller/controller.go
  14. +15
    -0
      vendor/cloud.google.com/go/AUTHORS
  15. +40
    -0
      vendor/cloud.google.com/go/CONTRIBUTORS
  16. +202
    -0
      vendor/cloud.google.com/go/LICENSE
  17. +248
    -0
      vendor/cloud.google.com/go/asset/apiv1beta1/asset_client.go
  18. +89
    -0
      vendor/cloud.google.com/go/asset/apiv1beta1/doc.go
  19. +248
    -0
      vendor/cloud.google.com/go/asset/v1beta1/asset_client.go
  20. +89
    -0
      vendor/cloud.google.com/go/asset/v1beta1/doc.go
  21. +85
    -0
      vendor/cloud.google.com/go/bigquery/benchmarks/bench.go
  22. +162
    -0
      vendor/cloud.google.com/go/bigquery/bigquery.go
  23. +107
    -0
      vendor/cloud.google.com/go/bigquery/copy.go
  24. +536
    -0
      vendor/cloud.google.com/go/bigquery/dataset.go
  25. +625
    -0
      vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/data_transfer_client.go
  26. +90
    -0
      vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/doc.go
  27. +135
    -0
      vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/path_funcs.go
  28. +310
    -0
      vendor/cloud.google.com/go/bigquery/doc.go
  29. +83
    -0
      vendor/cloud.google.com/go/bigquery/error.go
  30. +400
    -0
      vendor/cloud.google.com/go/bigquery/external.go
  31. +110
    -0
      vendor/cloud.google.com/go/bigquery/extract.go
  32. +137
    -0
      vendor/cloud.google.com/go/bigquery/file.go
  33. +75
    -0
      vendor/cloud.google.com/go/bigquery/gcs.go
  34. +238
    -0
      vendor/cloud.google.com/go/bigquery/inserter.go
  35. +222
    -0
      vendor/cloud.google.com/go/bigquery/iterator.go
  36. +830
    -0
      vendor/cloud.google.com/go/bigquery/job.go
  37. +146
    -0
      vendor/cloud.google.com/go/bigquery/load.go
  38. +320
    -0
      vendor/cloud.google.com/go/bigquery/nulls.go
  39. +360
    -0
      vendor/cloud.google.com/go/bigquery/params.go
  40. +328
    -0
      vendor/cloud.google.com/go/bigquery/query.go
  41. +56
    -0
      vendor/cloud.google.com/go/bigquery/random.go
  42. +488
    -0
      vendor/cloud.google.com/go/bigquery/schema.go
  43. +255
    -0
      vendor/cloud.google.com/go/bigquery/storage/apiv1beta1/big_query_storage_client.go
  44. +89
    -0
      vendor/cloud.google.com/go/bigquery/storage/apiv1beta1/doc.go
  45. +629
    -0
      vendor/cloud.google.com/go/bigquery/table.go
  46. +870
    -0
      vendor/cloud.google.com/go/bigquery/value.go
  47. +1133
    -0
      vendor/cloud.google.com/go/bigtable/admin.go
  48. +914
    -0
      vendor/cloud.google.com/go/bigtable/bigtable.go
  49. +1406
    -0
      vendor/cloud.google.com/go/bigtable/bttest/inmem.go
  50. +1614
    -0
      vendor/cloud.google.com/go/bigtable/cmd/cbt/cbt.go
  51. +425
    -0
      vendor/cloud.google.com/go/bigtable/cmd/cbt/cbtdoc.go
  52. +215
    -0
      vendor/cloud.google.com/go/bigtable/cmd/cbt/gcpolicy.go
  53. +52
    -0
      vendor/cloud.google.com/go/bigtable/cmd/emulator/cbtemulator.go
  54. +205
    -0
      vendor/cloud.google.com/go/bigtable/cmd/loadtest/loadtest.go
  55. +155
    -0
      vendor/cloud.google.com/go/bigtable/cmd/scantest/scantest.go
  56. +123
    -0
      vendor/cloud.google.com/go/bigtable/doc.go
  57. +330
    -0
      vendor/cloud.google.com/go/bigtable/filter.go
  58. +167
    -0
      vendor/cloud.google.com/go/bigtable/gc.go
  59. +262
    -0
      vendor/cloud.google.com/go/bigtable/internal/cbtconfig/cbtconfig.go
  60. +110
    -0
      vendor/cloud.google.com/go/bigtable/internal/gax/call_option.go
  61. +87
    -0
      vendor/cloud.google.com/go/bigtable/internal/gax/invoke.go
  62. +48
    -0
      vendor/cloud.google.com/go/bigtable/internal/option/option.go
  63. +150
    -0
      vendor/cloud.google.com/go/bigtable/internal/stat/stats.go
  64. +249
    -0
      vendor/cloud.google.com/go/bigtable/reader.go
  65. +57
    -0
      vendor/cloud.google.com/go/bigtable/trace.go
  66. +277
    -0
      vendor/cloud.google.com/go/civil/civil.go
  67. +79
    -0
      vendor/cloud.google.com/go/cloud.go
  68. +784
    -0
      vendor/cloud.google.com/go/cloudtasks/apiv2beta2/cloud_tasks_client.go
  69. +89
    -0
      vendor/cloud.google.com/go/cloudtasks/apiv2beta2/doc.go
  70. +665
    -0
      vendor/cloud.google.com/go/cloudtasks/apiv2beta3/cloud_tasks_client.go
  71. +89
    -0
      vendor/cloud.google.com/go/cloudtasks/apiv2beta3/doc.go
  72. +450
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/debuglet.go
  73. +174
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/breakpoints/breakpoints.go
  74. +291
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/controller/client.go
  75. +186
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/arch/arch.go
  76. +85
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/cmd/debugproxy/main.go
  77. +213
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/buf.go
  78. +277
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/cache.go
  79. +480
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/const.go
  80. +417
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/entry.go
  81. +309
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/frame.go
  82. +463
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/line.go
  83. +106
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/open.go
  84. +129
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/symbol.go
  85. +23
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/pclinetest.go
  86. +39
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/pcsptest.go
  87. +95
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/typedef.c
  88. +877
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/type.go
  89. +181
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/typeunit.go
  90. +100
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/unit.go
  91. +2993
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/elf.go
  92. +1417
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/file.go
  93. +118
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/reader.go
  94. +7
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/hello.c
  95. +9
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/pclinetest.h
  96. +472
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/pclntab.go
  97. +731
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/symtab.go
  98. +205
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/local/local.go
  99. +327
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/program.go
  100. +305
    -0
      vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/remote/remote.go

+ 77
- 0
.gitignore View File

@@ -0,0 +1,77 @@
# Temporary Build Files
build/_output
build/_test
# Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode
### Emacs ###
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
dist/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
projectile-bookmarks.eld
# directory configuration
.dir-locals.el
# saveplace
places
# url cache
url/cache/
# cedet
ede-projects.el
# smex
smex-items
# company-statistics
company-statistics-cache.el
# anaconda-mode
anaconda-mode/
### Go ###
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, build with 'go test -c'
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
### Vim ###
# swap
.sw[a-p]
.*.sw[a-p]
# session
Session.vim
# temporary
.netrwhist
# auto-generated tag files
tags
### VisualStudioCode ###
.vscode/*
.history
# End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode

+ 922
- 0
Gopkg.lock View File

@@ -0,0 +1,922 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.


[[projects]]
digest = "1:2173c429b0c4654deb4f3e8d1f503c374f93a6b5549d74f9cba797c1e787f8e4"
name = "cloud.google.com/go"
packages = ["compute/metadata"]
pruneopts = "NT"
revision = "c9474f2f8deb81759839474b6bd1726bbfe1c1c4"
version = "v0.36.0"

[[projects]]
digest = "1:0a111edd8693fd977f42a0c4f199a0efb13c20aec9da99ad8830c7bb6a87e8d6"
name = "github.com/PuerkitoBio/purell"
packages = ["."]
pruneopts = "NT"
revision = "44968752391892e1b0d0b821ee79e9a85fa13049"
version = "v1.1.1"

[[projects]]
branch = "master"
digest = "1:8098cd40cd09879efbf12e33bcd51ead4a66006ac802cd563a66c4f3373b9727"
name = "github.com/PuerkitoBio/urlesc"
packages = ["."]
pruneopts = "NT"
revision = "de5bf2ad457846296e2031421a34e2568e304e35"

[[projects]]
digest = "1:680b63a131506e668818d630d3ca36123ff290afa0afc9f4be21940adca3f27d"
name = "github.com/appscode/jsonpatch"
packages = ["."]
pruneopts = "NT"
revision = "7c0e3b262f30165a8ec3d0b4c6059fd92703bfb2"
version = "1.0.0"

[[projects]]
branch = "master"
digest = "1:c819830f4f5ef85874a90ac3cbcc96cd322c715f5c96fbe4722eacd3dafbaa07"
name = "github.com/beorn7/perks"
packages = ["quantile"]
pruneopts = "NT"
revision = "3a771d992973f24aa725d07868b467d1ddfceafb"

[[projects]]
digest = "1:c61f4f97321a37adcb5b4fd4fd61209cd553e46c99ee606c465553541b12a229"
name = "github.com/coreos/prometheus-operator"
packages = [
"pkg/apis/monitoring",
"pkg/apis/monitoring/v1",
"pkg/client/versioned/scheme",
"pkg/client/versioned/typed/monitoring/v1"
]
pruneopts = "NT"
revision = "72ec4b9b16ef11700724dc71fec77112536eed40"
version = "v0.26.0"

[[projects]]
digest = "1:4b8b5811da6970495e04d1f4e98bb89518cc3cfc3b3f456bdb876ed7b6c74049"
name = "github.com/davecgh/go-spew"
packages = ["spew"]
pruneopts = "NT"
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
version = "v1.1.1"

[[projects]]
digest = "1:2453249730493850718f891fb40b8f1bc932a0265384fc85b269dc04a01d4673"
name = "github.com/emicklei/go-restful"
packages = [
".",
"log"
]
pruneopts = "NT"
revision = "85d198d05a92d31823b852b4a5928114912e8949"
version = "v2.9.0"

[[projects]]
digest = "1:81466b4218bf6adddac2572a30ac733a9255919bc2f470b4827a317bd4ee1756"
name = "github.com/ghodss/yaml"
packages = ["."]
pruneopts = "NT"
revision = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7"
version = "v1.0.0"

[[projects]]
branch = "master"
digest = "1:d421af4c4fe51d399667d573982d663fe1fa67020a88d3ae43466ebfe8e2b5c9"
name = "github.com/go-logr/logr"
packages = ["."]
pruneopts = "NT"
revision = "9fb12b3b21c5415d16ac18dc5cd42c1cfdd40c4e"

[[projects]]
digest = "1:340497a512995aa69c0add901d79a2096b3449d35a44a6f1f1115091a9f8c687"
name = "github.com/go-logr/zapr"
packages = ["."]
pruneopts = "NT"
revision = "7536572e8d55209135cd5e7ccf7fce43dca217ab"
version = "v0.1.0"

[[projects]]
digest = "1:260f7ebefc63024c8dfe2c9f1a2935a89fa4213637a1f522f592f80c001cc441"
name = "github.com/go-openapi/jsonpointer"
packages = ["."]
pruneopts = "NT"
revision = "ef5f0afec364d3b9396b7b77b43dbe26bf1f8004"
version = "v0.18.0"

[[projects]]
digest = "1:98abd61947ff5c7c6fcfec5473d02a4821ed3a2dd99a4fbfdb7925b0dd745546"
name = "github.com/go-openapi/jsonreference"
packages = ["."]
pruneopts = "NT"
revision = "8483a886a90412cd6858df4ea3483dce9c8e35a3"
version = "v0.18.0"

[[projects]]
branch = "master"
digest = "1:8f80caf2fa31f78a035f33981c9685013033073b53f344f579e60fa69f0c6670"
name = "github.com/go-openapi/spec"
packages = ["."]
pruneopts = "NT"
revision = "53d776530bf78a11b03a7b52dd8a083086b045e5"

[[projects]]
digest = "1:dc0f590770e5a6c70ea086232324f7b7dc4857c60eca63ab8ff78e0a5cfcdbf3"
name = "github.com/go-openapi/swag"
packages = ["."]
pruneopts = "NT"
revision = "1d29f06aebd59ccdf11ae04aa0334ded96e2d909"
version = "v0.18.0"

[[projects]]
digest = "1:9059915429f7f3a5f18cfa6b7cab9a28721d7ac6db4079a62044aa229eb7f2a8"
name = "github.com/gobuffalo/envy"
packages = ["."]
pruneopts = "NT"
revision = "fa0dfdc10b5366ce365b7d9d1755a03e4e797bc5"
version = "v1.6.15"

[[projects]]
digest = "1:0b39706cfa32c1ba9e14435b5844d04aef81b60f44b6077e61e0607d56692603"
name = "github.com/gogo/protobuf"
packages = [
"proto",
"sortkeys"
]
pruneopts = "NT"
revision = "ba06b47c162d49f2af050fb4c75bcbc86a159d5c"
version = "v1.2.1"

[[projects]]
branch = "master"
digest = "1:e2b86e41f3d669fc36b50d31d32d22c8ac656c75aa5ea89717ce7177e134ff2a"
name = "github.com/golang/glog"
packages = ["."]
pruneopts = "NT"
revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998"

[[projects]]
branch = "master"
digest = "1:20b774dcfdf0fff3148432beb828c52404f3eb3d70b7ce71ae0356ed6cbc2bae"
name = "github.com/golang/groupcache"
packages = ["lru"]
pruneopts = "NT"
revision = "5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b"

[[projects]]
digest = "1:d7cb4458ea8782e6efacd8f4940796ec559c90833509c436f40c4085b98156dd"
name = "github.com/golang/protobuf"
packages = [
"proto",
"ptypes",
"ptypes/any",
"ptypes/duration",
"ptypes/timestamp"
]
pruneopts = "NT"
revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
version = "v1.2.0"

[[projects]]
branch = "master"
digest = "1:05f95ffdfcf651bdb0f05b40b69e7f5663047f8da75c72d58728acb59b5cc107"
name = "github.com/google/btree"
packages = ["."]
pruneopts = "NT"
revision = "4030bb1f1f0c35b30ca7009e9ebd06849dd45306"

[[projects]]
branch = "master"
digest = "1:52c5834e2bebac9030c97cc0798ac11c3aa8a39f098aeb419f142533da6cd3cc"
name = "github.com/google/gofuzz"
packages = ["."]
pruneopts = "NT"
revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1"

[[projects]]
digest = "1:56a1f3949ebb7fa22fa6b4e4ac0fe0f77cc4faee5b57413e6fa9199a8458faf1"
name = "github.com/google/uuid"
packages = ["."]
pruneopts = "NT"
revision = "9b3b1e0f5f99ae461456d768e7d301a7acdaa2d8"
version = "v1.1.0"

[[projects]]
digest = "1:289332c13b80edfefc88397cce5266c16845dcf204fa2f6ac7e464ee4c7f6e96"
name = "github.com/googleapis/gnostic"
packages = [
"OpenAPIv2",
"compiler",
"extensions"
]
pruneopts = "NT"
revision = "7c663266750e7d82587642f65e60bc4083f1f84e"
version = "v0.2.0"

[[projects]]
branch = "master"
digest = "1:bb7bd892abcb75ef819ce2efab9d54d22b7e38dc05ffac55428bb0578b52912b"
name = "github.com/gregjones/httpcache"
packages = [
".",
"diskcache"
]
pruneopts = "NT"
revision = "3befbb6ad0cc97d4c25d851e9528915809e1a22f"

[[projects]]
digest = "1:b42cde0e1f3c816dd57f57f7bbcf05ca40263ad96f168714c130c611fc0856a6"
name = "github.com/hashicorp/golang-lru"
packages = [
".",
"simplelru"
]
pruneopts = "NT"
revision = "20f1fb78b0740ba8c3cb143a61e86ba5c8669768"
version = "v0.5.0"

[[projects]]
digest = "1:aaa38889f11896ee3644d77e17dc7764cc47f5f3d3b488268df2af2b52541c5f"
name = "github.com/imdario/mergo"
packages = ["."]
pruneopts = "NT"
revision = "7c29201646fa3de8506f701213473dd407f19646"
version = "v0.3.7"

[[projects]]
digest = "1:f5b9328966ccea0970b1d15075698eff0ddb3e75889560aad2e9f76b289b536a"
name = "github.com/joho/godotenv"
packages = ["."]
pruneopts = "NT"
revision = "23d116af351c84513e1946b527c88823e476be13"
version = "v1.3.0"

[[projects]]
digest = "1:1d39c063244ad17c4b18e8da1551163b6ffb52bd1640a49a8ec5c3b7bf4dbd5d"
name = "github.com/json-iterator/go"
packages = ["."]
pruneopts = "NT"
revision = "1624edc4454b8682399def8740d46db5e4362ba4"
version = "v1.1.5"

[[projects]]
branch = "master"
digest = "1:4925ec3736ef6c299cfcf61597782e3d66ec13114f7476019d04c742a7be55d0"
name = "github.com/mailru/easyjson"
packages = [
"buffer",
"jlexer",
"jwriter"
]
pruneopts = "NT"
revision = "6243d8e04c3f819e79757e8bc3faa15c3cb27003"

[[projects]]
digest = "1:56dbf15e091bf7926cb33a57cb6bdfc658fc6d3498d2f76f10a97ce7856f1fde"
name = "github.com/markbates/inflect"
packages = ["."]
pruneopts = "NT"
revision = "24b83195037b3bc61fcda2d28b7b0518bce293b6"
version = "v1.0.4"

[[projects]]
digest = "1:ea1db000388d88b31db7531c83016bef0d6db0d908a07794bfc36aca16fbf935"
name = "github.com/matttproud/golang_protobuf_extensions"
packages = ["pbutil"]
pruneopts = "NT"
revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c"
version = "v1.0.1"

[[projects]]
digest = "1:2f42fa12d6911c7b7659738758631bec870b7e9b4c6be5444f963cdcfccc191f"
name = "github.com/modern-go/concurrent"
packages = ["."]
pruneopts = "NT"
revision = "bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94"
version = "1.0.3"

[[projects]]
digest = "1:c6aca19413b13dc59c220ad7430329e2ec454cc310bc6d8de2c7e2b93c18a0f6"
name = "github.com/modern-go/reflect2"
packages = ["."]
pruneopts = "NT"
revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd"
version = "1.0.1"

[[projects]]
branch = "master"
digest = "1:a9050c3f90153bcdfb2425f842a4f77db7cb96e3bbf5c0553d5af1f1f6bb3219"
name = "github.com/operator-framework/operator-sdk"
packages = [
"pkg/k8sutil",
"pkg/leader",
"pkg/log/zap",
"pkg/metrics",
"version"
]
pruneopts = "NT"
revision = "a882a84f8520dc8dcabaf03c0f1c7f55460eeafd"

[[projects]]
digest = "1:93b1d84c5fa6d1ea52f4114c37714cddd84d5b78f151b62bb101128dd51399bf"
name = "github.com/pborman/uuid"
packages = ["."]
pruneopts = "NT"
revision = "adf5a7427709b9deb95d29d3fa8a2bf9cfd388f1"
version = "v1.2"

[[projects]]
branch = "master"
digest = "1:bf2ac97824a7221eb16b096aecc1c390d4c8a4e49524386aaa2e2dd215cbfb31"
name = "github.com/petar/GoLLRB"
packages = ["llrb"]
pruneopts = "NT"
revision = "53be0d36a84c2a886ca057d34b6aa4468df9ccb4"

[[projects]]
digest = "1:e4e9e026b8e4c5630205cd0208efb491b40ad40552e57f7a646bb8a46896077b"
name = "github.com/peterbourgon/diskv"
packages = ["."]
pruneopts = "NT"
revision = "5f041e8faa004a95c88a202771f4cc3e991971e6"
version = "v2.0.1"

[[projects]]
digest = "1:14715f705ff5dfe0ffd6571d7d201dd8e921030f8070321a79380d8ca4ec1a24"
name = "github.com/pkg/errors"
packages = ["."]
pruneopts = "NT"
revision = "ba968bfe8b2f7e042a574c888954fccecfa385b4"
version = "v0.8.1"

[[projects]]
digest = "1:ec2a29e3bd141038ae5c3d3a4f57db0c341fcc1d98055a607aedd683aed124ee"
name = "github.com/prometheus/client_golang"
packages = [
"prometheus",
"prometheus/internal",
"prometheus/promhttp"
]
pruneopts = "NT"
revision = "505eaef017263e299324067d40ca2c48f6a2cf50"
version = "v0.9.2"

[[projects]]
branch = "master"
digest = "1:c2cc5049e927e2749c0d5163c9f8d924880d83e84befa732b9aad0b6be227bed"
name = "github.com/prometheus/client_model"
packages = ["go"]
pruneopts = "NT"
revision = "fd36f4220a901265f90734c3183c5f0c91daa0b8"

[[projects]]
digest = "1:30261b5e263b5c4fb40571b53a41a99c96016c6b1b2c45c1cefd226fc3f6304b"
name = "github.com/prometheus/common"
packages = [
"expfmt",
"internal/bitbucket.org/ww/goautoneg",
"model"
]
pruneopts = "NT"
revision = "cfeb6f9992ffa54aaa4f2170ade4067ee478b250"
version = "v0.2.0"

[[projects]]
branch = "master"
digest = "1:209d3c3933ffae5d28e62e3978c5feafa6a3dc23d601014922432ad3f7416acb"
name = "github.com/prometheus/procfs"
packages = [
".",
"internal/util",
"iostats",
"nfs",
"xfs"
]
pruneopts = "NT"
revision = "e4d4a2206da023361ed100d85c5f2cf9c8364e9f"

[[projects]]
digest = "1:fcef1ce61da6f8f6f115154fb0e0e5b159fe11656839ba1e6061372711c013ee"
name = "github.com/rogpeppe/go-internal"
packages = [
"modfile",
"module",
"semver"
]
pruneopts = "NT"
revision = "1cf9852c553c5b7da2d5a4a091129a7822fed0c9"
version = "v1.2.2"

[[projects]]
digest = "1:1bc08ec221c4fb25e6f2c019b23fe989fb44573c696983d8e403a3b76cc378e1"
name = "github.com/spf13/afero"
packages = [
".",
"mem"
]
pruneopts = "NT"
revision = "f4711e4db9e9a1d3887343acb72b2bbfc2f686f5"
version = "v1.2.1"

[[projects]]
digest = "1:9d8420bbf131d1618bde6530af37c3799340d3762cc47210c1d9532a4c3a2779"
name = "github.com/spf13/pflag"
packages = ["."]
pruneopts = "NT"
revision = "298182f68c66c05229eb03ac171abe6e309ee79a"
version = "v1.0.3"

[[projects]]
digest = "1:22f696cee54865fb8e9ff91df7b633f6b8f22037a8015253c6b6a71ca82219c7"
name = "go.uber.org/atomic"
packages = ["."]
pruneopts = "NT"
revision = "1ea20fb1cbb1cc08cbd0d913a96dead89aa18289"
version = "v1.3.2"

[[projects]]
digest = "1:58ca93bdf81bac106ded02226b5395a0595d5346cdc4caa8d9c1f3a5f8f9976e"
name = "go.uber.org/multierr"
packages = ["."]
pruneopts = "NT"
revision = "3c4937480c32f4c13a875a1829af76c98ca3d40a"
version = "v1.1.0"

[[projects]]
digest = "1:572fa4496563920f3e3107a2294cf2621d6cc4ffd03403fb6397b1bab9fa082a"
name = "go.uber.org/zap"
packages = [
".",
"buffer",
"internal/bufferpool",
"internal/color",
"internal/exit",
"zapcore"
]
pruneopts = "NT"
revision = "ff33455a0e382e8a81d14dd7c922020b6b5e7982"
version = "v1.9.1"

[[projects]]
branch = "master"
digest = "1:0a3ea0ec7bea3012951e75d8513a1ec530516a2cbd42dbe5e417f7760290e122"
name = "golang.org/x/crypto"
packages = ["ssh/terminal"]
pruneopts = "NT"
revision = "a4c6cb3142f211c99e4bf4cd769535b29a9b616f"

[[projects]]
branch = "master"
digest = "1:922c0bb9dc59af35400f6725ed08582f99f710ffc1a1075e8914c73515bb269e"
name = "golang.org/x/net"
packages = [
"context",
"context/ctxhttp",
"http/httpguts",
"http2",
"http2/hpack",
"idna"
]
pruneopts = "NT"
revision = "3a22650c66bd7f4fb6d1e8072ffd7b75c8a27898"

[[projects]]
branch = "master"
digest = "1:e759bd229deb1bded1c76c43c47caece22e765203cb048cf1d3c9c51a748f49f"
name = "golang.org/x/oauth2"
packages = [
".",
"google",
"internal",
"jws",
"jwt"
]
pruneopts = "NT"
revision = "9b3c75971fc92dd27c6436a37c05c831498658f1"

[[projects]]
branch = "master"
digest = "1:3661a08361d9fd3a6151653bb40b8e3479dec742418d88572f1c88bfdb09d83f"
name = "golang.org/x/sys"
packages = [
"unix",
"windows"
]
pruneopts = "NT"
revision = "a9d3bda3a223baa6bba6ef412cb273f0fd163c05"

[[projects]]
digest = "1:8c74f97396ed63cc2ef04ebb5fc37bb032871b8fd890a25991ed40974b00cd2a"
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 = "NT"
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
version = "v0.3.0"

[[projects]]
branch = "master"
digest = "1:9fdc2b55e8e0fafe4b41884091e51e77344f7dc511c5acedcfd98200003bff90"
name = "golang.org/x/time"
packages = ["rate"]
pruneopts = "NT"
revision = "85acf8d2951cb2a3bde7632f9ff273ef0379bcbd"

[[projects]]
branch = "master"
digest = "1:5e5ffea31fdbfc2aebc204909b1fb87f9819f9b2a1eab5dfbcaf4e75bfd05208"
name = "golang.org/x/tools"
packages = [
"go/ast/astutil",
"go/gcexportdata",
"go/internal/cgo",
"go/internal/gcimporter",
"go/internal/packagesdriver",
"go/packages",
"go/types/typeutil",
"imports",
"internal/fastwalk",
"internal/gopathwalk",
"internal/module",
"internal/semver"
]
pruneopts = "NT"
revision = "83362c3779f5f48611068d488a03ea7bbaddc81e"

[[projects]]
digest = "1:902ffa11f1d8c19c12b05cabffe69e1a16608ad03a8899ebcb9c6bde295660ae"
name = "google.golang.org/appengine"
packages = [
".",
"internal",
"internal/app_identity",
"internal/base",
"internal/datastore",
"internal/log",
"internal/modules",
"internal/remote_api",
"internal/urlfetch",
"urlfetch"
]
pruneopts = "NT"
revision = "e9657d882bb81064595ca3b56cbe2546bbabf7b1"
version = "v1.4.0"

[[projects]]
digest = "1:2d1fbdc6777e5408cabeb02bf336305e724b925ff4546ded0fa8715a7267922a"
name = "gopkg.in/inf.v0"
packages = ["."]
pruneopts = "NT"
revision = "d2d2541c53f18d2a059457998ce2876cc8e67cbf"
version = "v0.9.1"

[[projects]]
digest = "1:18108594151654e9e696b27b181b953f9a90b16bf14d253dd1b397b025a1487f"
name = "gopkg.in/yaml.v2"
packages = ["."]
pruneopts = "NT"
revision = "51d6538a90f86fe93ac480b35f37b2be17fef232"
version = "v2.2.2"

[[projects]]
digest = "1:6fa82ea248029bbbdddade20c06ab177ff6e485e5e45e48b045707415b7efd34"
name = "k8s.io/api"
packages = [
"admission/v1beta1",
"admissionregistration/v1alpha1",
"admissionregistration/v1beta1",
"apps/v1",
"apps/v1beta1",
"apps/v1beta2",
"auditregistration/v1alpha1",
"authentication/v1",
"authentication/v1beta1",
"authorization/v1",
"authorization/v1beta1",
"autoscaling/v1",
"autoscaling/v2beta1",
"autoscaling/v2beta2",
"batch/v1",
"batch/v1beta1",
"batch/v2alpha1",
"certificates/v1beta1",
"coordination/v1beta1",
"core/v1",
"events/v1beta1",
"extensions/v1beta1",
"networking/v1",
"policy/v1beta1",
"rbac/v1",
"rbac/v1alpha1",
"rbac/v1beta1",
"scheduling/v1alpha1",
"scheduling/v1beta1",
"settings/v1alpha1",
"storage/v1",
"storage/v1alpha1",
"storage/v1beta1"
]
pruneopts = "NT"
revision = "05914d821849570fba9eacfb29466f2d8d3cd229"

[[projects]]
digest = "1:c6f23048e162e65d586c809fd02e263e180ad157f110df17437c22517bb59a4b"
name = "k8s.io/apiextensions-apiserver"
packages = [
"pkg/apis/apiextensions",
"pkg/apis/apiextensions/v1beta1"
]
pruneopts = "NT"
revision = "0fe22c71c47604641d9aa352c785b7912c200562"

[[projects]]
digest = "1:15b5c41ff6faa4d0400557d4112d6337e1abc961c65513d44fce7922e32c9ca7"
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/v1beta1",
"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/mergepatch",
"pkg/util/naming",
"pkg/util/net",
"pkg/util/runtime",
"pkg/util/sets",
"pkg/util/strategicpatch",
"pkg/util/uuid",
"pkg/util/validation",
"pkg/util/validation/field",
"pkg/util/wait",
"pkg/util/yaml",
"pkg/version",
"pkg/watch",
"third_party/forked/golang/json",
"third_party/forked/golang/reflect"
]
pruneopts = "NT"
revision = "2b1284ed4c93a43499e781493253e2ac5959c4fd"

[[projects]]
digest = "1:c904a3d70131b33df36e4e51b574226b82308fc1ea66964aa21095a95d453fc9"
name = "k8s.io/client-go"
packages = [
"discovery",
"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/auditregistration/v1alpha1",
"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/autoscaling/v2beta2",
"kubernetes/typed/batch/v1",
"kubernetes/typed/batch/v1beta1",
"kubernetes/typed/batch/v2alpha1",
"kubernetes/typed/certificates/v1beta1",
"kubernetes/typed/coordination/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/scheduling/v1beta1",
"kubernetes/typed/settings/v1alpha1",
"kubernetes/typed/storage/v1",
"kubernetes/typed/storage/v1alpha1",
"kubernetes/typed/storage/v1beta1",
"pkg/apis/clientauthentication",
"pkg/apis/clientauthentication/v1alpha1",
"pkg/apis/clientauthentication/v1beta1",
"pkg/version",
"plugin/pkg/client/auth/exec",
"plugin/pkg/client/auth/gcp",
"rest",
"rest/watch",
"restmapper",
"third_party/forked/golang/template",
"tools/auth",
"tools/cache",
"tools/clientcmd",
"tools/clientcmd/api",
"tools/clientcmd/api/latest",
"tools/clientcmd/api/v1",
"tools/leaderelection",
"tools/leaderelection/resourcelock",
"tools/metrics",
"tools/pager",
"tools/record",
"tools/reference",
"transport",
"util/buffer",
"util/cert",
"util/connrotation",
"util/flowcontrol",
"util/homedir",
"util/integer",
"util/jsonpath",
"util/retry",
"util/workqueue"
]
pruneopts = "NT"
revision = "8d9ed539ba3134352c586810e749e58df4e94e4f"

[[projects]]
digest = "1:dc1ae99dcab96913d81ae970b1f7a7411a54199b14bfb17a7e86f9a56979c720"
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/args",
"cmd/conversion-gen/generators",
"cmd/deepcopy-gen",
"cmd/deepcopy-gen/args",
"cmd/defaulter-gen",
"cmd/defaulter-gen/args",
"cmd/informer-gen",
"cmd/informer-gen/args",
"cmd/informer-gen/generators",
"cmd/lister-gen",
"cmd/lister-gen/args",
"cmd/lister-gen/generators",
"pkg/util"
]
pruneopts = "T"
revision = "c2090bec4d9b1fb25de3812f868accc2bc9ecbae"

[[projects]]
branch = "master"
digest = "1:2b9071c93303f1196cfe959c7f7f69ed1e4a5180f240a259536c5886f79f86d4"
name = "k8s.io/gengo"
packages = [
"args",
"examples/deepcopy-gen/generators",
"examples/defaulter-gen/generators",
"examples/set-gen/sets",
"generator",
"namer",
"parser",
"types"
]
pruneopts = "T"
revision = "0689ccc1d7d65d9dd1bedcc3b0b1ed7df91ba266"

[[projects]]
digest = "1:29f93bb84d907a2c035e729e19d66fe52165d8c905cb3ef1920140d76ae6afaf"
name = "k8s.io/klog"
packages = ["."]
pruneopts = "NT"
revision = "71442cd4037d612096940ceb0f3fec3f7fff66e0"
version = "v0.2.0"

[[projects]]
digest = "1:c48a795cd7048bb1888273bc604b6e69b22f9b8089c3df65f77cc527757b515c"
name = "k8s.io/kube-openapi"
packages = [
"cmd/openapi-gen",
"cmd/openapi-gen/args",
"pkg/common",
"pkg/generators",
"pkg/generators/rules",
"pkg/util/proto",
"pkg/util/sets"
]
pruneopts = "NT"
revision = "0cf8f7e6ed1d2e3d47d02e3b6e559369af24d803"

[[projects]]
digest = "1:06035489efbd51ccface65fc878ceeb849aba05b2f9443c8993f363fc96e80ac"
name = "sigs.k8s.io/controller-runtime"
packages = [
"pkg/cache",
"pkg/cache/internal",
"pkg/client",
"pkg/client/apiutil",
"pkg/client/config",
"pkg/internal/recorder",
"pkg/leaderelection",
"pkg/manager",
"pkg/metrics",
"pkg/patch",
"pkg/recorder",
"pkg/runtime/inject",
"pkg/runtime/log",
"pkg/runtime/signals",
"pkg/webhook/admission",
"pkg/webhook/admission/types",
"pkg/webhook/internal/metrics",
"pkg/webhook/types"
]
pruneopts = "NT"
revision = "12d98582e72927b6cd0123e2b4e819f9341ce62c"
version = "v0.1.10"

[[projects]]
digest = "1:0a14ea9a2647d064bb9d48b2de78306e74b196681efd7b654eb0b518d90c2e8d"
name = "sigs.k8s.io/controller-tools"
packages = [
"pkg/crd/generator",
"pkg/crd/util",
"pkg/internal/codegen",
"pkg/internal/codegen/parse",
"pkg/internal/general",
"pkg/util"
]
pruneopts = "NT"
revision = "950a0e88e4effb864253b3c7504b326cc83b9d11"
version = "v0.1.8"

[[projects]]
digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c"
name = "sigs.k8s.io/yaml"
packages = ["."]
pruneopts = "NT"
revision = "fd68e9863619f6ec2fdd8625fe1f02e7c877e480"
version = "v1.1.0"

[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
input-imports = [
"github.com/operator-framework/operator-sdk/pkg/k8sutil",
"github.com/operator-framework/operator-sdk/pkg/leader",
"github.com/operator-framework/operator-sdk/pkg/log/zap",
"github.com/operator-framework/operator-sdk/pkg/metrics",
"github.com/operator-framework/operator-sdk/version",
"github.com/spf13/pflag",
"k8s.io/apimachinery/pkg/runtime",
"k8s.io/client-go/plugin/pkg/client/auth/gcp",
"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/gengo/args",
"k8s.io/kube-openapi/cmd/openapi-gen",
"sigs.k8s.io/controller-runtime/pkg/client/config",
"sigs.k8s.io/controller-runtime/pkg/manager",
"sigs.k8s.io/controller-runtime/pkg/runtime/log",
"sigs.k8s.io/controller-runtime/pkg/runtime/signals",
"sigs.k8s.io/controller-tools/pkg/crd/generator"
]
solver-name = "gps-cdcl"
solver-version = 1

+ 75
- 0
Gopkg.toml View File

@@ -0,0 +1,75 @@
# Force dep to vendor the code generators, which aren't imported just used at dev time.
required = [
"k8s.io/code-generator/cmd/defaulter-gen",
"k8s.io/code-generator/cmd/deepcopy-gen",
"k8s.io/code-generator/cmd/conversion-gen",
"k8s.io/code-generator/cmd/client-gen",
"k8s.io/code-generator/cmd/lister-gen",
"k8s.io/code-generator/cmd/informer-gen",
"k8s.io/kube-openapi/cmd/openapi-gen",
"k8s.io/gengo/args",
"sigs.k8s.io/controller-tools/pkg/crd/generator",
]

[[override]]
name = "k8s.io/code-generator"
# revision for tag "kubernetes-1.13.1"
revision = "c2090bec4d9b1fb25de3812f868accc2bc9ecbae"

[[override]]
name = "k8s.io/kube-openapi"
revision = "0cf8f7e6ed1d2e3d47d02e3b6e559369af24d803"

[[override]]
name = "github.com/go-openapi/spec"
branch = "master"

[[override]]
name = "sigs.k8s.io/controller-tools"
version = "=v0.1.8"

[[override]]
name = "k8s.io/api"
# revision for tag "kubernetes-1.13.1"
revision = "05914d821849570fba9eacfb29466f2d8d3cd229"

[[override]]
name = "k8s.io/apiextensions-apiserver"
# revision for tag "kubernetes-1.13.1"
revision = "0fe22c71c47604641d9aa352c785b7912c200562"

[[override]]
name = "k8s.io/apimachinery"
# revision for tag "kubernetes-1.13.1"
revision = "2b1284ed4c93a43499e781493253e2ac5959c4fd"

[[override]]
name = "k8s.io/client-go"
# revision for tag "kubernetes-1.13.1"
revision = "8d9ed539ba3134352c586810e749e58df4e94e4f"

[[override]]
name = "github.com/coreos/prometheus-operator"
version = "=v0.26.0"

[[override]]
name = "sigs.k8s.io/controller-runtime"
version = "=v0.1.10"

[[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" #osdk_branch_annotation
# version = "=v0.5.0" #osdk_version_annotation

[prune]
go-tests = true
non-go = true

[[prune.project]]
name = "k8s.io/code-generator"
non-go = false

[[prune.project]]
name = "k8s.io/gengo"
non-go = false

+ 15
- 0
build/Dockerfile View File

@@ -0,0 +1,15 @@
FROM alpine:3.8

ENV OPERATOR=/usr/local/bin/rabbitmq-operator \
USER_UID=1001 \
USER_NAME=rabbitmq-operator

# install operator binary
COPY build/_output/bin/rabbitmq-operator ${OPERATOR}

COPY build/bin /usr/local/bin
RUN /usr/local/bin/user_setup

ENTRYPOINT ["/usr/local/bin/entrypoint"]

USER ${USER_UID}

+ 12
- 0
build/bin/entrypoint View File

@@ -0,0 +1,12 @@
#!/bin/sh -e

# This is documented here:
# https://docs.openshift.com/container-platform/3.11/creating_images/guidelines.html#openshift-specific-guidelines

if ! whoami &>/dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-rabbitmq-operator}:x:$(id -u):$(id -g):${USER_NAME:-rabbitmq-operator} user:${HOME}:/sbin/nologin" >> /etc/passwd
fi
fi

exec ${OPERATOR} $@

+ 13
- 0
build/bin/user_setup View File

@@ -0,0 +1,13 @@
#!/bin/sh
set -x

# ensure $HOME exists and is accessible by group 0 (we don't know what the runtime UID will be)
mkdir -p ${HOME}
chown ${USER_UID}:0 ${HOME}
chmod ug+rwx ${HOME}

# runtime user will need to be able to self-insert in /etc/passwd
chmod g+rw /etc/passwd

# no need for this script to remain in the image after running
rm $0

+ 121
- 0
cmd/manager/main.go View File

@@ -0,0 +1,121 @@
package main

import (
"context"
"flag"
"fmt"
"os"
"runtime"

"github.com/tekliner/rabbitmq-operator/pkg/apis"
"github.com/tekliner/rabbitmq-operator/pkg/controller"

"github.com/operator-framework/operator-sdk/pkg/k8sutil"
"github.com/operator-framework/operator-sdk/pkg/leader"
"github.com/operator-framework/operator-sdk/pkg/log/zap"
"github.com/operator-framework/operator-sdk/pkg/metrics"
sdkVersion "github.com/operator-framework/operator-sdk/version"
"github.com/spf13/pflag"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/manager"
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
"sigs.k8s.io/controller-runtime/pkg/runtime/signals"
)

// Change below variables to serve metrics on different host or port.
var (
metricsHost = "0.0.0.0"
metricsPort int32 = 8383
)
var log = logf.Log.WithName("cmd")

func printVersion() {
log.Info(fmt.Sprintf("Go Version: %s", runtime.Version()))
log.Info(fmt.Sprintf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH))
log.Info(fmt.Sprintf("Version of operator-sdk: %v", sdkVersion.Version))
}

func main() {
// Add the zap logger flag set to the CLI. The flag set must
// be added before calling pflag.Parse().
pflag.CommandLine.AddFlagSet(zap.FlagSet())

// Add flags registered by imported packages (e.g. glog and
// controller-runtime)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)

pflag.Parse()

// Use a zap logr.Logger implementation. If none of the zap
// flags are configured (or if the zap flag set is not being
// used), this defaults to a production zap logger.
//
// The logger instantiated here can be changed to any logger
// implementing the logr.Logger interface. This logger will
// be propagated through the whole operator, generating
// uniform and structured logs.
logf.SetLogger(zap.Logger())

printVersion()

namespace, err := k8sutil.GetWatchNamespace()
if err != nil {
log.Error(err, "Failed to get watch namespace")
os.Exit(1)
}

// Get a config to talk to the apiserver
cfg, err := config.GetConfig()
if err != nil {
log.Error(err, "")
os.Exit(1)
}

ctx := context.TODO()

// Become the leader before proceeding
err = leader.Become(ctx, "rabbitmq-operator-lock")
if err != nil {
log.Error(err, "")
os.Exit(1)
}

// Create a new Cmd to provide shared dependencies and start components
mgr, err := manager.New(cfg, manager.Options{
Namespace: namespace,
MetricsBindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort),
})
if err != nil {
log.Error(err, "")
os.Exit(1)
}

log.Info("Registering Components.")

// Setup Scheme for all resources
if err := apis.AddToScheme(mgr.GetScheme()); err != nil {
log.Error(err, "")
os.Exit(1)
}

// Setup all Controllers
if err := controller.AddToManager(mgr); err != nil {
log.Error(err, "")
os.Exit(1)
}

// Create Service object to expose the metrics port.
_, err = metrics.ExposeMetricsPort(ctx, metricsPort)
if err != nil {
log.Info(err.Error())
}

log.Info("Starting the Cmd.")

// Start the Cmd
if err := mgr.Start(signals.SetupSignalHandler()); err != nil {
log.Error(err, "Manager exited non-zero")
os.Exit(1)
}
}

+ 33
- 0
deploy/operator.yaml View File

@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: rabbitmq-operator
spec:
replicas: 1
selector:
matchLabels:
name: rabbitmq-operator
template:
metadata:
labels:
name: rabbitmq-operator
spec:
serviceAccountName: rabbitmq-operator
containers:
- name: rabbitmq-operator
# Replace this with the built image name
image: REPLACE_IMAGE
command:
- rabbitmq-operator
imagePullPolicy: Always
env:
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: OPERATOR_NAME
value: "rabbitmq-operator"

+ 39
- 0
deploy/role.yaml View File

@@ -0,0 +1,39 @@
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: rabbitmq-operator
rules:
- apiGroups:
- ""
resources:
- pods
- services
- endpoints
- persistentvolumeclaims
- events
- configmaps
- secrets
verbs:
- "*"
- apiGroups:
- ""
resources:
- namespaces
verbs:
- get
- apiGroups:
- apps
resources:
- deployments
- daemonsets
- replicasets
- statefulsets
verbs:
- "*"
- apiGroups:
- monitoring.coreos.com
resources:
- servicemonitors
verbs:
- "get"
- "create"

+ 11
- 0
deploy/role_binding.yaml View File

@@ -0,0 +1,11 @@
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: rabbitmq-operator
subjects:
- kind: ServiceAccount
name: rabbitmq-operator
roleRef:
kind: Role
name: rabbitmq-operator
apiGroup: rbac.authorization.k8s.io

+ 4
- 0
deploy/service_account.yaml View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: rabbitmq-operator

+ 13
- 0
pkg/apis/apis.go View File

@@ -0,0 +1,13 @@
package apis

import (
"k8s.io/apimachinery/pkg/runtime"
)

// AddToSchemes may be used to add all resources defined in the project to a Scheme
var AddToSchemes runtime.SchemeBuilder

// AddToScheme adds all Resources to the Scheme
func AddToScheme(s *runtime.Scheme) error {
return AddToSchemes.AddToScheme(s)
}

+ 18
- 0
pkg/controller/controller.go View File

@@ -0,0 +1,18 @@
package controller

import (
"sigs.k8s.io/controller-runtime/pkg/manager"
)

// AddToManagerFuncs is a list of functions to add all Controllers to the Manager
var AddToManagerFuncs []func(manager.Manager) error

// AddToManager adds all Controllers to the Manager
func AddToManager(m manager.Manager) error {
for _, f := range AddToManagerFuncs {
if err := f(m); err != nil {
return err
}
}
return nil
}

+ 15
- 0
vendor/cloud.google.com/go/AUTHORS View File

@@ -0,0 +1,15 @@
# This is the official list of cloud authors for copyright purposes.
# This file is distinct from the CONTRIBUTORS files.
# See the latter for an explanation.

# Names should be added to this file as:
# Name or Organization <email address>
# The email address is not required for organizations.

Filippo Valsorda <hi@filippo.io>
Google Inc.
Ingo Oeser <nightlyone@googlemail.com>
Palm Stone Games, Inc.
Paweł Knap <pawelknap88@gmail.com>
Péter Szilágyi <peterke@gmail.com>
Tyler Treat <ttreat31@gmail.com>

+ 40
- 0
vendor/cloud.google.com/go/CONTRIBUTORS View File

@@ -0,0 +1,40 @@
# People who have agreed to one of the CLAs and can contribute patches.
# The AUTHORS file lists the copyright holders; this file
# lists people. For example, Google employees are listed here
# but not in AUTHORS, because Google holds the copyright.
#
# https://developers.google.com/open-source/cla/individual
# https://developers.google.com/open-source/cla/corporate
#
# Names should be added to this file as:
# Name <email address>

# Keep the list alphabetically sorted.

Alexis Hunt <lexer@google.com>
Andreas Litt <andreas.litt@gmail.com>
Andrew Gerrand <adg@golang.org>
Brad Fitzpatrick <bradfitz@golang.org>
Burcu Dogan <jbd@google.com>
Dave Day <djd@golang.org>
David Sansome <me@davidsansome.com>
David Symonds <dsymonds@golang.org>
Filippo Valsorda <hi@filippo.io>
Glenn Lewis <gmlewis@google.com>
Ingo Oeser <nightlyone@googlemail.com>
James Hall <james.hall@shopify.com>
Johan Euphrosine <proppy@google.com>
Jonathan Amsterdam <jba@google.com>
Kunpei Sakai <namusyaka@gmail.com>
Luna Duclos <luna.duclos@palmstonegames.com>
Magnus Hiie <magnus.hiie@gmail.com>
Mario Castro <mariocaster@gmail.com>
Michael McGreevy <mcgreevy@golang.org>
Omar Jarjur <ojarjur@google.com>
Paweł Knap <pawelknap88@gmail.com>
Péter Szilágyi <peterke@gmail.com>
Sarah Adams <shadams@google.com>
Thanatat Tamtan <acoshift@gmail.com>
Toby Burress <kurin@google.com>
Tuo Shan <shantuo@google.com>
Tyler Treat <ttreat31@gmail.com>

+ 202
- 0
vendor/cloud.google.com/go/LICENSE View File

@@ -0,0 +1,202 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

+ 248
- 0
vendor/cloud.google.com/go/asset/apiv1beta1/asset_client.go View File

@@ -0,0 +1,248 @@
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by gapic-generator. DO NOT EDIT.

package asset

import (
"context"
"time"

"cloud.google.com/go/longrunning"
lroauto "cloud.google.com/go/longrunning/autogen"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
"google.golang.org/api/transport"
assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1beta1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
)

// CallOptions contains the retry settings for each method of Client.
type CallOptions struct {
ExportAssets []gax.CallOption
BatchGetAssetsHistory []gax.CallOption
}

func defaultClientOptions() []option.ClientOption {
return []option.ClientOption{
option.WithEndpoint("cloudasset.googleapis.com:443"),
option.WithScopes(DefaultAuthScopes()...),
}
}

func defaultCallOptions() *CallOptions {
retry := map[[2]string][]gax.CallOption{
{"default", "idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.3,
})
}),
},
}
return &CallOptions{
ExportAssets: retry[[2]string{"default", "non_idempotent"}],
BatchGetAssetsHistory: retry[[2]string{"default", "idempotent"}],
}
}

// Client is a client for interacting with Cloud Asset API.
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
// The connection to the service.
conn *grpc.ClientConn

// The gRPC API client.
client assetpb.AssetServiceClient

// LROClient is used internally to handle longrunning operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient

// The call options for this service.
CallOptions *CallOptions

// The x-goog-* metadata to be sent with each request.
xGoogMetadata metadata.MD
}

// NewClient creates a new asset service client.
//
// Asset service definition.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
conn: conn,
CallOptions: defaultCallOptions(),

client: assetpb.NewAssetServiceClient(conn),
}
c.setGoogleClientInfo()

c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
if err != nil {
// This error "should not happen", since we are just reusing old connection
// and never actually need to dial.
// If this does happen, we could leak conn. However, we cannot close conn:
// If the user invoked the function with option.WithGRPCConn,
// we would close a connection that's still in use.
// TODO(pongad): investigate error conditions.
return nil, err
}
return c, nil
}

// Connection returns the client's connection to the API service.
func (c *Client) Connection() *grpc.ClientConn {
return c.conn
}

// Close closes the connection to the API service. The user should invoke this when
// the client is no longer required.
func (c *Client) Close() error {
return c.conn.Close()
}

// setGoogleClientInfo sets the name and version of the application in
// the `x-goog-api-client` header passed on each request. Intended for
// use by Google-written clients.
func (c *Client) setGoogleClientInfo(keyval ...string) {
kv := append([]string{"gl-go", versionGo()}, keyval...)
kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
}

// ExportAssets exports assets with time and resource types to a given Cloud Storage
// location. The output format is newline-delimited JSON.
// This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you
// to keep track of the export.
func (c *Client) ExportAssets(ctx context.Context, req *assetpb.ExportAssetsRequest, opts ...gax.CallOption) (*ExportAssetsOperation, error) {
ctx = insertMetadata(ctx, c.xGoogMetadata)
opts = append(c.CallOptions.ExportAssets[0:len(c.CallOptions.ExportAssets):len(c.CallOptions.ExportAssets)], opts...)
var resp *longrunningpb.Operation
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
var err error
resp, err = c.client.ExportAssets(ctx, req, settings.GRPC...)
return err
}, opts...)
if err != nil {
return nil, err
}
return &ExportAssetsOperation{
lro: longrunning.InternalNewOperation(c.LROClient, resp),
}, nil
}

// BatchGetAssetsHistory batch gets the update history of assets that overlap a time window.
// For RESOURCE content, this API outputs history with asset in both
// non-delete or deleted status.
// For IAM_POLICY content, this API outputs history when the asset and its
// attached IAM POLICY both exist. This can create gaps in the output history.
func (c *Client) BatchGetAssetsHistory(ctx context.Context, req *assetpb.BatchGetAssetsHistoryRequest, opts ...gax.CallOption) (*assetpb.BatchGetAssetsHistoryResponse, error) {
ctx = insertMetadata(ctx, c.xGoogMetadata)
opts = append(c.CallOptions.BatchGetAssetsHistory[0:len(c.CallOptions.BatchGetAssetsHistory):len(c.CallOptions.BatchGetAssetsHistory)], opts...)
var resp *assetpb.BatchGetAssetsHistoryResponse
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
var err error
resp, err = c.client.BatchGetAssetsHistory(ctx, req, settings.GRPC...)
return err
}, opts...)
if err != nil {
return nil, err
}
return resp, nil
}

// ExportAssetsOperation manages a long-running operation from ExportAssets.
type ExportAssetsOperation struct {
lro *longrunning.Operation
}

// ExportAssetsOperation returns a new ExportAssetsOperation from a given name.
// The name must be that of a previously created ExportAssetsOperation, possibly from a different process.
func (c *Client) ExportAssetsOperation(name string) *ExportAssetsOperation {
return &ExportAssetsOperation{
lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}),
}
}

// Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
//
// See documentation of Poll for error-handling information.
func (op *ExportAssetsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*assetpb.ExportAssetsResponse, error) {
var resp assetpb.ExportAssetsResponse
if err := op.lro.WaitWithInterval(ctx, &resp, 5000*time.Millisecond, opts...); err != nil {
return nil, err
}
return &resp, nil
}

// Poll fetches the latest state of the long-running operation.
//
// Poll also fetches the latest metadata, which can be retrieved by Metadata.
//
// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
// the operation has completed with failure, the error is returned and op.Done will return true.
// If Poll succeeds and the operation has completed successfully,
// op.Done will return true, and the response of the operation is returned.
// If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (op *ExportAssetsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*assetpb.ExportAssetsResponse, error) {
var resp assetpb.ExportAssetsResponse
if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
return nil, err
}
if !op.Done() {
return nil, nil
}
return &resp, nil
}

// Metadata returns metadata associated with the long-running operation.
// Metadata itself does not contact the server, but Poll does.
// To get the latest metadata, call this method after a successful call to Poll.
// If the metadata is not available, the returned metadata and error are both nil.
func (op *ExportAssetsOperation) Metadata() (*assetpb.ExportAssetsRequest, error) {
var meta assetpb.ExportAssetsRequest
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
return nil, nil
} else if err != nil {
return nil, err
}
return &meta, nil
}

// Done reports whether the long-running operation has completed.
func (op *ExportAssetsOperation) Done() bool {
return op.lro.Done()
}

// Name returns the name of the long-running operation.
// The name is assigned by the server and is unique within the service from which the operation is created.
func (op *ExportAssetsOperation) Name() string {
return op.lro.Name()
}

+ 89
- 0
vendor/cloud.google.com/go/asset/apiv1beta1/doc.go View File

@@ -0,0 +1,89 @@
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by gapic-generator. DO NOT EDIT.

// Package asset is an auto-generated package for the
// Cloud Asset API.
//
// NOTE: This package is in beta. It is not stable, and may be subject to changes.
//
// The cloud asset API manages the history and inventory of cloud resources.
package asset // import "cloud.google.com/go/asset/apiv1beta1"

import (
"context"
"runtime"
"strings"
"unicode"

"google.golang.org/grpc/metadata"
)

func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
out = out.Copy()
for _, md := range mds {
for k, v := range md {
out[k] = append(out[k], v...)
}
}
return metadata.NewOutgoingContext(ctx, out)
}

// DefaultAuthScopes reports the default set of authentication scopes to use with this package.
func DefaultAuthScopes() []string {
return []string{
"https://www.googleapis.com/auth/cloud-platform",
}
}

// versionGo returns the Go runtime version. The returned string
// has no whitespace, suitable for reporting in header.
func versionGo() string {
const develPrefix = "devel +"

s := runtime.Version()
if strings.HasPrefix(s, develPrefix) {
s = s[len(develPrefix):]
if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 {
s = s[:p]
}
return s
}

notSemverRune := func(r rune) bool {
return strings.IndexRune("0123456789.", r) < 0
}

if strings.HasPrefix(s, "go1") {
s = s[2:]
var prerelease string
if p := strings.IndexFunc(s, notSemverRune); p >= 0 {
s, prerelease = s[:p], s[p:]
}
if strings.HasSuffix(s, ".") {
s += "0"
} else if strings.Count(s, ".") < 2 {
s += ".0"
}
if prerelease != "" {
s += "-" + prerelease
}
return s
}
return "UNKNOWN"
}

const versionClient = "20190121"

+ 248
- 0
vendor/cloud.google.com/go/asset/v1beta1/asset_client.go View File

@@ -0,0 +1,248 @@
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// AUTO-GENERATED CODE. DO NOT EDIT.

package asset

import (
"context"
"time"

"cloud.google.com/go/longrunning"
lroauto "cloud.google.com/go/longrunning/autogen"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
"google.golang.org/api/transport"
assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1beta1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
)

// CallOptions contains the retry settings for each method of Client.
type CallOptions struct {
ExportAssets []gax.CallOption
BatchGetAssetsHistory []gax.CallOption
}

func defaultClientOptions() []option.ClientOption {
return []option.ClientOption{
option.WithEndpoint("cloudasset.googleapis.com:443"),
option.WithScopes(DefaultAuthScopes()...),
}
}

func defaultCallOptions() *CallOptions {
retry := map[[2]string][]gax.CallOption{
{"default", "idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.3,
})
}),
},
}
return &CallOptions{
ExportAssets: retry[[2]string{"default", "non_idempotent"}],
BatchGetAssetsHistory: retry[[2]string{"default", "idempotent"}],
}
}

// Client is a client for interacting with Cloud Asset API.
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
// The connection to the service.
conn *grpc.ClientConn

// The gRPC API client.
client assetpb.AssetServiceClient