Skip to content

Commit a085351

Browse files
authored
Merge branch 'cockroachdb:master' into do-main
2 parents 9c978de + f476ff3 commit a085351

File tree

88 files changed

+1650
-850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1650
-850
lines changed

.github/workflows/e2e-kind-create.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ jobs:
3737
path: "~/.cache/bazel"
3838
key: bazel
3939

40-
- name: End-to-end (kind)
41-
run: make test/e2e/kind-create
40+
- name: End-to-end (k3d)
41+
run: make test/e2e/k3d-create

.github/workflows/e2e-kind-decommission.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ jobs:
3737
path: "~/.cache/bazel"
3838
key: bazel
3939

40-
- name: End-to-end (kind)
41-
run: make test/e2e/kind-decommission
40+
- name: End-to-end (k3d)
41+
run: make test/e2e/k3d-decommission

.github/workflows/e2e-kind-upgrades.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ jobs:
3737
path: "~/.cache/bazel"
3838
key: bazel
3939

40-
- name: End-to-end (kind)
41-
run: make test/e2e/kind-upgrades
40+
- name: End-to-end (k3d)
41+
run: make test/e2e/k3d-upgrades

.github/workflows/e2e-kind-upgradessha256.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ jobs:
3737
path: "~/.cache/bazel"
3838
key: bazel
3939

40-
- name: End-to-end (kind)
41-
run: make test/e2e/kind-upgradessha256
40+
- name: End-to-end (k3d)
41+
run: make test/e2e/k3d-upgradessha256

.github/workflows/e2e-kind-versionchecker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
key: bazel
3939

4040
- name: End-to-end (kind)
41-
run: make test/e2e/kind-versionchecker
41+
run: make test/e2e/k3d-versionchecker

.github/workflows/nightly-smoketest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
strategy:
3232
matrix:
3333
# supported Kubenetes versions
34-
NODE_VERSION: [1.18.19, 1.19.11, 1.20.7, 1.21.2, 1.22.1]
34+
NODE_VERSION: [1.19.16, 1.20.15, 1.21.9, 1.22.6, 1.23.3]
3535
steps:
3636
- uses: actions/checkout@v3
3737
- name: Mount bazel cache

CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,32 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
66
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
# [Unreleased](https://github.com/cockroachdb/cockroach-operator/compare/v2.6.0...master)
8+
# [Unreleased](https://github.com/cockroachdb/cockroach-operator/compare/v2.8.0...master)
9+
10+
## Fixed
11+
12+
* Install init container certs with 600 permissions
13+
14+
# [v2.8.0](https://github.com/cockroachdb/cockroach-operator/compare/v2.7.0...v2.8.0)
15+
16+
## Added
17+
18+
* `AutomountServiceAccountToken` field for cluster spec to allow mounting the default service account token.
19+
20+
## Fixed
21+
22+
* Delete the CancelLoop function, fixing a cluster status update bug
23+
* Correctly detect failed version checker Pods
24+
* retry cluster status updates, reducing test flakes
25+
26+
# [v2.7.0](https://github.com/cockroachdb/cockroach-operator/compare/v2.6.0...v2.7.0)
27+
28+
## Fixed
29+
30+
* Grant operator deletecollection permissions to fix fullcluster restart flow
31+
* Grant operator list and update permissions on pvcs to fix pvc resize flow
32+
* Bump TerminationGracePeriodSeconds from 1m to 5m
33+
* Prefer user added --join flags over default when explicitly passed
934

1035
# [v2.6.0](https://github.com/cockroachdb/cockroach-operator/compare/v2.5.3...v2.6.0)
1136

DEVELOPER.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ See: https://docs.bazel.build/versions/master/install.html
66

