Compare commits

...

5 Commits

Author SHA1 Message Date
de65f68739 feat: implentation to use a preinstalled cluster issuer to create a certificate 2025-09-16 16:43:32 -04:00
c84b2413ed Merge pull request 'fix: added securityContext.runAsUser:null to argo-cd helm chart so that in okd user group will be randomly assigned within the uid range for the designated namespace' (#156) from fix/argo-cd-redis into master
All checks were successful
Run Check Script / check (push) Successful in 57s
Compile and package harmony_composer / package_harmony_composer (push) Successful in 6m35s
Reviewed-on: #156
2025-09-12 13:54:02 +00:00
f83fd09f11 fix(monitoring): returned namespaced kube metrics
All checks were successful
Run Check Script / check (pull_request) Successful in 55s
2025-09-12 09:49:20 -04:00
c15bd53331 fix: added securityContext.runAsUser:null to argo-cd helm chart so that in okd user group will be randomly assigned within the uid range for the designated namespace
All checks were successful
Run Check Script / check (pull_request) Successful in 59s
2025-09-12 09:29:27 -04:00
6e6f57e38c Merge pull request 'fix: added routes to domain name for prometheus, grafana, alertmanageradded argo cd to the reporting after successfull build' (#155) from fix/add_routes_to_domain into master
All checks were successful
Run Check Script / check (push) Successful in 59s
Compile and package harmony_composer / package_harmony_composer (push) Successful in 6m27s
Reviewed-on: #155
2025-09-10 19:44:53 +00:00
5 changed files with 126 additions and 9 deletions

View File

@@ -194,3 +194,11 @@ impl From<String> for InterpretError {
} }
} }
} }
impl From<serde_yaml::Error> for InterpretError {
fn from(value: serde_yaml::Error) -> Self {
Self {
msg: format!("InterpretError : {value}"),
}
}
}

View File

@@ -160,6 +160,9 @@ global:
## Used for ingresses, certificates, SSO, notifications, etc. ## Used for ingresses, certificates, SSO, notifications, etc.
domain: {domain} domain: {domain}
securityContext:
runAsUser: null
# -- Runtime class name for all components # -- Runtime class name for all components
runtimeClassName: "" runtimeClassName: ""
@@ -471,6 +474,13 @@ redis:
# -- Redis name # -- Redis name
name: redis name: redis
serviceAccount:
create: true
securityContext:
runAsUser: null
## Redis image ## Redis image
image: image:
# -- Redis repository # -- Redis repository

View File

@@ -0,0 +1,106 @@
use std::sync::Arc;
use async_trait::async_trait;
use harmony_types::id::Id;
use serde::Serialize;
use crate::{
data::Version,
interpret::{Interpret, InterpretError, InterpretName, InterpretStatus, Outcome},
inventory::Inventory,
score::Score,
topology::{K8sclient, Topology, k8s::K8sClient},
};
#[derive(Clone, Serialize, Debug)]
pub struct GenerateCaCertScore {
cluster_issuer_name: String,
dns_names: String,
operator_namespace: String,
}
impl<T: Topology + K8sclient> Score<T> for GenerateCaCertScore {
fn name(&self) -> String {
"GenerateCaCertScore".to_string()
}
fn create_interpret(&self) -> Box<dyn Interpret<T>> {
Box::new(GenerateCaCertIntepret {
score: self.clone(),
})
}
}
#[derive(Clone, Serialize, Debug)]
pub struct GenerateCaCertIntepret {
score: GenerateCaCertScore,
}
#[async_trait]
impl<T: Topology + K8sclient> Interpret<T> for GenerateCaCertIntepret {
async fn execute(
&self,
_inventory: &Inventory,
topology: &T,
) -> Result<Outcome, InterpretError> {
let client = topology.k8s_client().await.unwrap();
let cert_yaml = self
.build_cert_request_yaml(&self.score.cluster_issuer_name, &self.score.dns_names)
.unwrap();
self.apply_cert_request(&client, cert_yaml, &self.score.operator_namespace)
.await?;
Ok(Outcome::success("created ca cert".to_string()))
}
fn get_name(&self) -> InterpretName {
InterpretName::Custom("GenerateCaCertInterpret")
}
fn get_version(&self) -> Version {
todo!()
}
fn get_status(&self) -> InterpretStatus {
todo!()
}
fn get_children(&self) -> Vec<Id> {
todo!()
}
}
impl GenerateCaCertIntepret {
pub fn build_cert_request_yaml(
&self,
cluster_issuer_name: &str,
dns_names: &str,
) -> Result<serde_yaml::Value, InterpretError> {
let cert_yaml = format!(
r#"
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: ingress-cert
namespace: openshift-ingress
spec:
secretName: ingress-cert-tls
issuerRef:
name: {cluster_issuer_name}
kind: ClusterIssuer
dnsNames:
- "*.{dns_names}"
"#
);
Ok(serde_yaml::to_value(cert_yaml)?)
}
pub async fn apply_cert_request(
&self,
client: &Arc<K8sClient>,
cert_yaml: serde_yaml::Value,
operator_namespace: &str,
) -> Result<(), InterpretError> {
Ok(client
.apply_yaml(&cert_yaml, Some(operator_namespace))
.await?)
}
}

