mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-04 12:47:36 +08:00
[FIX] secret not found
This commit is contained in:
parent
74633ec749
commit
408ace2142
@ -28,7 +28,7 @@ import (
|
|||||||
"github.com/goodrain/rainbond/db/model"
|
"github.com/goodrain/rainbond/db/model"
|
||||||
"github.com/goodrain/rainbond/event"
|
"github.com/goodrain/rainbond/event"
|
||||||
"github.com/goodrain/rainbond/gateway/annotations/parser"
|
"github.com/goodrain/rainbond/gateway/annotations/parser"
|
||||||
v1 "github.com/goodrain/rainbond/worker/appm/types/v1"
|
"github.com/goodrain/rainbond/worker/appm/types/v1"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
extensions "k8s.io/api/extensions/v1beta1"
|
extensions "k8s.io/api/extensions/v1beta1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -155,14 +155,14 @@ func (a *AppServiceBuild) Build() (*v1.K8sResources, error) {
|
|||||||
if port.IsOuterService {
|
if port.IsOuterService {
|
||||||
service := a.createOuterService(port)
|
service := a.createOuterService(port)
|
||||||
services = append(services, service)
|
services = append(services, service)
|
||||||
ings, secret, err := a.ApplyRules(port, service)
|
ings, secrs, err := a.ApplyRules(port, service)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Debugf("error applying rules: %s", err.Error())
|
logrus.Debugf("error applying rules: %s", err.Error())
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ingresses = append(ingresses, ings...)
|
ingresses = append(ingresses, ings...)
|
||||||
if secret != nil {
|
if secrs != nil {
|
||||||
secrets = append(secrets, secret)
|
secrets = append(secrets, secrs...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,9 +185,9 @@ func (a *AppServiceBuild) Build() (*v1.K8sResources, error) {
|
|||||||
|
|
||||||
// ApplyRules applies http rules and tcp rules
|
// ApplyRules applies http rules and tcp rules
|
||||||
func (a AppServiceBuild) ApplyRules(port *model.TenantServicesPort,
|
func (a AppServiceBuild) ApplyRules(port *model.TenantServicesPort,
|
||||||
service *corev1.Service) ([]*extensions.Ingress, *corev1.Secret, error) {
|
service *corev1.Service) ([]*extensions.Ingress, []*corev1.Secret, error) {
|
||||||
var ingresses []*extensions.Ingress
|
var ingresses []*extensions.Ingress
|
||||||
var secret *corev1.Secret
|
var secrets []*corev1.Secret
|
||||||
httpRules, err := a.dbmanager.HTTPRuleDao().GetHTTPRuleByServiceIDAndContainerPort(port.ServiceID,
|
httpRules, err := a.dbmanager.HTTPRuleDao().GetHTTPRuleByServiceIDAndContainerPort(port.ServiceID,
|
||||||
port.ContainerPort)
|
port.ContainerPort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -203,7 +203,7 @@ func (a AppServiceBuild) ApplyRules(port *model.TenantServicesPort,
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ingresses = append(ingresses, ing)
|
ingresses = append(ingresses, ing)
|
||||||
secret = sec
|
secrets = append(secrets, sec)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ func (a AppServiceBuild) ApplyRules(port *model.TenantServicesPort,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ingresses, secret, nil
|
return ingresses, secrets, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// applyTCPRule applies stream rule into ingress
|
// applyTCPRule applies stream rule into ingress
|
||||||
@ -296,7 +296,7 @@ func (a *AppServiceBuild) applyHTTPRule(rule *model.HTTPRule, port *model.Tenant
|
|||||||
// create secret
|
// create secret
|
||||||
sec = &corev1.Secret{
|
sec = &corev1.Secret{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: rule.UUID,
|
Name: rule.UUID, // TODO: one cert, one secret
|
||||||
Namespace: a.tenant.UUID,
|
Namespace: a.tenant.UUID,
|
||||||
Labels: a.appService.GetCommonLabels(),
|
Labels: a.appService.GetCommonLabels(),
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user