Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Cross-Site tests #1431

Merged
merged 1 commit into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions controllers/infinispan_config_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ func configureXSiteTransportTLS(i *v1.Infinispan, c *config.Spec, client client.
}

log.Info("Transport TLS Configured.", "Keystore", keyStoreFileName, "Secret Name", keyStoreSecret.Name)
c.Transport.TLS.Enabled = true
c.Transport.TLS.KeyStore = config.Keystore{
Path: fmt.Sprintf("%s/%s", consts.SiteTransportKeyStoreRoot, keyStoreFileName),
Password: password,
Expand Down
5 changes: 3 additions & 2 deletions controllers/infinispan_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (

const (
InfinispanContainer = "infinispan"
GossipRouterContainer = "gossiprouter"
DataMountPath = consts.ServerRoot + "/data"
OperatorConfMountPath = consts.ServerRoot + "/conf/operator"
DataMountVolume = "data-volume"
Expand Down Expand Up @@ -1357,13 +1358,13 @@ func (r *infinispanRequest) statefulSetForInfinispan(adminSecret, userSecret, ke
}

if ispn.IsSiteTLSEnabled() {
AddSecretVolume(ispn.GetSiteTransportSecretName(), SiteTransportKeystoreVolumeName, consts.SiteTransportKeyStoreRoot, spec)
AddSecretVolume(ispn.GetSiteTransportSecretName(), SiteTransportKeystoreVolumeName, consts.SiteTransportKeyStoreRoot, spec, InfinispanContainer)
secret, err := FindSiteTrustStoreSecret(ispn, r.Client, r.ctx)
if err != nil {
return nil, err
}
if secret != nil {
AddSecretVolume(ispn.GetSiteTrustoreSecretName(), SiteTruststoreVolumeName, consts.SiteTrustStoreRoot, spec)
AddSecretVolume(ispn.GetSiteTrustoreSecretName(), SiteTruststoreVolumeName, consts.SiteTrustStoreRoot, spec, InfinispanContainer)
}
}

Expand Down
8 changes: 4 additions & 4 deletions controllers/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ func chmodInitContainer(containerName, volumeName, mountPath string) corev1.Cont
}

func AddVolumesForEncryption(i *infinispanv1.Infinispan, spec *corev1.PodSpec) {
AddSecretVolume(i.GetKeystoreSecretName(), EncryptKeystoreVolumeName, consts.ServerEncryptKeystoreRoot, spec)
AddSecretVolume(i.GetKeystoreSecretName(), EncryptKeystoreVolumeName, consts.ServerEncryptKeystoreRoot, spec, InfinispanContainer)

if i.IsClientCertEnabled() {
AddSecretVolume(i.GetTruststoreSecretName(), EncryptTruststoreVolumeName, consts.ServerEncryptTruststoreRoot, spec)
AddSecretVolume(i.GetTruststoreSecretName(), EncryptTruststoreVolumeName, consts.ServerEncryptTruststoreRoot, spec, InfinispanContainer)
}
}

// AddSecretVolume creates a volume to a secret
func AddSecretVolume(secretName, volumeName, mountPath string, spec *corev1.PodSpec) {
func AddSecretVolume(secretName, volumeName, mountPath string, spec *corev1.PodSpec, containerName string) {
v := &spec.Volumes

if _, index := findSecretInVolume(spec, volumeName); index < 0 {
Expand All @@ -220,7 +220,7 @@ func AddSecretVolume(secretName, volumeName, mountPath string, spec *corev1.PodS
}

index := -1
volumeMounts := &GetContainer(InfinispanContainer, spec).VolumeMounts
volumeMounts := &GetContainer(containerName, spec).VolumeMounts
for i, vm := range *volumeMounts {
if vm.Name == volumeName {
index = i
Expand Down
6 changes: 3 additions & 3 deletions controllers/xsite.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (r *infinispanRequest) GetGossipRouterDeployment(m *ispnv1.Infinispan, keys
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{{
Name: "gossiprouter",
Name: GossipRouterContainer,
Image: m.ImageName(),
Command: []string{"/opt/gossiprouter/bin/launch.sh"},
Args: args,
Expand All @@ -141,10 +141,10 @@ func (r *infinispanRequest) GetGossipRouterDeployment(m *ispnv1.Infinispan, keys
}

if addKeystoreVolume {
AddSecretVolume(m.GetSiteRouterSecretName(), SiteRouterKeystoreVolumeName, consts.SiteRouterKeyStoreRoot, &deployment.Spec.Template.Spec)
AddSecretVolume(m.GetSiteRouterSecretName(), SiteRouterKeystoreVolumeName, consts.SiteRouterKeyStoreRoot, &deployment.Spec.Template.Spec, GossipRouterContainer)
}
if addTruststoreVolume {
AddSecretVolume(m.GetSiteTrustoreSecretName(), SiteTruststoreVolumeName, consts.SiteTrustStoreRoot, &deployment.Spec.Template.Spec)
AddSecretVolume(m.GetSiteTrustoreSecretName(), SiteTruststoreVolumeName, consts.SiteTrustStoreRoot, &deployment.Spec.Template.Spec, GossipRouterContainer)
}

return deployment, nil
Expand Down