View File

@@ -1,2 +1,3 @@
mod gen_ca_cert;
mod helm; mod helm;
pub use helm::*; pub use helm::*;

View File

@@ -12,9 +12,6 @@ use std::process::Command;
use crate::modules::k8s::ingress::{K8sIngressScore, PathType}; use crate::modules::k8s::ingress::{K8sIngressScore, PathType};
use crate::modules::monitoring::kube_prometheus::crd::grafana_default_dashboard::build_default_dashboard; use crate::modules::monitoring::kube_prometheus::crd::grafana_default_dashboard::build_default_dashboard;
use crate::modules::monitoring::kube_prometheus::crd::rhob_alertmanager_config::RHOBObservability; use crate::modules::monitoring::kube_prometheus::crd::rhob_alertmanager_config::RHOBObservability;
use crate::modules::monitoring::kube_prometheus::crd::rhob_alertmanagers::{
Alertmanager, AlertmanagerSpec,
};
use crate::modules::monitoring::kube_prometheus::crd::rhob_grafana::{ use crate::modules::monitoring::kube_prometheus::crd::rhob_grafana::{
Grafana, GrafanaDashboard, GrafanaDashboardSpec, GrafanaDatasource, GrafanaDatasourceConfig, Grafana, GrafanaDashboard, GrafanaDashboardSpec, GrafanaDatasource, GrafanaDatasourceConfig,
GrafanaDatasourceSpec, GrafanaSpec, GrafanaDatasourceSpec, GrafanaSpec,
@@ -25,13 +22,8 @@ use crate::modules::monitoring::kube_prometheus::crd::rhob_monitoring_stack::{
use crate::modules::monitoring::kube_prometheus::crd::rhob_prometheus_rules::{ use crate::modules::monitoring::kube_prometheus::crd::rhob_prometheus_rules::{
PrometheusRule, PrometheusRuleSpec, RuleGroup, PrometheusRule, PrometheusRuleSpec, RuleGroup,
}; };
use crate::modules::monitoring::kube_prometheus::crd::rhob_prometheuses::{ use crate::modules::monitoring::kube_prometheus::crd::rhob_prometheuses::LabelSelector;
AlertmanagerEndpoints, LabelSelector, PrometheusSpec, PrometheusSpecAlerting,
};
use crate::modules::monitoring::kube_prometheus::crd::rhob_role::{
build_prom_role, build_prom_rolebinding, build_prom_service_account,
};
use crate::modules::monitoring::kube_prometheus::crd::rhob_service_monitor::{ use crate::modules::monitoring::kube_prometheus::crd::rhob_service_monitor::{
ServiceMonitor, ServiceMonitorSpec, ServiceMonitor, ServiceMonitorSpec,
}; };