Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use discovery addr #554

Merged
merged 7 commits into from
Oct 9, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/test_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
- name: run
uses: ./.github/actions/e2e
with:
mo_version: "1.0.0-rc1"
mo_version: "1.2.3"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SHELL=/usr/bin/env bash -o pipefail
REPO ?= "matrixorigin/matrixone-operator"
TAG ?= "latest"
GOPROXY ?= "https://proxy.golang.org,direct"
MO_VERSION ?= "nightly-d98832bb"
MO_VERSION ?= "1.2.3"
MO_IMAGE_REPO ?= "matrixorigin/matrixone"
BRANCH ?= main
ENVTEST_K8S_VERSION = 1.24.1
Expand Down
15 changes: 15 additions & 0 deletions api/core/v1alpha1/common_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ const (
reasonEmpty = "empty"
)

var (
LatestOpVersion = semver.MustParse("1.3.0")
)

func (c *ConditionalStatus) SetCondition(condition metav1.Condition) {
if c.Conditions == nil {
c.Conditions = []metav1.Condition{}
Expand Down Expand Up @@ -293,3 +297,14 @@ func (p *PodSet) GetSemVer() (*semver.Version, bool) {
}
return &v, true
}

func (p *PodSet) GetOperatorVersion() semver.Version {
if p.OperatorVersion == nil {
return LatestOpVersion
}
v, err := semver.ParseTolerant(*p.OperatorVersion)
if err != nil {
return LatestOpVersion
}
return v
}
4 changes: 4 additions & 0 deletions api/core/v1alpha1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ type PodSet struct {
// reconciliations
// +optional
SemanticVersion *string `json:"semanticVersion,omitempty"`

// OperatorVersion is the controller version of mo-operator that should be used to
// reconcile this set
OperatorVersion *string `json:"operatorVersion,omitempty"`
}

// MainContainer is the description of the main container of a Pod
Expand Down
32 changes: 32 additions & 0 deletions api/core/v1alpha1/controller_version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2024 Matrix Origin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package v1alpha1

import "github.com/blang/semver/v4"

type Gate string

var (
gateVersions = map[Gate][]semver.Version{}
)

func (g Gate) Enabled(v semver.Version) bool {
for _, minVersion := range gateVersions[g] {
if versionPrecedes(minVersion, v) {
return true
}
}
return false
}
2 changes: 2 additions & 0 deletions api/core/v1alpha1/matrixonecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ type MatrixOneClusterSpec struct {
// reconciliations
// +optional
SemanticVersion *string `json:"semanticVersion,omitempty"`

OperatorVersion *string `json:"operatorVersion,omitempty"`
}

func (m *MatrixOneCluster) GetMetricReaderEnabled() bool {
Expand Down
9 changes: 6 additions & 3 deletions api/core/v1alpha1/semver.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ const (
MOFeaturePipelineInfo MOFeature = "PipelineInfo"
MOFeatureSessionSource MOFeature = "SessionSource"
MOFeatureLockMigration MOFeature = "LockMigration"

MOFeatureDiscoveryFixed MOFeature = "DiscoveryFixed"
)

var (
featureVersions = map[MOFeature][]semver.Version{
MOFeaturePipelineInfo: {semver.MustParse("1.1.2"), semver.MustParse("1.2.0")},
MOFeatureSessionSource: {semver.MustParse("1.1.2"), semver.MustParse("1.2.0")},
MOFeatureLockMigration: {semver.MustParse("1.2.0")},
MOFeaturePipelineInfo: {semver.MustParse("1.1.2"), semver.MustParse("1.2.0")},
MOFeatureSessionSource: {semver.MustParse("1.1.2"), semver.MustParse("1.2.0")},
MOFeatureLockMigration: {semver.MustParse("1.2.0")},
MOFeatureDiscoveryFixed: {semver.MustParse("2.0.0")},
}

MinimalVersion = semver.Version{Major: 0, Minor: 0, Patch: 0}
Expand Down
10 changes: 10 additions & 0 deletions api/core/v1alpha1/zz_generated.deepcopy.go

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

4 changes: 2 additions & 2 deletions charts/kruise/templates/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ spec:
command:
- /manager
image: {{ .Values.manager.image.repository }}:{{ .Values.manager.image.tag }}
imagePullPolicy: Always
imagePullPolicy: {{ .Values.imagePullPolicy }}
name: manager
env:
{{- if .Values.enableKubeCacheMutationDetector }}
Expand Down Expand Up @@ -193,7 +193,7 @@ spec:
- --feature-gates={{ .Values.featureGates }}
- --socket-file={{ .Values.daemon.socketFile }}
image: {{ .Values.manager.image.repository }}:{{ .Values.manager.image.tag }}
imagePullPolicy: Always
imagePullPolicy: {{ .Values.imagePullPolicy }}
name: daemon
env:
{{- if .Values.enableKubeCacheMutationDetector }}
Expand Down
2 changes: 2 additions & 0 deletions charts/kruise/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,5 @@ daemon:

serviceAccount:
annotations: {}

imagePullPolicy: IfNotPresent
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
pauseUpdate:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
pauseUpdate:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
promDiscoveryScheme:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
promDiscoveryScheme:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
pauseUpdate:
Expand Down Expand Up @@ -489,6 +494,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
pauseUpdate:
Expand Down Expand Up @@ -824,6 +834,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
promDiscoveryScheme:
Expand Down Expand Up @@ -1021,6 +1036,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
promDiscoveryScheme:
Expand Down Expand Up @@ -1247,6 +1267,8 @@ spec:
NodeSelector specifies default node selector for all components,
this will be overridden by component-level config
type: object
operatorVersion:
type: string
proxy:
description: Proxy defines an optional MO Proxy of this cluster
properties:
Expand Down Expand Up @@ -1288,6 +1310,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
promDiscoveryScheme:
Expand Down Expand Up @@ -1462,6 +1489,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
promDiscoveryScheme:
Expand Down Expand Up @@ -1670,6 +1702,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
pauseUpdate:
Expand Down Expand Up @@ -1979,6 +2016,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
promDiscoveryScheme:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
promDiscoveryScheme:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
promDiscoveryScheme:
Expand Down
5 changes: 5 additions & 0 deletions deploy/crds/core.matrixorigin.io_cnpools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
pauseUpdate:
Expand Down
5 changes: 5 additions & 0 deletions deploy/crds/core.matrixorigin.io_cnsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
pauseUpdate:
Expand Down
5 changes: 5 additions & 0 deletions deploy/crds/core.matrixorigin.io_dnsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
promDiscoveryScheme:
Expand Down
5 changes: 5 additions & 0 deletions deploy/crds/core.matrixorigin.io_logsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ spec:
additionalProperties:
type: string
type: object
operatorVersion:
description: |-
OperatorVersion is the controller version of mo-operator that should be used to
reconcile this set
type: string
overlay:
x-kubernetes-preserve-unknown-fields: true
promDiscoveryScheme:
Expand Down
Loading
Loading