Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
## [0.3.8](https://github.com/arangodb/kube-arangodb/tree/0.3.8) (2019-02-19)
[Full Changelog](https://github.com/arangodb/kube-arangodb/compare/0.3.6...0.3.7)

- Wait for shards to be in sync before continuing upgrade process.
- Rotate members when patch-level upgrade.
- Don't trigger cleanout server during upgrade.
- More robust remove-server actions.

## [0.3.8](https://github.com/arangodb/kube-arangodb/tree/0.3.8) (2019-02-19)
[Full Changelog](https://github.com/arangodb/kube-arangodb/compare/0.3.6...0.3.7)

- Added scaling limits to spec and enforce in operator.
- npm update for dashboard to alleviate security problems.
- Added bare metal walk through to documentation.
Expand Down
3 changes: 2 additions & 1 deletion deps/github.com/arangodb/go-driver/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ __test_go_test:
-e TEST_CVERSION=$(TEST_CVERSION) \
-e TEST_CONTENT_TYPE=$(TEST_CONTENT_TYPE) \
-e TEST_PPROF=$(TEST_PPROF) \
-e TEST_MODE=$(TEST_MODE) \
-w /usr/code/ \
golang:$(GOVERSION) \
go test $(TAGS) $(TESTOPTIONS) $(TESTVERBOSEOPTIONS) $(TESTS)
Expand All @@ -337,7 +338,7 @@ ifdef JWTSECRET
echo "$JWTSECRET" > "${JWTSECRETFILE}"
endif
@-docker rm -f -v $(TESTCONTAINER) &> /dev/null
@TESTCONTAINER=$(TESTCONTAINER) ARANGODB=$(ARANGODB) STARTER=$(STARTER) STARTERMODE=$(TEST_MODE) TMPDIR=${GOBUILDDIR} $(CLUSTERENV) $(ROOTDIR)/test/cluster.sh start
@TESTCONTAINER=$(TESTCONTAINER) ARANGODB=$(ARANGODB) ARANGO_LICENSE_KEY=$(ARANGO_LICENSE_KEY) STARTER=$(STARTER) STARTERMODE=$(TEST_MODE) TMPDIR=${GOBUILDDIR} $(CLUSTERENV) $(ROOTDIR)/test/cluster.sh start
endif

__test_cleanup:
Expand Down
4 changes: 4 additions & 0 deletions deps/github.com/arangodb/go-driver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ type VersionInfo struct {
Details map[string]interface{} `json:"details,omitempty"`
}

func (v *VersionInfo) IsEnterprise() bool {
return v.License == "enterprise"
}

// String creates a string representation of the given VersionInfo.
func (v VersionInfo) String() string {
result := fmt.Sprintf("%s, version %s, license %s", v.Server, v.Version, v.License)
Expand Down
49 changes: 38 additions & 11 deletions deps/github.com/arangodb/go-driver/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,40 @@ type ClusterHealth struct {
Health map[ServerID]ServerHealth `json:"Health"`
}

// ServerSyncStatus describes the servers sync status
type ServerSyncStatus string

const (
ServerSyncStatusUnknown ServerSyncStatus = "UNKNOWN"
ServerSyncStatusUndefined ServerSyncStatus = "UNDEFINED"
ServerSyncStatusStartup ServerSyncStatus = "STARTUP"
ServerSyncStatusStopping ServerSyncStatus = "STOPPING"
ServerSyncStatusStopped ServerSyncStatus = "STOPPED"
ServerSyncStatusServing ServerSyncStatus = "SERVING"
ServerSyncStatusShutdown ServerSyncStatus = "SHUTDOWN"
)

// ServerHealth contains health information of a single server in a cluster.
type ServerHealth struct {
Endpoint string `json:"Endpoint"`
LastHeartbeatAcked time.Time `json:"LastHeartbeatAcked"`
LastHeartbeatSent time.Time `json:"LastHeartbeatSent"`
LastHeartbeatStatus string `json:"LastHeartbeatStatus"`
Role ServerRole `json:"Role"`
ShortName string `json:"ShortName"`
Status ServerStatus `json:"Status"`
CanBeDeleted bool `json:"CanBeDeleted"`
HostID string `json:"Host,omitempty"`
Version Version `json:"Version,omitempty"`
Engine EngineType `json:"Engine,omitempty"`
Endpoint string `json:"Endpoint"`
LastHeartbeatAcked time.Time `json:"LastHeartbeatAcked"`
LastHeartbeatSent time.Time `json:"LastHeartbeatSent"`
LastHeartbeatStatus string `json:"LastHeartbeatStatus"`
Role ServerRole `json:"Role"`
ShortName string `json:"ShortName"`
Status ServerStatus `json:"Status"`
CanBeDeleted bool `json:"CanBeDeleted"`
HostID string `json:"Host,omitempty"`
Version Version `json:"Version,omitempty"`
Engine EngineType `json:"Engine,omitempty"`
SyncStatus ServerSyncStatus `json:"SyncStatus,omitempty"`

// Only for Coordinators
AdvertisedEndpoint *string `json:"AdvertisedEndpoint,omitempty"`

// Only for Agents
Leader *string `json:"Leader,omitempty"`
Leading *bool `json:"Leading,omitempty"`
}

// ServerStatus describes the health status of a server
Expand Down Expand Up @@ -146,6 +167,7 @@ type InventoryCollection struct {
Indexes []InventoryIndex `json:"indexes,omitempty"`
PlanVersion int64 `json:"planVersion,omitempty"`
IsReady bool `json:"isReady,omitempty"`
AllInSync bool `json:"allInSync,omitempty"`
}

// IndexByFieldsAndType returns the InventoryIndex with given fields & type.
Expand Down Expand Up @@ -189,6 +211,11 @@ type InventoryCollectionParameters struct {
DistributeShardsLike string `json:"distributeShardsLike,omitempty"`
}

// IsSatellite returns true if the collection is a satellite collection
func (icp *InventoryCollectionParameters) IsSatellite() bool {
return icp.ReplicationFactor == ReplicationFactorSatellite
}

// ShardID is an internal identifier of a specific shard
type ShardID string

Expand Down
150 changes: 150 additions & 0 deletions deps/github.com/arangodb/go-driver/cluster_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ package driver

import (
"context"
"encoding/json"
"path"
"reflect"
)

// newCluster creates a new Cluster implementation.
Expand Down Expand Up @@ -221,3 +223,151 @@ func (c *cluster) RemoveServer(ctx context.Context, serverID ServerID) error {
}
return nil
}

// replicationFactor represents the replication factor of a collection
// Has special value ReplicationFactorSatellite for satellite collections
type replicationFactor int

type inventoryCollectionParametersInternal struct {
Deleted bool `json:"deleted,omitempty"`
DoCompact bool `json:"doCompact,omitempty"`
ID string `json:"id,omitempty"`
IndexBuckets int `json:"indexBuckets,omitempty"`
Indexes []InventoryIndex `json:"indexes,omitempty"`
IsSmart bool `json:"isSmart,omitempty"`
SmartGraphAttribute string `json:"smartGraphAttribute,omitempty"`
IsSystem bool `json:"isSystem,omitempty"`
IsVolatile bool `json:"isVolatile,omitempty"`
JournalSize int64 `json:"journalSize,omitempty"`
KeyOptions struct {
Type string `json:"type,omitempty"`
AllowUserKeys bool `json:"allowUserKeys,omitempty"`
LastValue int64 `json:"lastValue,omitempty"`
} `json:"keyOptions"`
Name string `json:"name,omitempty"`
NumberOfShards int `json:"numberOfShards,omitempty"`
Path string `json:"path,omitempty"`
PlanID string `json:"planId,omitempty"`
ReplicationFactor replicationFactor `json:"replicationFactor,omitempty"`
ShardKeys []string `json:"shardKeys,omitempty"`
Shards map[ShardID][]ServerID `json:"shards,omitempty"`
Status CollectionStatus `json:"status,omitempty"`
Type CollectionType `json:"type,omitempty"`
WaitForSync bool `json:"waitForSync,omitempty"`
DistributeShardsLike string `json:"distributeShardsLike,omitempty"`
}

func (p *InventoryCollectionParameters) asInternal() inventoryCollectionParametersInternal {
return inventoryCollectionParametersInternal{
Deleted: p.Deleted,
DoCompact: p.DoCompact,
ID: p.ID,
IndexBuckets: p.IndexBuckets,
Indexes: p.Indexes,
IsSmart: p.IsSmart,
SmartGraphAttribute: p.SmartGraphAttribute,
IsSystem: p.IsSystem,
IsVolatile: p.IsVolatile,
JournalSize: p.JournalSize,
KeyOptions: p.KeyOptions,
Name: p.Name,
NumberOfShards: p.NumberOfShards,
Path: p.Path,
PlanID: p.PlanID,
ReplicationFactor: replicationFactor(p.ReplicationFactor),
ShardKeys: p.ShardKeys,
Shards: p.Shards,
Status: p.Status,
Type: p.Type,
WaitForSync: p.WaitForSync,
DistributeShardsLike: p.DistributeShardsLike,
}
}

func (p *InventoryCollectionParameters) fromInternal(i inventoryCollectionParametersInternal) {
*p = i.asExternal()
}

func (p *inventoryCollectionParametersInternal) asExternal() InventoryCollectionParameters {
return InventoryCollectionParameters{
Deleted: p.Deleted,
DoCompact: p.DoCompact,
ID: p.ID,
IndexBuckets: p.IndexBuckets,
Indexes: p.Indexes,
IsSmart: p.IsSmart,
SmartGraphAttribute: p.SmartGraphAttribute,
IsSystem: p.IsSystem,
IsVolatile: p.IsVolatile,
JournalSize: p.JournalSize,
KeyOptions: p.KeyOptions,
Name: p.Name,
NumberOfShards: p.NumberOfShards,
Path: p.Path,
PlanID: p.PlanID,
ReplicationFactor: int(p.ReplicationFactor),
ShardKeys: p.ShardKeys,
Shards: p.Shards,
Status: p.Status,
Type: p.Type,
WaitForSync: p.WaitForSync,
DistributeShardsLike: p.DistributeShardsLike,
}
}

// MarshalJSON converts InventoryCollectionParameters into json
func (p *InventoryCollectionParameters) MarshalJSON() ([]byte, error) {
return json.Marshal(p.asInternal())
}

// UnmarshalJSON loads InventoryCollectionParameters from json
func (p *InventoryCollectionParameters) UnmarshalJSON(d []byte) error {
var internal inventoryCollectionParametersInternal
if err := json.Unmarshal(d, &internal); err != nil {
return err
}

p.fromInternal(internal)
return nil
}

const (
replicationFactorSatelliteString string = "satellite"
)

// MarshalJSON marshals InventoryCollectionParameters to arangodb json representation
func (r replicationFactor) MarshalJSON() ([]byte, error) {
var replicationFactor interface{}

if int(r) == ReplicationFactorSatellite {
replicationFactor = replicationFactorSatelliteString
} else {
replicationFactor = int(r)
}

return json.Marshal(replicationFactor)
}

// UnmarshalJSON marshals InventoryCollectionParameters to arangodb json representation
func (r *replicationFactor) UnmarshalJSON(d []byte) error {
var internal interface{}

if err := json.Unmarshal(d, &internal); err != nil {
return err
}

if i, ok := internal.(float64); ok {
*r = replicationFactor(i)
return nil
} else if str, ok := internal.(string); ok {
if ok && str == replicationFactorSatelliteString {
*r = replicationFactor(ReplicationFactorSatellite)
return nil
}
}

return &json.UnmarshalTypeError{
Value: string(d),
Type: reflect.TypeOf(r).Elem(),
}
}
10 changes: 10 additions & 0 deletions deps/github.com/arangodb/go-driver/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@ type CollectionProperties struct {
ReplicationFactor int `json:"replicationFactor,omitempty"`
}

const (
// ReplicationFactorSatellite represents a satellite collection's replication factor
ReplicationFactorSatellite int = -1
)

// IsSatellite returns true if the collection is a satellite collection
func (p *CollectionProperties) IsSatellite() bool {
return p.ReplicationFactor == ReplicationFactorSatellite
}

// SetCollectionPropertiesOptions contains data for Collection.SetProperties.
type SetCollectionPropertiesOptions struct {
// If true then creating or changing a document will wait until the data has been synchronized to disk.
Expand Down
Loading