77
Take a look at the [Makefile](https://github.com/cockroachdb/cockroach-operator/blob/master/Makefile) for various
88
targets you can run. The e2e testing requires a container engine like docker running as it starts a K8s cluster with
9-
Kind. The Makefile is simply a wrapper for bazel commands and does not have any build functionality in it.
9+
[k3d]. The Makefile is simply a wrapper for bazel commands and does not have any build functionality in it.
1010

1111
You will also need kubectl and a running Kubernetes cluster to run the k8s targets like `make k8s/apply`.
1212

1313
Bazel has been primarily tested on Linux but "should" run on macOS as well. Windows at this time has not been tested.
1414

15-
TODO: notes on python configuration for the host.
16-
1715
If you are new to Bazel take a look at the Workspace file, as it lays out which rule sets we are using, such as docker
1816
rules and k8s rules. The Makefile notes below talk about the different target groups that run various bazel commands.
1917

@@ -39,25 +37,24 @@ Please run the testing targets locally before you push a PR.
3937

4038
## Running Locally
4139

42-
We use [kind] to run the operator in a local environment. This can provide a faster feedback cycle while developing
40+
We use [k3d] to run the operator in a local environment. This can provide a faster feedback cycle while developing
4341
since there's no need to set up a remote GKE/OpenShift cluster.
4442

45-
[kind]: https://kind.sigs.k8s.io/
43+
[k3d]: https://k3d.io
4644

4745
**make dev/up**
4846

4947
This command will get everything set up for you to begin testing out the operator. Specifically it will:
5048

51-
* Start a local docker registry (via docker run) and configure it to work with kind/K8s
52-
* Start a kind cluster named test (context=kind-test)
49+
* Start a k3d cluster named test (context=k3d-test) with a managed docker registry
5350
* Install the CRDs
54-
* Build a docker image and publish it to the local registry
51+
* Build a docker image and publish it to the k3d registry
5552
* Deploy the operator and wait for it to be available
5653
* Ensure your shell is configured to use the new cluster (kube context)
5754

5855
**make dev/down**
5956

60-
Tears down the kind cluster.
57+
Tears down the k3d cluster.
6158

6259
## Testing CR Database
6360

@@ -108,8 +105,8 @@ When you have removed your example and the persitent volumes you can use the fol
108105
1. If you do not have a GKE cluster we have a helper script `./hack/create-gke-cluster.sh -c test`.
109106
1. Locate the latest released tag here https://github.com/cockroachdb/cockroach-operator/tags
110107
1. Clone the tag `git clone --depth 1 --branch <tag_name> https://github.com/cockroachdb/cockroach-operator`
111-
1. Execute `kubectl apply -f config/crd/bases/crdb.cockroachlabs.com_crdbclusters.yaml`
112-
1. Execute `kubectl apply -f manifests/operator.yaml`
108+
1. Execute `kubectl apply -f install/crds.yaml`
109+
1. Execute `kubectl apply -f install/operator.yaml`
113110
1. Check that the operator has deployed properly
114111

115112
The examples directory contains various examples, for example you can run `kubectl apply -f examples/example.yaml`.

Makefile

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
SHELL:=/usr/bin/env bash -O globstar
2020

21+
# Define path where we install binaries.
22+
# NOTE(all): We need to use absolute paths because kubetest2 on go 1.19 does
23+
# not support relative paths.
24+
BINPATH := $(abspath bazel-bin)
25+
2126
# values used in workspace-status.sh
2227
CLUSTER_NAME?=bazel-test
2328
COCKROACH_DATABASE_VERSION=v21.2.3
@@ -60,7 +65,7 @@ test/verify:
6065
test/lint:
6166
bazel run //hack:verify-gofmt
6267

63-
# NODE_VERSION refers the to version of the kindest/node image. E.g. 1.22.1
68+
# NODE_VERSION refers the to patch version of Kubernetes (e.g. 1.22.6)
6469
.PHONY: test/smoketest
6570
test/smoketest:
6671
@bazel run //hack/smoketest -- -dir $(PWD) -version $(NODE_VERSION)
@@ -71,10 +76,9 @@ test/smoketest:
7176
test/e2e-short:
7277
bazel test //e2e/... --test_arg=--test.short
7378

74-
#
7579
# End to end testing targets
7680
#
77-
# kind: use make test/e2e/kind
81+
# k3d: use make test/e2e/k3d
7882
# gke: use make test/e2e/gke
7983
#
8084
# kubetest2 binaries from the kubernetes testing team is used
@@ -83,48 +87,49 @@ test/e2e-short:
8387
# Once the repo releases binaries we should vendor the tag or
8488
# download the built binaries.
8589

86-
# This target is used by kubetest2-tester-exec when running a kind test
87-
# This target exportis the kubeconfig from kind and then runs
88-
# k8s:k8s -type kind which checks to see if kind is up and running.
90+
# This target is used by kubetest2-tester-exec when running a k3d test
91+
# It run k8s:k8s -type k3d which checks to see if k3d is up and running.
8992
# Then bazel e2e testing is run.
90-
# An example of calling this is using make test/e2e/testrunner-kind-upgrades
91-
test/e2e/testrunner-kind-%: PACKAGE=$*
92-
test/e2e/testrunner-kind-%:
93-
bazel-bin/hack/bin/kind export kubeconfig --name $(CLUSTER_NAME)
94-
bazel run //hack/k8s:k8s -- -type kind
93+
# An example of calling this is using make test/e2e/testrunner-k3d-upgrades
94+
test/e2e/testrunner-k3d-%: PACKAGE=$*
95+
test/e2e/testrunner-k3d-%:
96+
bazel run //hack/k8s:k8s -- -type k3d
9597
bazel test --stamp //e2e/$(PACKAGE)/... --test_arg=-test.v --test_arg=-test.parallel=8 --test_arg=parallel=true
9698

97-
# Use this target to run e2e tests using a kind k8s cluster.
98-
# This target uses kind to start a k8s cluster and runs the e2e tests
99+
# Use this target to run e2e tests using a k3d k8s cluster.
100+
# This target uses k3d to start a k8s cluster and runs the e2e tests
99101
# against that cluster.
100-
# This is the main entrypoint for running the e2e tests on kind.
101-
# This target runs kubetest2 kind that starts a kind cluster
102+
#
103+
# This is the main entrypoint for running the e2e tests on k3d.
104+
# This target runs kubetest2 k3d that starts a k3d cluster
102105
# Then kubetest2 tester exec is run which runs the make target
103-
# test/e2e/testrunner-kind.
106+
# test/e2e/testrunner-k3d.
104107
# After the tests run the cluster is deleted.
105108
# If you need a unique cluster name override CLUSTER_NAME.
106-
test/e2e/kind-%: PACKAGE=$*
107-
test/e2e/kind-%:
108-
bazel build //hack/bin/...
109-
PATH=${PATH}:bazel-bin/hack/bin kubetest2 kind --cluster-name=$(CLUSTER_NAME) \
110-
--up --down -v 10 --test=exec -- make test/e2e/testrunner-kind-$(PACKAGE)
109+
test/e2e/k3d-%: PACKAGE=$*
110+
test/e2e/k3d-%:
111+
bazel build //hack/bin/... //e2e/kubetest2-k3d/...
112+
PATH=$(BINPATH)/hack/bin:$(BINPATH)/e2e/kubetest2-k3d/kubetest2-k3d_/:${PATH} \
113+
kubetest2 k3d \
114+
--cluster-name=$(CLUSTER_NAME) --image rancher/k3s:v1.23.3-k3s1 --servers 3 \
115+
--up --down -v 10 --test=exec -- make test/e2e/testrunner-k3d-$(PACKAGE)
111116

112117
# This target is used by kubetest2-eks to run e2e tests.
113118
.PHONY: test/e2e/testrunner-eks
114119
test/e2e/testrunner-eks:
115-
KUBECONFIG=$(TMPDIR)/$(CLUSTER_NAME)-eks.kubeconfig.yaml bazel-bin/hack/bin/kubectl create -f hack/eks-storageclass.yaml
120+
KUBECONFIG=$(TMPDIR)/$(CLUSTER_NAME)-eks.kubeconfig.yaml $(BINPATH)/hack/bin/kubectl create -f hack/eks-storageclass.yaml
116121
bazel test --stamp //e2e/upgrades/... --action_env=KUBECONFIG=$(TMPDIR)/$(CLUSTER_NAME)-eks.kubeconfig.yaml
117122
bazel test --stamp //e2e/create/... --action_env=KUBECONFIG=$(TMPDIR)/$(CLUSTER_NAME)-eks.kubeconfig.yaml
118123
bazel test --stamp //e2e/decommission/... --action_env=KUBECONFIG=$(TMPDIR)/$(CLUSTER_NAME)-eks.kubeconfig.yaml
119124

120125
# Use this target to run e2e tests with a eks cluster.
121-
# This target uses kind to start a eks k8s cluster and runs the e2e tests
126+
# This target uses kubetest2 to start a eks k8s cluster and runs the e2e tests
122127
# against that cluster.
123128
.PHONY: test/e2e/eks
124129
test/e2e/eks:
125130
bazel build //hack/bin/... //e2e/kubetest2-eks/...
126-
PATH=${PATH}:bazel-bin/hack/bin:bazel-bin/e2e/kubetest2-eks/kubetest2-eks_/ \
127-
bazel-bin/hack/bin/kubetest2 eks --cluster-name=$(CLUSTER_NAME) --up --down -v 10 \
131+
PATH=${PATH}:$(BINPATH)/hack/bin:$(BINPATH)/e2e/kubetest2-eks/kubetest2-eks_/ \
132+
$(BINPATH)/hack/bin/kubetest2 eks --cluster-name=$(CLUSTER_NAME) --up --down -v 10 \
128133
--test=exec -- make test/e2e/testrunner-eks
129134

130135
# This target is used by kubetest2-tester-exec when running a gke test
@@ -148,9 +153,9 @@ test/e2e/testrunner-gke:
148153
bazel test --stamp //e2e/decommission/...
149154

150155
# Use this target to run e2e tests with a gke cluster.
151-
# This target uses kind to start a gke k8s cluster and runs the e2e tests
156+
# This target uses kubetest2 to start a gke k8s cluster and runs the e2e tests
152157
# against that cluster.
153-
# This is the main entrypoint for running the e2e tests on gke kind.
158+
# This is the main entrypoint for running the e2e tests on gke.
154159
# This target runs kubetest2 gke that starts a gke cluster
155160
# Then kubetest2 tester exec is run which runs the make target
156161
# test/e2e/testrunner-gke.
@@ -163,7 +168,7 @@ test/e2e/testrunner-gke:
163168
.PHONY: test/e2e/gke
164169
test/e2e/gke:
165170
bazel build //hack/bin/...
166-
PATH=${PATH}:bazel-bin/hack/bin bazel-bin/hack/bin/kubetest2 gke --cluster-name=$(CLUSTER_NAME) \
171+
PATH=${PATH}:$(BINPATH)/hack/bin kubetest2 gke --cluster-name=$(CLUSTER_NAME) \
167172
--zone=$(GCP_ZONE) --project=$(GCP_PROJECT) \
168173
--version latest --up --down -v 10 --ignore-gcp-ssh-key \
169174
--test=exec -- make test/e2e/testrunner-gke
@@ -175,7 +180,7 @@ test/e2e/testrunner-openshift:
175180
bazel test --stamp //e2e/decommission/... --action_env=KUBECONFIG=$(HOME)/openshift-$(CLUSTER_NAME)/auth/kubeconfig
176181

177182
# Use this target to run e2e tests with a openshift cluster.
178-
# This target uses kind to start a openshift cluster and runs the e2e tests
183+
# This target uses kubetest2 to start a openshift cluster and runs the e2e tests
179184
# against that cluster. A full TLD is required to creat an openshift clutser.
180185
# This target runs kubetest2 openshift that starts a openshift cluster
181186
# Then kubetest2 tester exec is run which runs the make target
@@ -185,8 +190,8 @@ test/e2e/testrunner-openshift:
185190
.PHONY: test/e2e/openshift
186191
test/e2e/openshift:
187192
bazel build //hack/bin/... //e2e/kubetest2-openshift/...
188-
PATH=${PATH}:bazel-bin/hack/bin:bazel-bin/e2e/kubetest2-openshift/kubetest2-openshift_/ \
189-
bazel-bin/hack/bin/kubetest2 openshift --cluster-name=$(CLUSTER_NAME) \
193+
PATH=${PATH}:$(BINPATH)/hack/bin:$(BINPATH)/e2e/kubetest2-openshift/kubetest2-openshift_/ \
194+
kubetest2 openshift --cluster-name=$(CLUSTER_NAME) \
190195
--gcp-project-id=$(GCP_PROJECT) \
191196
--gcp-region=$(GCP_REGION) \
192197
--base-domain=$(BASE_DOMAIN) \
@@ -257,7 +262,7 @@ dev/syncdeps:
257262
@make dev/syncbazel
258263

259264
.PHONY: dev/up
260-
dev/up:
265+
dev/up: dev/down
261266
@hack/dev.sh up
262267

263268
.PHONY: dev/down

apis/v1alpha1/cluster_types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,17 @@ type CrdbClusterSpec struct {
134134
// proper channels in the cockroachdb. Logging configuration is available for cockroach version v21.1.0 onwards.
135135
// The logging configuration is taken in format of yaml file, you can check the logging configuration here (https://www.cockroachlabs.com/docs/stable/configure-logs.html#default-logging-configuration)
136136
// The default logging for cockroach version v20.x or less is stderr, logging API is ignored for older versions.
137+
// NOTE: The `data` field of map must contain an entry called `logging.yaml`
138+
// that contains config options.
137139
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Cockroach Database Logging configuration config map"
138140
// +optional
139141
LogConfigMap string `json:"logConfigMap,omitempty"`
142+
// (Optional) AutomountServiceAccountToken determines whether or not the stateful set pods should
143+
// automount the service account token. This is the default behavior in Kubernetes. For backward
144+
// compatibility reasons, this value defaults to `false` here.
145+
// Default: false
146+
// +optional
147+
AutomountServiceAccountToken bool `json:"automountServiceAccountToken,omitempty"`
140148
}
141149

142150
// +k8s:openapi-gen=true

config/crd/bases/crdb.cockroachlabs.com_crdbclusters.yaml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,13 @@ spec:
665665
type: array
666666
type: object
667667
type: object
668+
automountServiceAccountToken:
669+
description: '(Optional) AutomountServiceAccountToken determines whether
670+
or not the stateful set pods should automount the service account
671+
token. This is the default behavior in Kubernetes. For backward
672+
compatibility reasons, this value defaults to `false` here. Default:
673+
false'
674+
type: boolean
668675
cache:
669676
description: '(Optional) The total size for caches (`--cache` command
670677
line parameter) Default: "25%"'
@@ -974,13 +981,16 @@ spec:
974981
type: object
975982
type: object
976983
logConfigMap:
977-
description: (Optional) LogConfigMap define the config map which contains
978-
log configuration used to send the logs through the proper channels
979-
in the cockroachdb. Logging configuration is available for cockroach
980-
version v21.1.0 onwards. The logging configuration is taken in format
981-
of yaml file, you can check the logging configuration here (https://www.cockroachlabs.com/docs/stable/configure-logs.html#default-logging-configuration)
984+
description: '(Optional) LogConfigMap define the config map which
985+
contains log configuration used to send the logs through the proper
986+
channels in the cockroachdb. Logging configuration is available
987+
for cockroach version v21.1.0 onwards. The logging configuration
988+
is taken in format of yaml file, you can check the logging configuration
989+
here (https://www.cockroachlabs.com/docs/stable/configure-logs.html#default-logging-configuration)
982990
The default logging for cockroach version v20.x or less is stderr,
983-
logging API is ignored for older versions.
991+
logging API is ignored for older versions. NOTE: The `data` field
992+
of map must contain an entry called `logging.yaml` that contains
993+
config options.'
984994
type: string
985995
maxSQLMemory:
986996
description: '(Optional) The maximum in-memory storage capacity available

0 commit comments

Comments
 (0)