From fe9a8ee952f4dcd57c4bc96f3e430d7221a1dacf Mon Sep 17 00:00:00 2001 From: Joel Takvorian Date: Tue, 23 Jan 2024 15:56:58 +0100 Subject: [PATCH] Generate some specDescriptors from script --- Makefile | 3 + ...observ-operator.clusterserviceversion.yaml | 110 ++++---- ...observ-operator.clusterserviceversion.yaml | 238 +++++------------- hack/crd2csvSpecDesc.sh | 80 ++++++ 4 files changed, 212 insertions(+), 219 deletions(-) create mode 100755 hack/crd2csvSpecDesc.sh diff --git a/Makefile b/Makefile index ed66ce0e9..9e5878ea3 100644 --- a/Makefile +++ b/Makefile @@ -387,12 +387,15 @@ bundle-prepare: OPSDK generate kustomize ## Generate bundle manifests and metada bundle: bundle-prepare ## Generate final bundle files. rm -r bundle/manifests rm -r bundle/metadata + cp ./config/csv/bases/netobserv-operator.clusterserviceversion.yaml tmp-csv + hack/crd2csvSpecDesc.sh v1beta2 $(SED) -e 's/^/ /' config/descriptions/upstream.md > tmp-desc $(KUSTOMIZE) build $(BUNDLE_CONFIG) \ | $(SED) -e 's~:container-image:~$(IMAGE)~' \ | $(SED) -e "/':full-description:'/r tmp-desc" \ | $(SED) -e "s/':full-description:'/|\-/" \ | $(OPSDK) generate bundle -q --overwrite --version $(BUNDLE_VERSION) $(BUNDLE_METADATA_OPTS) + mv tmp-csv ./config/csv/bases/netobserv-operator.clusterserviceversion.yaml rm tmp-desc sh -c '\ VALIDATION_OUTPUT=$$($(OPSDK) bundle validate ./bundle --select-optional suite=operatorframework); \ diff --git a/bundle/manifests/netobserv-operator.clusterserviceversion.yaml b/bundle/manifests/netobserv-operator.clusterserviceversion.yaml index 1d1897ec5..a73342c6c 100644 --- a/bundle/manifests/netobserv-operator.clusterserviceversion.yaml +++ b/bundle/manifests/netobserv-operator.clusterserviceversion.yaml @@ -409,7 +409,7 @@ metadata: capabilities: Seamless Upgrades categories: Monitoring, Networking console.openshift.io/plugins: '["netobserv-plugin"]' - containerImage: quay.io/netobserv/network-observability-operator:main + containerImage: quay.io/netobserv/network-observability-operator:1.0.4 createdAt: ':created-at:' description: Network flows collector and monitoring solution operatorframework.io/suggested-namespace: openshift-netobserv-operator @@ -446,8 +446,6 @@ spec: kind: FlowCollector name: flowcollectors.flows.netobserv.io specDescriptors: - - displayName: Namespace - path: namespace - description: defines the desired type of deployment for flow processing. displayName: Deployment model path: deploymentModel @@ -465,15 +463,11 @@ spec: path: agent.ebpf x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:agent.type:eBPF - - displayName: Sampling - path: agent.ebpf.sampling - displayName: Privileged mode path: agent.ebpf.privileged x-descriptors: - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - - displayName: Features - path: agent.ebpf.features - - displayName: Cache timeout + - displayName: Cache active timeout path: agent.ebpf.cacheActiveTimeout x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced @@ -481,15 +475,11 @@ spec: path: agent.ebpf.cacheMaxFlows x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Kafka maximum request size + - displayName: Kafka batch size path: agent.ebpf.kafkaBatchSize x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:deploymentModel:Kafka - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Interfaces - path: agent.ebpf.interfaces - - displayName: Exclude interfaces - path: agent.ebpf.excludeInterfaces - displayName: Log level path: agent.ebpf.logLevel x-descriptors: @@ -511,14 +501,9 @@ spec: path: kafka x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:deploymentModel:Kafka - - displayName: Address - path: kafka.address - - displayName: Topic - path: kafka.topic - displayName: TLS configuration path: kafka.tls - - displayName: Enable - path: kafka.tls.enable + - path: kafka.tls.enable x-descriptors: - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - displayName: Insecure @@ -526,22 +511,17 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - urn:alm:descriptor:com.tectonic.ui:fieldDependency:kafka.tls.enable:true - - displayName: User cert + - displayName: User certificate when using mTLS path: kafka.tls.userCert x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:kafka.tls.enable:true - - displayName: CA cert + - displayName: CA certificate path: kafka.tls.caCert x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:kafka.tls.enable:true - - displayName: SASL configuration - path: kafka.sasl - - displayName: Type - path: kafka.sasl.type - - displayName: Client ID - path: kafka.sasl.clientIDReference - - displayName: Client secret - path: kafka.sasl.clientSecretReference + - path: kafka.sasl + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:hidden - description: of the component that receives the flows from the agent, enriches them, generates metrics, and forwards them to the Loki persistence layer and/or any available exporter. @@ -557,8 +537,6 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:fieldDependency:processor.multiClusterDeployment:true - - displayName: Log types - path: processor.logTypes - path: processor.advanced x-descriptors: - urn:alm:descriptor:com.tectonic.ui:hidden @@ -566,12 +544,8 @@ spec: path: processor.metrics - displayName: Server configuration path: processor.metrics.server - - displayName: Port - path: processor.metrics.server.port - displayName: TLS configuration path: processor.metrics.server.tls - - displayName: Type - path: processor.metrics.server.tls.type - displayName: Insecure path: processor.metrics.server.tls.insecureSkipVerify x-descriptors: @@ -584,10 +558,6 @@ spec: path: processor.metrics.server.tls.providedCaFile x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:processor.metrics.server.tls.type:Provided - - displayName: Include list - path: processor.metrics.includeList - - displayName: Disable alerts - path: processor.metrics.disableAlerts - displayName: Kafka consumer replicas path: processor.kafkaConsumerReplicas x-descriptors: @@ -632,7 +602,7 @@ spec: path: loki.mode x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true - - displayName: Loki Stack + - displayName: Loki stack path: loki.lokiStack x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.mode:LokiStack @@ -648,7 +618,7 @@ spec: path: loki.manual x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.mode:Manual - - displayName: Write batch timeout + - displayName: Write batch wait path: loki.writeBatchWait x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true @@ -701,7 +671,7 @@ spec: - displayName: Image pull policy path: consolePlugin.imagePullPolicy x-descriptors: - - urn:alm:descriptor:com.tectonic.ui:imagePullPolicy + - urn:alm:descriptor:com.tectonic.ui:imagePullPolicy" - urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true - urn:alm:descriptor:com.tectonic.ui:advanced - displayName: Resource Requirements @@ -727,6 +697,56 @@ spec: path: exporters[0].kafka x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:exporters.type:Kafka + - displayName: Exclude interfaces + path: agent.ebpf.excludeInterfaces + - displayName: Features + path: agent.ebpf.features + - displayName: Interfaces + path: agent.ebpf.interfaces + - displayName: Sampling + path: agent.ebpf.sampling + - displayName: Enable + path: consolePlugin.portNaming.enable + - displayName: Port names + path: consolePlugin.portNaming.portNames + - displayName: Address + path: kafka.address + - displayName: Topic + path: kafka.topic + - displayName: Name + path: loki.lokiStack.name + - displayName: Namespace + path: loki.lokiStack.namespace + - displayName: Auth token + path: loki.manual.authToken + - displayName: Ingester url + path: loki.manual.ingesterUrl + - displayName: Querier url + path: loki.manual.querierUrl + - displayName: Status url + path: loki.manual.statusUrl + - displayName: TenantID + path: loki.manual.tenantID + - displayName: Ingester url + path: loki.microservices.ingesterUrl + - displayName: Querier url + path: loki.microservices.querierUrl + - displayName: TenantID + path: loki.microservices.tenantID + - displayName: TenantID + path: loki.monolithic.tenantID + - displayName: Url + path: loki.monolithic.url + - displayName: Namespace + path: namespace + - displayName: Log types + path: processor.logTypes + - displayName: Disable alerts + path: processor.metrics.disableAlerts + - displayName: Include list + path: processor.metrics.includeList + - displayName: Port + path: processor.metrics.server.port statusDescriptors: - description: Namespace where console plugin and flowlogs-pipeline have been deployed. @@ -783,7 +803,7 @@ spec: ## Configuration - The `FlowCollector` resource is used to configure the operator and its managed components. A comprehensive documentation is [available here](https://github.com/netobserv/network-observability-operator/blob/main/docs/FlowCollector.md), and a full sample file [there](https://github.com/netobserv/network-observability-operator/blob/main/config/samples/flows_v1beta1_flowcollector.yaml). + The `FlowCollector` resource is used to configure the operator and its managed components. A comprehensive documentation is [available here](https://github.com/netobserv/network-observability-operator/blob/1.0.4/docs/FlowCollector.md), and a full sample file [there](https://github.com/netobserv/network-observability-operator/blob/1.0.4/config/samples/flows_v1beta1_flowcollector.yaml). To edit configuration in cluster, run: @@ -801,7 +821,7 @@ spec: - Loki (`spec.loki`): configure here how to reach Loki. The default values match the Loki quick install paths mentioned above, but you may have to configure differently if you used another installation method. - - Quick filters (`spec.consolePlugin.quickFilters`): configure preset filters to be displayed in the Console plugin. They offer a way to quickly switch from filters to others, such as showing / hiding pods network, or infrastructure network, or application network, etc. They can be tuned to reflect the different workloads running on your cluster. For a list of available filters, [check this page](https://github.com/netobserv/network-observability-operator/blob/main/docs/QuickFilters.md). + - Quick filters (`spec.consolePlugin.quickFilters`): configure preset filters to be displayed in the Console plugin. They offer a way to quickly switch from filters to others, such as showing / hiding pods network, or infrastructure network, or application network, etc. They can be tuned to reflect the different workloads running on your cluster. For a list of available filters, [check this page](https://github.com/netobserv/network-observability-operator/blob/1.0.4/docs/QuickFilters.md). - Kafka (`spec.deploymentModel: KAFKA` and `spec.kafka`): when enabled, integrates the flow collection pipeline with Kafka, by splitting ingestion from transformation (kube enrichment, derived metrics, ...). Kafka can provide better scalability, resiliency and high availability ([view more details](https://www.redhat.com/en/topics/integration/what-is-apache-kafka)). Assumes Kafka is already deployed and a topic is created. @@ -1079,7 +1099,7 @@ spec: - name: DOWNSTREAM_DEPLOYMENT value: "false" - name: PROFILING_BIND_ADDRESS - image: quay.io/netobserv/network-observability-operator:main + image: quay.io/netobserv/network-observability-operator:1.0.4 imagePullPolicy: Always livenessProbe: httpGet: diff --git a/config/csv/bases/netobserv-operator.clusterserviceversion.yaml b/config/csv/bases/netobserv-operator.clusterserviceversion.yaml index 18f38feb6..e3c7da2f3 100644 --- a/config/csv/bases/netobserv-operator.clusterserviceversion.yaml +++ b/config/csv/bases/netobserv-operator.clusterserviceversion.yaml @@ -43,10 +43,7 @@ spec: version: v1beta2 specDescriptors: # ROOT - - displayName: Namespace - path: namespace - description: defines the desired type of deployment for flow processing. - displayName: Deployment model path: deploymentModel # AGENT - description: for flows extraction. @@ -62,45 +59,32 @@ spec: displayName: eBPF Agent configuration path: agent.ebpf x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:agent.type:eBPF" - - displayName: Sampling - path: agent.ebpf.sampling + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:agent.type:eBPF - displayName: Privileged mode path: agent.ebpf.privileged x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:booleanSwitch" - - displayName: Features - path: agent.ebpf.features - - displayName: Cache timeout - path: agent.ebpf.cacheActiveTimeout + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - path: agent.ebpf.cacheActiveTimeout x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Cache max flows - path: agent.ebpf.cacheMaxFlows + - path: agent.ebpf.cacheMaxFlows x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Kafka maximum request size - path: agent.ebpf.kafkaBatchSize + - path: agent.ebpf.kafkaBatchSize x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:deploymentModel:Kafka" + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:deploymentModel:Kafka - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Interfaces - path: agent.ebpf.interfaces - - displayName: Exclude interfaces - path: agent.ebpf.excludeInterfaces - - displayName: Log level - path: agent.ebpf.logLevel + - path: agent.ebpf.logLevel x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Image pull policy - path: agent.ebpf.imagePullPolicy + - path: agent.ebpf.imagePullPolicy x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:imagePullPolicy" + - urn:alm:descriptor:com.tectonic.ui:imagePullPolicy - urn:alm:descriptor:com.tectonic.ui:advanced - displayName: Resource Requirements path: agent.ebpf.resources x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:resourceRequirements" + - urn:alm:descriptor:com.tectonic.ui:resourceRequirements - path: agent.ebpf.advanced x-descriptors: - urn:alm:descriptor:com.tectonic.ui:hidden @@ -109,38 +93,28 @@ spec: displayName: Kafka configuration path: kafka x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:deploymentModel:Kafka" - - displayName: Address - path: kafka.address - - displayName: Topic - path: kafka.topic + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:deploymentModel:Kafka - displayName: TLS configuration path: kafka.tls - - displayName: Enable - path: kafka.tls.enable + - path: kafka.tls.enable x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:booleanSwitch" + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - displayName: Insecure path: kafka.tls.insecureSkipVerify x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:booleanSwitch" - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:kafka.tls.enable:true" - - displayName: User cert + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:kafka.tls.enable:true + - displayName: User certificate when using mTLS path: kafka.tls.userCert x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:kafka.tls.enable:true" - - displayName: CA cert + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:kafka.tls.enable:true + - displayName: CA certificate path: kafka.tls.caCert x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:kafka.tls.enable:true" - - displayName: SASL configuration - path: kafka.sasl - - displayName: Type - path: kafka.sasl.type - - displayName: Client ID - path: kafka.sasl.clientIDReference - - displayName: Client secret - path: kafka.sasl.clientSecretReference + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:kafka.tls.enable:true + - path: kafka.sasl + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:hidden # PROCESSOR / FLP - description: of the component that receives the flows from the agent, enriches them, generates metrics, and forwards them to the Loki persistence layer and/or any available exporter. displayName: Processor configuration @@ -150,13 +124,10 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - - displayName: Cluster name - path: processor.clusterName + - path: processor.clusterName x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:fieldDependency:processor.multiClusterDeployment:true - - displayName: Log types - path: processor.logTypes - path: processor.advanced x-descriptors: - urn:alm:descriptor:com.tectonic.ui:hidden @@ -164,209 +135,128 @@ spec: path: processor.metrics - displayName: Server configuration path: processor.metrics.server - - displayName: Port - path: processor.metrics.server.port - displayName: TLS configuration path: processor.metrics.server.tls - - displayName: Type - path: processor.metrics.server.tls.type - displayName: Insecure path: processor.metrics.server.tls.insecureSkipVerify x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:processor.metrics.server.tls.type:Provided" + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:processor.metrics.server.tls.type:Provided - displayName: Cert path: processor.metrics.server.tls.provided x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:processor.metrics.server.tls.type:Provided" + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:processor.metrics.server.tls.type:Provided - displayName: CA path: processor.metrics.server.tls.providedCaFile x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:processor.metrics.server.tls.type:Provided" - - displayName: Include list - path: processor.metrics.includeList - - displayName: Disable alerts - path: processor.metrics.disableAlerts - - displayName: Kafka consumer replicas - path: processor.kafkaConsumerReplicas + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:processor.metrics.server.tls.type:Provided + - path: processor.kafkaConsumerReplicas x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:deploymentModel:Kafka" + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:deploymentModel:Kafka - urn:alm:descriptor:com.tectonic.ui:advanced - displayName: kafka consumer autoscaler path: processor.kafkaConsumerAutoscaler x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:deploymentModel:Kafka" + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:deploymentModel:Kafka - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Kafka consumer queue capacity - path: processor.kafkaConsumerQueueCapacity + - path: processor.kafkaConsumerQueueCapacity x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:deploymentModel:Kafka" + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:deploymentModel:Kafka - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Kafka consumer batch size - path: processor.kafkaConsumerBatchSize + - path: processor.kafkaConsumerBatchSize x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:deploymentModel:Kafka" + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:deploymentModel:Kafka - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Log level - path: processor.logLevel + - path: processor.logLevel x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Image pull policy - path: processor.imagePullPolicy + - path: processor.imagePullPolicy x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:imagePullPolicy" + - urn:alm:descriptor:com.tectonic.ui:imagePullPolicy - urn:alm:descriptor:com.tectonic.ui:advanced - displayName: Resource Requirements path: processor.resources x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:resourceRequirements" + - urn:alm:descriptor:com.tectonic.ui:resourceRequirements # LOKI - description: for the flow store. displayName: Loki client settings path: loki - - displayName: Enable - path: loki.enable + - path: loki.enable x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:booleanSwitch" - - displayName: Mode - path: loki.mode + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - path: loki.mode x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true - - displayName: Loki Stack - path: loki.lokiStack + - path: loki.lokiStack x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.mode:LokiStack - - displayName: Monolithic - path: loki.monolithic + - path: loki.monolithic x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.mode:Monolithic - - displayName: Microservices - path: loki.microservices + - path: loki.microservices x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.mode:Microservices - - displayName: Manual - path: loki.manual + - path: loki.manual x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.mode:Manual - - displayName: Write batch timeout - path: loki.writeBatchWait + - path: loki.writeBatchWait x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Write batch size - path: loki.writeBatchSize + - path: loki.writeBatchSize x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Write timeout - path: loki.writeTimeout + - path: loki.writeTimeout x-descriptors: - urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true - urn:alm:descriptor:com.tectonic.ui:advanced - path: loki.advanced x-descriptors: - urn:alm:descriptor:com.tectonic.ui:hidden - # - displayName: TLS configuration - # path: loki.tls - # x-descriptors: - # - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true" - # - displayName: Enable - # path: loki.tls.enable - # x-descriptors: - # - "urn:alm:descriptor:com.tectonic.ui:booleanSwitch" - # - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true" - # - displayName: Insecure - # path: loki.tls.insecureSkipVerify - # x-descriptors: - # - "urn:alm:descriptor:com.tectonic.ui:booleanSwitch" - # - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.tls.enable:true" - # - displayName: User cert - # path: loki.tls.userCert - # x-descriptors: - # - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.tls.enable:true" - # - displayName: CA cert - # path: loki.tls.caCert - # x-descriptors: - # - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.tls.enable:true" - # - displayName: Status TLS configuration - # path: loki.statusTls - # x-descriptors: - # - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true" - # - displayName: Enable - # path: loki.statusTls.enable - # x-descriptors: - # - "urn:alm:descriptor:com.tectonic.ui:booleanSwitch" - # - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true" - # - displayName: Insecure - # path: loki.statusTls.insecureSkipVerify - # x-descriptors: - # - "urn:alm:descriptor:com.tectonic.ui:booleanSwitch" - # - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.statusTls.enable:true" - # - displayName: User cert - # path: loki.statusTls.userCert - # x-descriptors: - # - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.statusTls.enable:true" - # - displayName: CA cert - # path: loki.statusTls.caCert - # x-descriptors: - # - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.statusTls.enable:true" - # - displayName: Tenant ID - # path: loki.tenantID - # x-descriptors: - # - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true" - # - displayName: Authentication Token - # path: loki.authToken - # x-descriptors: - # - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true" # CONSOLE PLUGIN - description: related to the OpenShift Console integration. displayName: Console plugin configuration path: consolePlugin x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true" - - displayName: Enable - path: consolePlugin.enable + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true + - path: consolePlugin.enable x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:booleanSwitch" - - displayName: Port naming - path: consolePlugin.portNaming + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - path: consolePlugin.portNaming x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true" - - displayName: Quick filters - path: consolePlugin.quickFilters + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true + - path: consolePlugin.quickFilters x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true" - - displayName: Replicas - path: consolePlugin.replicas + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true + - path: consolePlugin.replicas x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true" + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true - urn:alm:descriptor:com.tectonic.ui:advanced - displayName: Horizontal pod autoscaler path: consolePlugin.autoscaler x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true" + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Log level - path: consolePlugin.logLevel + - path: consolePlugin.logLevel x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true" + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Image pull policy - path: consolePlugin.imagePullPolicy + - path: consolePlugin.imagePullPolicy x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:imagePullPolicy" - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true" + - urn:alm:descriptor:com.tectonic.ui:imagePullPolicy" + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true - urn:alm:descriptor:com.tectonic.ui:advanced - displayName: Resource Requirements path: consolePlugin.resources x-descriptors: - - "urn:alm:descriptor:com.tectonic.ui:resourceRequirements" - - "urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true" + - urn:alm:descriptor:com.tectonic.ui:resourceRequirements + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:consolePlugin.enable:true - path: consolePlugin.advanced x-descriptors: - urn:alm:descriptor:com.tectonic.ui:hidden # EXPORTERS - description: additional optional exporters for custom consumption or storage. - displayName: Exporters path: exporters x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced diff --git a/hack/crd2csvSpecDesc.sh b/hack/crd2csvSpecDesc.sh new file mode 100755 index 000000000..c2a983436 --- /dev/null +++ b/hack/crd2csvSpecDesc.sh @@ -0,0 +1,80 @@ +#!/bin/bash + +version="$1" + +if [[ $version == "" ]]; then + echo "Missing CRD version." + exit 1 +fi + +crd="./config/crd/bases/flows.netobserv.io_flowcollectors.yaml" +csv="./config/csv/bases/netobserv-operator.clusterserviceversion.yaml" + +crdRoot=".spec.versions[] | select(.name==\"$version\").schema.openAPIV3Schema.properties.spec.properties" +csvRoot=".spec.customresourcedefinitions.owned[] | select(.version==\"$version\").specDescriptors" + +process_property() { + local yamlPath=$1 + local logicPath=$2 + # Ignore some patterns + if [[ $logicPath == *"utoscaler" ]] || [[ $logicPath == *".resources" ]] || [[ $logicPath == *".tls" ]] || [[ $logicPath == *".statusTls" ]] ; then + # echo "Ignoring entry" >&2 + false + return + fi + # Lookup in CSV + local xDescs=$(cat $csv | yq "$csvRoot[] | select(.path==\"$logicPath\").x-descriptors") + if [[ $xDescs == *":hidden" ]]; then + # echo "Hidden property; ignoring" >&2 + false + return + fi + local displayName=$(echo $logicPath | sed 's/.*\.//' | sed 's/\([A-Z]\)\([a-z]\)/ \L\1\2/g' | sed 's/.*/\u&/' ) +# local description=$(cat $crd | yq "$yamlPath.description" | sed 's/`/"/g' | sed 's/
//g') + if [[ $(cat $csv | yq "$csvRoot[] | select(.path==\"$logicPath\")") != "" ]]; then + if [[ $(cat $csv | yq "$csvRoot[] | select(.path==\"$logicPath\") | has(\"displayName\")") == false ]]; then + # echo "Set display name: $displayName" >&2 + yq -i "($csvRoot[] | select(.path==\"$logicPath\").displayName) = \"$displayName\"" $csv + fi + # if [[ $(cat $csv | yq "$csvRoot[] | select(.path==\"$logicPath\") | has(\"description\")") == false ]]; then + # echo "Set description: $description" >&2 + # # yq -i "$csvRoot[] | select(.path==\"$logicPath\").description = \"$description\"" $csv + # fi + else + # echo "Creating entry for $displayName" >&2 + yq -i "($csvRoot) += {\"path\":\"$logicPath\",\"displayName\":\"$displayName\"}" $csv + fi +} + +process_properties() { + local yamlPath=$1 + local logicPath=$2 + local props=$(cat $crd | yq "$yamlPath | keys | @tsv") + for prop in $props; do + if [[ $logicPath != "" ]]; then + local propLogicPath="$logicPath.$prop" + else + local propLogicPath="$prop" + fi + # echo "Checking property $propLogicPath" >&2 + if process_property "$yamlPath.$prop" $propLogicPath; then + local type=$(cat $crd | yq "$yamlPath.$prop.type") + if [[ "$type" == "object" ]]; then + # echo "it's an object" >&2 + if [[ $(cat $crd | yq "$yamlPath.$prop | has(\"properties\")") == true ]]; then + process_properties "$yamlPath.$prop.properties" $propLogicPath + # else + # echo "Skipping: no properties." >&2 + fi + # else + # if [[ "$type" == "array" ]]; then + # echo "it's an array" >&2 + # # else + # # echo "it's a leaf" >&2 + # fi + fi + fi + done +} + +process_properties "$crdRoot" ""