Skip to content

Commit

Permalink
fix:github action update go version to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
chuntaojun committed Dec 24, 2023
1 parent 99a959e commit 9f2b4e3
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.20"
go-version: "1.21"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
golangci:
strategy:
matrix:
go-version: [ "1.20" ]
go-version: [ "1.21" ]
name: golangci-lint
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.20"
go-version: "1.21"

- name: Build
id: build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.20"
go-version: "1.21"

- name: Build polairs-controller
run: make build
Expand Down
6 changes: 4 additions & 2 deletions pkg/controller/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ func (p *PolarisController) syncConfigMap(task *Task) error {
metav1.SetMetaDataAnnotation(&operationConfigMap.ObjectMeta, util.PolarisConfigGroup, groupName)
}
// 记录ConfigMap 的 sync 来源 kubernetes 集群
metav1.SetMetaDataLabel(&operationConfigMap.ObjectMeta, util.InternalConfigFileSyncSourceClusterKey, p.config.PolarisController.ClusterName)
metav1.SetMetaDataLabel(&operationConfigMap.ObjectMeta, util.InternalConfigFileSyncSourceClusterKey,
p.config.PolarisController.ClusterName)

cachedConfigMap, ok := p.configFileCache.Load(task.Key())
if !ok {
Expand Down Expand Up @@ -161,7 +162,8 @@ func (p *PolarisController) processSyncNamespaceAndConfigMap(configmap *v1.Confi
func (p *PolarisController) processUpdateConfigMap(old, cur *v1.ConfigMap) error {
log.SyncConfigScope().Infof("Update ConfigMap %s/%s", cur.GetNamespace(), cur.GetName())
if !p.IsPolarisConfigMap(cur) {
log.SyncConfigScope().Infof("user cancel sync ConfigMap %s/%s, delete(%v)", cur.GetNamespace(), cur.GetName(), p.allowDeleteConfig())
log.SyncConfigScope().Infof("user cancel sync ConfigMap %s/%s, delete(%v)", cur.GetNamespace(),
cur.GetName(), p.allowDeleteConfig())
return p.processDeleteConfigMap(cur)
}
_, err := polarisapi.UpdateConfigMap(cur)
Expand Down
6 changes: 4 additions & 2 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,14 @@ func NewPolarisController(

// AllowSyncFromConfigMap 是否开启配置同步从 ConfigMap 到 Polaris
func (p *PolarisController) AllowSyncFromConfigMap() bool {
return p.config.PolarisController.ConfigSync.Enable && p.config.PolarisController.ConfigSync.SyncDirection != util.SyncDirectionPolarisKubernetes
return p.config.PolarisController.ConfigSync.Enable &&
p.config.PolarisController.ConfigSync.SyncDirection != util.SyncDirectionPolarisKubernetes
}

// AllowSyncToConfigMap 是否开启配置同步从 Polaris 到 Kubernetes
func (p *PolarisController) AllowSyncToConfigMap() bool {
return p.config.PolarisController.ConfigSync.Enable && p.config.PolarisController.ConfigSync.SyncDirection != util.SyncDirectionKubernetesToPolaris
return p.config.PolarisController.ConfigSync.Enable &&
p.config.PolarisController.ConfigSync.SyncDirection != util.SyncDirectionKubernetesToPolaris
}

func (p *PolarisController) allowDeleteConfig() bool {
Expand Down
3 changes: 2 additions & 1 deletion pkg/util/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ func (set *SyncSet[K]) Contains(val K) bool {

func (set *SyncSet[K]) String() string {
ret := set.ToSlice()
data, _ := json.Marshal(ret)
data, err := json.Marshal(ret)
_ = err
return string(data)
}

Expand Down

0 comments on commit 9f2b4e3

Please sign in to comment.