-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from cockroachdb/upgrade-code
Add update code
- Loading branch information
Showing
12 changed files
with
936 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = [ | ||
"internal.go", | ||
"update.go", | ||
"update_cockroach_version.go", | ||
"update_cockroach_version_common.go", | ||
], | ||
importpath = "github.com/cockroachdb/cockroach-operator/pkg/update", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"@com_github_cenkalti_backoff//:go_default_library", | ||
"@com_github_lib_pq//:go_default_library", | ||
"@com_github_masterminds_semver_v3//:go_default_library", | ||
"@com_github_pkg_errors//:go_default_library", | ||
"@io_k8s_api//apps/v1:go_default_library", | ||
"@io_k8s_api//core/v1:go_default_library", | ||
"@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", | ||
"@io_k8s_client_go//kubernetes:go_default_library", | ||
"@org_uber_go_zap//:go_default_library", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "package-srcs", | ||
srcs = glob(["**"]), | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
filegroup( | ||
name = "all-srcs", | ||
srcs = [":package-srcs"], | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
Copyright 2020 The Cockroach Authors | ||
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. | ||
*/ | ||
|
||
package update | ||
|
||
// Cockroach roles that we can grant/revoke for users. | ||
const ( | ||
// Fixed fields in the client certificate. Any other values will be rejected by Vault. | ||
// Remember to update <repo root>/conf/policies/intrusion.hcl when updating this list of users. | ||
RootSQLUser = "root" | ||
NodeUser = "node" | ||
AdminRole = "admin" | ||
) | ||
|
||
// internalUsers is a set of SQL users created as part of the managed service, not to be used | ||
// by customers. This struct is used to hide specific users in the console. | ||
var internalUsers = map[string]struct{}{ | ||
RootSQLUser: {}, | ||
NodeUser: {}, | ||
} | ||
|
||
// internalDBs is a set of SQL databases created as part of CRDB, not to be used by customers. | ||
var internalDBs = map[string]struct{}{ | ||
"system": {}, | ||
"postgres": {}, | ||
} | ||
|
||
func IsInternalUser(user string) bool { | ||
_, ok := internalUsers[user] | ||
return ok | ||
} | ||
|
||
func IsInternalDB(db string) bool { | ||
_, ok := internalDBs[db] | ||
return ok | ||
} |
Oops, something went wrong.