diff --git a/Makefile b/Makefile index 2648de6d..e60e5f10 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # To re-generate a bundle for another specific version without changing the standard setup, you can: # - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2) # - use environment variables to overwrite this value (e.g export VERSION=0.0.2) -VERSION ?= 0.17.1-alpha.11 +VERSION ?= 0.17.1-alpha.12 # CHANNELS define the bundle channels used in the bundle. # Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable") @@ -295,7 +295,7 @@ GOBINDATA ?= $(LOCALBIN)/go-bindata ## Tool Versions KUSTOMIZE_VERSION ?= v3.8.7 -CONTROLLER_TOOLS_VERSION ?= v0.9.2 +CONTROLLER_TOOLS_VERSION ?= v0.10.0 GINKGO_VERSION ?= v2.1.4 CRD_REFDOCS_VERSION ?= v0.0.8 KIND_VERSION ?= v0.16.0 diff --git a/api/v1alpha1/common_types.go b/api/v1alpha1/common_types.go index 64c1dbfc..2f319b92 100644 --- a/api/v1alpha1/common_types.go +++ b/api/v1alpha1/common_types.go @@ -660,6 +660,10 @@ func InitializeExternalSecretSecretStoreReferenceSpec(spec *ExternalSecretSecret // BugsnagSpec has configuration for Bugsnag integration type BugsnagSpec struct { + // Release Stage to identify environment + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + ReleaseStage *string `json:"releaseStage,omitempty"` // API key // +operator-sdk:csv:customresourcedefinitions:type=spec APIKey SecretReference `json:"apiKey"` diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index dc8e1a0e..51ea6fbb 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -660,6 +660,11 @@ func (in *BackendStatus) DeepCopy() *BackendStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BugsnagSpec) DeepCopyInto(out *BugsnagSpec) { *out = *in + if in.ReleaseStage != nil { + in, out := &in.ReleaseStage, &out.ReleaseStage + *out = new(string) + **out = **in + } in.APIKey.DeepCopyInto(&out.APIKey) } diff --git a/bundle/manifests/saas-operator.clusterserviceversion.yaml b/bundle/manifests/saas-operator.clusterserviceversion.yaml index 5ad4b601..fa4413b9 100644 --- a/bundle/manifests/saas-operator.clusterserviceversion.yaml +++ b/bundle/manifests/saas-operator.clusterserviceversion.yaml @@ -342,7 +342,8 @@ metadata: "key": "BUGSNAG_API_KEY", "path": "secret/data/path/system-app" } - } + }, + "releaseStage": "staging" }, "configFiles": { "files": [ @@ -530,7 +531,8 @@ metadata: "key": "BUGSNAG_API_KEY", "path": "secret/data/path/zync" } - } + }, + "releaseStage": "development" }, "databaseDSN": { "fromVault": { @@ -574,7 +576,7 @@ metadata: operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: https://github.com/3scale/saas-operator support: Red Hat - name: saas-operator.v0.17.1-alpha.11 + name: saas-operator.v0.17.1-alpha.12 namespace: placeholder spec: apiservicedefinitions: {} @@ -2830,6 +2832,9 @@ spec: - description: Override allows to directly specify a string value. displayName: Override path: config.bugsnag.apiKey.override + - description: Release Stage to identify environment + displayName: Release Stage + path: config.bugsnag.releaseStage - description: Secret containging system configuration files to be mounted in the pods displayName: Config Files Secret @@ -4131,6 +4136,9 @@ spec: - description: Override allows to directly specify a string value. displayName: Override path: config.bugsnag.apiKey.override + - description: Release Stage to identify environment + displayName: Release Stage + path: config.bugsnag.releaseStage - description: A reference to the secret holding the database DSN displayName: Database DSN path: config.databaseDSN @@ -4393,7 +4401,7 @@ spec: valueFrom: fieldRef: fieldPath: metadata.annotations['olm.targetNamespaces'] - image: quay.io/3scale/saas-operator:v0.17.1-alpha.11 + image: quay.io/3scale/saas-operator:v0.17.1-alpha.12 livenessProbe: httpGet: path: /healthz @@ -4895,4 +4903,4 @@ spec: provider: name: Red Hat url: https://www.3scale.net/ - version: 0.17.1-alpha.11 + version: 0.17.1-alpha.12 diff --git a/bundle/manifests/saas.3scale.net_systems.yaml b/bundle/manifests/saas.3scale.net_systems.yaml index fb042581..ac241bad 100644 --- a/bundle/manifests/saas.3scale.net_systems.yaml +++ b/bundle/manifests/saas.3scale.net_systems.yaml @@ -708,6 +708,9 @@ spec: value. type: string type: object + releaseStage: + description: Release Stage to identify environment + type: string required: - apiKey type: object diff --git a/bundle/manifests/saas.3scale.net_zyncs.yaml b/bundle/manifests/saas.3scale.net_zyncs.yaml index 9f22f018..a7807143 100644 --- a/bundle/manifests/saas.3scale.net_zyncs.yaml +++ b/bundle/manifests/saas.3scale.net_zyncs.yaml @@ -454,6 +454,9 @@ spec: value. type: string type: object + releaseStage: + description: Release Stage to identify environment + type: string required: - apiKey type: object diff --git a/config/crd/bases/saas.3scale.net_systems.yaml b/config/crd/bases/saas.3scale.net_systems.yaml index 1caab455..6cc181bf 100644 --- a/config/crd/bases/saas.3scale.net_systems.yaml +++ b/config/crd/bases/saas.3scale.net_systems.yaml @@ -709,6 +709,9 @@ spec: value. type: string type: object + releaseStage: + description: Release Stage to identify environment + type: string required: - apiKey type: object diff --git a/config/crd/bases/saas.3scale.net_zyncs.yaml b/config/crd/bases/saas.3scale.net_zyncs.yaml index 1f926bb1..d509ba44 100644 --- a/config/crd/bases/saas.3scale.net_zyncs.yaml +++ b/config/crd/bases/saas.3scale.net_zyncs.yaml @@ -455,6 +455,9 @@ spec: value. type: string type: object + releaseStage: + description: Release Stage to identify environment + type: string required: - apiKey type: object diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 52c694dc..9267c682 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -13,4 +13,4 @@ kind: Kustomization images: - name: controller newName: quay.io/3scale/saas-operator - newTag: v0.17.1-alpha.11 + newTag: v0.17.1-alpha.12 diff --git a/config/manifests/bases/saas-operator.clusterserviceversion.yaml b/config/manifests/bases/saas-operator.clusterserviceversion.yaml index 7fa0817e..7c5a5f9a 100644 --- a/config/manifests/bases/saas-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/saas-operator.clusterserviceversion.yaml @@ -2403,6 +2403,9 @@ spec: - description: Override allows to directly specify a string value. displayName: Override path: config.bugsnag.apiKey.override + - description: Release Stage to identify environment + displayName: Release Stage + path: config.bugsnag.releaseStage - description: Secret containging system configuration files to be mounted in the pods displayName: Config Files Secret @@ -3704,6 +3707,9 @@ spec: - description: Override allows to directly specify a string value. displayName: Override path: config.bugsnag.apiKey.override + - description: Release Stage to identify environment + displayName: Release Stage + path: config.bugsnag.releaseStage - description: A reference to the secret holding the database DSN displayName: Database DSN path: config.databaseDSN diff --git a/config/samples/saas_v1alpha1_system.yaml b/config/samples/saas_v1alpha1_system.yaml index 75d880d0..4367472f 100644 --- a/config/samples/saas_v1alpha1_system.yaml +++ b/config/samples/saas_v1alpha1_system.yaml @@ -98,6 +98,7 @@ spec: key: RH_CUSTOMER_PORTAL_CLIENT_SECRET realm: "sso.example.net" bugsnag: + releaseStage: staging apiKey: fromVault: path: secret/data/path/system-app diff --git a/config/samples/saas_v1alpha1_zync.yaml b/config/samples/saas_v1alpha1_zync.yaml index 681975f4..5f38625a 100644 --- a/config/samples/saas_v1alpha1_zync.yaml +++ b/config/samples/saas_v1alpha1_zync.yaml @@ -16,6 +16,7 @@ spec: path: secret/data/path/zync key: SECRET_KEY_BASE bugsnag: + releaseStage: development apiKey: fromVault: path: secret/data/path/zync diff --git a/controllers/system_controller_suite_test.go b/controllers/system_controller_suite_test.go index d7fbf222..6dfff192 100644 --- a/controllers/system_controller_suite_test.go +++ b/controllers/system_controller_suite_test.go @@ -82,7 +82,8 @@ var _ = Describe("System controller", func() { Realm: pointer.StringPtr("sso.example.net"), }, Bugsnag: &saasv1alpha1.BugsnagSpec{ - APIKey: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, + ReleaseStage: pointer.StringPtr("staging"), + APIKey: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, }, DatabaseSecret: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, MemcachedServers: "value", diff --git a/controllers/zync_controller_suite_test.go b/controllers/zync_controller_suite_test.go index 44e70755..001d6a24 100644 --- a/controllers/zync_controller_suite_test.go +++ b/controllers/zync_controller_suite_test.go @@ -72,6 +72,7 @@ var _ = Describe("Zync controller", func() { }, }, Bugsnag: &saasv1alpha1.BugsnagSpec{ + ReleaseStage: pointer.StringPtr("staging"), APIKey: saasv1alpha1.SecretReference{ FromVault: &saasv1alpha1.VaultSecretReference{ Path: "some-path-bugsnag", diff --git a/docs/api-reference/reference.asciidoc b/docs/api-reference/reference.asciidoc index 371f8f56..37dc5ab3 100644 --- a/docs/api-reference/reference.asciidoc +++ b/docs/api-reference/reference.asciidoc @@ -398,6 +398,7 @@ BugsnagSpec has configuration for Bugsnag integration [cols="25a,75a", options="header"] |=== | Field | Description +| *`releaseStage`* __string__ | Release Stage to identify environment | *`apiKey`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-secretreference[$$SecretReference$$]__ | API key |=== diff --git a/pkg/generators/system/config/options.go b/pkg/generators/system/config/options.go index dd47d271..337f3268 100644 --- a/pkg/generators/system/config/options.go +++ b/pkg/generators/system/config/options.go @@ -77,6 +77,7 @@ type Options struct { RedHatCustomerPortalClientSecret pod.EnvVarValue `env:"RH_CUSTOMER_PORTAL_CLIENT_SECRET" secret:"system-app"` RedHatCustomerPortalRealm pod.EnvVarValue `env:"RH_CUSTOMER_PORTAL_REALM"` BugsnagAPIKey pod.EnvVarValue `env:"BUGSNAG_API_KEY" secret:"system-app"` + BugsnagReleaseStage pod.EnvVarValue `env:"BUGSNAG_RELEASE_STAGE"` DatabaseSecret pod.EnvVarValue `env:"DB_SECRET" secret:"system-app"` } @@ -146,6 +147,11 @@ func NewOptions(spec saasv1alpha1.SystemSpec) Options { if spec.Config.Bugsnag.Enabled() { opts.BugsnagAPIKey = &pod.SecretValue{Value: spec.Config.Bugsnag.APIKey} + + if spec.Config.Bugsnag.ReleaseStage != nil { + opts.BugsnagReleaseStage = &pod.ClearTextValue{Value: *spec.Config.Bugsnag.ReleaseStage} + } + } else { opts.BugsnagAPIKey = &pod.SecretValue{Value: saasv1alpha1.SecretReference{Override: pointer.StringPtr("")}} } diff --git a/pkg/generators/zync/config/api_options.go b/pkg/generators/zync/config/api_options.go index 66fd23fb..2518c14c 100644 --- a/pkg/generators/zync/config/api_options.go +++ b/pkg/generators/zync/config/api_options.go @@ -18,6 +18,7 @@ type APIOptions struct { SecretKeyBase pod.EnvVarValue `env:"SECRET_KEY_BASE" secret:"zync"` ZyncAuthenticationToken pod.EnvVarValue `env:"ZYNC_AUTHENTICATION_TOKEN" secret:"zync"` BugsnagAPIKey pod.EnvVarValue `env:"BUGSNAG_API_KEY" secret:"zync"` + BugsnagReleaseStage pod.EnvVarValue `env:"BUGSNAG_RELEASE_STAGE"` } // NewAPIOptions returns an Options struct for the given saasv1alpha1.ZyncSpec @@ -35,6 +36,11 @@ func NewAPIOptions(spec saasv1alpha1.ZyncSpec) APIOptions { if spec.Config.Bugsnag.Enabled() { opts.BugsnagAPIKey = &pod.SecretValue{Value: spec.Config.Bugsnag.APIKey} + + if spec.Config.Bugsnag.ReleaseStage != nil { + opts.BugsnagReleaseStage = &pod.ClearTextValue{Value: *spec.Config.Bugsnag.ReleaseStage} + } + } else { opts.BugsnagAPIKey = &pod.SecretValue{Value: saasv1alpha1.SecretReference{Override: pointer.StringPtr("")}} } diff --git a/pkg/generators/zync/config/que_options.go b/pkg/generators/zync/config/que_options.go index b8ec3d3e..c3a80b04 100644 --- a/pkg/generators/zync/config/que_options.go +++ b/pkg/generators/zync/config/que_options.go @@ -15,6 +15,7 @@ type QueOptions struct { SecretKeyBase pod.EnvVarValue `env:"SECRET_KEY_BASE" secret:"zync"` ZyncAuthenticationToken pod.EnvVarValue `env:"ZYNC_AUTHENTICATION_TOKEN" secret:"zync"` BugsnagAPIKey pod.EnvVarValue `env:"BUGSNAG_API_KEY" secret:"zync"` + BugsnagReleaseStage pod.EnvVarValue `env:"BUGSNAG_RELEASE_STAGE"` } // NewQueOptions returns an Options struct for the given saasv1alpha1.ZyncSpec @@ -31,6 +32,11 @@ func NewQueOptions(spec saasv1alpha1.ZyncSpec) QueOptions { if spec.Config.Bugsnag.Enabled() { opts.BugsnagAPIKey = &pod.SecretValue{Value: spec.Config.Bugsnag.APIKey} + + if spec.Config.Bugsnag.ReleaseStage != nil { + opts.BugsnagReleaseStage = &pod.ClearTextValue{Value: *spec.Config.Bugsnag.ReleaseStage} + } + } else { opts.BugsnagAPIKey = &pod.SecretValue{Value: saasv1alpha1.SecretReference{Override: pointer.StringPtr("")}} } diff --git a/pkg/version/version.go b/pkg/version/version.go index ac9c249e..f2816e17 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -1,7 +1,7 @@ package version const ( - version string = "v0.17.1-alpha.11" + version string = "v0.17.1-alpha.12" ) // Current returns the current marin3r operator version