From 3e24871f503c8d8c779a42470043a939aed5961d Mon Sep 17 00:00:00 2001 From: Craig Furman Date: Tue, 28 May 2024 15:57:06 +0100 Subject: [PATCH] appliance: move storage elements to standard feature (#62903) * appliance: move storage elements to standard feature Add a new standard block, persistentVolumeConfig, containing a storage size and storage class name. pvc.NewPersistentVolumeClaim() can fetch these values when a standard config is (optionally) passed to it, similar to other standard features. Remove service-specific code that parses storage quantities out of config. Regarding storage class, this makes the reconciler "dumber" and more verbosely-configured: every PVC must be explicitly assigned a storage class (or none), rather than taking from the global StorageClassSpec. Note that this doesn't have direct implications for admin UX: the appliance web app can still have features to configure a single, global, storage class name - it can simply copy this field everywhere needed into the ConfigMap it crafts. This relates to https://linear.app/sourcegraph/issue/REL-16/appliance-can-create-recommended-storageclasses-for-various-k8s also - the StorageClassSpec is unused until that feature is implemented. * appliance: consolidate storage tests Now that we have a standard feature, we can replace most instances of with-storage tests with one standard fixture. Symbols is the exception, since there is some logic done on the storage size (to determine a cache size env var). --- internal/appliance/config/config.go | 14 +- internal/appliance/config/defaults.go | 40 +- internal/appliance/config/spec.go | 40 -- internal/appliance/reconciler/blobstore.go | 10 +- internal/appliance/reconciler/codeintel.go | 8 +- internal/appliance/reconciler/gitserver.go | 15 +- .../appliance/reconciler/gitserver_test.go | 1 - internal/appliance/reconciler/pgsql.go | 8 +- internal/appliance/reconciler/pgsql_test.go | 1 - internal/appliance/reconciler/prometheus.go | 5 +- .../appliance/reconciler/prometheus_test.go | 1 - internal/appliance/reconciler/redis.go | 5 +- internal/appliance/reconciler/redis_test.go | 1 - .../reconciler/standard_config_test.go | 9 +- internal/appliance/reconciler/symbols.go | 11 +- internal/appliance/reconciler/symbols_test.go | 3 + .../golden-fixtures/blobstore/default.yaml | 6 +- .../golden-fixtures/codeintel/default.yaml | 12 +- .../golden-fixtures/gitserver/default.yaml | 6 +- .../gitserver/with-storage.yaml | 271 --------- .../golden-fixtures/pgsql/default.yaml | 12 +- .../golden-fixtures/pgsql/with-storage.yaml | 497 --------------- .../precise-code-intel/default.yaml | 6 +- .../precise-code-intel/with-blobstore.yaml | 12 +- .../precise-code-intel/with-num-workers.yaml | 6 +- .../precise-code-intel/with-replicas.yaml | 6 +- .../golden-fixtures/prometheus/default.yaml | 14 +- .../prometheus/privileged.yaml | 14 +- .../prometheus/subsequent-disable.yaml | 6 +- .../prometheus/with-existing-configmap.yaml | 12 +- .../prometheus/with-storage.yaml | 565 ------------------ .../golden-fixtures/redis/default.yaml | 16 +- .../golden-fixtures/repo-updater/default.yaml | 6 +- .../blobstore-subsequent-disable.yaml | 2 +- .../blobstore-with-named-storage-class.yaml | 13 +- .../precise-code-intel-with-env-vars.yaml | 6 +- .../redis-with-multiple-custom-images.yaml | 8 +- .../redis-with-storage.yaml} | 24 +- .../repo-updater-with-no-resources.yaml | 6 +- ...repo-updater-with-pod-template-config.yaml | 6 +- .../standard/repo-updater-with-resources.yaml | 6 +- .../repo-updater-with-sa-annotations.yaml | 6 +- .../standard/symbols-with-custom-image.yaml | 6 +- .../golden-fixtures/symbols/default.yaml | 6 +- .../golden-fixtures/symbols/with-storage.yaml | 9 +- .../golden-fixtures/syntect/default.yaml | 6 +- .../syntect/with-replicas.yaml | 6 +- .../testdata/sg/pgsql/with-storage.yaml | 59 -- .../testdata/sg/prometheus/with-storage.yaml | 56 -- .../testdata/sg/redis/with-storage.yaml | 56 -- .../blobstore-with-named-storage-class.yaml | 7 +- .../redis-with-storage.yaml} | 8 +- .../testdata/sg/symbols/with-storage.yaml | 3 +- internal/k8s/resource/pvc/BUILD.bazel | 2 + internal/k8s/resource/pvc/pvc.go | 20 +- 55 files changed, 224 insertions(+), 1736 deletions(-) delete mode 100644 internal/appliance/reconciler/testdata/golden-fixtures/gitserver/with-storage.yaml delete mode 100644 internal/appliance/reconciler/testdata/golden-fixtures/pgsql/with-storage.yaml delete mode 100644 internal/appliance/reconciler/testdata/golden-fixtures/prometheus/with-storage.yaml rename internal/appliance/reconciler/testdata/golden-fixtures/{redis/with-storage.yaml => standard/redis-with-storage.yaml} (93%) delete mode 100644 internal/appliance/reconciler/testdata/sg/pgsql/with-storage.yaml delete mode 100644 internal/appliance/reconciler/testdata/sg/prometheus/with-storage.yaml delete mode 100644 internal/appliance/reconciler/testdata/sg/redis/with-storage.yaml rename internal/appliance/reconciler/testdata/sg/{gitserver/with-storage.yaml => standard/redis-with-storage.yaml} (85%) diff --git a/internal/appliance/config/config.go b/internal/appliance/config/config.go index 58f553ccf17..9b51b787c87 100644 --- a/internal/appliance/config/config.go +++ b/internal/appliance/config/config.go @@ -5,6 +5,7 @@ import corev1 "k8s.io/api/core/v1" type StandardComponent interface { Disableable GetContainerConfig() map[string]ContainerConfig + GetPersistentVolumeConfig() PersistentVolumeConfig GetPodTemplateConfig() PodTemplateConfig GetServiceAccountAnnotations() map[string]string GetPrometheusPort() *int @@ -17,6 +18,7 @@ type Disableable interface { type StandardConfig struct { Disabled bool `json:"disabled,omitempty"` ContainerConfig map[string]ContainerConfig `json:"containerConfig,omitempty"` + PersistentVolumeConfig PersistentVolumeConfig `json:"persistentVolumeConfig,omitempty"` PodTemplateConfig PodTemplateConfig `json:"podTemplateConfig,omitempty"` PrometheusPort *int `json:"prometheusPort,omitempty"` ServiceAccountAnnotations map[string]string `json:"serviceAccountAnnotations,omitempty"` @@ -37,6 +39,11 @@ type ContainerConfig struct { EnvVars map[string]string `json:"envVars,omitempty"` } +type PersistentVolumeConfig struct { + StorageSize string `json:"storageSize,omitempty"` + StorageClassName *string `json:"storageClassName,omitempty"` +} + // PodTemplateConfig is a config that applies to all Pod templates produced by a Service. If this needs // to differ between pod templates, split another service definition. type PodTemplateConfig struct { @@ -48,8 +55,11 @@ type PodTemplateConfig struct { func (c StandardConfig) IsDisabled() bool { return c.Disabled } func (c StandardConfig) GetContainerConfig() map[string]ContainerConfig { return c.ContainerConfig } -func (c StandardConfig) GetPodTemplateConfig() PodTemplateConfig { return c.PodTemplateConfig } -func (c StandardConfig) GetPrometheusPort() *int { return c.PrometheusPort } +func (c StandardConfig) GetPersistentVolumeConfig() PersistentVolumeConfig { + return c.PersistentVolumeConfig +} +func (c StandardConfig) GetPodTemplateConfig() PodTemplateConfig { return c.PodTemplateConfig } +func (c StandardConfig) GetPrometheusPort() *int { return c.PrometheusPort } func (c StandardConfig) GetServiceAccountAnnotations() map[string]string { return c.ServiceAccountAnnotations } diff --git a/internal/appliance/config/defaults.go b/internal/appliance/config/defaults.go index f81c663e0e3..021e02e94a8 100644 --- a/internal/appliance/config/defaults.go +++ b/internal/appliance/config/defaults.go @@ -21,7 +21,11 @@ func NewDefaultConfig() Sourcegraph { // Service-specific config Blobstore: BlobstoreSpec{ - StorageSize: "100Gi", + StandardConfig: StandardConfig{ + PersistentVolumeConfig: PersistentVolumeConfig{ + StorageSize: "100Gi", + }, + }, }, RepoUpdater: RepoUpdaterSpec{ StandardConfig: StandardConfig{ @@ -31,22 +35,28 @@ func NewDefaultConfig() Sourcegraph { Symbols: SymbolsSpec{ StandardConfig: StandardConfig{ PrometheusPort: pointers.Ptr(6060), + PersistentVolumeConfig: PersistentVolumeConfig{ + StorageSize: "12Gi", + }, }, - Replicas: 1, - StorageSize: "12Gi", + Replicas: 1, }, GitServer: GitServerSpec{ StandardConfig: StandardConfig{ PrometheusPort: pointers.Ptr(6060), + PersistentVolumeConfig: PersistentVolumeConfig{ + StorageSize: "200Gi", + }, }, - Replicas: 1, - StorageSize: "200Gi", + Replicas: 1, }, PGSQL: PGSQLSpec{ StandardConfig: StandardConfig{ PrometheusPort: pointers.Ptr(9187), + PersistentVolumeConfig: PersistentVolumeConfig{ + StorageSize: "200Gi", + }, }, - StorageSize: "200Gi", DatabaseConnection: &DatabaseConnectionSpec{ Host: "pgsql", Port: "5432", @@ -58,14 +68,18 @@ func NewDefaultConfig() Sourcegraph { RedisCache: RedisSpec{ StandardConfig: StandardConfig{ PrometheusPort: pointers.Ptr(9121), + PersistentVolumeConfig: PersistentVolumeConfig{ + StorageSize: "100Gi", + }, }, - StorageSize: "100Gi", }, RedisStore: RedisSpec{ StandardConfig: StandardConfig{ PrometheusPort: pointers.Ptr(9121), + PersistentVolumeConfig: PersistentVolumeConfig{ + StorageSize: "100Gi", + }, }, - StorageSize: "100Gi", }, SyntectServer: SyntectServerSpec{ StandardConfig: StandardConfig{ @@ -83,8 +97,10 @@ func NewDefaultConfig() Sourcegraph { CodeIntel: CodeIntelSpec{ StandardConfig: StandardConfig{ PrometheusPort: pointers.Ptr(9187), + PersistentVolumeConfig: PersistentVolumeConfig{ + StorageSize: "200Gi", + }, }, - StorageSize: "200Gi", DatabaseConnection: &DatabaseConnectionSpec{ Host: "codeintel-db", Port: "5432", @@ -94,7 +110,11 @@ func NewDefaultConfig() Sourcegraph { }, }, Prometheus: PrometheusSpec{ - StorageSize: "200Gi", + StandardConfig: StandardConfig{ + PersistentVolumeConfig: PersistentVolumeConfig{ + StorageSize: "200Gi", + }, + }, }, }, } diff --git a/internal/appliance/config/spec.go b/internal/appliance/config/spec.go index 5ee2d238bf1..60a5c400dc4 100644 --- a/internal/appliance/config/spec.go +++ b/internal/appliance/config/spec.go @@ -28,10 +28,6 @@ type DatabaseConnectionSpec struct { // BlobstoreSpec defines the desired state of Blobstore. type BlobstoreSpec struct { StandardConfig - - // StorageSize defines the requested amount of storage for the PVC. - // Default: 200Gi - StorageSize string `json:"storageSize,omitempty"` } // CodeInsightsDBSpec defines the desired state of Code Insights database. @@ -46,10 +42,6 @@ type CodeInsightsDBSpec struct { // Database allows for custom database connection details. Database *DatabaseConnectionSpec `json:"database,omitempty"` - // StorageSize defines the requested amount of storage for the PVC. - // Default: 200Gi - StorageSize string `json:"storageSize,omitempty"` - // Resources allows for custom resource limits and requests. Resources *corev1.ResourceList `json:"resources,omitempty"` } @@ -60,10 +52,6 @@ type CodeIntelSpec struct { // Database allows for custom database connection details. DatabaseConnection *DatabaseConnectionSpec `json:"database,omitempty"` - - // StorageSize defines the requested amount of storage for the PVC. - // Default: 200Gi - StorageSize string `json:"storageSize,omitempty"` } type IngressSpec struct { @@ -98,10 +86,6 @@ type GitServerSpec struct { // Default: 1 Replicas int32 `json:"replicas,omitempty"` - // StorageSize defines the requested amount of storage for the PVC. - // Default: 200Gi - StorageSize string `json:"storageSize,omitempty"` - // SSHSecret is the name of existing secret that contains SSH credentials to clone repositories. // This secret generally contains keys such as `id_rsa` (private key) and `known_hosts`. SSHSecret string `json:"sshSecret,omitempty"` @@ -113,10 +97,6 @@ type IndexedSearchSpec struct { // Default: 1 Replicas int32 `json:"replicas,omitempty"` - // StorageSize defines the requested amount of storage for the PVC. - // Default: 200Gi - StorageSize string `json:"storageSize,omitempty"` - // Resources allows for custom resource limits and requests. Resources *corev1.ResourceList `json:"resources,omitempty"` } @@ -133,10 +113,6 @@ type PGSQLSpec struct { // DatabaseConnection allows for custom database connection details. DatabaseConnection *DatabaseConnectionSpec `json:"database,omitempty"` - - // StorageSize defines the requested amount of storage for the PVC. - // Default: 200Gi - StorageSize string `json:"storageSize,omitempty"` } type PostgresExporterSpec struct { @@ -159,16 +135,11 @@ type PrometheusSpec struct { ExistingConfigMap string `json:"existingConfigMap,omitempty"` Privileged bool `json:"privileged,omitempty"` - StorageSize string `json:"storageSize,omitempty"` } // RedisSpec defines the desired state of a Redis-based service. type RedisSpec struct { StandardConfig - - // StorageSize defines the requested amount of storage for the PVC. - // Default: 100Gi - StorageSize string `json:"storageSize,omitempty"` } // RepoUpdaterSpec defines the desired state of the Repo Updater service. @@ -185,13 +156,6 @@ type SearcherSpec struct { // Replicas defines the number of Searcher pod replicas. // Default: 1 Replicas int32 `json:"replicas,omitempty"` - - // StorageSize defines the requested amount of storage for the PVC. - // Default: 26Gi - StorageSize string `json:"storageSize,omitempty"` - - // Resources allows for custom resource limits and requests. - Resources *corev1.ResourceList `json:"resources,omitempty"` } // SymbolsSpec defines the desired state of the Symbols service. @@ -201,10 +165,6 @@ type SymbolsSpec struct { // Replicas defines the number of Symbols pod replicas. // Default: 1 Replicas int32 `json:"replicas,omitempty"` - - // StorageSize defines the requested amount of storage for the PVC. - // Default: 12Gi - StorageSize string `json:"storageSize,omitempty"` } // SyntectServerSpec defines the desired state of the Syntect server service. diff --git a/internal/appliance/reconciler/blobstore.go b/internal/appliance/reconciler/blobstore.go index fb7dcc12b7e..b467dc09c2d 100644 --- a/internal/appliance/reconciler/blobstore.go +++ b/internal/appliance/reconciler/blobstore.go @@ -15,7 +15,6 @@ import ( "github.com/sourcegraph/sourcegraph/internal/k8s/resource/pod" "github.com/sourcegraph/sourcegraph/internal/k8s/resource/pvc" "github.com/sourcegraph/sourcegraph/internal/k8s/resource/service" - "github.com/sourcegraph/sourcegraph/lib/errors" ) func (r *Reconciler) reconcileBlobstore(ctx context.Context, sg *config.Sourcegraph, owner client.Object) error { @@ -35,14 +34,7 @@ func (r *Reconciler) reconcileBlobstore(ctx context.Context, sg *config.Sourcegr } func buildBlobstorePersistentVolumeClaim(sg *config.Sourcegraph) (corev1.PersistentVolumeClaim, error) { - storage := sg.Spec.Blobstore.StorageSize - if _, err := resource.ParseQuantity(storage); err != nil { - return corev1.PersistentVolumeClaim{}, errors.Errorf("invalid blobstore storage size: %s", storage) - } - - p := pvc.NewPersistentVolumeClaim("blobstore", sg.Namespace, resource.MustParse(storage), sg.Spec.StorageClass.Name) - - return p, nil + return pvc.NewPersistentVolumeClaim("blobstore", sg.Namespace, sg.Spec.Blobstore) } func (r *Reconciler) reconcileBlobstorePersistentVolumeClaims(ctx context.Context, sg *config.Sourcegraph, owner client.Object) error { diff --git a/internal/appliance/reconciler/codeintel.go b/internal/appliance/reconciler/codeintel.go index 73e241660c3..5fb58f5f2f6 100644 --- a/internal/appliance/reconciler/codeintel.go +++ b/internal/appliance/reconciler/codeintel.go @@ -18,7 +18,6 @@ import ( "github.com/sourcegraph/sourcegraph/internal/k8s/resource/service" "github.com/sourcegraph/sourcegraph/internal/k8s/resource/serviceaccount" "github.com/sourcegraph/sourcegraph/internal/k8s/resource/statefulset" - "github.com/sourcegraph/sourcegraph/lib/errors" "github.com/sourcegraph/sourcegraph/lib/pointers" ) @@ -200,13 +199,10 @@ func (r *Reconciler) reconcileCodeIntelStatefulSet(ctx context.Context, sg *conf func (r *Reconciler) reconcileCodeIntelPersistentVolumeClaim(ctx context.Context, sg *config.Sourcegraph, owner client.Object) error { cfg := sg.Spec.CodeIntel - storageSize, err := resource.ParseQuantity(cfg.StorageSize) + p, err := pvc.NewPersistentVolumeClaim("codeintel-db", sg.Namespace, cfg) if err != nil { - return errors.Wrap(err, "parsing storage size") + return err } - - p := pvc.NewPersistentVolumeClaim("codeintel-db", sg.Namespace, storageSize, sg.Spec.StorageClass.Name) - return reconcileObject(ctx, r, sg.Spec.CodeIntel, &p, &corev1.PersistentVolumeClaim{}, sg, owner) } diff --git a/internal/appliance/reconciler/gitserver.go b/internal/appliance/reconciler/gitserver.go index d1198d8f1e4..dc63a690402 100644 --- a/internal/appliance/reconciler/gitserver.go +++ b/internal/appliance/reconciler/gitserver.go @@ -9,7 +9,6 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/sourcegraph/sourcegraph/lib/errors" "github.com/sourcegraph/sourcegraph/lib/pointers" "github.com/sourcegraph/sourcegraph/internal/appliance/config" @@ -56,11 +55,6 @@ func (r *Reconciler) reconcileGitServerStatefulSet(ctx context.Context, sg *conf }, }) - storageSize, err := resource.ParseQuantity(cfg.StorageSize) - if err != nil { - return errors.Wrap(err, "parsing storage size") - } - ctr.Env = append(ctr.Env, container.EnvVarsRedis()...) ctr.Env = append(ctr.Env, container.EnvVarsOtel()...) @@ -107,11 +101,14 @@ func (r *Reconciler) reconcileGitServerStatefulSet(ctx context.Context, sg *conf podTemplate.Template.Spec.ServiceAccountName = name podTemplate.Template.Spec.Volumes = podVolumes + pvc, err := pvc.NewPersistentVolumeClaim("repos", sg.Namespace, sg.Spec.GitServer) + if err != nil { + return err + } + sset := statefulset.NewStatefulSet(name, sg.Namespace, sg.Spec.RequestedVersion) sset.Spec.Template = podTemplate.Template - sset.Spec.VolumeClaimTemplates = []corev1.PersistentVolumeClaim{ - pvc.NewPersistentVolumeClaim("repos", sg.Namespace, storageSize, sg.Spec.StorageClass.Name), - } + sset.Spec.VolumeClaimTemplates = []corev1.PersistentVolumeClaim{pvc} return reconcileObject(ctx, r, sg.Spec.GitServer, &sset, &appsv1.StatefulSet{}, sg, owner) } diff --git a/internal/appliance/reconciler/gitserver_test.go b/internal/appliance/reconciler/gitserver_test.go index a53dd8942a0..e34fa33ca81 100644 --- a/internal/appliance/reconciler/gitserver_test.go +++ b/internal/appliance/reconciler/gitserver_test.go @@ -7,7 +7,6 @@ func (suite *ApplianceTestSuite) TestDeployGitServer() { name string }{ {name: "gitserver/default"}, - {name: "gitserver/with-storage"}, } { suite.Run(tc.name, func() { namespace := suite.createConfigMap(tc.name) diff --git a/internal/appliance/reconciler/pgsql.go b/internal/appliance/reconciler/pgsql.go index d86bbbaa1c3..b5bea5bdf20 100644 --- a/internal/appliance/reconciler/pgsql.go +++ b/internal/appliance/reconciler/pgsql.go @@ -18,7 +18,6 @@ import ( "github.com/sourcegraph/sourcegraph/internal/k8s/resource/service" "github.com/sourcegraph/sourcegraph/internal/k8s/resource/serviceaccount" "github.com/sourcegraph/sourcegraph/internal/k8s/resource/statefulset" - "github.com/sourcegraph/sourcegraph/lib/errors" "github.com/sourcegraph/sourcegraph/lib/pointers" ) @@ -207,13 +206,10 @@ func (r *Reconciler) reconcilePGSQLStatefulSet(ctx context.Context, sg *config.S func (r *Reconciler) reconcilePGSQLPersistentVolumeClaim(ctx context.Context, sg *config.Sourcegraph, owner client.Object) error { cfg := sg.Spec.PGSQL - storageSize, err := resource.ParseQuantity(cfg.StorageSize) + p, err := pvc.NewPersistentVolumeClaim("pgsql", sg.Namespace, cfg) if err != nil { - return errors.Wrap(err, "parsing storage size") + return err } - - p := pvc.NewPersistentVolumeClaim("pgsql", sg.Namespace, storageSize, sg.Spec.StorageClass.Name) - return reconcileObject(ctx, r, sg.Spec.PGSQL, &p, &corev1.PersistentVolumeClaim{}, sg, owner) } diff --git a/internal/appliance/reconciler/pgsql_test.go b/internal/appliance/reconciler/pgsql_test.go index 9b730f2dfd1..42f6d869b2f 100644 --- a/internal/appliance/reconciler/pgsql_test.go +++ b/internal/appliance/reconciler/pgsql_test.go @@ -7,7 +7,6 @@ func (suite *ApplianceTestSuite) TestDeployPGSQL() { name string }{ {name: "pgsql/default"}, - {name: "pgsql/with-storage"}, } { suite.Run(tc.name, func() { namespace := suite.createConfigMap(tc.name) diff --git a/internal/appliance/reconciler/prometheus.go b/internal/appliance/reconciler/prometheus.go index 1abe6c07db4..5eef1a7ee84 100644 --- a/internal/appliance/reconciler/prometheus.go +++ b/internal/appliance/reconciler/prometheus.go @@ -254,10 +254,9 @@ func (r *Reconciler) reconcilePrometheusClusterRoleBinding(ctx context.Context, func (r *Reconciler) reconcilePrometheusPVC(ctx context.Context, sg *config.Sourcegraph, owner client.Object) error { name := "prometheus" cfg := sg.Spec.Prometheus - storageSize, err := resource.ParseQuantity(cfg.StorageSize) + pvc, err := pvc.NewPersistentVolumeClaim(name, sg.Namespace, cfg) if err != nil { - return errors.Wrap(err, "parsing storage size") + return err } - pvc := pvc.NewPersistentVolumeClaim(name, sg.Namespace, storageSize, sg.Spec.StorageClass.Name) return reconcileObject(ctx, r, cfg, &pvc, &corev1.PersistentVolumeClaim{}, sg, owner) } diff --git a/internal/appliance/reconciler/prometheus_test.go b/internal/appliance/reconciler/prometheus_test.go index ba58a9a9a8f..616929f0260 100644 --- a/internal/appliance/reconciler/prometheus_test.go +++ b/internal/appliance/reconciler/prometheus_test.go @@ -9,7 +9,6 @@ func (suite *ApplianceTestSuite) TestDeployPrometheus() { {name: "prometheus/default"}, {name: "prometheus/privileged"}, {name: "prometheus/with-existing-configmap"}, - {name: "prometheus/with-storage"}, } { suite.Run(tc.name, func() { namespace := suite.createConfigMap(tc.name) diff --git a/internal/appliance/reconciler/redis.go b/internal/appliance/reconciler/redis.go index 6109b311c49..9b0ea22223a 100644 --- a/internal/appliance/reconciler/redis.go +++ b/internal/appliance/reconciler/redis.go @@ -160,11 +160,10 @@ func (r *Reconciler) reconcileRedisService(ctx context.Context, sg *config.Sourc func (r *Reconciler) reconcileRedisPVC(ctx context.Context, sg *config.Sourcegraph, owner client.Object, kind string, cfg config.RedisSpec) error { name := "redis-" + kind - storageSize, err := resource.ParseQuantity(cfg.StorageSize) + pvc, err := pvc.NewPersistentVolumeClaim(name, sg.Namespace, cfg) if err != nil { - return errors.Wrap(err, "parsing storage size") + return err } - pvc := pvc.NewPersistentVolumeClaim(name, sg.Namespace, storageSize, sg.Spec.StorageClass.Name) return reconcileObject(ctx, r, cfg, &pvc, &corev1.PersistentVolumeClaim{}, sg, owner) } diff --git a/internal/appliance/reconciler/redis_test.go b/internal/appliance/reconciler/redis_test.go index 2ca8b6790ce..fb206d17524 100644 --- a/internal/appliance/reconciler/redis_test.go +++ b/internal/appliance/reconciler/redis_test.go @@ -7,7 +7,6 @@ func (suite *ApplianceTestSuite) TestDeployRedis() { name string }{ {name: "redis/default"}, - {name: "redis/with-storage"}, } { suite.Run(tc.name, func() { namespace := suite.createConfigMap(tc.name) diff --git a/internal/appliance/reconciler/standard_config_test.go b/internal/appliance/reconciler/standard_config_test.go index 245407607aa..dde29670573 100644 --- a/internal/appliance/reconciler/standard_config_test.go +++ b/internal/appliance/reconciler/standard_config_test.go @@ -9,14 +9,15 @@ func (suite *ApplianceTestSuite) TestStandardFeatures() { for _, tc := range []struct { name string }{ + {name: "standard/blobstore-with-named-storage-class"}, + {name: "standard/precise-code-intel-with-env-vars"}, + {name: "standard/redis-with-multiple-custom-images"}, + {name: "standard/redis-with-storage"}, + {name: "standard/repo-updater-with-no-resources"}, {name: "standard/repo-updater-with-pod-template-config"}, {name: "standard/repo-updater-with-resources"}, - {name: "standard/repo-updater-with-no-resources"}, {name: "standard/repo-updater-with-sa-annotations"}, {name: "standard/symbols-with-custom-image"}, - {name: "standard/redis-with-multiple-custom-images"}, - {name: "standard/precise-code-intel-with-env-vars"}, - {name: "standard/blobstore-with-named-storage-class"}, } { suite.Run(tc.name, func() { namespace := suite.createConfigMap(tc.name) diff --git a/internal/appliance/reconciler/symbols.go b/internal/appliance/reconciler/symbols.go index 6081d4f79af..c738a8c3a3f 100644 --- a/internal/appliance/reconciler/symbols.go +++ b/internal/appliance/reconciler/symbols.go @@ -56,7 +56,7 @@ func (r *Reconciler) reconcileSymbolsStatefulSet(ctx context.Context, sg *config }, }) - storageSize, err := resource.ParseQuantity(cfg.StorageSize) + storageSize, err := resource.ParseQuantity(cfg.GetPersistentVolumeConfig().StorageSize) if err != nil { return errors.Wrap(err, "parsing storage size") } @@ -116,11 +116,14 @@ func (r *Reconciler) reconcileSymbolsStatefulSet(ctx context.Context, sg *config pod.NewVolumeEmptyDir("tmp"), } + pvc, err := pvc.NewPersistentVolumeClaim("cache", sg.Namespace, cfg) + if err != nil { + return err + } + sset := statefulset.NewStatefulSet(name, sg.Namespace, sg.Spec.RequestedVersion) sset.Spec.Template = podTemplate.Template - sset.Spec.VolumeClaimTemplates = []corev1.PersistentVolumeClaim{ - pvc.NewPersistentVolumeClaim("cache", sg.Namespace, storageSize, sg.Spec.StorageClass.Name), - } + sset.Spec.VolumeClaimTemplates = []corev1.PersistentVolumeClaim{pvc} return reconcileObject(ctx, r, sg.Spec.Symbols, &sset, &appsv1.StatefulSet{}, sg, owner) } diff --git a/internal/appliance/reconciler/symbols_test.go b/internal/appliance/reconciler/symbols_test.go index 6cc56b12421..a773358459f 100644 --- a/internal/appliance/reconciler/symbols_test.go +++ b/internal/appliance/reconciler/symbols_test.go @@ -7,6 +7,9 @@ func (suite *ApplianceTestSuite) TestDeploySymbols() { name string }{ {name: "symbols/default"}, + + // This service does some logic on the storage quantity, so we can't + // just rely on the standard config test for storage amounts/classes. {name: "symbols/with-storage"}, } { suite.Run(tc.name, func() { diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/blobstore/default.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/blobstore/default.yaml index 787b792e819..66ff6e53234 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/blobstore/default.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/blobstore/default.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: d33e42f7a0651e109c1a55ae881f9e3000e194cb5257dad1714cf26d5a370b3c + appliance.sourcegraph.com/configHash: 2b72058f008a684f7fa052f8ad33d0226af4cfb7973242c9103d6d1900da355e creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -160,7 +160,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: d33e42f7a0651e109c1a55ae881f9e3000e194cb5257dad1714cf26d5a370b3c + appliance.sourcegraph.com/configHash: 2b72058f008a684f7fa052f8ad33d0226af4cfb7973242c9103d6d1900da355e creationTimestamp: "2024-04-19T00:00:00Z" finalizers: - kubernetes.io/pvc-protection @@ -190,7 +190,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: d33e42f7a0651e109c1a55ae881f9e3000e194cb5257dad1714cf26d5a370b3c + appliance.sourcegraph.com/configHash: 2b72058f008a684f7fa052f8ad33d0226af4cfb7973242c9103d6d1900da355e creationTimestamp: "2024-04-19T00:00:00Z" labels: app: blobstore diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/codeintel/default.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/codeintel/default.yaml index 6fa9853f22b..b530a88447e 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/codeintel/default.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/codeintel/default.yaml @@ -3,7 +3,7 @@ resources: kind: StatefulSet metadata: annotations: - appliance.sourcegraph.com/configHash: 08a9f89fce0d5a0784d40c635aac4b63182af3bcf52068f2e8bc5941aa9706df + appliance.sourcegraph.com/configHash: e7053c9dc5c68dc937eb3ccad38acdb7e070b7a95ada6564027665296fb6bab6 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -282,7 +282,7 @@ resources: kind: ConfigMap metadata: annotations: - appliance.sourcegraph.com/configHash: 08a9f89fce0d5a0784d40c635aac4b63182af3bcf52068f2e8bc5941aa9706df + appliance.sourcegraph.com/configHash: e7053c9dc5c68dc937eb3ccad38acdb7e070b7a95ada6564027665296fb6bab6 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -372,7 +372,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: 08a9f89fce0d5a0784d40c635aac4b63182af3bcf52068f2e8bc5941aa9706df + appliance.sourcegraph.com/configHash: e7053c9dc5c68dc937eb3ccad38acdb7e070b7a95ada6564027665296fb6bab6 creationTimestamp: "2024-04-19T00:00:00Z" finalizers: - kubernetes.io/pvc-protection @@ -408,7 +408,7 @@ resources: kind: Secret metadata: annotations: - appliance.sourcegraph.com/configHash: 08a9f89fce0d5a0784d40c635aac4b63182af3bcf52068f2e8bc5941aa9706df + appliance.sourcegraph.com/configHash: e7053c9dc5c68dc937eb3ccad38acdb7e070b7a95ada6564027665296fb6bab6 creationTimestamp: "2024-04-19T00:00:00Z" labels: app.kubernetes.io/component: codeintel-db-auth @@ -431,7 +431,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: 08a9f89fce0d5a0784d40c635aac4b63182af3bcf52068f2e8bc5941aa9706df + appliance.sourcegraph.com/configHash: e7053c9dc5c68dc937eb3ccad38acdb7e070b7a95ada6564027665296fb6bab6 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -450,7 +450,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 08a9f89fce0d5a0784d40c635aac4b63182af3bcf52068f2e8bc5941aa9706df + appliance.sourcegraph.com/configHash: e7053c9dc5c68dc937eb3ccad38acdb7e070b7a95ada6564027665296fb6bab6 prometheus.io/port: "9187" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/gitserver/default.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/gitserver/default.yaml index 4b2a4f5c872..15097d16dad 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/gitserver/default.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/gitserver/default.yaml @@ -3,7 +3,7 @@ resources: kind: StatefulSet metadata: annotations: - appliance.sourcegraph.com/configHash: 83479964f6f3f84d669035db9422f03b10c7543d344f6c222c1d1698eb3acb6a + appliance.sourcegraph.com/configHash: 10b487fc6c2af0601db02e309e916f17fb8fc7100871dd3c3db28cf1c2e1ac2f creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -210,7 +210,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: 83479964f6f3f84d669035db9422f03b10c7543d344f6c222c1d1698eb3acb6a + appliance.sourcegraph.com/configHash: 10b487fc6c2af0601db02e309e916f17fb8fc7100871dd3c3db28cf1c2e1ac2f creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -229,7 +229,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 83479964f6f3f84d669035db9422f03b10c7543d344f6c222c1d1698eb3acb6a + appliance.sourcegraph.com/configHash: 10b487fc6c2af0601db02e309e916f17fb8fc7100871dd3c3db28cf1c2e1ac2f prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/gitserver/with-storage.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/gitserver/with-storage.yaml deleted file mode 100644 index 8c07bcfa466..00000000000 --- a/internal/appliance/reconciler/testdata/golden-fixtures/gitserver/with-storage.yaml +++ /dev/null @@ -1,271 +0,0 @@ -resources: - - apiVersion: apps/v1 - kind: StatefulSet - metadata: - annotations: - appliance.sourcegraph.com/configHash: ab677ca3d3c1faf2f802c3a7a01b81b35c553394c3ec9a548543908453c6e57f - creationTimestamp: "2024-04-19T00:00:00Z" - generation: 1 - labels: - app.kubernetes.io/component: gitserver - app.kubernetes.io/name: sourcegraph - app.kubernetes.io/version: 5.3.9104 - deploy: sourcegraph - name: gitserver - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - spec: - minReadySeconds: 10 - persistentVolumeClaimRetentionPolicy: - whenDeleted: Retain - whenScaled: Retain - podManagementPolicy: OrderedReady - replicas: 1 - revisionHistoryLimit: 10 - selector: - matchLabels: - app: gitserver - serviceName: gitserver - template: - metadata: - annotations: - kubectl.kubernetes.io/default-container: gitserver - creationTimestamp: null - labels: - app: gitserver - deploy: sourcegraph - name: gitserver - spec: - containers: - - args: - - run - env: - - name: REDIS_CACHE_ENDPOINT - valueFrom: - secretKeyRef: - key: endpoint - name: redis-cache - - name: REDIS_STORE_ENDPOINT - valueFrom: - secretKeyRef: - key: endpoint - name: redis-store - - name: OTEL_AGENT_HOST - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: status.hostIP - - name: OTEL_EXPORTER_OTLP_ENDPOINT - value: http://$(OTEL_AGENT_HOST):4317 - image: index.docker.io/sourcegraph/gitserver:5.3.2@sha256:6c6042cf3e5f3f16de9b82e3d4ab1647f8bb924cd315245bd7a3162f5489e8c4 - imagePullPolicy: IfNotPresent - livenessProbe: - failureThreshold: 3 - initialDelaySeconds: 5 - periodSeconds: 10 - successThreshold: 1 - tcpSocket: - port: rpc - timeoutSeconds: 5 - name: gitserver - ports: - - containerPort: 3178 - name: rpc - protocol: TCP - resources: - limits: - cpu: "4" - memory: 8Gi - requests: - cpu: "4" - memory: 8Gi - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsGroup: 101 - runAsUser: 100 - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: FallbackToLogsOnError - volumeMounts: - - mountPath: /tmp - name: tmpdir - - mountPath: /data/repos - name: repos - dnsPolicy: ClusterFirst - restartPolicy: Always - schedulerName: default-scheduler - securityContext: - fsGroup: 101 - fsGroupChangePolicy: OnRootMismatch - runAsGroup: 101 - runAsUser: 100 - serviceAccount: gitserver - serviceAccountName: gitserver - terminationGracePeriodSeconds: 30 - volumes: - - emptyDir: {} - name: repos - - emptyDir: {} - name: tmpdir - updateStrategy: - type: RollingUpdate - volumeClaimTemplates: - - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - creationTimestamp: null - labels: - deploy: sourcegraph - name: repos - namespace: NORMALIZED_FOR_TESTING - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 500Gi - volumeMode: Filesystem - status: - phase: Pending - status: - availableReplicas: 0 - replicas: 0 - - apiVersion: v1 - data: - spec: | - spec: - requestedVersion: "5.3.9104" - - blobstore: - disabled: true - - codeInsights: - disabled: true - - codeIntel: - disabled: true - - frontend: - disabled: true - - gitServer: - storageSize: "500Gi" - - indexedSearch: - disabled: true - - indexedSearchIndexer: - disabled: true - - pgsql: - disabled: true - - postgresExporter: - disabled: true - - preciseCodeIntel: - disabled: true - - redisCache: - disabled: true - - redisStore: - disabled: true - - repoUpdater: - disabled: true - - searcher: - disabled: true - - symbols: - disabled: true - - syntectServer: - disabled: true - - worker: - disabled: true - - prometheus: - disabled: true - kind: ConfigMap - metadata: - annotations: - appliance.sourcegraph.com/currentVersion: 5.3.9104 - appliance.sourcegraph.com/managed: "true" - creationTimestamp: "2024-04-19T00:00:00Z" - name: sg - namespace: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - - apiVersion: v1 - kind: ServiceAccount - metadata: - annotations: - appliance.sourcegraph.com/configHash: ab677ca3d3c1faf2f802c3a7a01b81b35c553394c3ec9a548543908453c6e57f - creationTimestamp: "2024-04-19T00:00:00Z" - labels: - deploy: sourcegraph - name: gitserver - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - - apiVersion: v1 - kind: Service - metadata: - annotations: - appliance.sourcegraph.com/configHash: ab677ca3d3c1faf2f802c3a7a01b81b35c553394c3ec9a548543908453c6e57f - prometheus.io/port: "6060" - sourcegraph.prometheus/scrape: "true" - creationTimestamp: "2024-04-19T00:00:00Z" - labels: - app: gitserver - app.kubernetes.io/component: gitserver - deploy: sourcegraph - name: gitserver - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - spec: - clusterIP: NORMALIZED_FOR_TESTING - clusterIPs: - - NORMALIZED_FOR_TESTING - internalTrafficPolicy: Cluster - ipFamilies: - - IPv4 - ipFamilyPolicy: SingleStack - ports: - - name: unused - port: 10811 - protocol: TCP - targetPort: 10811 - selector: - app: gitserver - type: gitserver - sessionAffinity: None - type: ClusterIP - status: - loadBalancer: {} diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/pgsql/default.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/pgsql/default.yaml index 4997c4ef0af..12175d087e8 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/pgsql/default.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/pgsql/default.yaml @@ -3,7 +3,7 @@ resources: kind: StatefulSet metadata: annotations: - appliance.sourcegraph.com/configHash: 1a699c66e173ecb90aba090427b165f1eb257dcaf67627d48b11d21460a8475b + appliance.sourcegraph.com/configHash: 698f92f36854e67da6c2c31b86457552f0dddfbfc131a3d0ac54dbbd1502c350 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -288,7 +288,7 @@ resources: kind: ConfigMap metadata: annotations: - appliance.sourcegraph.com/configHash: 1a699c66e173ecb90aba090427b165f1eb257dcaf67627d48b11d21460a8475b + appliance.sourcegraph.com/configHash: 698f92f36854e67da6c2c31b86457552f0dddfbfc131a3d0ac54dbbd1502c350 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -378,7 +378,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: 1a699c66e173ecb90aba090427b165f1eb257dcaf67627d48b11d21460a8475b + appliance.sourcegraph.com/configHash: 698f92f36854e67da6c2c31b86457552f0dddfbfc131a3d0ac54dbbd1502c350 creationTimestamp: "2024-04-19T00:00:00Z" finalizers: - kubernetes.io/pvc-protection @@ -414,7 +414,7 @@ resources: kind: Secret metadata: annotations: - appliance.sourcegraph.com/configHash: 1a699c66e173ecb90aba090427b165f1eb257dcaf67627d48b11d21460a8475b + appliance.sourcegraph.com/configHash: 698f92f36854e67da6c2c31b86457552f0dddfbfc131a3d0ac54dbbd1502c350 creationTimestamp: "2024-04-19T00:00:00Z" labels: app.kubernetes.io/component: pgsql-auth @@ -437,7 +437,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: 1a699c66e173ecb90aba090427b165f1eb257dcaf67627d48b11d21460a8475b + appliance.sourcegraph.com/configHash: 698f92f36854e67da6c2c31b86457552f0dddfbfc131a3d0ac54dbbd1502c350 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -456,7 +456,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 1a699c66e173ecb90aba090427b165f1eb257dcaf67627d48b11d21460a8475b + appliance.sourcegraph.com/configHash: 698f92f36854e67da6c2c31b86457552f0dddfbfc131a3d0ac54dbbd1502c350 prometheus.io/port: "9187" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/pgsql/with-storage.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/pgsql/with-storage.yaml deleted file mode 100644 index cef0648d989..00000000000 --- a/internal/appliance/reconciler/testdata/golden-fixtures/pgsql/with-storage.yaml +++ /dev/null @@ -1,497 +0,0 @@ -resources: - - apiVersion: apps/v1 - kind: StatefulSet - metadata: - annotations: - appliance.sourcegraph.com/configHash: 76d8bfd89d72c07b04aed10ff0e6c0a90928d82a505dd6c0d508adb7ef855dc3 - creationTimestamp: "2024-04-19T00:00:00Z" - generation: 1 - labels: - app.kubernetes.io/component: pgsql - app.kubernetes.io/name: sourcegraph - app.kubernetes.io/version: 5.3.9104 - deploy: sourcegraph - name: pgsql - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - spec: - minReadySeconds: 10 - persistentVolumeClaimRetentionPolicy: - whenDeleted: Retain - whenScaled: Retain - podManagementPolicy: OrderedReady - replicas: 1 - revisionHistoryLimit: 10 - selector: - matchLabels: - app: pgsql - serviceName: pgsql - template: - metadata: - annotations: - kubectl.kubernetes.io/default-container: pgsql - creationTimestamp: null - labels: - app: pgsql - deploy: sourcegraph - name: pgsql - spec: - containers: - - env: - - name: POSTGRES_DATABASE - valueFrom: - secretKeyRef: - key: database - name: pgsql-auth - - name: POSTGRES_HOST - valueFrom: - secretKeyRef: - key: host - name: pgsql-auth - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - key: password - name: pgsql-auth - - name: POSTGRES_PORT - valueFrom: - secretKeyRef: - key: port - name: pgsql-auth - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - key: user - name: pgsql-auth - - name: POSTGRES_DB - value: $(POSTGRES_DATABASE) - image: index.docker.io/sourcegraph/postgres-12-alpine:5.3.2@sha256:1e0e93661a65c832b9697048c797f9894dfb502e2e1da2b8209f0018a6632b79 - imagePullPolicy: IfNotPresent - livenessProbe: - exec: - command: - - /liveness.sh - failureThreshold: 3 - initialDelaySeconds: 15 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 1 - name: pgsql - ports: - - containerPort: 5432 - name: pgsql - protocol: TCP - readinessProbe: - exec: - command: - - /ready.sh - failureThreshold: 3 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 1 - resources: - limits: - cpu: "4" - memory: 4Gi - requests: - cpu: "4" - memory: 4Gi - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsGroup: 999 - runAsUser: 999 - startupProbe: - exec: - command: - - /liveness.sh - failureThreshold: 360 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 1 - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: FallbackToLogsOnError - volumeMounts: - - mountPath: /data - name: disk - - mountPath: /conf - name: pgsql-conf - - mountPath: /dev/shm - name: dshm - - mountPath: /var/run/postgresql - name: lockdir - - env: - - name: DATA_SOURCE_DB - valueFrom: - secretKeyRef: - key: database - name: pgsql-auth - - name: DATA_SOURCE_PASS - valueFrom: - secretKeyRef: - key: password - name: pgsql-auth - - name: DATA_SOURCE_PORT - valueFrom: - secretKeyRef: - key: port - name: pgsql-auth - - name: DATA_SOURCE_USER - valueFrom: - secretKeyRef: - key: user - name: pgsql-auth - - name: DATA_SOURCE_URI - value: 127.0.0.1:$(DATA_SOURCE_PORT)/$(DATA_SOURCE_DB)?sslmode=disable - - name: PG_EXPORTER_EXTEND_QUERY_PATH - value: /config/queries.yaml - image: index.docker.io/sourcegraph/postgres_exporter:5.3.2@sha256:b9fa66fbcb4cc2d466487259db4ae2deacd7651dac4a9e28c9c7fc36523699d0 - imagePullPolicy: IfNotPresent - name: pgsql-exporter - resources: - limits: - cpu: 10m - memory: 50M - requests: - cpu: 10m - memory: 50M - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsGroup: 999 - runAsUser: 999 - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: FallbackToLogsOnError - dnsPolicy: ClusterFirst - initContainers: - - command: - - sh - - -c - - if [ -d /data/pgdata-12 ]; then chmod 750 /data/pgdata-12; fi - image: index.docker.io/sourcegraph/alpine-3.14:5.3.2@sha256:982220e0fd8ce55a73798fa7e814a482c4807c412f054c8440c5970b610239b7 - imagePullPolicy: IfNotPresent - name: correct-data-dir-permissions - resources: - limits: - cpu: 10m - memory: 50M - requests: - cpu: 10m - memory: 50M - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsGroup: 999 - runAsUser: 999 - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: FallbackToLogsOnError - volumeMounts: - - mountPath: /data - name: disk - restartPolicy: Always - schedulerName: default-scheduler - securityContext: - fsGroup: 999 - fsGroupChangePolicy: OnRootMismatch - runAsGroup: 999 - runAsUser: 999 - serviceAccount: pgsql - serviceAccountName: pgsql - terminationGracePeriodSeconds: 120 - volumes: - - emptyDir: {} - name: lockdir - - emptyDir: - medium: Memory - sizeLimit: 1Gi - name: dshm - - name: disk - persistentVolumeClaim: - claimName: pgsql - - configMap: - defaultMode: 511 - name: pgsql-conf - name: pgsql-conf - updateStrategy: - type: RollingUpdate - status: - availableReplicas: 0 - replicas: 0 - - apiVersion: v1 - data: - postgresql.conf: | - #------------------------------------------------------------------------------ - # POSTGRESQL DEFAULT CONFIGURATION - #------------------------------------------------------------------------------ - - # Below is PostgreSQL default configuration. - # You should apply your own customization in the CUSTOMIZED OPTIONS section below - # to avoid merge conflict in the future. - - listen_addresses = '*' - max_connections = 100 - shared_buffers = 128MB - dynamic_shared_memory_type = posix - max_wal_size = 1GB - min_wal_size = 80MB - log_timezone = 'UTC' - datestyle = 'iso, mdy' - timezone = 'UTC' - lc_messages = 'en_US.utf8' - lc_monetary = 'en_US.utf8' - lc_numeric = 'en_US.utf8' - lc_time = 'en_US.utf8' - default_text_search_config = 'pg_catalog.english' - - - #------------------------------------------------------------------------------ - # SOURCEGRAPH RECOMMENDED OPTIONS - #------------------------------------------------------------------------------ - - # Below is Sourcegraph recommended Postgres configuration based on the default resource configuration. - # You should apply your own customization in the CUSTOMIZED OPTIONS section below - # to avoid merge conflict in the future. - - shared_buffers = 1GB - work_mem = 5MB - maintenance_work_mem = 250MB - temp_file_limit = 20GB - bgwriter_delay = 50ms - bgwriter_lru_maxpages = 200 - effective_io_concurrency = 200 - max_worker_processes = 4 - max_parallel_maintenance_workers = 4 - max_parallel_workers_per_gather = 2 - max_parallel_workers = 4 - wal_buffers = 16MB - max_wal_size = 8GB - min_wal_size = 2GB - random_page_cost = 1.1 - effective_cache_size = 3GB - - - #------------------------------------------------------------------------------ - # CUSTOMIZED OPTIONS - #------------------------------------------------------------------------------ - - # Add your customization by using 'pgsql.additionalConfig' in your override file. - # Learn more: https://docs.sourcegraph.com/admin/config/postgres-conf - immutable: false - kind: ConfigMap - metadata: - annotations: - appliance.sourcegraph.com/configHash: 76d8bfd89d72c07b04aed10ff0e6c0a90928d82a505dd6c0d508adb7ef855dc3 - creationTimestamp: "2024-04-19T00:00:00Z" - labels: - deploy: sourcegraph - name: pgsql-conf - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - - apiVersion: v1 - data: - spec: | - spec: - requestedVersion: "5.3.9104" - - blobstore: - disabled: true - - codeInsights: - disabled: true - - codeIntel: - disabled: true - - frontend: - disabled: true - - gitServer: - disabled: true - - indexedSearch: - disabled: true - - indexedSearchIndexer: - disabled: true - - pgsql: - storageSize: "500Gi" - - postgresExporter: - disabled: true - - preciseCodeIntel: - disabled: true - - redisCache: - disabled: true - - redisExporter: - disabled: true - - redisStore: - disabled: true - - repoUpdater: - disabled: true - - searcher: - disabled: true - - symbols: - disabled: true - - syntectServer: - disabled: true - - worker: - disabled: true - - prometheus: - disabled: true - kind: ConfigMap - metadata: - annotations: - appliance.sourcegraph.com/currentVersion: 5.3.9104 - appliance.sourcegraph.com/managed: "true" - creationTimestamp: "2024-04-19T00:00:00Z" - name: sg - namespace: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - annotations: - appliance.sourcegraph.com/configHash: 76d8bfd89d72c07b04aed10ff0e6c0a90928d82a505dd6c0d508adb7ef855dc3 - creationTimestamp: "2024-04-19T00:00:00Z" - finalizers: - - kubernetes.io/pvc-protection - labels: - deploy: sourcegraph - name: pgsql - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 500Gi - volumeMode: Filesystem - status: - phase: Pending - - apiVersion: v1 - data: - database: c2c= - host: cGdzcWw= - password: cGFzc3dvcmQ= - port: NTQzMg== - user: c2c= - kind: Secret - metadata: - annotations: - appliance.sourcegraph.com/configHash: 76d8bfd89d72c07b04aed10ff0e6c0a90928d82a505dd6c0d508adb7ef855dc3 - creationTimestamp: "2024-04-19T00:00:00Z" - labels: - app.kubernetes.io/component: pgsql-auth - app.kubernetes.io/name: sourcegraph - app.kubernetes.io/version: 5.3.9104 - deploy: sourcegraph - name: pgsql-auth - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - type: Opaque - - apiVersion: v1 - kind: ServiceAccount - metadata: - annotations: - appliance.sourcegraph.com/configHash: 76d8bfd89d72c07b04aed10ff0e6c0a90928d82a505dd6c0d508adb7ef855dc3 - creationTimestamp: "2024-04-19T00:00:00Z" - labels: - deploy: sourcegraph - name: pgsql - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - - apiVersion: v1 - kind: Service - metadata: - annotations: - appliance.sourcegraph.com/configHash: 76d8bfd89d72c07b04aed10ff0e6c0a90928d82a505dd6c0d508adb7ef855dc3 - prometheus.io/port: "9187" - sourcegraph.prometheus/scrape: "true" - creationTimestamp: "2024-04-19T00:00:00Z" - labels: - app: pgsql - app.kubernetes.io/component: pgsql - deploy: sourcegraph - name: pgsql - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - spec: - clusterIP: NORMALIZED_FOR_TESTING - clusterIPs: - - NORMALIZED_FOR_TESTING - internalTrafficPolicy: Cluster - ipFamilies: - - IPv4 - ipFamilyPolicy: SingleStack - ports: - - name: pgsql - port: 5432 - protocol: TCP - targetPort: pgsql - selector: - app: pgsql - sessionAffinity: None - type: ClusterIP - status: - loadBalancer: {} diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/default.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/default.yaml index 1bcde74462e..18c00cd89fa 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/default.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/default.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: 05b6b32b7f7702146178081817670b43a900fd5b2ed61dcdaa8e34d7a4e0d204 + appliance.sourcegraph.com/configHash: d2a14e19239696e63f4fe553c79d50b3fa2d530fa25e73631803b74ebdce50d3 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -192,7 +192,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: 05b6b32b7f7702146178081817670b43a900fd5b2ed61dcdaa8e34d7a4e0d204 + appliance.sourcegraph.com/configHash: d2a14e19239696e63f4fe553c79d50b3fa2d530fa25e73631803b74ebdce50d3 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -211,7 +211,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 05b6b32b7f7702146178081817670b43a900fd5b2ed61dcdaa8e34d7a4e0d204 + appliance.sourcegraph.com/configHash: d2a14e19239696e63f4fe553c79d50b3fa2d530fa25e73631803b74ebdce50d3 prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/with-blobstore.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/with-blobstore.yaml index dd109382223..4a25cdd8da4 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/with-blobstore.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/with-blobstore.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: d33e42f7a0651e109c1a55ae881f9e3000e194cb5257dad1714cf26d5a370b3c + appliance.sourcegraph.com/configHash: 2b72058f008a684f7fa052f8ad33d0226af4cfb7973242c9103d6d1900da355e creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -92,7 +92,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: 05b6b32b7f7702146178081817670b43a900fd5b2ed61dcdaa8e34d7a4e0d204 + appliance.sourcegraph.com/configHash: d2a14e19239696e63f4fe553c79d50b3fa2d530fa25e73631803b74ebdce50d3 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -284,7 +284,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: d33e42f7a0651e109c1a55ae881f9e3000e194cb5257dad1714cf26d5a370b3c + appliance.sourcegraph.com/configHash: 2b72058f008a684f7fa052f8ad33d0226af4cfb7973242c9103d6d1900da355e creationTimestamp: "2024-04-19T00:00:00Z" finalizers: - kubernetes.io/pvc-protection @@ -314,7 +314,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: 05b6b32b7f7702146178081817670b43a900fd5b2ed61dcdaa8e34d7a4e0d204 + appliance.sourcegraph.com/configHash: d2a14e19239696e63f4fe553c79d50b3fa2d530fa25e73631803b74ebdce50d3 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -333,7 +333,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: d33e42f7a0651e109c1a55ae881f9e3000e194cb5257dad1714cf26d5a370b3c + appliance.sourcegraph.com/configHash: 2b72058f008a684f7fa052f8ad33d0226af4cfb7973242c9103d6d1900da355e creationTimestamp: "2024-04-19T00:00:00Z" labels: app: blobstore @@ -373,7 +373,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 05b6b32b7f7702146178081817670b43a900fd5b2ed61dcdaa8e34d7a4e0d204 + appliance.sourcegraph.com/configHash: d2a14e19239696e63f4fe553c79d50b3fa2d530fa25e73631803b74ebdce50d3 prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/with-num-workers.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/with-num-workers.yaml index ddb55066447..1288756246a 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/with-num-workers.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/with-num-workers.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: ae3936b4f91f4e9c6ec5979fa4778412db0298f3fd33789ca2a652675c2a1a37 + appliance.sourcegraph.com/configHash: e4dab740adc29e4a868a73401d9acabb090817ba9f8621c0c684f67969a23ca0 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -193,7 +193,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: ae3936b4f91f4e9c6ec5979fa4778412db0298f3fd33789ca2a652675c2a1a37 + appliance.sourcegraph.com/configHash: e4dab740adc29e4a868a73401d9acabb090817ba9f8621c0c684f67969a23ca0 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -212,7 +212,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: ae3936b4f91f4e9c6ec5979fa4778412db0298f3fd33789ca2a652675c2a1a37 + appliance.sourcegraph.com/configHash: e4dab740adc29e4a868a73401d9acabb090817ba9f8621c0c684f67969a23ca0 prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/with-replicas.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/with-replicas.yaml index 82bfc10cb7d..e78f634eaf4 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/with-replicas.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/precise-code-intel/with-replicas.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: 75f3d926f79f73ef77502da4215fa2db8f4ebe149e367c862b1023d4bbadc115 + appliance.sourcegraph.com/configHash: ccfa606a4b7366e50b7d56618c7c3754e05e82431f86d23a22e7a560fbc5ef8a creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -193,7 +193,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: 75f3d926f79f73ef77502da4215fa2db8f4ebe149e367c862b1023d4bbadc115 + appliance.sourcegraph.com/configHash: ccfa606a4b7366e50b7d56618c7c3754e05e82431f86d23a22e7a560fbc5ef8a creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -212,7 +212,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 75f3d926f79f73ef77502da4215fa2db8f4ebe149e367c862b1023d4bbadc115 + appliance.sourcegraph.com/configHash: ccfa606a4b7366e50b7d56618c7c3754e05e82431f86d23a22e7a560fbc5ef8a prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/default.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/default.yaml index 528f6cf7766..f5665e937f4 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/default.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/default.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: 40ddb993f0b30dff9200540c876d34e75d530d9ca00cd171e90e517a34b963c2 + appliance.sourcegraph.com/configHash: 0d793282aafb84217a72f4943c126870b047084dea6cd77eeebbcdb9929a1477 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -327,7 +327,7 @@ resources: kind: ConfigMap metadata: annotations: - appliance.sourcegraph.com/configHash: 40ddb993f0b30dff9200540c876d34e75d530d9ca00cd171e90e517a34b963c2 + appliance.sourcegraph.com/configHash: 0d793282aafb84217a72f4943c126870b047084dea6cd77eeebbcdb9929a1477 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -414,7 +414,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: 40ddb993f0b30dff9200540c876d34e75d530d9ca00cd171e90e517a34b963c2 + appliance.sourcegraph.com/configHash: 0d793282aafb84217a72f4943c126870b047084dea6cd77eeebbcdb9929a1477 creationTimestamp: "2024-04-19T00:00:00Z" finalizers: - kubernetes.io/pvc-protection @@ -444,7 +444,7 @@ resources: kind: Role metadata: annotations: - appliance.sourcegraph.com/configHash: 40ddb993f0b30dff9200540c876d34e75d530d9ca00cd171e90e517a34b963c2 + appliance.sourcegraph.com/configHash: 0d793282aafb84217a72f4943c126870b047084dea6cd77eeebbcdb9929a1477 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -480,7 +480,7 @@ resources: kind: RoleBinding metadata: annotations: - appliance.sourcegraph.com/configHash: 40ddb993f0b30dff9200540c876d34e75d530d9ca00cd171e90e517a34b963c2 + appliance.sourcegraph.com/configHash: 0d793282aafb84217a72f4943c126870b047084dea6cd77eeebbcdb9929a1477 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -507,7 +507,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: 40ddb993f0b30dff9200540c876d34e75d530d9ca00cd171e90e517a34b963c2 + appliance.sourcegraph.com/configHash: 0d793282aafb84217a72f4943c126870b047084dea6cd77eeebbcdb9929a1477 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -526,7 +526,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 40ddb993f0b30dff9200540c876d34e75d530d9ca00cd171e90e517a34b963c2 + appliance.sourcegraph.com/configHash: 0d793282aafb84217a72f4943c126870b047084dea6cd77eeebbcdb9929a1477 creationTimestamp: "2024-04-19T00:00:00Z" labels: app: prometheus diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/privileged.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/privileged.yaml index f6a4e07f982..a84da3d5df7 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/privileged.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/privileged.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: f3552ecdd048a5aa1442524110f3648d103930c4977323d60e0832a9afbb941a + appliance.sourcegraph.com/configHash: 67efb602e9f61b6b18e0c5eea7be1713e7f99cb08862aa0bc779a8eef66be301 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -102,7 +102,7 @@ resources: kind: ClusterRole metadata: annotations: - appliance.sourcegraph.com/configHash: f3552ecdd048a5aa1442524110f3648d103930c4977323d60e0832a9afbb941a + appliance.sourcegraph.com/configHash: 67efb602e9f61b6b18e0c5eea7be1713e7f99cb08862aa0bc779a8eef66be301 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -140,7 +140,7 @@ resources: kind: ClusterRoleBinding metadata: annotations: - appliance.sourcegraph.com/configHash: f3552ecdd048a5aa1442524110f3648d103930c4977323d60e0832a9afbb941a + appliance.sourcegraph.com/configHash: 67efb602e9f61b6b18e0c5eea7be1713e7f99cb08862aa0bc779a8eef66be301 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -455,7 +455,7 @@ resources: kind: ConfigMap metadata: annotations: - appliance.sourcegraph.com/configHash: f3552ecdd048a5aa1442524110f3648d103930c4977323d60e0832a9afbb941a + appliance.sourcegraph.com/configHash: 67efb602e9f61b6b18e0c5eea7be1713e7f99cb08862aa0bc779a8eef66be301 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -543,7 +543,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: f3552ecdd048a5aa1442524110f3648d103930c4977323d60e0832a9afbb941a + appliance.sourcegraph.com/configHash: 67efb602e9f61b6b18e0c5eea7be1713e7f99cb08862aa0bc779a8eef66be301 creationTimestamp: "2024-04-19T00:00:00Z" finalizers: - kubernetes.io/pvc-protection @@ -573,7 +573,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: f3552ecdd048a5aa1442524110f3648d103930c4977323d60e0832a9afbb941a + appliance.sourcegraph.com/configHash: 67efb602e9f61b6b18e0c5eea7be1713e7f99cb08862aa0bc779a8eef66be301 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -592,7 +592,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: f3552ecdd048a5aa1442524110f3648d103930c4977323d60e0832a9afbb941a + appliance.sourcegraph.com/configHash: 67efb602e9f61b6b18e0c5eea7be1713e7f99cb08862aa0bc779a8eef66be301 creationTimestamp: "2024-04-19T00:00:00Z" labels: app: prometheus diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/subsequent-disable.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/subsequent-disable.yaml index 0b49c1fd900..9ceb2810107 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/subsequent-disable.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/subsequent-disable.yaml @@ -3,7 +3,7 @@ resources: kind: ClusterRole metadata: annotations: - appliance.sourcegraph.com/configHash: f3552ecdd048a5aa1442524110f3648d103930c4977323d60e0832a9afbb941a + appliance.sourcegraph.com/configHash: 67efb602e9f61b6b18e0c5eea7be1713e7f99cb08862aa0bc779a8eef66be301 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -41,7 +41,7 @@ resources: kind: ClusterRoleBinding metadata: annotations: - appliance.sourcegraph.com/configHash: f3552ecdd048a5aa1442524110f3648d103930c4977323d60e0832a9afbb941a + appliance.sourcegraph.com/configHash: 67efb602e9f61b6b18e0c5eea7be1713e7f99cb08862aa0bc779a8eef66be301 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -131,7 +131,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: f3552ecdd048a5aa1442524110f3648d103930c4977323d60e0832a9afbb941a + appliance.sourcegraph.com/configHash: 67efb602e9f61b6b18e0c5eea7be1713e7f99cb08862aa0bc779a8eef66be301 creationTimestamp: "2024-04-19T00:00:00Z" deletionGracePeriodSeconds: 0 deletionTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/with-existing-configmap.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/with-existing-configmap.yaml index 174470fbdad..acfed5ba6b8 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/with-existing-configmap.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/with-existing-configmap.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: f20217f689003e9cac09c0005fcef47984f55c7df672b25fe21825d28a679cdf + appliance.sourcegraph.com/configHash: abe42daf7b6f91b14b81057cfe0a95a3980fa78efdcbf24b04ec6219686751ce creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -171,7 +171,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: f20217f689003e9cac09c0005fcef47984f55c7df672b25fe21825d28a679cdf + appliance.sourcegraph.com/configHash: abe42daf7b6f91b14b81057cfe0a95a3980fa78efdcbf24b04ec6219686751ce creationTimestamp: "2024-04-19T00:00:00Z" finalizers: - kubernetes.io/pvc-protection @@ -201,7 +201,7 @@ resources: kind: Role metadata: annotations: - appliance.sourcegraph.com/configHash: f20217f689003e9cac09c0005fcef47984f55c7df672b25fe21825d28a679cdf + appliance.sourcegraph.com/configHash: abe42daf7b6f91b14b81057cfe0a95a3980fa78efdcbf24b04ec6219686751ce creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -237,7 +237,7 @@ resources: kind: RoleBinding metadata: annotations: - appliance.sourcegraph.com/configHash: f20217f689003e9cac09c0005fcef47984f55c7df672b25fe21825d28a679cdf + appliance.sourcegraph.com/configHash: abe42daf7b6f91b14b81057cfe0a95a3980fa78efdcbf24b04ec6219686751ce creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -264,7 +264,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: f20217f689003e9cac09c0005fcef47984f55c7df672b25fe21825d28a679cdf + appliance.sourcegraph.com/configHash: abe42daf7b6f91b14b81057cfe0a95a3980fa78efdcbf24b04ec6219686751ce creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -283,7 +283,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: f20217f689003e9cac09c0005fcef47984f55c7df672b25fe21825d28a679cdf + appliance.sourcegraph.com/configHash: abe42daf7b6f91b14b81057cfe0a95a3980fa78efdcbf24b04ec6219686751ce creationTimestamp: "2024-04-19T00:00:00Z" labels: app: prometheus diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/with-storage.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/with-storage.yaml deleted file mode 100644 index e95f1b49e3b..00000000000 --- a/internal/appliance/reconciler/testdata/golden-fixtures/prometheus/with-storage.yaml +++ /dev/null @@ -1,565 +0,0 @@ -resources: - - apiVersion: apps/v1 - kind: Deployment - metadata: - annotations: - appliance.sourcegraph.com/configHash: 3e93177a87a6b1419772658a608559612bdd0e71d369dd8c58af490fc65c6c9d - creationTimestamp: "2024-04-19T00:00:00Z" - generation: 1 - labels: - app.kubernetes.io/component: prometheus - app.kubernetes.io/name: sourcegraph - app.kubernetes.io/version: 5.3.9104 - deploy: sourcegraph - name: prometheus - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - spec: - minReadySeconds: 10 - progressDeadlineSeconds: 600 - replicas: 1 - revisionHistoryLimit: 10 - selector: - matchLabels: - app: prometheus - strategy: - type: Recreate - template: - metadata: - annotations: - kubectl.kubernetes.io/default-container: prometheus - creationTimestamp: null - labels: - app: prometheus - deploy: sourcegraph - name: prometheus - spec: - containers: - - image: index.docker.io/sourcegraph/prometheus:5.3.2@sha256:1b5c003fb39628f79e7655ba33f9ca119ddc4be021602ede3cc1674ef99fcdad - imagePullPolicy: IfNotPresent - name: prometheus - ports: - - containerPort: 9090 - name: http - protocol: TCP - readinessProbe: - failureThreshold: 120 - httpGet: - path: /-/ready - port: http - scheme: HTTP - periodSeconds: 5 - successThreshold: 1 - timeoutSeconds: 3 - resources: - limits: - cpu: "2" - memory: 6G - requests: - cpu: 500m - memory: 6G - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsGroup: 101 - runAsUser: 100 - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: FallbackToLogsOnError - volumeMounts: - - mountPath: /prometheus - name: data - - mountPath: /sg_prometheus_add_ons - name: config - dnsPolicy: ClusterFirst - restartPolicy: Always - schedulerName: default-scheduler - securityContext: - fsGroup: 101 - fsGroupChangePolicy: OnRootMismatch - runAsGroup: 101 - runAsUser: 100 - serviceAccount: prometheus - serviceAccountName: prometheus - terminationGracePeriodSeconds: 30 - volumes: - - name: data - persistentVolumeClaim: - claimName: prometheus - - configMap: - defaultMode: 511 - name: prometheus - name: config - status: {} - - apiVersion: v1 - data: - extra_rules.yml: "" - prometheus.yml: | - global: - scrape_interval: 30s - evaluation_interval: 30s - - alerting: - alertmanagers: - # Bundled Alertmanager, started by prom-wrapper - - static_configs: - - targets: ['127.0.0.1:9093'] - path_prefix: /alertmanager - # Uncomment the following to have alerts delivered to additional Alertmanagers discovered - # in the cluster. This configuration is not required if you use Sourcegraph's built-in alerting: - # https://docs.sourcegraph.com/admin/observability/alerting - # - kubernetes_sd_configs: - # - role: endpoints - # relabel_configs: - # - source_labels: [__meta_kubernetes_service_name] - # regex: alertmanager - # action: keep - - rule_files: - - '*_rules.yml' - - "/sg_config_prometheus/*_rules.yml" - - "/sg_prometheus_add_ons/*_rules.yml" - - # A scrape configuration for running Prometheus on a Kubernetes cluster. - # This uses separate scrape configs for cluster components (i.e. API server, node) - # and services to allow each to use different authentication configs. - # - # Kubernetes labels will be added as Prometheus labels on metrics via the - # `labelmap` relabeling action. - - # Scrape config for API servers. - # - # Kubernetes exposes API servers as endpoints to the default/kubernetes - # service so this uses `endpoints` role and uses relabelling to only keep - # the endpoints associated with the default/kubernetes service using the - # default named port `https`. This works for single API server deployments as - # well as HA API server deployments. - scrape_configs: # End of privileged config - - # Scrape config for service endpoints. - # - # The relabeling allows the actual service scrape endpoint to be configured - # via the following annotations: - # - # * `prometheus.io/scrape`: Only scrape services that have a value of `true` - # * `prometheus.io/scheme`: If the metrics endpoint is secured then you will need - # to set this to `https` & most likely set the `tls_config` of the scrape config. - # * `prometheus.io/path`: If the metrics path is not `/metrics` override this. - # * `prometheus.io/port`: If the metrics are exposed on a different port to the - # service then set this appropriately. - - job_name: 'kubernetes-service-endpoints' - - kubernetes_sd_configs: - - role: endpoints - namespaces: - names: - - NORMALIZED_FOR_TESTING - - relabel_configs: - - source_labels: [__meta_kubernetes_service_annotation_sourcegraph_prometheus_scrape] - action: keep - regex: true - - source_labels: [__meta_kubernetes_pod_container_name] - action: drop - regex: jaeger-agent - - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme] - action: replace - target_label: __scheme__ - regex: (https?) - - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path] - action: replace - target_label: __metrics_path__ - regex: (.+) - - source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port] - action: replace - target_label: __address__ - regex: (.+)(?::\d+);(\d+) - replacement: $1:$2 - - action: labelmap - regex: __meta_kubernetes_service_label_(.+) - - source_labels: [__meta_kubernetes_namespace] - action: replace - # Sourcegraph specific customization. We want a more convenient to type label. - # target_label: kubernetes_namespace - target_label: ns - - source_labels: [__meta_kubernetes_service_name] - action: replace - target_label: kubernetes_name - # Sourcegraph specific customization. We want a nicer name for job - - source_labels: [app] - action: replace - target_label: job - # Sourcegraph specific customization. We want a nicer name for instance - - source_labels: [__meta_kubernetes_pod_name] - action: replace - target_label: instance - # Sourcegraph specific customization. We want to add a label to every - # metric that indicates the node it came from. - - source_labels: [__meta_kubernetes_endpoint_node_name] - action: replace - target_label: nodename - metric_relabel_configs: - # Sourcegraph specific customization. Drop metrics with empty nodename responses from the k8s API - - source_labels: [nodename] - regex: ^$ - action: drop - - # Example scrape config for probing services via the Blackbox Exporter. - # - # The relabeling allows the actual service scrape endpoint to be configured - # via the following annotations: - # - # * `prometheus.io/probe`: Only probe services that have a value of `true` - - job_name: 'kubernetes-services' - - metrics_path: /probe - params: - module: [http_2xx] - - kubernetes_sd_configs: - - role: service - - relabel_configs: - - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_probe] - action: keep - regex: true - - source_labels: [__address__] - target_label: __param_target - - target_label: __address__ - replacement: blackbox - - source_labels: [__param_target] - target_label: instance - - action: labelmap - regex: __meta_kubernetes_service_label_(.+) - - source_labels: [__meta_kubernetes_service_namespace] - # Sourcegraph specific customization. We want a more convenient to type label. - # target_label: kubernetes_namespace - target_label: ns - - source_labels: [__meta_kubernetes_service_name] - target_label: kubernetes_name - - # Example scrape config for pods - # - # The relabeling allows the actual pod scrape endpoint to be configured via the - # following annotations: - # - # * `prometheus.io/scrape`: Only scrape pods that have a value of `true` - # * `prometheus.io/path`: If the metrics path is not `/metrics` override this. - # * `prometheus.io/port`: Scrape the pod on the indicated port instead of the default of `9102`. - - job_name: 'kubernetes-pods' - - kubernetes_sd_configs: - - role: pod - - relabel_configs: - - source_labels: [__meta_kubernetes_pod_annotation_sourcegraph_prometheus_scrape] - action: keep - regex: true - - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path] - action: replace - target_label: __metrics_path__ - regex: (.+) - - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port] - action: replace - regex: (.+):(?:\d+);(\d+) - replacement: ${1}:${2} - target_label: __address__ - - action: labelmap - regex: __meta_kubernetes_pod_label_(.+) - - source_labels: [__meta_kubernetes_pod_name] - action: replace - target_label: kubernetes_pod_name - # Sourcegraph specific customization. We want a more convenient to type label. - # target_label: kubernetes_namespace - - source_labels: [__meta_kubernetes_namespace] - action: replace - target_label: ns - # Sourcegraph specific customization. We want to add a label to every - # metric that indicates the node it came from. - - source_labels: [__meta_kubernetes_pod_node_name] - action: replace - target_label: nodename - - metric_relabel_configs: - # cAdvisor-specific customization. Drop container metrics exported by cAdvisor - # not in the same namespace as Sourcegraph. - # Uncomment this if you have problems with certain dashboards or cAdvisor itself - # picking up non-Sourcegraph services. Ensure all Sourcegraph services are running - # within the Sourcegraph namespace you have defined. - # The regex must keep matches on '^$' (empty string) to ensure other metrics do not - # get dropped. - - source_labels: [container_label_io_kubernetes_pod_namespace] - regex: ^$|NORMALIZED_FOR_TESTING - action: keep - # cAdvisor-specific customization. We want container metrics to be named after their container name label. - # Note that 'io.kubernetes.container.name' and 'io.kubernetes.pod.name' must be provided in cAdvisor - # '--whitelisted_container_labels' (see cadvisor.DaemonSet.yaml) - - source_labels: [container_label_io_kubernetes_container_name, container_label_io_kubernetes_pod_name] - regex: (.+) - action: replace - target_label: name - separator: '-' - # Sourcegraph specific customization. Drop metrics with empty nodename responses from the k8s API - - source_labels: [nodename] - regex: ^$ - action: drop - - # Scrape prometheus itself for metrics. - - job_name: 'builtin-prometheus' - static_configs: - - targets: ['127.0.0.1:9092'] - labels: - app: prometheus - - job_name: 'builtin-alertmanager' - metrics_path: /alertmanager/metrics - static_configs: - - targets: ['127.0.0.1:9093'] - labels: - app: alertmanager - immutable: false - kind: ConfigMap - metadata: - annotations: - appliance.sourcegraph.com/configHash: 3e93177a87a6b1419772658a608559612bdd0e71d369dd8c58af490fc65c6c9d - creationTimestamp: "2024-04-19T00:00:00Z" - labels: - deploy: sourcegraph - name: prometheus - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - - apiVersion: v1 - data: - spec: | - spec: - requestedVersion: "5.3.9104" - - blobstore: - disabled: true - - codeInsights: - disabled: true - - codeIntel: - disabled: true - - frontend: - disabled: true - - gitServer: - disabled: true - - indexedSearch: - disabled: true - - indexedSearchIndexer: - disabled: true - - pgsql: - disabled: true - - postgresExporter: - disabled: true - - preciseCodeIntel: - disabled: true - - redisCache: - disabled: true - - redisStore: - disabled: true - - repoUpdater: - disabled: true - - searcher: - disabled: true - - symbols: - disabled: true - - syntectServer: - disabled: true - - worker: - disabled: true - - prometheus: - storageSize: 123Gi - kind: ConfigMap - metadata: - annotations: - appliance.sourcegraph.com/currentVersion: 5.3.9104 - appliance.sourcegraph.com/managed: "true" - creationTimestamp: "2024-04-19T00:00:00Z" - name: sg - namespace: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - annotations: - appliance.sourcegraph.com/configHash: 3e93177a87a6b1419772658a608559612bdd0e71d369dd8c58af490fc65c6c9d - creationTimestamp: "2024-04-19T00:00:00Z" - finalizers: - - kubernetes.io/pvc-protection - labels: - deploy: sourcegraph - name: prometheus - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 123Gi - volumeMode: Filesystem - status: - phase: Pending - - apiVersion: rbac.authorization.k8s.io/v1 - kind: Role - metadata: - annotations: - appliance.sourcegraph.com/configHash: 3e93177a87a6b1419772658a608559612bdd0e71d369dd8c58af490fc65c6c9d - creationTimestamp: "2024-04-19T00:00:00Z" - labels: - deploy: sourcegraph - name: prometheus - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - rules: - - apiGroups: - - "" - resources: - - endpoints - - pods - - services - verbs: - - get - - list - - watch - - apiGroups: - - "" - resources: - - configmap - verbs: - - get - - apiVersion: rbac.authorization.k8s.io/v1 - kind: RoleBinding - metadata: - annotations: - appliance.sourcegraph.com/configHash: 3e93177a87a6b1419772658a608559612bdd0e71d369dd8c58af490fc65c6c9d - creationTimestamp: "2024-04-19T00:00:00Z" - labels: - deploy: sourcegraph - name: prometheus - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: prometheus - subjects: - - kind: ServiceAccount - name: prometheus - namespace: NORMALIZED_FOR_TESTING - - apiVersion: v1 - kind: ServiceAccount - metadata: - annotations: - appliance.sourcegraph.com/configHash: 3e93177a87a6b1419772658a608559612bdd0e71d369dd8c58af490fc65c6c9d - creationTimestamp: "2024-04-19T00:00:00Z" - labels: - deploy: sourcegraph - name: prometheus - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - - apiVersion: v1 - kind: Service - metadata: - annotations: - appliance.sourcegraph.com/configHash: 3e93177a87a6b1419772658a608559612bdd0e71d369dd8c58af490fc65c6c9d - creationTimestamp: "2024-04-19T00:00:00Z" - labels: - app: prometheus - app.kubernetes.io/component: prometheus - deploy: sourcegraph - name: prometheus - namespace: NORMALIZED_FOR_TESTING - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: ConfigMap - name: sg - uid: NORMALIZED_FOR_TESTING - resourceVersion: NORMALIZED_FOR_TESTING - uid: NORMALIZED_FOR_TESTING - spec: - clusterIP: NORMALIZED_FOR_TESTING - clusterIPs: - - NORMALIZED_FOR_TESTING - internalTrafficPolicy: Cluster - ipFamilies: - - IPv4 - ipFamilyPolicy: SingleStack - ports: - - name: http - port: 30090 - protocol: TCP - targetPort: http - selector: - app: syntect-server - sessionAffinity: None - type: ClusterIP - status: - loadBalancer: {} diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/redis/default.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/redis/default.yaml index 952dcd99aa2..a1e7175e9e3 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/redis/default.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/redis/default.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: 142c00ae31a1d919c6bebf39a02cfd56ecf57e219dc5427b0fbeba316a831ebf + appliance.sourcegraph.com/configHash: 37fe5323c846c6cc05683d28024d7b98c0a9b6bc2818ffc14a4d886981569411 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -136,7 +136,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: 142c00ae31a1d919c6bebf39a02cfd56ecf57e219dc5427b0fbeba316a831ebf + appliance.sourcegraph.com/configHash: 37fe5323c846c6cc05683d28024d7b98c0a9b6bc2818ffc14a4d886981569411 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -336,7 +336,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: 142c00ae31a1d919c6bebf39a02cfd56ecf57e219dc5427b0fbeba316a831ebf + appliance.sourcegraph.com/configHash: 37fe5323c846c6cc05683d28024d7b98c0a9b6bc2818ffc14a4d886981569411 creationTimestamp: "2024-04-19T00:00:00Z" finalizers: - kubernetes.io/pvc-protection @@ -366,7 +366,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: 142c00ae31a1d919c6bebf39a02cfd56ecf57e219dc5427b0fbeba316a831ebf + appliance.sourcegraph.com/configHash: 37fe5323c846c6cc05683d28024d7b98c0a9b6bc2818ffc14a4d886981569411 creationTimestamp: "2024-04-19T00:00:00Z" finalizers: - kubernetes.io/pvc-protection @@ -398,7 +398,7 @@ resources: kind: Secret metadata: annotations: - appliance.sourcegraph.com/configHash: 142c00ae31a1d919c6bebf39a02cfd56ecf57e219dc5427b0fbeba316a831ebf + appliance.sourcegraph.com/configHash: 37fe5323c846c6cc05683d28024d7b98c0a9b6bc2818ffc14a4d886981569411 creationTimestamp: "2024-04-19T00:00:00Z" labels: app.kubernetes.io/component: redis-cache @@ -423,7 +423,7 @@ resources: kind: Secret metadata: annotations: - appliance.sourcegraph.com/configHash: 142c00ae31a1d919c6bebf39a02cfd56ecf57e219dc5427b0fbeba316a831ebf + appliance.sourcegraph.com/configHash: 37fe5323c846c6cc05683d28024d7b98c0a9b6bc2818ffc14a4d886981569411 creationTimestamp: "2024-04-19T00:00:00Z" labels: app.kubernetes.io/component: redis-store @@ -446,7 +446,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 142c00ae31a1d919c6bebf39a02cfd56ecf57e219dc5427b0fbeba316a831ebf + appliance.sourcegraph.com/configHash: 37fe5323c846c6cc05683d28024d7b98c0a9b6bc2818ffc14a4d886981569411 prometheus.io/port: "9121" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" @@ -488,7 +488,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 142c00ae31a1d919c6bebf39a02cfd56ecf57e219dc5427b0fbeba316a831ebf + appliance.sourcegraph.com/configHash: 37fe5323c846c6cc05683d28024d7b98c0a9b6bc2818ffc14a4d886981569411 prometheus.io/port: "9121" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/repo-updater/default.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/repo-updater/default.yaml index 7fc2259d9ea..224968354a4 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/repo-updater/default.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/repo-updater/default.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: 3faa37df52522509224800ad0dec835c442830666395c449e98bfe72eb739ac3 + appliance.sourcegraph.com/configHash: d98eb071d17e65d314c546906dcc4949682a5339210b56c05b156dbe1f4c95f8 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -190,7 +190,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: 3faa37df52522509224800ad0dec835c442830666395c449e98bfe72eb739ac3 + appliance.sourcegraph.com/configHash: d98eb071d17e65d314c546906dcc4949682a5339210b56c05b156dbe1f4c95f8 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -209,7 +209,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 3faa37df52522509224800ad0dec835c442830666395c449e98bfe72eb739ac3 + appliance.sourcegraph.com/configHash: d98eb071d17e65d314c546906dcc4949682a5339210b56c05b156dbe1f4c95f8 prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/standard/blobstore-subsequent-disable.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/standard/blobstore-subsequent-disable.yaml index 94df815468b..cfd4914918c 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/standard/blobstore-subsequent-disable.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/standard/blobstore-subsequent-disable.yaml @@ -72,7 +72,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: d33e42f7a0651e109c1a55ae881f9e3000e194cb5257dad1714cf26d5a370b3c + appliance.sourcegraph.com/configHash: 2b72058f008a684f7fa052f8ad33d0226af4cfb7973242c9103d6d1900da355e creationTimestamp: "2024-04-19T00:00:00Z" deletionGracePeriodSeconds: 0 deletionTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/standard/blobstore-with-named-storage-class.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/standard/blobstore-with-named-storage-class.yaml index 82e86ae08cf..d61b8cb6e72 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/standard/blobstore-with-named-storage-class.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/standard/blobstore-with-named-storage-class.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: d33e42f7a0651e109c1a55ae881f9e3000e194cb5257dad1714cf26d5a370b3c + appliance.sourcegraph.com/configHash: 4b2ab18e05ba5d188d2419b3d05d7bc57d505298a37147b66882a5b091bb370f creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -94,7 +94,9 @@ resources: spec: requestedVersion: "5.3.9104" - blobstore: {} + blobstore: + persistentVolumeConfig: + storageClassName: sourcegraph codeInsights: disabled: true @@ -144,9 +146,6 @@ resources: worker: disabled: true - storageClass: - name: sourcegraph - prometheus: disabled: true kind: ConfigMap @@ -163,7 +162,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: d33e42f7a0651e109c1a55ae881f9e3000e194cb5257dad1714cf26d5a370b3c + appliance.sourcegraph.com/configHash: 4b2ab18e05ba5d188d2419b3d05d7bc57d505298a37147b66882a5b091bb370f creationTimestamp: "2024-04-19T00:00:00Z" finalizers: - kubernetes.io/pvc-protection @@ -194,7 +193,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: d33e42f7a0651e109c1a55ae881f9e3000e194cb5257dad1714cf26d5a370b3c + appliance.sourcegraph.com/configHash: 4b2ab18e05ba5d188d2419b3d05d7bc57d505298a37147b66882a5b091bb370f creationTimestamp: "2024-04-19T00:00:00Z" labels: app: blobstore diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/standard/precise-code-intel-with-env-vars.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/standard/precise-code-intel-with-env-vars.yaml index 9eea632ea7c..0d926c048f6 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/standard/precise-code-intel-with-env-vars.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/standard/precise-code-intel-with-env-vars.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: 83689326f712d087a04bc450648847ed22cf610bc94aa0fc9437cff54b7bcf8b + appliance.sourcegraph.com/configHash: 521a3e11a60a97b486f52c76c6ced27b9c63163dd37640b3737d60542ba18871 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -201,7 +201,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: 83689326f712d087a04bc450648847ed22cf610bc94aa0fc9437cff54b7bcf8b + appliance.sourcegraph.com/configHash: 521a3e11a60a97b486f52c76c6ced27b9c63163dd37640b3737d60542ba18871 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -220,7 +220,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 83689326f712d087a04bc450648847ed22cf610bc94aa0fc9437cff54b7bcf8b + appliance.sourcegraph.com/configHash: 521a3e11a60a97b486f52c76c6ced27b9c63163dd37640b3737d60542ba18871 prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/standard/redis-with-multiple-custom-images.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/standard/redis-with-multiple-custom-images.yaml index 67bf62a2824..d684b94b8b0 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/standard/redis-with-multiple-custom-images.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/standard/redis-with-multiple-custom-images.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: 47d66a78b1de65fcfbf8ab61f1629a4e0eaec6b84314237799f4e7cb02ac1d2f + appliance.sourcegraph.com/configHash: 7fa2fa4ff84df20d92d920222aede2b1ac9aa4052123d7b4586cd1b7c5137530 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -209,7 +209,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: 47d66a78b1de65fcfbf8ab61f1629a4e0eaec6b84314237799f4e7cb02ac1d2f + appliance.sourcegraph.com/configHash: 7fa2fa4ff84df20d92d920222aede2b1ac9aa4052123d7b4586cd1b7c5137530 creationTimestamp: "2024-04-19T00:00:00Z" finalizers: - kubernetes.io/pvc-protection @@ -241,7 +241,7 @@ resources: kind: Secret metadata: annotations: - appliance.sourcegraph.com/configHash: 47d66a78b1de65fcfbf8ab61f1629a4e0eaec6b84314237799f4e7cb02ac1d2f + appliance.sourcegraph.com/configHash: 7fa2fa4ff84df20d92d920222aede2b1ac9aa4052123d7b4586cd1b7c5137530 creationTimestamp: "2024-04-19T00:00:00Z" labels: app.kubernetes.io/component: redis-cache @@ -264,7 +264,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 47d66a78b1de65fcfbf8ab61f1629a4e0eaec6b84314237799f4e7cb02ac1d2f + appliance.sourcegraph.com/configHash: 7fa2fa4ff84df20d92d920222aede2b1ac9aa4052123d7b4586cd1b7c5137530 prometheus.io/port: "9121" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/redis/with-storage.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/standard/redis-with-storage.yaml similarity index 93% rename from internal/appliance/reconciler/testdata/golden-fixtures/redis/with-storage.yaml rename to internal/appliance/reconciler/testdata/golden-fixtures/standard/redis-with-storage.yaml index ff667b6f680..90fb6e804e4 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/redis/with-storage.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/standard/redis-with-storage.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: dcf04ea0a83980da871d47b3c8a1b6270dd967bb34163ae59384fdfd9ff5eb1c + appliance.sourcegraph.com/configHash: b70d78a1875f7ea6c57f032a569e8956aed76dd6ec0b086034732b0cfa8e82e1 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -136,7 +136,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: dcf04ea0a83980da871d47b3c8a1b6270dd967bb34163ae59384fdfd9ff5eb1c + appliance.sourcegraph.com/configHash: 59d9f8b80a9ea6154b52b5756375c12702faf941da62d7229afca379368f0199 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -302,10 +302,12 @@ resources: disabled: true redisCache: - storageSize: 123Gi + persistentVolumeConfig: + storageSize: 123Gi redisStore: - storageSize: 123Gi + persistentVolumeConfig: + storageSize: 456Gi repoUpdater: disabled: true @@ -338,7 +340,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: dcf04ea0a83980da871d47b3c8a1b6270dd967bb34163ae59384fdfd9ff5eb1c + appliance.sourcegraph.com/configHash: b70d78a1875f7ea6c57f032a569e8956aed76dd6ec0b086034732b0cfa8e82e1 creationTimestamp: "2024-04-19T00:00:00Z" finalizers: - kubernetes.io/pvc-protection @@ -368,7 +370,7 @@ resources: kind: PersistentVolumeClaim metadata: annotations: - appliance.sourcegraph.com/configHash: dcf04ea0a83980da871d47b3c8a1b6270dd967bb34163ae59384fdfd9ff5eb1c + appliance.sourcegraph.com/configHash: 59d9f8b80a9ea6154b52b5756375c12702faf941da62d7229afca379368f0199 creationTimestamp: "2024-04-19T00:00:00Z" finalizers: - kubernetes.io/pvc-protection @@ -390,7 +392,7 @@ resources: - ReadWriteOnce resources: requests: - storage: 123Gi + storage: 456Gi volumeMode: Filesystem status: phase: Pending @@ -400,7 +402,7 @@ resources: kind: Secret metadata: annotations: - appliance.sourcegraph.com/configHash: dcf04ea0a83980da871d47b3c8a1b6270dd967bb34163ae59384fdfd9ff5eb1c + appliance.sourcegraph.com/configHash: b70d78a1875f7ea6c57f032a569e8956aed76dd6ec0b086034732b0cfa8e82e1 creationTimestamp: "2024-04-19T00:00:00Z" labels: app.kubernetes.io/component: redis-cache @@ -425,7 +427,7 @@ resources: kind: Secret metadata: annotations: - appliance.sourcegraph.com/configHash: dcf04ea0a83980da871d47b3c8a1b6270dd967bb34163ae59384fdfd9ff5eb1c + appliance.sourcegraph.com/configHash: 59d9f8b80a9ea6154b52b5756375c12702faf941da62d7229afca379368f0199 creationTimestamp: "2024-04-19T00:00:00Z" labels: app.kubernetes.io/component: redis-store @@ -448,7 +450,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: dcf04ea0a83980da871d47b3c8a1b6270dd967bb34163ae59384fdfd9ff5eb1c + appliance.sourcegraph.com/configHash: b70d78a1875f7ea6c57f032a569e8956aed76dd6ec0b086034732b0cfa8e82e1 prometheus.io/port: "9121" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" @@ -490,7 +492,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: dcf04ea0a83980da871d47b3c8a1b6270dd967bb34163ae59384fdfd9ff5eb1c + appliance.sourcegraph.com/configHash: 59d9f8b80a9ea6154b52b5756375c12702faf941da62d7229afca379368f0199 prometheus.io/port: "9121" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-no-resources.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-no-resources.yaml index 095c864f44d..bc54ced48ec 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-no-resources.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-no-resources.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: db60986dc2fa6300a59d62fe32fccd74d3974c69bc88550270eb14ce4f2831ac + appliance.sourcegraph.com/configHash: 9404211e7aed83f1a42c1e3593807020cdfb5f91aae45de1ba91e542820149b8 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -187,7 +187,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: db60986dc2fa6300a59d62fe32fccd74d3974c69bc88550270eb14ce4f2831ac + appliance.sourcegraph.com/configHash: 9404211e7aed83f1a42c1e3593807020cdfb5f91aae45de1ba91e542820149b8 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -206,7 +206,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: db60986dc2fa6300a59d62fe32fccd74d3974c69bc88550270eb14ce4f2831ac + appliance.sourcegraph.com/configHash: 9404211e7aed83f1a42c1e3593807020cdfb5f91aae45de1ba91e542820149b8 prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-pod-template-config.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-pod-template-config.yaml index 822373cb4e2..da6c099642c 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-pod-template-config.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-pod-template-config.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: 22be172d47714de247ecfb86dd3692c0dfcff8382c02f80c6ba4df3fb3935104 + appliance.sourcegraph.com/configHash: 842f51fca06b49e8351c4b12f073e88229092bb6743aaf83d0125b33278ed1ba creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -227,7 +227,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: 22be172d47714de247ecfb86dd3692c0dfcff8382c02f80c6ba4df3fb3935104 + appliance.sourcegraph.com/configHash: 842f51fca06b49e8351c4b12f073e88229092bb6743aaf83d0125b33278ed1ba creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -246,7 +246,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 22be172d47714de247ecfb86dd3692c0dfcff8382c02f80c6ba4df3fb3935104 + appliance.sourcegraph.com/configHash: 842f51fca06b49e8351c4b12f073e88229092bb6743aaf83d0125b33278ed1ba prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-resources.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-resources.yaml index 9c08a95a8ac..15105452aa6 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-resources.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-resources.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: ef7e879dd6941a6e3549b796700a532ce0069f41b2a7ecd3dc6dfcce79811954 + appliance.sourcegraph.com/configHash: 17c6cd2ddcf6602c55c2bca747ccb123149d980b24a33c10ef84bbbb1f88fd83 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -199,7 +199,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: ef7e879dd6941a6e3549b796700a532ce0069f41b2a7ecd3dc6dfcce79811954 + appliance.sourcegraph.com/configHash: 17c6cd2ddcf6602c55c2bca747ccb123149d980b24a33c10ef84bbbb1f88fd83 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -218,7 +218,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: ef7e879dd6941a6e3549b796700a532ce0069f41b2a7ecd3dc6dfcce79811954 + appliance.sourcegraph.com/configHash: 17c6cd2ddcf6602c55c2bca747ccb123149d980b24a33c10ef84bbbb1f88fd83 prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-sa-annotations.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-sa-annotations.yaml index 5ad82bcacd8..a977133f34f 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-sa-annotations.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/standard/repo-updater-with-sa-annotations.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: a446ffe150f9de1af3394264d4882819edd6416fe720c32ae309f834c940f83a + appliance.sourcegraph.com/configHash: 050a2fc7345a0a0d06e62f5faf9012059b20c998fd44fd54cd0ff8cc59a5779e creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -192,7 +192,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: a446ffe150f9de1af3394264d4882819edd6416fe720c32ae309f834c940f83a + appliance.sourcegraph.com/configHash: 050a2fc7345a0a0d06e62f5faf9012059b20c998fd44fd54cd0ff8cc59a5779e foo: bar creationTimestamp: "2024-04-19T00:00:00Z" labels: @@ -212,7 +212,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: a446ffe150f9de1af3394264d4882819edd6416fe720c32ae309f834c940f83a + appliance.sourcegraph.com/configHash: 050a2fc7345a0a0d06e62f5faf9012059b20c998fd44fd54cd0ff8cc59a5779e prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/standard/symbols-with-custom-image.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/standard/symbols-with-custom-image.yaml index f91e7b6c1d9..6efd9406950 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/standard/symbols-with-custom-image.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/standard/symbols-with-custom-image.yaml @@ -3,7 +3,7 @@ resources: kind: StatefulSet metadata: annotations: - appliance.sourcegraph.com/configHash: 4310746eaab789e0d69f900836e6a3cea2979fe2e00be351e44120eb9cc43f29 + appliance.sourcegraph.com/configHash: 2cd8b4623bf86e778add72b8e717d729f770668a196627f1187406962c2fc13c creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -238,7 +238,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: 4310746eaab789e0d69f900836e6a3cea2979fe2e00be351e44120eb9cc43f29 + appliance.sourcegraph.com/configHash: 2cd8b4623bf86e778add72b8e717d729f770668a196627f1187406962c2fc13c creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -257,7 +257,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 4310746eaab789e0d69f900836e6a3cea2979fe2e00be351e44120eb9cc43f29 + appliance.sourcegraph.com/configHash: 2cd8b4623bf86e778add72b8e717d729f770668a196627f1187406962c2fc13c prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/symbols/default.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/symbols/default.yaml index 07b6c235917..cf98cb1155a 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/symbols/default.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/symbols/default.yaml @@ -3,7 +3,7 @@ resources: kind: StatefulSet metadata: annotations: - appliance.sourcegraph.com/configHash: 42254bee5b26f7bae4341b4f5ed9af950f2238e8c139dc720feb15078a4b6cfd + appliance.sourcegraph.com/configHash: 8f39500e7d6a3030c52d43d407f6b64f5a303ba418a28f6049a03aabd1d3a544 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -234,7 +234,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: 42254bee5b26f7bae4341b4f5ed9af950f2238e8c139dc720feb15078a4b6cfd + appliance.sourcegraph.com/configHash: 8f39500e7d6a3030c52d43d407f6b64f5a303ba418a28f6049a03aabd1d3a544 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -253,7 +253,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 42254bee5b26f7bae4341b4f5ed9af950f2238e8c139dc720feb15078a4b6cfd + appliance.sourcegraph.com/configHash: 8f39500e7d6a3030c52d43d407f6b64f5a303ba418a28f6049a03aabd1d3a544 prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/symbols/with-storage.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/symbols/with-storage.yaml index efe3d7d44e7..b38c3ca09f0 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/symbols/with-storage.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/symbols/with-storage.yaml @@ -3,7 +3,7 @@ resources: kind: StatefulSet metadata: annotations: - appliance.sourcegraph.com/configHash: c5a3d0a6ba37246cf3f9a5b26c0a98c5742e6024a9dffa6836d70eae7de13412 + appliance.sourcegraph.com/configHash: 1b91f9ad9b2b92f50de93100c10a3d21c7879d700ba5436a6b90f94c7ab64c7e creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -211,7 +211,8 @@ resources: disabled: true symbols: - storageSize: "100Gi" + persistentVolumeConfig: + storageSize: "100Gi" syntectServer: disabled: true @@ -235,7 +236,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: c5a3d0a6ba37246cf3f9a5b26c0a98c5742e6024a9dffa6836d70eae7de13412 + appliance.sourcegraph.com/configHash: 1b91f9ad9b2b92f50de93100c10a3d21c7879d700ba5436a6b90f94c7ab64c7e creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -254,7 +255,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: c5a3d0a6ba37246cf3f9a5b26c0a98c5742e6024a9dffa6836d70eae7de13412 + appliance.sourcegraph.com/configHash: 1b91f9ad9b2b92f50de93100c10a3d21c7879d700ba5436a6b90f94c7ab64c7e prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/syntect/default.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/syntect/default.yaml index 54394251607..c8c622b8e3e 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/syntect/default.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/syntect/default.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: 9ede95ea4e7966c44b553ccf3bb3edbb1e4811c9a554051f842b643a6c5e63e2 + appliance.sourcegraph.com/configHash: 24debcd57654ec9bad2bc69454c6c9eb407fa072782198b3410f88874cd2eb25 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -168,7 +168,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: 9ede95ea4e7966c44b553ccf3bb3edbb1e4811c9a554051f842b643a6c5e63e2 + appliance.sourcegraph.com/configHash: 24debcd57654ec9bad2bc69454c6c9eb407fa072782198b3410f88874cd2eb25 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -187,7 +187,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 9ede95ea4e7966c44b553ccf3bb3edbb1e4811c9a554051f842b643a6c5e63e2 + appliance.sourcegraph.com/configHash: 24debcd57654ec9bad2bc69454c6c9eb407fa072782198b3410f88874cd2eb25 prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/golden-fixtures/syntect/with-replicas.yaml b/internal/appliance/reconciler/testdata/golden-fixtures/syntect/with-replicas.yaml index 6352a278a1a..2f3ae4035cf 100644 --- a/internal/appliance/reconciler/testdata/golden-fixtures/syntect/with-replicas.yaml +++ b/internal/appliance/reconciler/testdata/golden-fixtures/syntect/with-replicas.yaml @@ -3,7 +3,7 @@ resources: kind: Deployment metadata: annotations: - appliance.sourcegraph.com/configHash: 9f8414122e2a51cef31478f6b33d5808e9c413a1f62955f3cdb644c65a8f778b + appliance.sourcegraph.com/configHash: bcc1b9d741c7408fd8b5bd4ce468f028528e0884fce1b4b33bc62053f4d0ffc3 creationTimestamp: "2024-04-19T00:00:00Z" generation: 1 labels: @@ -169,7 +169,7 @@ resources: kind: ServiceAccount metadata: annotations: - appliance.sourcegraph.com/configHash: 9f8414122e2a51cef31478f6b33d5808e9c413a1f62955f3cdb644c65a8f778b + appliance.sourcegraph.com/configHash: bcc1b9d741c7408fd8b5bd4ce468f028528e0884fce1b4b33bc62053f4d0ffc3 creationTimestamp: "2024-04-19T00:00:00Z" labels: deploy: sourcegraph @@ -188,7 +188,7 @@ resources: kind: Service metadata: annotations: - appliance.sourcegraph.com/configHash: 9f8414122e2a51cef31478f6b33d5808e9c413a1f62955f3cdb644c65a8f778b + appliance.sourcegraph.com/configHash: bcc1b9d741c7408fd8b5bd4ce468f028528e0884fce1b4b33bc62053f4d0ffc3 prometheus.io/port: "6060" sourcegraph.prometheus/scrape: "true" creationTimestamp: "2024-04-19T00:00:00Z" diff --git a/internal/appliance/reconciler/testdata/sg/pgsql/with-storage.yaml b/internal/appliance/reconciler/testdata/sg/pgsql/with-storage.yaml deleted file mode 100644 index e2238017f1e..00000000000 --- a/internal/appliance/reconciler/testdata/sg/pgsql/with-storage.yaml +++ /dev/null @@ -1,59 +0,0 @@ -spec: - requestedVersion: "5.3.9104" - - blobstore: - disabled: true - - codeInsights: - disabled: true - - codeIntel: - disabled: true - - frontend: - disabled: true - - gitServer: - disabled: true - - indexedSearch: - disabled: true - - indexedSearchIndexer: - disabled: true - - pgsql: - storageSize: "500Gi" - - postgresExporter: - disabled: true - - preciseCodeIntel: - disabled: true - - redisCache: - disabled: true - - redisExporter: - disabled: true - - redisStore: - disabled: true - - repoUpdater: - disabled: true - - searcher: - disabled: true - - symbols: - disabled: true - - syntectServer: - disabled: true - - worker: - disabled: true - - prometheus: - disabled: true diff --git a/internal/appliance/reconciler/testdata/sg/prometheus/with-storage.yaml b/internal/appliance/reconciler/testdata/sg/prometheus/with-storage.yaml deleted file mode 100644 index fb3f9be9c28..00000000000 --- a/internal/appliance/reconciler/testdata/sg/prometheus/with-storage.yaml +++ /dev/null @@ -1,56 +0,0 @@ -spec: - requestedVersion: "5.3.9104" - - blobstore: - disabled: true - - codeInsights: - disabled: true - - codeIntel: - disabled: true - - frontend: - disabled: true - - gitServer: - disabled: true - - indexedSearch: - disabled: true - - indexedSearchIndexer: - disabled: true - - pgsql: - disabled: true - - postgresExporter: - disabled: true - - preciseCodeIntel: - disabled: true - - redisCache: - disabled: true - - redisStore: - disabled: true - - repoUpdater: - disabled: true - - searcher: - disabled: true - - symbols: - disabled: true - - syntectServer: - disabled: true - - worker: - disabled: true - - prometheus: - storageSize: 123Gi diff --git a/internal/appliance/reconciler/testdata/sg/redis/with-storage.yaml b/internal/appliance/reconciler/testdata/sg/redis/with-storage.yaml deleted file mode 100644 index b9f6c80d753..00000000000 --- a/internal/appliance/reconciler/testdata/sg/redis/with-storage.yaml +++ /dev/null @@ -1,56 +0,0 @@ -spec: - requestedVersion: "5.3.9104" - - blobstore: - disabled: true - - codeInsights: - disabled: true - - codeIntel: - disabled: true - - frontend: - disabled: true - - gitServer: - disabled: true - - indexedSearch: - disabled: true - - indexedSearchIndexer: - disabled: true - - pgsql: - disabled: true - - postgresExporter: - disabled: true - - preciseCodeIntel: - disabled: true - - redisCache: - storageSize: 123Gi - - redisStore: - storageSize: 123Gi - - repoUpdater: - disabled: true - - searcher: - disabled: true - - symbols: - disabled: true - - syntectServer: - disabled: true - - worker: - disabled: true - - prometheus: - disabled: true diff --git a/internal/appliance/reconciler/testdata/sg/standard/blobstore-with-named-storage-class.yaml b/internal/appliance/reconciler/testdata/sg/standard/blobstore-with-named-storage-class.yaml index e04993b6699..c2783655d82 100644 --- a/internal/appliance/reconciler/testdata/sg/standard/blobstore-with-named-storage-class.yaml +++ b/internal/appliance/reconciler/testdata/sg/standard/blobstore-with-named-storage-class.yaml @@ -1,7 +1,9 @@ spec: requestedVersion: "5.3.9104" - blobstore: {} + blobstore: + persistentVolumeConfig: + storageClassName: sourcegraph codeInsights: disabled: true @@ -51,8 +53,5 @@ spec: worker: disabled: true - storageClass: - name: sourcegraph - prometheus: disabled: true diff --git a/internal/appliance/reconciler/testdata/sg/gitserver/with-storage.yaml b/internal/appliance/reconciler/testdata/sg/standard/redis-with-storage.yaml similarity index 85% rename from internal/appliance/reconciler/testdata/sg/gitserver/with-storage.yaml rename to internal/appliance/reconciler/testdata/sg/standard/redis-with-storage.yaml index 73b14e668a1..a90d2e3b0d3 100644 --- a/internal/appliance/reconciler/testdata/sg/gitserver/with-storage.yaml +++ b/internal/appliance/reconciler/testdata/sg/standard/redis-with-storage.yaml @@ -14,7 +14,7 @@ spec: disabled: true gitServer: - storageSize: "500Gi" + disabled: true indexedSearch: disabled: true @@ -32,10 +32,12 @@ spec: disabled: true redisCache: - disabled: true + persistentVolumeConfig: + storageSize: 123Gi redisStore: - disabled: true + persistentVolumeConfig: + storageSize: 456Gi repoUpdater: disabled: true diff --git a/internal/appliance/reconciler/testdata/sg/symbols/with-storage.yaml b/internal/appliance/reconciler/testdata/sg/symbols/with-storage.yaml index 224b6ba0310..02f93702213 100644 --- a/internal/appliance/reconciler/testdata/sg/symbols/with-storage.yaml +++ b/internal/appliance/reconciler/testdata/sg/symbols/with-storage.yaml @@ -44,7 +44,8 @@ spec: disabled: true symbols: - storageSize: "100Gi" + persistentVolumeConfig: + storageSize: "100Gi" syntectServer: disabled: true diff --git a/internal/k8s/resource/pvc/BUILD.bazel b/internal/k8s/resource/pvc/BUILD.bazel index b5a5f669a4b..e24eea25946 100644 --- a/internal/k8s/resource/pvc/BUILD.bazel +++ b/internal/k8s/resource/pvc/BUILD.bazel @@ -7,6 +7,8 @@ go_library( tags = [TAG_INFRA_RELEASE], visibility = ["//:__subpackages__"], deps = [ + "//internal/appliance/config", + "//lib/errors", "@io_k8s_api//core/v1:core", "@io_k8s_apimachinery//pkg/api/resource", "@io_k8s_apimachinery//pkg/apis/meta/v1:meta", diff --git a/internal/k8s/resource/pvc/pvc.go b/internal/k8s/resource/pvc/pvc.go index a77e76e3810..2b465b6cd65 100644 --- a/internal/k8s/resource/pvc/pvc.go +++ b/internal/k8s/resource/pvc/pvc.go @@ -4,10 +4,24 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/sourcegraph/sourcegraph/internal/appliance/config" + "github.com/sourcegraph/sourcegraph/lib/errors" ) // NewPersistentVolumeClaim creates a new k8s PVC with some default values set. -func NewPersistentVolumeClaim(name, namespace string, storage resource.Quantity, storageClassName *string) corev1.PersistentVolumeClaim { +func NewPersistentVolumeClaim(name, namespace string, cfg config.StandardComponent) (corev1.PersistentVolumeClaim, error) { + // If a nil value is passed in, default to zero values. Callers will then + // have to override these values, and golden tests can catch any issues. + var storageCfg config.PersistentVolumeConfig + if cfg != nil { + storageCfg = cfg.GetPersistentVolumeConfig() + } + + storage, err := resource.ParseQuantity(storageCfg.StorageSize) + if err != nil { + return corev1.PersistentVolumeClaim{}, errors.Wrap(err, "parsing storage size") + } return corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{ Name: name, @@ -25,7 +39,7 @@ func NewPersistentVolumeClaim(name, namespace string, storage resource.Quantity, corev1.ResourceStorage: storage, }, }, - StorageClassName: storageClassName, + StorageClassName: storageCfg.StorageClassName, }, - } + }, nil }