diff --git a/stackpacks/open-telemetry/settings/main-menu.sty b/stackpacks/open-telemetry/settings/main-menu.sty index b5ad538..d0615fe 100644 --- a/stackpacks/open-telemetry/settings/main-menu.sty +++ b/stackpacks/open-telemetry/settings/main-menu.sty @@ -1,7 +1,8 @@ nodes: - _type: MainMenuGroup name: Open Telemetry + order: 0 iconbase64: !icon open-telemetry.svg defaultOpen: true items: [] - identifier: "urn:stackpack:open-telemetry:main-menu-group:open-telemetry" \ No newline at end of file + identifier: "urn:stackpack:open-telemetry:main-menu-group:open-telemetry" diff --git a/stackpacks/open-telemetry/stackpack.yaml b/stackpacks/open-telemetry/stackpack.yaml index fde883a..b34b7b9 100644 --- a/stackpacks/open-telemetry/stackpack.yaml +++ b/stackpacks/open-telemetry/stackpack.yaml @@ -1,5 +1,5 @@ name: "open-telemetry" -version: "0.1.6" +version: "0.1.7" schemaVersion: "2.0" displayName: "Open Telemetry" categories: [ "Open Telemetry" ] diff --git a/stackpacks/otel-k8s-crd/icons/agent.svg b/stackpacks/otel-k8s-crd/icons/agent.svg new file mode 100644 index 0000000..1487ec9 --- /dev/null +++ b/stackpacks/otel-k8s-crd/icons/agent.svg @@ -0,0 +1,5 @@ + + + diff --git a/stackpacks/otel-k8s-crd/resources/detailed-overview.md b/stackpacks/otel-k8s-crd/resources/detailed-overview.md index 9de123d..871456b 100644 --- a/stackpacks/otel-k8s-crd/resources/detailed-overview.md +++ b/stackpacks/otel-k8s-crd/resources/detailed-overview.md @@ -11,6 +11,21 @@ The StackPack defines SUSE Observability settings (component and relation mappin - **instance of** - Links each Custom Resource to its defining Custom Resource Definition +### Resource collections + +CollectionDeclaration declarations appear in the **Collection Declarations** overview +under **Agent**. Their highlights show collection state, reason, details and +the declaration and observed generations. Configuration contains the selections; +status contains the collector's per-selection feedback. + +Declarations also appear in **Kubernetes → Custom Resources** as part of the +custom-resource inventory. + +**Awaiting reconciliation** means the available feedback does not describe the +current declaration generation. **Collecting**, **Pending** and **Blocked** reflect +the collector's Ready condition. A blocked declaration can still collect its +permitted selections; collection state is separate from component health. + ### Data sources - CRD and CR discovery via the Kubernetes API server diff --git a/stackpacks/otel-k8s-crd/settings/component-mappings/collection-declarations.sty b/stackpacks/otel-k8s-crd/settings/component-mappings/collection-declarations.sty new file mode 100644 index 0000000..65cf35e --- /dev/null +++ b/stackpacks/otel-k8s-crd/settings/component-mappings/collection-declarations.sty @@ -0,0 +1,86 @@ +nodes: + - _type: "OtelComponentMapping" + name: "Kubernetes Collection Declaration" + description: "Collection declarations and their generation-bound feedback" + identifier: "urn:stackpack:otel-k8s-crd:otel-component-mapping:collection-declaration" + input: + signal: + - "LOGS" + resource: + scope: + log: + action: "log.body['type'] in ['ADDED', 'MODIFIED'] ? 'CREATE' : log.body['type'] == 'DELETED' ? 'DELETE' : 'CONTINUE'" + condition: >- + log.eventName == 'KubernetesCustomResourceEvent' && + log.attributes['k8s.resource.group'] == 'observability.suse.com' && + log.attributes['k8s.resource.kind'] == 'CollectionDeclaration' + vars: + - name: "clusterName" + value: "resource.attributes['k8s.cluster.name']" + - name: "name" + value: "log.attributes['k8s.object.name']" + - name: "object" + value: "log.body['object']" + - name: "status" + value: "'status' in log.body['object'] ? log.body['object']['status'] : {}" + - name: "readyConditions" + value: >- + 'status' in log.body['object'] && 'conditions' in log.body['object']['status'] + ? log.body['object']['status']['conditions'].filter(c, c['type'] == 'Ready') + : [] + - name: "current" + value: >- + 'generation' in log.body['object']['metadata'] && + log.body['object']['metadata']['generation'] > 0 && + 'status' in log.body['object'] && + 'observedGeneration' in log.body['object']['status'] && + log.body['object']['status']['observedGeneration'] == log.body['object']['metadata']['generation'] && + 'conditions' in log.body['object']['status'] && + log.body['object']['status']['conditions'].exists(c, + c['type'] == 'Ready' && 'observedGeneration' in c && + c['observedGeneration'] == log.body['object']['metadata']['generation']) + output: + identifier: "'urn:k8s:cr:/cluster/' + vars.clusterName + ':namespace/:group/observability.suse.com:kind/CollectionDeclaration:name/' + vars.name" + name: "vars.name" + typeName: "'custom resource'" + required: + configuration: "omit(vars.object, ['status', 'metadata'])" + tags: + - source: "'otel-k8s-crd'" + target: "stackpack" + - source: "'CollectionDeclaration'" + target: "k8s.resource.kind" + - source: "'observability.suse.com'" + target: "k8s.resource.group" + - source: "vars.name" + target: "k8s.resource.name" + - source: "vars.clusterName" + target: "cluster-name" + - source: >- + !vars.current ? 'Awaiting reconciliation' : + vars.readyConditions[0]['status'] == 'True' ? 'Collecting' : + vars.readyConditions[0]['status'] == 'False' + ? (vars.readyConditions[0]['reason'] == 'ResourcesPending' ? 'Pending' : 'Blocked') + : 'Unknown' + target: "k8s.collection.state" + optional: + status: "vars.status" + tags: + - source: >- + vars.current ? vars.readyConditions[0]['reason'] : '' + target: "k8s.collection.reason" + - source: >- + vars.current ? vars.readyConditions[0]['message'] + : 'Waiting for feedback on the current declaration.' + target: "k8s.collection.message" + - source: "string(vars.object['metadata']['generation'])" + target: "k8s.collection.generation" + - source: "string(vars.status['observedGeneration'])" + target: "k8s.collection.observed-generation" + - source: "string(size(vars.object['spec']['resources']))" + target: "k8s.collection.selections" + - source: "vars.object['metadata']['creationTimestamp']" + target: "k8s.creationTimestamp" + expireAfter: 900000 + rank: + specificity: 100 diff --git a/stackpacks/otel-k8s-crd/settings/main-menu.sty b/stackpacks/otel-k8s-crd/settings/main-menu.sty index 4966499..e5eb926 100644 --- a/stackpacks/otel-k8s-crd/settings/main-menu.sty +++ b/stackpacks/otel-k8s-crd/settings/main-menu.sty @@ -1,7 +1,15 @@ nodes: - _type: MainMenuGroup name: Kubernetes + order: 0 iconbase64: "" defaultOpen: true items: [] identifier: "urn:stackpack:otel-k8s-crd:main-menu-group:kubernetes" + - _type: MainMenuGroup + name: Agent + order: -1 + iconbase64: !icon agent.svg + defaultOpen: false + items: [] + identifier: "urn:stackpack:otel-k8s-crd:main-menu-group:agent" diff --git a/stackpacks/otel-k8s-crd/settings/presentations/collection-declarations.sty b/stackpacks/otel-k8s-crd/settings/presentations/collection-declarations.sty new file mode 100644 index 0000000..c2ec337 --- /dev/null +++ b/stackpacks/otel-k8s-crd/settings/presentations/collection-declarations.sty @@ -0,0 +1,147 @@ +nodes: + - _type: ComponentPresentation + name: "Collection Declaration" + description: "Presentation for Kubernetes collection declarations" + identifier: "urn:stackpack:otel-k8s-crd:component-presentation:collection-declaration" + binding: + _type: ComponentPresentationQueryBinding + query: >- + label = "stackpack:otel-k8s-crd" and label = "source-type:custom resource" + and label = "k8s.resource.group:observability.suse.com" + and label = "k8s.resource.kind:CollectionDeclaration" + rank: + specificity: 20 + presentation: + icon: !icon cr.svg + filters: + - filterId: "crd_cluster" + topology: + groupingEnabled: true + showIndirectRelations: false + minimumGroupSize: 8 + groupedByLayers: false + groupedByDomains: true + autoGrouping: true + connectedComponents: true + overview: + name: + singular: "collection declaration" + plural: "collection declarations" + title: "Collection Declarations" + mainMenu: + group: "Agent" + order: 0 + columns: + - columnId: cr_name + title: "Name" + projection: + _type: ComponentLinkProjection + name: "name" + identifier: "identifiers[0]" + - columnId: collection_state + title: "Collection" + projection: + _type: TextProjection + value: "tags.singleValue('k8s.collection.state')" + - columnId: collection_reason + title: "Reason" + projection: + _type: TextProjection + value: "tags.singleValue('k8s.collection.reason')" + - columnId: collection_selections + title: "Selections" + projection: + _type: TextProjection + value: "tags.singleValue('k8s.collection.selections')" + - columnId: cr_cluster + title: "Cluster" + projection: + _type: TextProjection + value: "tags.singleValue('cluster-name')" + - columnId: cr_age + title: "Age" + projection: + _type: DurationProjection + startTime: "tags.singleValue('k8s.creationTimestamp')" + highlight: + title: "Collection Declaration" + fields: + - fieldId: collection_state + title: "Collection" + order: 100.0 + projection: + _type: TextProjection + value: "tags.singleValue('k8s.collection.state')" + - fieldId: collection_reason + title: "Reason" + order: 95.0 + projection: + _type: TextProjection + value: "tags.singleValue('k8s.collection.reason')" + - fieldId: collection_message + title: "Collection details" + order: 90.0 + projection: + _type: TextProjection + value: "tags.singleValue('k8s.collection.message')" + - fieldId: collection_generation + title: "Declaration generation" + order: 80.0 + projection: + _type: TextProjection + value: "tags.singleValue('k8s.collection.generation')" + - fieldId: collection_observed_generation + title: "Observed generation" + order: 75.0 + projection: + _type: TextProjection + value: "tags.singleValue('k8s.collection.observed-generation')" + - fieldId: collection_selections + title: "Selections" + order: 70.0 + projection: + _type: TextProjection + value: "tags.singleValue('k8s.collection.selections')" + - fieldId: kind + title: "Kind" + order: 60.0 + projection: + _type: ComponentLinkProjection + name: "tags.singleValue('k8s.resource.kind')" + identifier: "'urn:k8s:crd:/cluster/' + tags.singleValue('cluster-name') + ':group/' + tags.singleValue('k8s.resource.group') + ':kind/' + tags.singleValue('k8s.resource.kind')" + - fieldId: cluster + title: "Cluster" + order: 50.0 + projection: + _type: TextProjection + value: "tags.singleValue('cluster-name')" + - fieldId: age + title: "Age" + order: 40.0 + projection: + _type: DurationProjection + startTime: "tags.singleValue('k8s.creationTimestamp')" + - fieldId: labels + title: "Labels" + order: 10.0 + projection: + _type: TagProjection + provisioning: + topologySourceSelector: "source.identifier == identifiers[0]" + showConfiguration: true + showStatus: true + relatedResources: + - resourceId: "cr_definition" + title: "Custom Resource Definition" + order: 1.0 + topologyQuery: >- + (withNeighborsOf(direction = "both", + components = (identifier = "${identifiers[0]}"), + levels = "1")) and label = "source-type:custom resource definition" + presentationIdentifier: "urn:stackpack:otel-k8s-crd:component-presentation:custom-resource-definition" + events: + showEvents: true + relatedResourcesQuery: | + identifier = "${identifiers[0]}" + OR + (withNeighborsOf(direction = "both", components = (identifier = "${identifiers[0]}"), levels = "1") and label = "source-type:custom resource definition") diff --git a/stackpacks/otel-k8s-crd/settings/presentations/custom-resources.sty b/stackpacks/otel-k8s-crd/settings/presentations/custom-resources.sty index c4d3162..14799cd 100644 --- a/stackpacks/otel-k8s-crd/settings/presentations/custom-resources.sty +++ b/stackpacks/otel-k8s-crd/settings/presentations/custom-resources.sty @@ -5,7 +5,8 @@ nodes: identifier: "urn:stackpack:otel-k8s-crd:component-presentation:custom-resource" binding: _type: ComponentPresentationQueryBinding - query: (label = "stackpack:otel-k8s-crd" and label = "source-type:custom resource") + query: >- + label = "stackpack:otel-k8s-crd" and label = "source-type:custom resource" rank: specificity: 10 presentation: diff --git a/stackpacks/otel-k8s-crd/stackpack.yaml b/stackpacks/otel-k8s-crd/stackpack.yaml index e82813d..d9ff15a 100644 --- a/stackpacks/otel-k8s-crd/stackpack.yaml +++ b/stackpacks/otel-k8s-crd/stackpack.yaml @@ -1,5 +1,5 @@ name: "otel-k8s-crd" -version: "0.0.9" +version: "0.0.10" schemaVersion: "2.0" displayName: "Kubernetes Custom Resources" categories: [ "Kubernetes" ]