diff --git a/charts/argocd-understack/templates/application-ironic-hardware-exporter.yaml b/charts/argocd-understack/templates/application-ironic-hardware-exporter.yaml new file mode 100644 index 000000000..5bfa70772 --- /dev/null +++ b/charts/argocd-understack/templates/application-ironic-hardware-exporter.yaml @@ -0,0 +1,44 @@ +{{- if eq (include "understack.isEnabled" (list $.Values.site "ironic_hardware_exporter")) "true" }} +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: {{ printf "%s-%s" $.Release.Name "ironic-hardware-exporter" }} + finalizers: + - resources-finalizer.argocd.argoproj.io + annotations: + argocd.argoproj.io/compare-options: ServerSideDiff=true,IncludeMutationWebhook=true +{{- include "understack.appLabelsBlock" $ | nindent 2 }} +spec: + destination: + namespace: openstack + server: {{ $.Values.cluster_server }} + project: understack + sources: + - ref: understack + path: 'go/ironic-hardware-exporter/helm' + repoURL: {{ include "understack.understack_url" $ }} + targetRevision: {{ include "understack.understack_ref" $ }} + helm: + releaseName: ironic-hardware-exporter + valueFiles: + - $understack/go/ironic-hardware-exporter/helm/values.yaml + - $deploy/{{ include "understack.deploy_path" $ }}/ironic-hardware-exporter/values.yaml + ignoreMissingValueFiles: true + - ref: deploy + repoURL: {{ include "understack.deploy_url" $ }} + targetRevision: {{ include "understack.deploy_ref" $ }} + path: {{ include "understack.deploy_path" $ }}/ironic-hardware-exporter + syncPolicy: + automated: + prune: true + selfHeal: true + managedNamespaceMetadata: + annotations: + argocd.argoproj.io/sync-options: Delete=false + syncOptions: + - CreateNamespace=true + - ServerSideApply=true + - RespectIgnoreDifferences=true + - ApplyOutOfSyncOnly=true +{{- end }} diff --git a/charts/argocd-understack/values.yaml b/charts/argocd-understack/values.yaml index 2f16bbce0..9b5a96668 100644 --- a/charts/argocd-understack/values.yaml +++ b/charts/argocd-understack/values.yaml @@ -574,6 +574,12 @@ site: # @default -- $understack/components/nautobot/nautobot_config.py nautobot_config: '$understack/components/nautobot/nautobot_config.py' + # -- Ironic hardware exporter for bare-metal hardware metrics via RabbitMQ + ironic_hardware_exporter: + # -- Enable/disable deploying ironic-hardware-exporter + # @default -- false + enabled: false + # -- SNMP exporter for network device monitoring snmp_exporter: # -- Enable/disable deploying SNMP exporter diff --git a/docs/deploy-guide/components/index.md b/docs/deploy-guide/components/index.md index 981c3a6f9..e8300aaec 100644 --- a/docs/deploy-guide/components/index.md +++ b/docs/deploy-guide/components/index.md @@ -114,6 +114,7 @@ enablement defaults, validation, and troubleshooting notes. | [glance](./glance.md) | site | | [cinder](./cinder.md) | site | | [ironic](./ironic.md) | site | +| [ironic-hardware-exporter](./ironic-hardware-exporter.md) | site | | [neutron](./neutron.md) | site | | [placement](./placement.md) | site | | [nova](./nova.md) | site | diff --git a/docs/deploy-guide/components/ironic-hardware-exporter.md b/docs/deploy-guide/components/ironic-hardware-exporter.md new file mode 100644 index 000000000..693f51bd4 --- /dev/null +++ b/docs/deploy-guide/components/ironic-hardware-exporter.md @@ -0,0 +1,55 @@ +--- +charts: +- ironic-hardware-exporter +source_text: ArgoCD renders both the exporter Helm chart and the deploy-repo + directory declared as a second source. +deploy_overrides: + helm: + mode: values + kustomize: + mode: second_source +--- + +# ironic-hardware-exporter + +RabbitMQ-driven Prometheus exporter for Ironic hardware and node-state metrics. + +## Deployment Scope + +- Cluster scope: site +- Values key: `site.ironic_hardware_exporter` +- ArgoCD Application template: `charts/argocd-understack/templates/application-ironic-hardware-exporter.yaml` + +## How ArgoCD Builds It + +{{ component_argocd_builds() }} + +## How to Enable + +Enable this component in your site deployment values: + +```yaml title="$CLUSTER_NAME/deploy.yaml" +site: + ironic_hardware_exporter: + enabled: true +``` + +## Deployment Repo Content + +{{ secrets_disclaimer }} + +Required or commonly required items: + +- `values.yaml`: Provide site-specific Helm values such as RabbitMQ host, queue names, TLS settings, and optional `ServiceMonitor` tuning. +- `kustomization.yaml`: Include any Secrets or manifests that must be applied alongside the chart from the same deploy-repo directory. +- `RabbitMQ password Secret`: Create the Secret referenced by `rabbitmq.existingSecret`. + +Optional additions: + +- `RabbitMQ CA Secret`: Add a Secret containing `ca.crt` when `rabbitmq.tls.enabled=true` and the broker uses a private CA. +- `Additional overlay manifests`: Add SealedSecrets, ExternalSecrets, NetworkPolicies, or namespace-local overrides if this site needs extra deployment-specific resources. + +## Notes + +- This component uses a deploy-repo second source, so enabling it should normally create a site directory like `$CLUSTER_NAME/ironic-hardware-exporter/`. +- The chart itself lives in `go/ironic-hardware-exporter/helm` inside the UnderStack repo. diff --git a/go/ironic-hardware-exporter/cmd/main.go b/go/ironic-hardware-exporter/cmd/main.go index bb7accb59..1cf173c88 100644 --- a/go/ironic-hardware-exporter/cmd/main.go +++ b/go/ironic-hardware-exporter/cmd/main.go @@ -10,6 +10,13 @@ import ( "github.com/rackerlabs/understack/go/ironic-hardware-exporter/internal/server" ) +func derefStr(s *string) string { + if s == nil { + return "" + } + return *s +} + func main() { cfg, err := config.Load() if err != nil { @@ -63,8 +70,8 @@ func main() { return } store.UpdateNodeState(stateMsg) - log.Printf("cached state node=%s power=%v provision=%v", - stateMsg.NodeName, stateMsg.PowerState, stateMsg.ProvisionState) + log.Printf("cached state node=%s power=%s provision=%s", + stateMsg.NodeName, derefStr(stateMsg.PowerState), derefStr(stateMsg.ProvisionState)) }); err != nil { log.Fatalf("states consumer stopped: %v", err) } diff --git a/mkdocs.yml b/mkdocs.yml index fa91a2d07..0ab3a5d2c 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -183,6 +183,7 @@ nav: - deploy-guide/components/horizon.md - deploy-guide/components/ingress-nginx.md - deploy-guide/components/ironic.md + - deploy-guide/components/ironic-hardware-exporter.md - deploy-guide/components/karma.md - deploy-guide/components/keystone.md - deploy-guide/components/mariadb-operator.md