diff --git a/controllers/cloud.redhat.com/providers/featureflags/localfeatureflags.go b/controllers/cloud.redhat.com/providers/featureflags/localfeatureflags.go index e80ae47cd..8d72b0f57 100644 --- a/controllers/cloud.redhat.com/providers/featureflags/localfeatureflags.go +++ b/controllers/cloud.redhat.com/providers/featureflags/localfeatureflags.go @@ -216,7 +216,7 @@ func makeLocalFeatureFlags(o obj.ClowdObject, objMap providers.ObjectMap, _ bool labels := o.GetLabels() labels["env-app"] = nn.Name - + labels["service"] = "featureflags" labeler := utils.MakeLabeler(nn, labels, o) labeler(dd) diff --git a/controllers/cloud.redhat.com/providers/inmemorydb/redis.go b/controllers/cloud.redhat.com/providers/inmemorydb/redis.go index fb656dd44..30d6c2dcd 100644 --- a/controllers/cloud.redhat.com/providers/inmemorydb/redis.go +++ b/controllers/cloud.redhat.com/providers/inmemorydb/redis.go @@ -97,6 +97,7 @@ func makeLocalRedis(o obj.ClowdObject, objMap providers.ObjectMap, _ bool, nodeP labels := o.GetLabels() labels["env-app"] = nn.Name + labels["service"] = "redis" labeler := utils.MakeLabeler(nn, labels, o) labeler(dd) diff --git a/controllers/cloud.redhat.com/providers/kafka/strimzi.go b/controllers/cloud.redhat.com/providers/kafka/strimzi.go index 96a7de027..d469e7e7d 100644 --- a/controllers/cloud.redhat.com/providers/kafka/strimzi.go +++ b/controllers/cloud.redhat.com/providers/kafka/strimzi.go @@ -287,6 +287,15 @@ func (s *strimziProvider) configureKafkaCluster() error { kafLimits = *s.Env.Spec.Providers.Kafka.Cluster.Resources.Limits } + var klabels apiextensions.JSON + + err = klabels.UnmarshalJSON([]byte(`{ + "service" : "strimziKafka" + }`)) + if err != nil { + return fmt.Errorf("could not unmarshal klabels: %w", err) + } + k.Spec = &strimzi.KafkaSpec{ Kafka: strimzi.KafkaSpecKafka{ Config: &kafConfig, @@ -296,6 +305,18 @@ func (s *strimziProvider) configureKafkaCluster() error { Requests: &kafRequests, Limits: &kafLimits, }, + Template: &strimzi.KafkaSpecKafkaTemplate{ + PerPodService: &strimzi.KafkaSpecKafkaTemplatePerPodService{ + Metadata: &strimzi.KafkaSpecKafkaTemplatePerPodServiceMetadata{ + Labels: &klabels, + }, + }, + Pod: &strimzi.KafkaSpecKafkaTemplatePod{ + Metadata: &strimzi.KafkaSpecKafkaTemplatePodMetadata{ + Labels: &klabels, + }, + }, + }, }, Zookeeper: strimzi.KafkaSpecZookeeper{ Replicas: replicas, @@ -303,8 +324,27 @@ func (s *strimziProvider) configureKafkaCluster() error { Requests: &zRequests, Limits: &zLimits, }, + Template: &strimzi.KafkaSpecZookeeperTemplate{ + NodesService: &strimzi.KafkaSpecZookeeperTemplateNodesService{ + Metadata: &strimzi.KafkaSpecZookeeperTemplateNodesServiceMetadata{ + Labels: &klabels, + }, + }, + Pod: &strimzi.KafkaSpecZookeeperTemplatePod{ + Metadata: &strimzi.KafkaSpecZookeeperTemplatePodMetadata{ + Labels: &klabels, + }, + }, + }, }, EntityOperator: &strimzi.KafkaSpecEntityOperator{ + Template: &strimzi.KafkaSpecEntityOperatorTemplate{ + Pod: &strimzi.KafkaSpecEntityOperatorTemplatePod{ + Metadata: &strimzi.KafkaSpecEntityOperatorTemplatePodMetadata{ + Labels: &klabels, + }, + }, + }, TopicOperator: &strimzi.KafkaSpecEntityOperatorTopicOperator{ Resources: &strimzi.KafkaSpecEntityOperatorTopicOperatorResources{ Requests: &entityTopicRequests, diff --git a/tests/kuttl/test-cyndi-local-db/01-pods.yaml b/tests/kuttl/test-cyndi-local-db/01-pods.yaml index ccb3bd58a..6a7f0a9aa 100644 --- a/tests/kuttl/test-cyndi-local-db/01-pods.yaml +++ b/tests/kuttl/test-cyndi-local-db/01-pods.yaml @@ -22,7 +22,7 @@ spec: objectStore: mode: none inMemoryDb: - mode: none + mode: redis resourceDefaults: limits: cpu: 400m @@ -49,3 +49,4 @@ spec: database: name: app-a-db version: 12 + inMemoryDb: true diff --git a/tests/kuttl/test-db-pvc-tee/01-assert.yaml b/tests/kuttl/test-db-pvc-tee/01-assert.yaml index 5d6493d8a..1224ec25c 100644 --- a/tests/kuttl/test-db-pvc-tee/01-assert.yaml +++ b/tests/kuttl/test-db-pvc-tee/01-assert.yaml @@ -4,6 +4,8 @@ kind: Deployment metadata: name: app-a-db namespace: test-db-pvc-tee + labels: + service: db spec: template: spec: diff --git a/tests/kuttl/test-db-resource-tee/01-assert.yaml b/tests/kuttl/test-db-resource-tee/01-assert.yaml index 6cc1cfa6a..5888cb99a 100644 --- a/tests/kuttl/test-db-resource-tee/01-assert.yaml +++ b/tests/kuttl/test-db-resource-tee/01-assert.yaml @@ -6,6 +6,9 @@ metadata: namespace: test-db-resource-tee spec: template: + metadata: + labels: + service: db spec: containers: - image: quay.io/cloudservices/postgresql-rds:12-9ee2984 diff --git a/tests/kuttl/test-ff-local/01-assert.yaml b/tests/kuttl/test-ff-local/01-assert.yaml index ba6c65407..e25d2f2ee 100644 --- a/tests/kuttl/test-ff-local/01-assert.yaml +++ b/tests/kuttl/test-ff-local/01-assert.yaml @@ -23,6 +23,8 @@ kind: Deployment metadata: name: test-ff-local-featureflags namespace: test-ff-local + labels: + service: featureflags spec: template: spec: diff --git a/tests/kuttl/test-kafka-strimzi-ephemeral/01-assert.yaml b/tests/kuttl/test-kafka-strimzi-ephemeral/01-assert.yaml index 59b9b08e0..622fffd88 100644 --- a/tests/kuttl/test-kafka-strimzi-ephemeral/01-assert.yaml +++ b/tests/kuttl/test-kafka-strimzi-ephemeral/01-assert.yaml @@ -35,11 +35,34 @@ spec: requests: cpu: 250m memory: 600Mi + template: + perPodService: + metadata: + labels: + service: strimziKafka + pod: + metadata: + labels: + service: strimziKafka zookeeper: replicas: 1 storage: type: ephemeral + template: + nodesService: + metadata: + labels: + service: strimziKafka + pod: + metadata: + labels: + service: strimziKafka entityOperator: + template: + pod: + metadata: + labels: + service: strimziKafka topicOperator: {} --- apiVersion: kafka.strimzi.io/v1beta2 diff --git a/tests/kuttl/test-local-db-redis/00-install.yaml b/tests/kuttl/test-local-db-redis/00-install.yaml new file mode 100644 index 000000000..dafcfa39e --- /dev/null +++ b/tests/kuttl/test-local-db-redis/00-install.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: test-local-db-redis +spec: + finalizers: + - kubernetes diff --git a/tests/kuttl/test-local-db-redis/01-assert.yaml b/tests/kuttl/test-local-db-redis/01-assert.yaml new file mode 100644 index 000000000..67e95b690 --- /dev/null +++ b/tests/kuttl/test-local-db-redis/01-assert.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: app-a-redis + namespace: test-local-db-redis +spec: + template: + metadata: + labels: + service: redis + spec: + containers: + - image: quay.io/cloudservices/redis-ephemeral:6 + resources: {} diff --git a/tests/kuttl/test-local-db-redis/01-pods.yaml b/tests/kuttl/test-local-db-redis/01-pods.yaml new file mode 100644 index 000000000..ae32c4a50 --- /dev/null +++ b/tests/kuttl/test-local-db-redis/01-pods.yaml @@ -0,0 +1,48 @@ +--- +apiVersion: cloud.redhat.com/v1alpha1 +kind: ClowdEnvironment +metadata: + name: test-local-db-redis +spec: + targetNamespace: test-local-db-redis + providers: + web: + port: 8000 + mode: operator + metrics: + port: 9000 + mode: operator + path: "/metrics" + kafka: + mode: none + db: + mode: none + logging: + mode: none + objectStore: + mode: none + inMemoryDb: + mode: redis + pvc: false + featureFlags: + mode: none + resourceDefaults: + limits: + cpu: 400m + memory: 1024Mi + requests: + cpu: 30m + memory: 512Mi +--- +apiVersion: cloud.redhat.com/v1alpha1 +kind: ClowdApp +metadata: + name: app-a + namespace: test-local-db-redis +spec: + envName: test-local-db-redis + deployments: + - name: processor + podSpec: + image: quay.io/psav/clowder-hello + inMemoryDb: true diff --git a/tests/kuttl/test-local-db-redis/02-delete.yaml b/tests/kuttl/test-local-db-redis/02-delete.yaml new file mode 100644 index 000000000..17923a2eb --- /dev/null +++ b/tests/kuttl/test-local-db-redis/02-delete.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +delete: +- apiVersion: v1 + kind: Namespace + name: test-local-db-redis +- apiVersion: cloud.redhat.com/v1alpha1 + kind: ClowdEnvironment + name: test-local-db-redis