mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Improvement] ArangoDB image validation (=>3.10) for ARM64 architecture (#1161)
This commit is contained in:
parent
60c7a35331
commit
2f94237256
8 changed files with 48 additions and 11 deletions
|
@ -14,6 +14,7 @@
|
|||
- (Dependencies) Bump K8S Dependencies to 1.22.15
|
||||
- (Bugfix) Unlock broken inspectors
|
||||
- (Debug) Allow to send package to stdout
|
||||
- (Improvement) ArangoDB image validation (=>3.10) for ARM64 architecture
|
||||
|
||||
## [1.2.20](https://github.com/arangodb/kube-arangodb/tree/1.2.20) (2022-10-25)
|
||||
- (Feature) Add action progress
|
||||
|
|
5
Makefile
5
Makefile
|
@ -39,7 +39,8 @@ ifndef KEEP_GOPATH
|
|||
endif
|
||||
|
||||
GOBUILDARGS ?=
|
||||
GOVERSION := 1.17-alpine3.15
|
||||
GOBASEVERSION := 1.17
|
||||
GOVERSION := $(GOBASEVERSION)-alpine3.15
|
||||
DISTRIBUTION := alpine:3.15
|
||||
|
||||
PULSAR := $(GOBUILDDIR)/bin/pulsar$(shell go env GOEXE)
|
||||
|
@ -482,7 +483,7 @@ patch-chart:
|
|||
|
||||
.PHONY: tidy
|
||||
tidy:
|
||||
@go mod tidy
|
||||
@go mod tidy -compat=$(GOBASEVERSION)
|
||||
|
||||
.PHONY: deps-reload
|
||||
deps-reload: tidy init
|
||||
|
|
|
@ -78,6 +78,8 @@ const (
|
|||
ConditionTypeUpgradeFailed ConditionType = "UpgradeFailed"
|
||||
// ConditionTypeArchitectureMismatch indicates that the member has a different architecture than the deployment.
|
||||
ConditionTypeArchitectureMismatch ConditionType = "ArchitectureMismatch"
|
||||
// ConditionTypeArchitectureChangeCannotBeApplied indicates that the member has a different architecture than the requested one.
|
||||
ConditionTypeArchitectureChangeCannotBeApplied ConditionType = "ArchitectureChangeCannotBeApplied"
|
||||
|
||||
// ConditionTypeMemberMaintenanceMode indicates that Maintenance is enabled on particular member
|
||||
ConditionTypeMemberMaintenanceMode ConditionType = "MemberMaintenanceMode"
|
||||
|
|
|
@ -103,6 +103,7 @@ func removeMemberConditionsMapFunc(m *api.MemberStatus) {
|
|||
m.Conditions.Remove(api.MemberReplacementRequired)
|
||||
m.Conditions.Remove(api.ConditionTypePVCResizePending)
|
||||
m.Conditions.Remove(api.ConditionTypeArchitectureMismatch)
|
||||
m.Conditions.Remove(api.ConditionTypeArchitectureChangeCannotBeApplied)
|
||||
|
||||
m.RemoveTerminationsBefore(time.Now().Add(-1 * recentTerminationsKeepPeriod))
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import (
|
|||
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
|
||||
"github.com/arangodb/kube-arangodb/pkg/deployment/reconcile"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
|
||||
)
|
||||
|
||||
func (d *Deployment) createAgencyMapping(ctx context.Context) error {
|
||||
|
@ -127,7 +128,13 @@ func (d *Deployment) renderMember(spec api.DeploymentSpec, status *api.Deploymen
|
|||
}
|
||||
deploymentName := apiObject.GetName()
|
||||
role := group.AsRole()
|
||||
|
||||
arch := apiObject.GetAcceptedSpec().Architecture.GetDefault()
|
||||
if arch != api.ArangoDeploymentArchitectureAMD64 && apiObject.Status.CurrentImage.ArangoDBVersion.CompareTo("3.10.0") < 0 {
|
||||
arch = api.ArangoDeploymentArchitectureAMD64
|
||||
d.log.Str("arch", string(arch)).Warn("Cannot render pod with requested arch. It's not supported in ArangoDB < 3.10.0. Defaulting architecture to AMD64")
|
||||
d.CreateEvent(k8sutil.NewCannotSetArchitectureEvent(d.GetAPIObject(), string(arch), id))
|
||||
}
|
||||
|
||||
switch group {
|
||||
case api.ServerGroupSingle:
|
||||
|
|
|
@ -32,6 +32,8 @@ import (
|
|||
|
||||
// PlanBuilderContext contains context methods provided to plan builders.
|
||||
type PlanBuilderContext interface {
|
||||
reconciler.DeploymentStatusUpdate
|
||||
|
||||
reconciler.DeploymentInfoGetter
|
||||
reconciler.DeploymentAgencyMaintenance
|
||||
reconciler.ArangoMemberContext
|
||||
|
|
|
@ -22,6 +22,7 @@ package reconcile
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
|
@ -45,15 +46,28 @@ func (r *Reconciler) createChangeMemberArchPlan(ctx context.Context,
|
|||
|
||||
if pod, ok := cache.Pod().V1().GetSimple(member.Pod.GetName()); ok {
|
||||
if v, ok := pod.GetAnnotations()[deployment.ArangoDeploymentPodChangeArchAnnotation]; ok {
|
||||
arch := api.ArangoDeploymentArchitectureType(v)
|
||||
if arch.IsArchMismatch(spec.Architecture, member.Architecture) {
|
||||
r.log.
|
||||
Str("pod-name", member.Pod.GetName()).
|
||||
Str("server-group", m.Group.AsRole()).
|
||||
Warn("try changing an Architecture type, but %s", getRequiredRotateMessage(member.Pod.GetName()))
|
||||
p = append(p,
|
||||
actions.NewAction(api.ActionTypeSetCurrentMemberArch, m.Group, member, "Architecture Mismatch").SetArch(arch),
|
||||
)
|
||||
archToApply := api.ArangoDeploymentArchitectureType(v)
|
||||
if archToApply.IsArchMismatch(spec.Architecture, member.Architecture) {
|
||||
if archToApply != api.ArangoDeploymentArchitectureAMD64 && status.CurrentImage.ArangoDBVersion.CompareTo("3.10.0") < 0 {
|
||||
if member.Conditions.Update(api.ConditionTypeArchitectureChangeCannotBeApplied, true,
|
||||
fmt.Sprintf("Member has ArangoDB in version which not supports Architecture change (%s)", archToApply), "") {
|
||||
r.log.Warn("Cannot apply 'arch' annotation changes. It's not supported in ArangoDB < 3.10.0")
|
||||
context.CreateEvent(k8sutil.NewCannotSetArchitectureEvent(apiObject, string(archToApply), member.ID))
|
||||
context.CreateEvent(k8sutil.NewCannotSetArchitectureEvent(pod, string(archToApply), member.ID))
|
||||
|
||||
if err := context.UpdateMember(ctx, member); err != nil {
|
||||
r.log.Error("Can not save member condition", member.ID, api.ConditionTypeArchitectureChangeCannotBeApplied, err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
r.log.
|
||||
Str("pod-name", member.Pod.GetName()).
|
||||
Str("server-group", m.Group.AsRole()).
|
||||
Warn("try changing an Architecture type, but %s", getRequiredRotateMessage(member.Pod.GetName()))
|
||||
p = append(p,
|
||||
actions.NewAction(api.ActionTypeSetCurrentMemberArch, m.Group, member, "Architecture Mismatch").SetArch(archToApply),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,3 +283,12 @@ func NewOperatorEngineOpsAlertEvent(reason string, apiObject APIObject) *Event {
|
|||
event.Message = fmt.Sprintf("Event OperatorEngineOpsAlert raised, investigation needed: %s", reason)
|
||||
return event
|
||||
}
|
||||
|
||||
// NewCannotSetArchitectureEvent creates an even of type CannotSetArchitectureEvent.
|
||||
func NewCannotSetArchitectureEvent(apiObject runtime.Object, arch, memberId string) *Event {
|
||||
event := newDeploymentEvent(apiObject)
|
||||
event.Type = core.EventTypeWarning
|
||||
event.Reason = "Can not set architecture"
|
||||
event.Message = fmt.Sprintf("Can not apply %s arch for member %s. It is not supported in current ArangoDB version", arch, memberId)
|
||||
return event
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue