Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
bsnyder788 committed May 2, 2024
2 parents 1f0788b + 28d139c commit 18e3a00
Show file tree
Hide file tree
Showing 306 changed files with 3,363 additions and 1,255 deletions.
1 change: 1 addition & 0 deletions .bazeliskrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
USE_BAZEL_VERSION=5.4.0
2 changes: 1 addition & 1 deletion .github/workflows/e2e-kind-create.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 The Cockroach Authors
# Copyright 2024 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.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-kind-decommission.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 The Cockroach Authors
# Copyright 2024 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.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-kind-upgrades.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 The Cockroach Authors
# Copyright 2024 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.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-kind-upgradessha256.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 The Cockroach Authors
# Copyright 2024 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.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-kind-versionchecker.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 The Cockroach Authors
# Copyright 2024 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.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-smoketest.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 The Cockroach Authors
# Copyright 2024 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.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/templates.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 The Cockroach Authors
# Copyright 2024 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.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 The Cockroach Authors
# Copyright 2024 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.
Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/update-crdb-versions.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 The Cockroach Authors
# Copyright 2024 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.
Expand Down Expand Up @@ -31,13 +31,17 @@ jobs:
with:
path: "~/.cache/bazel"
key: bazel
- name: Update CRDB versions
uses: technote-space/create-pr-action@v2
- name: Update CRDB version
run: make release/gen-templates
- name: Create PR
uses: peter-evans/create-pull-request@v5
with:
EXECUTE_COMMANDS: |
make release/gen-templates
COMMIT_MESSAGE: 'Update CRDB versions'
COMMIT_NAME: 'GitHub Actions'
COMMIT_EMAIL: 'dev-inf+github-cockroach-dev-inf@cockroachlabs.com'
PR_BRANCH_NAME: 'crdb-update-${PR_ID}'
PR_TITLE: 'Update CRDB versions'
base: "master"
branch: 'crdb-version-update'
title: "Update CRDB versions"
author: "CRL Release bot <teamcity@cockroachlabs.com>"
body: |
Update supported CRDB versions.
commit-message: |
Update supported CRDB versions.
delete-branch: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ bundle/
faq

_artifacts
bundle.Dockerfile
artifacts
tmp
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 The Cockroach Authors
# Copyright 2024 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.
Expand Down
44 changes: 43 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,55 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [Unreleased](https://github.com/cockroachdb/cockroach-operator/compare/v2.6.0...master)
# [Unreleased](https://github.com/cockroachdb/cockroach-operator/compare/v2.14.0...master)

# [v2.14.0](https://github.com/cockroachdb/cockroach-operator/compare/v2.13.0...v2.14.0)

# [v2.13.0](https://github.com/cockroachdb/cockroach-operator/compare/v2.12.0...v2.13.0)

# [v2.12.0](https://github.com/cockroachdb/cockroach-operator/compare/v2.11.0...v2.12.0)

# [v2.11.0](https://github.com/cockroachdb/cockroach-operator/compare/v2.10.0...v2.11.0)

* Bug fix to return correct error message if value passed for `whenUnsatisfiable` under `topologySpreadConstraints` field is invalid.
* Add openshift release process for cockroach operator

# [v2.10.0](https://github.com/cockroachdb/cockroach-operator/compare/v2.9.0...v2.10.0)

## Added

* Upgrade the underlying k8s dependencies from 1.20 to 1.21 to support operator installation on k8s 1.25+.

# [v2.9.0](https://github.com/cockroachdb/cockroach-operator/compare/v2.8.0...v2.9.0)

## Fixed

* Install init container certs with 600 permissions
* Ensure operator can connect to DBs in all namespaces

# [v2.8.0](https://github.com/cockroachdb/cockroach-operator/compare/v2.7.0...v2.8.0)

## Added

* `AutomountServiceAccountToken` field for cluster spec to allow mounting the default service account token.

## Fixed

* Delete the CancelLoop function, fixing a cluster status update bug
* Correctly detect failed version checker Pods
* retry cluster status updates, reducing test flakes

## Changed
* Update validation webhook to reject changes to cluster spec's AdditionalLabels field

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

## Fixed

* Grant operator deletecollection permissions to fix fullcluster restart flow
* Grant operator list and update permissions on pvcs to fix pvc resize flow
* Bump TerminationGracePeriodSeconds from 1m to 5m
* Prefer user added --join flags over default when explicitly passed

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

Expand Down
47 changes: 36 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 The Cockroach Authors
# Copyright 2024 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.
Expand All @@ -18,6 +18,11 @@

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

# Define path where we install binaries.
# NOTE(all): We need to use absolute paths because kubetest2 on go 1.19 does
# not support relative paths.
BINPATH := $(abspath bazel-bin)

# values used in workspace-status.sh
CLUSTER_NAME?=bazel-test
COCKROACH_DATABASE_VERSION=v21.2.3
Expand Down Expand Up @@ -89,7 +94,7 @@ test/e2e-short:
test/e2e/testrunner-k3d-%: PACKAGE=$*
test/e2e/testrunner-k3d-%:
bazel run //hack/k8s:k8s -- -type k3d
bazel test --stamp //e2e/$(PACKAGE)/... --test_arg=-test.v --test_arg=-test.parallel=8 --test_arg=parallel=true
bazel test --stamp //e2e/$(PACKAGE)/... --test_arg=-test.v --test_arg=-test.parallel=4 --test_arg=parallel=true

# Use this target to run e2e tests using a k3d k8s cluster.
# This target uses k3d to start a k8s cluster and runs the e2e tests
Expand All @@ -104,15 +109,15 @@ test/e2e/testrunner-k3d-%:
test/e2e/k3d-%: PACKAGE=$*
test/e2e/k3d-%:
bazel build //hack/bin/... //e2e/kubetest2-k3d/...
PATH=bazel-bin/hack/bin:bazel-bin/e2e/kubetest2-k3d/kubetest2-k3d_/:${PATH} \
bazel-bin/hack/bin/kubetest2 k3d \
PATH=$(BINPATH)/hack/bin:$(BINPATH)/e2e/kubetest2-k3d/kubetest2-k3d_/:${PATH} \
kubetest2 k3d \
--cluster-name=$(CLUSTER_NAME) --image rancher/k3s:v1.23.3-k3s1 --servers 3 \
--up --down -v 10 --test=exec -- make test/e2e/testrunner-k3d-$(PACKAGE)

# This target is used by kubetest2-eks to run e2e tests.
.PHONY: test/e2e/testrunner-eks
test/e2e/testrunner-eks:
KUBECONFIG=$(TMPDIR)/$(CLUSTER_NAME)-eks.kubeconfig.yaml bazel-bin/hack/bin/kubectl create -f hack/eks-storageclass.yaml
KUBECONFIG=$(TMPDIR)/$(CLUSTER_NAME)-eks.kubeconfig.yaml $(BINPATH)/hack/bin/kubectl create -f hack/eks-storageclass.yaml
bazel test --stamp //e2e/upgrades/... --action_env=KUBECONFIG=$(TMPDIR)/$(CLUSTER_NAME)-eks.kubeconfig.yaml
bazel test --stamp //e2e/create/... --action_env=KUBECONFIG=$(TMPDIR)/$(CLUSTER_NAME)-eks.kubeconfig.yaml
bazel test --stamp //e2e/decommission/... --action_env=KUBECONFIG=$(TMPDIR)/$(CLUSTER_NAME)-eks.kubeconfig.yaml
Expand All @@ -123,8 +128,8 @@ test/e2e/testrunner-eks:
.PHONY: test/e2e/eks
test/e2e/eks:
bazel build //hack/bin/... //e2e/kubetest2-eks/...
PATH=${PATH}:bazel-bin/hack/bin:bazel-bin/e2e/kubetest2-eks/kubetest2-eks_/ \
bazel-bin/hack/bin/kubetest2 eks --cluster-name=$(CLUSTER_NAME) --up --down -v 10 \
PATH=${PATH}:$(BINPATH)/hack/bin:$(BINPATH)/e2e/kubetest2-eks/kubetest2-eks_/ \
$(BINPATH)/hack/bin/kubetest2 eks --cluster-name=$(CLUSTER_NAME) --up --down -v 10 \
--test=exec -- make test/e2e/testrunner-eks

# This target is used by kubetest2-tester-exec when running a gke test
Expand Down Expand Up @@ -163,7 +168,7 @@ test/e2e/testrunner-gke:
.PHONY: test/e2e/gke
test/e2e/gke:
bazel build //hack/bin/...
PATH=${PATH}:bazel-bin/hack/bin bazel-bin/hack/bin/kubetest2 gke --cluster-name=$(CLUSTER_NAME) \
PATH=${PATH}:$(BINPATH)/hack/bin kubetest2 gke --cluster-name=$(CLUSTER_NAME) \
--zone=$(GCP_ZONE) --project=$(GCP_PROJECT) \
--version latest --up --down -v 10 --ignore-gcp-ssh-key \
--test=exec -- make test/e2e/testrunner-gke
Expand All @@ -185,8 +190,8 @@ test/e2e/testrunner-openshift:
.PHONY: test/e2e/openshift
test/e2e/openshift:
bazel build //hack/bin/... //e2e/kubetest2-openshift/...
PATH=${PATH}:bazel-bin/hack/bin:bazel-bin/e2e/kubetest2-openshift/kubetest2-openshift_/ \
bazel-bin/hack/bin/kubetest2 openshift --cluster-name=$(CLUSTER_NAME) \
PATH=${PATH}:$(BINPATH)/hack/bin:$(BINPATH)/e2e/kubetest2-openshift/kubetest2-openshift_/ \
kubetest2 openshift --cluster-name=$(CLUSTER_NAME) \
--gcp-project-id=$(GCP_PROJECT) \
--gcp-region=$(GCP_REGION) \
--base-domain=$(BASE_DOMAIN) \
Expand All @@ -205,6 +210,12 @@ test/e2e/testrunner-openshift-packaging: test/openshift-package
--action_env=APP_VERSION=$(APP_VERSION) \
--action_env=DOCKER_REGISTRY=$(DOCKER_REGISTRY)

# Run preflight checks for OpenShift. This expects a running OpenShift cluster.
# Eg. make test/preflight-<operator|bundle|marketplace>
test/preflight-%: CONTAINER=$*
test/preflight-%: release/generate-bundle
@bazel run //hack:redhat-preflight -- $(CONTAINER)

#
# Different dev targets
#
Expand Down Expand Up @@ -262,6 +273,7 @@ dev/up: dev/down

.PHONY: dev/down
dev/down:
@bazel build //hack/bin:k3d
@hack/dev.sh down
#
# Targets that allow to install the operator on an existing cluster
Expand Down Expand Up @@ -327,7 +339,7 @@ release/image:
# RedHat OpenShift targets
#

#RED HAT IMAGE BUNDLE
#REDHAT IMAGE BUNDLE
RH_BUNDLE_REGISTRY?=registry.connect.redhat.com/cockroachdb
RH_BUNDLE_IMAGE_REPOSITORY?=cockroachdb-operator-bundle
RH_BUNDLE_VERSION?=$(VERSION)
Expand All @@ -351,3 +363,16 @@ PKG_MAN_OPTS ?= "$(PKG_CHANNELS) $(PKG_DEFAULT_CHANNEL)"
.PHONY: release/generate-bundle
release/generate-bundle:
bazel run //hack:bundle -- $(RH_BUNDLE_VERSION) $(RH_OPERATOR_IMAGE) $(PKG_MAN_OPTS) $(RH_COCKROACH_DATABASE_IMAGE)

.PHONY: release/publish-operator
publish-operator:
./build/release/teamcity-publish-release.sh

.PHONY: release/publish-operator-openshift
publish-operator-openshift:
./build/release/teamcity-publish-openshift.sh

.PHONY: release/publish-openshift-bundle
release/publish-openshift-bundle:
./build/release/teamcity-publish-openshift-bundle.sh

10 changes: 3 additions & 7 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,15 @@ container_pull(
################################
http_archive(
name = "io_bazel_rules_k8s",
sha256 = "51f0977294699cd547e139ceff2396c32588575588678d2054da167691a227ef",
strip_prefix = "rules_k8s-0.6",
urls = ["https://github.com/bazelbuild/rules_k8s/archive/v0.6.tar.gz"],
sha256 = "ce5b9bc0926681e2e7f2147b49096f143e6cbc783e71bc1d4f36ca76b00e6f4a",
strip_prefix = "rules_k8s-0.7",
urls = ["https://github.com/bazelbuild/rules_k8s/archive/refs/tags/v0.7.tar.gz"],
)

load("@io_bazel_rules_k8s//k8s:k8s.bzl", "k8s_repositories")

k8s_repositories()

load("@io_bazel_rules_k8s//k8s:k8s_go_deps.bzl", k8s_go_deps = "deps")

k8s_go_deps()

load("@io_bazel_rules_k8s//k8s:k8s.bzl", "k8s_defaults")

#############################################################
Expand Down
4 changes: 2 additions & 2 deletions apis/v1alpha1/action_status.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2022 The Cockroach Authors
Copyright 2024 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.
Expand All @@ -16,7 +16,7 @@ limitations under the License.

package v1alpha1

//ActionStatus struct used to save the status of each action that the controller runs
// ActionStatus struct used to save the status of each action that the controller runs
type ActionStatus int

const (
Expand Down
4 changes: 2 additions & 2 deletions apis/v1alpha1/action_types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2022 The Cockroach Authors
Copyright 2024 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.
Expand All @@ -16,7 +16,7 @@ limitations under the License.

package v1alpha1

//ActionType type alias
// ActionType type alias
type ActionType string

// All possible action types
Expand Down
8 changes: 7 additions & 1 deletion apis/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2022 The Cockroach Authors
Copyright 2024 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.
Expand Down Expand Up @@ -139,6 +139,12 @@ type CrdbClusterSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Cockroach Database Logging configuration config map"
// +optional
LogConfigMap string `json:"logConfigMap,omitempty"`
// (Optional) AutomountServiceAccountToken determines whether or not the stateful set pods should
// automount the service account token. This is the default behavior in Kubernetes. For backward
// compatibility reasons, this value defaults to `false` here.
// Default: false
// +optional
AutomountServiceAccountToken bool `json:"automountServiceAccountToken,omitempty"`
}

// +k8s:openapi-gen=true
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha1/cluster_types_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2022 The Cockroach Authors
Copyright 2024 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.
Expand Down
4 changes: 2 additions & 2 deletions apis/v1alpha1/condition_types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2022 The Cockroach Authors
Copyright 2024 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.
Expand All @@ -16,7 +16,7 @@ limitations under the License.

package v1alpha1

//ClusterConditionType type alias
// ClusterConditionType type alias
type ClusterConditionType string

const (
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2022 The Cockroach Authors
Copyright 2024 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.
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2022 The Cockroach Authors
Copyright 2024 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.
Expand Down
Loading

0 comments on commit 18e3a00

Please sign in to comment.