Skip to content

Commit

Permalink
🐛 Provide the default name for BYO (#1070)
Browse files Browse the repository at this point in the history
* Provide the default name for BYO

Signed-off-by: clyang82 <[email protected]>

* Fix client certs issue

Signed-off-by: clyang82 <[email protected]>

---------

Signed-off-by: clyang82 <[email protected]>
  • Loading branch information
clyang82 authored Aug 22, 2024
1 parent e042809 commit 4129196
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions operator/pkg/controllers/addon/addon_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (a *AddonController) Start(ctx context.Context) error {
)).
WithScheme(addonScheme)
if config.TransporterProtocol() == transport.StrimziTransporter {
factory.WithAgentRegistrationOption(newRegistrationOption(operatorconstants.GHManagedClusterAddonName))
factory.WithAgentRegistrationOption(newRegistrationOption())
}
agentAddon, err := factory.BuildTemplateAgentAddon()
if err != nil {
Expand All @@ -145,7 +145,7 @@ func (a *AddonController) AddonManager() addonmanager.AddonManager {
return a.addonManager
}

func newRegistrationOption(addonName string) *agent.RegistrationOption {
func newRegistrationOption() *agent.RegistrationOption {
return &agent.RegistrationOption{
CSRConfigurations: certificates.SignerAndCsrConfigurations,
CSRApproveCheck: certificates.Approve,
Expand Down
3 changes: 1 addition & 2 deletions operator/pkg/controllers/addon/addon_controller_manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
globalhubv1alpha4 "github.com/stolostron/multicluster-global-hub/operator/api/operator/v1alpha4"
"github.com/stolostron/multicluster-global-hub/operator/pkg/config"
operatorconstants "github.com/stolostron/multicluster-global-hub/operator/pkg/constants"
"github.com/stolostron/multicluster-global-hub/operator/pkg/controllers/addon/certificates"
"github.com/stolostron/multicluster-global-hub/operator/pkg/utils"
"github.com/stolostron/multicluster-global-hub/pkg/constants"
"github.com/stolostron/multicluster-global-hub/pkg/transport"
Expand Down Expand Up @@ -238,7 +237,7 @@ func (a *HohAgentAddon) GetValues(cluster *clusterv1.ManagedCluster,
KafkaCACert: kafkaConnection.CACert,
KafkaClientCert: kafkaConnection.ClientCert,
KafkaClientKey: kafkaConnection.ClientKey,
KafkaClientCertSecret: certificates.AgentCertificateSecretName(),
KafkaClientCertSecret: kafkaConnection.ClientSecretName,
KafkaClusterCASecret: kafkaConnection.CASecretName,
KafkaConsumerTopic: clusterTopic.SpecTopic,
KafkaProducerTopic: clusterTopic.StatusTopic,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ spec:
volumes:
- name: kafka-cluster-ca
secret:
secretName: kafka-cluster-ca-cert
secretName: {{.KafkaClusterCASecret}}
- name: kafka-client-certs
secret:
secretName: {{.KafkaClientCertSecret}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
apiVersion: v1
kind: Secret
metadata:
name: kafka-certs-secret
name: {{.KafkaClientCertSecret}}
namespace: {{ .AddonInstallNamespace }}
labels:
addon.open-cluster-management.io/hosted-manifest-location: none
type: Opaque
data:
"ca.crt": "{{.KafkaCACert}}"
"client.crt": "{{.KafkaClientCert}}"
"client.key": "{{.KafkaClientKey}}"
"tls.crt": "{{.KafkaClientCert}}"
"tls.key": "{{.KafkaClientKey}}"
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,8 @@ func (s *BYOTransporter) GetConnCredential(clusterName string) (*transport.Kafka
// for the byo case, the status topic isn't change by the clusterName
StatusTopic: config.GetStatusTopic(""),
SpecTopic: config.GetSpecTopic(),
// temporarily to fix the blocker. they should be removed after get the kafka configurations from a secret
CASecretName: "kafka-cluster-ca-cert",
ClientSecretName: "kafka-certs-secret",
}, nil
}

0 comments on commit 4129196

Please sign in to comment.