Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Qihoo360/wayne
Browse files Browse the repository at this point in the history
  • Loading branch information
BennieMeng committed Jan 14, 2020
2 parents f3117a6 + 33d6e0a commit 9085136
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 17 deletions.
1 change: 0 additions & 1 deletion hack/build/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ COPY go.sum /go/src/github.com/Qihoo360/wayne
COPY src/backend /go/src/github.com/Qihoo360/wayne/src/backend

RUN export GO111MODULE=on && \
export GOPROXY=https://goproxy.io && \
cd /go/src/github.com/Qihoo360/wayne/src/backend && \
bee generate docs && \
bee pack -o /_build
Expand Down
2 changes: 1 addition & 1 deletion src/backend/controllers/ingress/ingress_tpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ingress
import (
"encoding/json"
"fmt"

kapiv1beta1 "k8s.io/api/extensions/v1beta1"

"github.com/Qihoo360/wayne/src/backend/controllers/base"
Expand Down
11 changes: 10 additions & 1 deletion src/backend/resources/ingress/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"k8s.io/apimachinery/pkg/api/errors"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"

"github.com/Qihoo360/wayne/src/backend/util/logs"
)

func CreateOrUpdateIngress(c *kubernetes.Clientset, ingress *v1beta1.Ingress) (*Ingress, error) {
Expand All @@ -19,7 +21,14 @@ func CreateOrUpdateIngress(c *kubernetes.Clientset, ingress *v1beta1.Ingress) (*
}
return nil, err
}
ingress.Spec.DeepCopyInto(&old.Spec)

// ingress.Spec.DeepCopyInto(&old.Spec)
// also need update Labels、Annotations、Spec
old.Labels = ingress.Labels
old.Annotations = ingress.Annotations
old.Spec = ingress.Spec
logs.Info("new ingress", old)

kubeIngress, err := c.ExtensionsV1beta1().Ingresses(ingress.Namespace).Update(old)
if err != nil {
return nil, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ <h3 class="header-title">创建 Ingress 模版</h3>
<clr-icon shape="trash"></clr-icon>删除</button>
</label>
<clr-input-container>
<label class="required">域名</label>
<input type="text" clrInput required [ngModelOptions]="{standalone: true}" [(ngModel)]="kubeResource.spec.rules[i].host">
<label>域名</label>
<input type="text" clrInput [ngModelOptions]="{standalone: true}" [(ngModel)]="kubeResource.spec.rules[i].host">
</clr-input-container>
<ng-container *ngFor="let path of kubeResource.spec.rules[i].http.paths; let j = index">
<div class="clr-form-control clr-row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ export class CreateEditIngressTplComponent extends CreateEditResourceTemplate im
return false;
}
for (const rule of this.kubeResource.spec.rules) {
if (rule.host.length === 0) {
return false;
}
if (rule.http.paths.length === 0) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,17 @@ export class CreateEditResourceTemplate {
this.aceEditorService.announceMessage(AceEditorMsg.Instance(resourceObj, true));
}

// 处理资源(挂载系统 label 等)
// 处理资源(挂载系统 label 等)删除 host
generateResource(kubeResource: any): any {
kubeResource.metadata.name = this.resource.name;
kubeResource.metadata.labels = this.generateLabels(this.kubeResource.metadata.labels);
const { rules } = kubeResource.spec;
rules.forEach(rule => {
if (rule.host !== undefined && rule.host.trim() === '') {
delete rule.host;
}
});
console.log('kubeResource', kubeResource);
return kubeResource;
}

Expand Down
9 changes: 1 addition & 8 deletions src/frontend/src/app/shared/default-models/ingress.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@ export const defaultIngress = `{
"name": ""
},
"spec": {
"tls": [
{
"hosts": [
""
],
"secretName": ""
}
],
"tls": [],
"rules": [
{
"host": "",
Expand Down

0 comments on commit 9085136

Please sign in to comment.