Skip to content

Commit

Permalink
Use manifestutils and naming functions
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
  • Loading branch information
rubenvp8510 committed Jul 4, 2024
1 parent 5c0c525 commit 6335d66
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions internal/manifests/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func BuildDistributor(params manifestutils.Params) ([]client.Object, error) {

if tempo.Spec.Template.Distributor.TLS.Enabled {
if params.CtrlConfig.Gates.OpenShift.DistributorServingCertsService {
caSecretName := getTLSConfigMapName(tempo.Name)
caSecretName := naming.ServingCABundleName(tempo.Name)
certSecretName := getTLSSecretName(tempo.Name)
err = configureReceiversTLS(dep, caSecretName, certSecretName)
if err != nil {
Expand Down Expand Up @@ -361,26 +361,10 @@ func service(tempo v1alpha1.TempoStack) *corev1.Service {
func getTLSSecretName(tempoName string) string {
return fmt.Sprintf("%s-distributor-tls", tempoName)
}
func getTLSConfigMapName(tempoName string) string {
return fmt.Sprintf("%s-distributor-ca", tempoName)
}

func getConfigmapCABundle(tempo v1alpha1.TempoStack) *corev1.ConfigMap {
name := getTLSConfigMapName(tempo.Name)
annotations := map[string]string{
"service.beta.openshift.io/inject-cabundle": "true",
}

return &corev1.ConfigMap{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1",
Kind: "ConfigMap",
},
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: tempo.Namespace,
Annotations: annotations,
Labels: manifestutils.ComponentLabels(manifestutils.DistributorComponentName, tempo.Name),
},
}
return manifestutils.NewConfigMapCABundle(tempo.Namespace,
naming.ServingCABundleName(tempo.Name),
manifestutils.ComponentLabels(manifestutils.DistributorComponentName, tempo.Name),
)
}

0 comments on commit 6335d66

Please # to comment.