Skip to content

Commit

Permalink
Feature/add ingress class (#800)
Browse files Browse the repository at this point in the history
* support ingress class name

Co-authored-by: wangcanfeng <wangcanfeng@corp.netease.com>
  • Loading branch information
wangcanfengxs and wangcanfeng committed Nov 5, 2021
1 parent f19ac81 commit 3553e9c
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 5 deletions.
3 changes: 3 additions & 0 deletions apis/goharbor.io/v1beta1/harbor_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,9 @@ type HarborExposeIngressSpec struct {

// +kubebuilder:validation:Optional
Annotations map[string]string `json:"annotations,omitempty"`

// +kubebuilder:validation:Optional
IngressClassName *string `json:"ingressClassName,omitempty"`
}

// CertificateInjection defines the certs injection.
Expand Down
5 changes: 5 additions & 0 deletions apis/goharbor.io/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions charts/harbor-operator/templates/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6840,6 +6840,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down Expand Up @@ -6870,6 +6872,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down Expand Up @@ -7639,6 +7643,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down Expand Up @@ -10508,6 +10514,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down Expand Up @@ -10538,6 +10546,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down
10 changes: 6 additions & 4 deletions controllers/goharbor/harbor/ingresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ func (r *Reconciler) GetCoreIngress(ctx context.Context, harbor *goharborv1.Harb
Annotations: r.GetCoreIngressAnnotations(ctx, harbor),
},
Spec: netv1.IngressSpec{
TLS: tls,
Rules: rules,
TLS: tls,
Rules: rules,
IngressClassName: harbor.Spec.Expose.Core.Ingress.IngressClassName,
},
}, nil
}
Expand Down Expand Up @@ -137,8 +138,9 @@ func (r *Reconciler) GetNotaryServerIngress(ctx context.Context, harbor *goharbo
Annotations: r.GetNotaryIngressAnnotations(ctx, harbor),
},
Spec: netv1.IngressSpec{
TLS: tls,
Rules: ingressRules,
TLS: tls,
Rules: ingressRules,
IngressClassName: harbor.Spec.Expose.Notary.Ingress.IngressClassName,
},
}, nil
}
Expand Down
10 changes: 10 additions & 0 deletions manifests/cluster/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6859,6 +6859,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down Expand Up @@ -6889,6 +6891,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down Expand Up @@ -7658,6 +7662,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down Expand Up @@ -10532,6 +10538,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down Expand Up @@ -10562,6 +10570,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down
10 changes: 10 additions & 0 deletions manifests/harbor/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6859,6 +6859,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down Expand Up @@ -6889,6 +6891,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down Expand Up @@ -7658,6 +7662,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down Expand Up @@ -10532,6 +10538,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down Expand Up @@ -10562,6 +10570,8 @@ spec:
type: string
host:
type: string
ingressClassName:
type: string
required:
- host
type: object
Expand Down
3 changes: 2 additions & 1 deletion pkg/cluster/controllers/storage/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ func (m *MinIOController) generateIngress(ctx context.Context, harborcluster *go
Annotations: annotations,
},
Spec: netv1.IngressSpec{
TLS: tls,
TLS: tls,
IngressClassName: harborcluster.Spec.Storage.Spec.MinIO.Redirect.Expose.Ingress.IngressClassName,
Rules: []netv1.IngressRule{
{
Host: harborcluster.Spec.Storage.Spec.MinIO.Redirect.Expose.Ingress.Host,
Expand Down

0 comments on commit 3553e9c

Please sign in to comment.