Skip to content

Commit

Permalink
revert(lb) revert loadblance from 1.0
Browse files Browse the repository at this point in the history
Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
  • Loading branch information
Ghostbaby authored and bitsf committed Sep 10, 2021
1 parent 23729c5 commit 13b3663
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 559 deletions.
11 changes: 0 additions & 11 deletions apis/goharbor.io/v1beta1/harbor_types.go
Expand Up @@ -662,9 +662,6 @@ type HarborExposeSpec struct {
// +kubebuilder:validation:Optional
// The ingress of the notary, required when notary component enabled.
Notary *HarborExposeComponentSpec `json:"notary,omitempty"`

// +kubebuilder:validation:Optional
Portal *HarborExposeComponentSpec `json:"portal,omitempty"`
}

type HarborExposeComponentSpec struct {
Expand All @@ -673,14 +670,6 @@ type HarborExposeComponentSpec struct {

// +kubebuilder:validation:Optional
Ingress *HarborExposeIngressSpec `json:"ingress,omitempty"`

// +kubebuilder:validation:Optional
LoadBalancer *HarborExposeLBSpec `json:"loadbalancer,omitempty"`
}

type HarborExposeLBSpec struct {
// +kubebuilder:validation:Optional
Enable bool `json:"enable,omitempty"`
}

type HarborExposeIngressSpec struct {
Expand Down
33 changes: 0 additions & 33 deletions apis/goharbor.io/v1beta1/harborcluster_webhook.go
Expand Up @@ -117,10 +117,6 @@ func (harborcluster *HarborCluster) validate(old *HarborCluster) error {
allErrs = append(allErrs, err)
}

if err := harborcluster.validateExpose(); err != nil {
allErrs = append(allErrs, err)
}

if old == nil { // create harbor resource
if err := version.Validate(harborcluster.Spec.Version); err != nil {
allErrs = append(allErrs, field.Invalid(field.NewPath("spec").Child("version"), harborcluster.Spec.Version, err.Error()))
Expand Down Expand Up @@ -216,39 +212,10 @@ func (harborcluster *HarborCluster) validateCache() *field.Error {
return nil
}

func (harborcluster *HarborCluster) validateExpose() *field.Error {
core := field.NewPath("spec").Child("expose").Child("core")

if harborcluster.Spec.Expose.Core.LoadBalancer != nil &&
harborcluster.Spec.Expose.Core.Ingress != nil {
lb := core.Child("loadbalancer")
ingress := core.Child("ingress")

return forbidden(ingress, lb)
}

notary := field.NewPath("spec").Child("expose").Child("notary")

if harborcluster.Spec.Expose.Notary != nil &&
harborcluster.Spec.Expose.Notary.LoadBalancer != nil &&
harborcluster.Spec.Expose.Notary.Ingress != nil {
lb := notary.Child("loadbalancer")
ingress := notary.Child("ingress")

return forbidden(ingress, lb)
}

return nil
}

func required(mainPath *field.Path) *field.Error {
return field.Required(mainPath, fmt.Sprintf("%s should be configured", mainPath.String()))
}

func invalid(mainPath *field.Path, value interface{}, details string) *field.Error {
return field.Invalid(mainPath, value, details)
}

func forbidden(mainPath fmt.Stringer, conflictPath *field.Path) *field.Error {
return field.Forbidden(conflictPath, fmt.Sprintf("conflicts: %s should not be configured as %s has been configured already", conflictPath.String(), mainPath.String()))
}
25 changes: 0 additions & 25 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.

93 changes: 0 additions & 93 deletions charts/harbor-operator/templates/crds.yaml
Expand Up @@ -6843,11 +6843,6 @@ spec:
required:
- host
type: object
loadbalancer:
properties:
enable:
type: boolean
type: object
tls:
properties:
certificateRef:
Expand Down Expand Up @@ -6878,45 +6873,6 @@ spec:
required:
- host
type: object
loadbalancer:
properties:
enable:
type: boolean
type: object
tls:
properties:
certificateRef:
pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'
type: string
type: object
type: object
portal:
properties:
ingress:
properties:
annotations:
additionalProperties:
type: string
type: object
controller:
default: default
description: Set to the type of ingress controller.
enum:
- default
- gce
- ncp
- contour
type: string
host:
type: string
required:
- host
type: object
loadbalancer:
properties:
enable:
type: boolean
type: object
tls:
properties:
certificateRef:
Expand Down Expand Up @@ -7686,11 +7642,6 @@ spec:
required:
- host
type: object
loadbalancer:
properties:
enable:
type: boolean
type: object
tls:
properties:
certificateRef:
Expand Down Expand Up @@ -10560,11 +10511,6 @@ spec:
required:
- host
type: object
loadbalancer:
properties:
enable:
type: boolean
type: object
tls:
properties:
certificateRef:
Expand Down Expand Up @@ -10595,45 +10541,6 @@ spec:
required:
- host
type: object
loadbalancer:
properties:
enable:
type: boolean
type: object
tls:
properties:
certificateRef:
pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'
type: string
type: object
type: object
portal:
properties:
ingress:
properties:
annotations:
additionalProperties:
type: string
type: object
controller:
default: default
description: Set to the type of ingress controller.
enum:
- default
- gce
- ncp
- contour
type: string
host:
type: string
required:
- host
type: object
loadbalancer:
properties:
enable:
type: boolean
type: object
tls:
properties:
certificateRef:
Expand Down

0 comments on commit 13b3663

Please sign in to comment.