Skip to content

Commit

Permalink
Revert "Advertise endpoint if set in spec. Immutable."
Browse files Browse the repository at this point in the history
This reverts commit e183277.
  • Loading branch information
maierlars committed Nov 8, 2018
1 parent e183277 commit d977d06
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 47 deletions.
31 changes: 0 additions & 31 deletions pkg/apis/deployment/v1alpha/external_access_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
package v1alpha

import (
"fmt"
"net/url"

"github.com/arangodb/kube-arangodb/pkg/util"
)

Expand All @@ -37,8 +34,6 @@ type ExternalAccessSpec struct {
NodePort *int `json:"nodePort,omitempty"`
// Optional IP used to configure a load-balancer on, in case of Auto or LoadBalancer type.
LoadBalancerIP *string `json:"loadBalancerIP,omitempty"`
// Advertised Endpoint is passed to the coordinators/single servers for advertising a specific endpoint
AdvertisedEndpoint *string `json:"advertisedEndpoint,omitempty"`
}

// GetType returns the value of type.
Expand All @@ -56,27 +51,11 @@ func (s ExternalAccessSpec) GetLoadBalancerIP() string {
return util.StringOrDefault(s.LoadBalancerIP)
}

// GetAdvertisedEndpoint returns the advertised endpoint or empty string if none was specified
func (s ExternalAccessSpec) GetAdvertisedEndpoint() string {
return util.StringOrDefault(s.AdvertisedEndpoint)
}

// HasAdvertisedEndpoint return whether an advertised endpoint was specified or not
func (s ExternalAccessSpec) HasAdvertisedEndpoint() bool {
return s.AdvertisedEndpoint != nil
}

// Validate the given spec
func (s ExternalAccessSpec) Validate() error {
if err := s.GetType().Validate(); err != nil {
return maskAny(err)
}
if s.AdvertisedEndpoint != nil {
ep := s.GetAdvertisedEndpoint()
if _, err := url.Parse(ep); err != nil {
return maskAny(fmt.Errorf("Failed to parse advertised endpoint '%s': %s", ep, err))
}
}
return nil
}

Expand All @@ -95,21 +74,11 @@ func (s *ExternalAccessSpec) SetDefaultsFrom(source ExternalAccessSpec) {
if s.LoadBalancerIP == nil {
s.LoadBalancerIP = util.NewStringOrNil(source.LoadBalancerIP)
}
if s.AdvertisedEndpoint == nil {
s.AdvertisedEndpoint = source.AdvertisedEndpoint
}
}

// ResetImmutableFields replaces all immutable fields in the given target with values from the source spec.
// It returns a list of fields that have been reset.
// Field names are relative to given field prefix.
func (s ExternalAccessSpec) ResetImmutableFields(fieldPrefix string, target *ExternalAccessSpec) []string {
var resetFields []string

// THIS SHOULD NOT BE IMMUTABLE!
if s.GetAdvertisedEndpoint() != target.GetAdvertisedEndpoint() {
target.AdvertisedEndpoint = util.NewStringOrNil(s.AdvertisedEndpoint)
resetFields = append(resetFields, fieldPrefix+".advertisedEndpoint")
}
return nil
}
5 changes: 0 additions & 5 deletions pkg/apis/deployment/v1alpha/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion pkg/deployment/reconcile/action_cleanout_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (a *actionCleanoutMember) CheckProgress(ctx context.Context) (bool, bool, e
}
// do not try to clean out a pod that was not initialized
if !m.IsInitialized {
return true, false, nil
return false, true, nil
}
c, err := a.actionCtx.GetDatabaseClient(ctx)
if err != nil {
Expand Down
10 changes: 0 additions & 10 deletions pkg/deployment/resources/pod_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,6 @@ func createArangodArgs(apiObject metav1.Object, deplSpec api.DeploymentSpec, gro
optionPair{"--foxx.queues", "true"},
optionPair{"--server.statistics", "true"},
)
if deplSpec.ExternalAccess.HasAdvertisedEndpoint() {
options = append(options,
optionPair{"--cluster.my-advertised-endpoint", deplSpec.ExternalAccess.GetAdvertisedEndpoint()},
)
}
case api.ServerGroupSingle:
options = append(options,
optionPair{"--foxx.queues", "true"},
Expand All @@ -197,11 +192,6 @@ func createArangodArgs(apiObject metav1.Object, deplSpec api.DeploymentSpec, gro
optionPair{"--cluster.my-address", myTCPURL},
optionPair{"--cluster.my-role", "SINGLE"},
)
if deplSpec.ExternalAccess.HasAdvertisedEndpoint() {
options = append(options,
optionPair{"--cluster.my-advertised-endpoint", deplSpec.ExternalAccess.GetAdvertisedEndpoint()},
)
}
}
}
if addAgentEndpoints {
Expand Down

0 comments on commit d977d06

Please sign in to comment.