Skip to content

Commit

Permalink
bump go lib to 1.21
Browse files Browse the repository at this point in the history
Signed-off-by: Xiangjing Li <[email protected]>
  • Loading branch information
xiangjingli committed Apr 19, 2024
1 parent be8ec83 commit 4319162
Show file tree
Hide file tree
Showing 43 changed files with 715 additions and 822 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-postsubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
# Common versions
GO_VERSION: '1.20'
GO_VERSION: '1.21'
GO_REQUIRED_MIN_VERSION: ''
GOPATH: '/home/runner/work/multicloud-operators-subscription/multicloud-operators-subscription/go'
defaults:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go-presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
# Common versions
GO_VERSION: '1.20'
GO_VERSION: '1.21'
GO_REQUIRED_MIN_VERSION: ''
GOPATH: '/home/runner/work/multicloud-operators-subscription/multicloud-operators-subscription/go'
defaults:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'v*.*.*'
env:
# Common versions
GO_VERSION: '1.20'
GO_VERSION: '1.21'
GO_REQUIRED_MIN_VERSION: ''
GOPATH: '/home/runner/work/multicloud-operators-subscription/multicloud-operators-subscription/go'
GITHUB_REF: ${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.ci.openshift.org/stolostron/builder:go1.20-linux AS plugin-builder
FROM registry.ci.openshift.org/stolostron/builder:go1.21-linux AS plugin-builder
ENV POLICY_GENERATOR_TAG=v1.13.0

WORKDIR /go/src/github.com/open-cluster-management/multicloud-operators-subscription
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile.prow
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.ci.openshift.org/stolostron/builder:go1.20-linux AS builder
FROM registry.ci.openshift.org/stolostron/builder:go1.21-linux AS builder
ENV POLICY_GENERATOR_TAG=v1.13.0

WORKDIR /go/src/github.com/stolostron/multicluster-operators-subscription
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile.rhtap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.20 AS plugin-builder
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.21 AS plugin-builder
ENV POLICY_GENERATOR_TAG=v1.13.0

WORKDIR /go/src/github.com/open-cluster-management/multicloud-operators-subscription
Expand Down
25 changes: 17 additions & 8 deletions cmd/appsubsummary/exec/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package exec

import (
"crypto/tls"
"fmt"
"os"

Expand All @@ -30,14 +31,14 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
k8swebhook "sigs.k8s.io/controller-runtime/pkg/webhook"
)

// Change below variables to serve metrics on different host or port.
var (
metricsHost = "0.0.0.0"
metricsPort = 8391
operatorMetricsPort = 8691
metricsHost = "0.0.0.0"
metricsPort = 8391
)

// RunManager starts the actual manager.
Expand Down Expand Up @@ -74,23 +75,31 @@ func RunManager() {
"renewDeadline", options.LeaderElectionRenewDeadline,
"retryPeriod", options.LeaderElectionRetryPeriod)

webhookServer := k8swebhook.NewServer(k8swebhook.Options{
TLSMinVersion: appsubv1.TLSMinVersionString,
webhookOption := k8swebhook.Options{}
webhookOption.TLSOpts = append(webhookOption.TLSOpts, func(config *tls.Config) {
config.MinVersion = appsubv1.TLSMinVersionInt
})
webhookServer := k8swebhook.NewServer(webhookOption)

// Create a new Cmd to provide shared dependencies and start components
mgr, err := ctrl.NewManager(cfg, ctrl.Options{
MetricsBindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort),
Port: operatorMetricsPort,
Metrics: metricsserver.Options{
BindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort),
},
LeaderElection: enableLeaderElection,
LeaderElectionID: "multicloud-operators-appsubsummary-leader.open-cluster-management.io",
LeaderElectionNamespace: "kube-system",
LeaseDuration: &options.LeaderElectionLeaseDuration,
RenewDeadline: &options.LeaderElectionRenewDeadline,
RetryPeriod: &options.LeaderElectionRetryPeriod,
WebhookServer: webhookServer,
ClientDisableCacheFor: []client.Object{&corev1.Secret{}, &corev1.ServiceAccount{}},
Client: client.Options{
Cache: &client.CacheOptions{
DisableFor: []client.Object{&corev1.Secret{}, &corev1.ServiceAccount{}},
},
},
})

if err != nil {
klog.Error(err, "")
os.Exit(1)
Expand Down
18 changes: 13 additions & 5 deletions cmd/manager/exec/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import (
"open-cluster-management.io/multicloud-operators-subscription/pkg/synchronizer"
"open-cluster-management.io/multicloud-operators-subscription/pkg/utils"
"open-cluster-management.io/multicloud-operators-subscription/pkg/webhook"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
k8swebhook "sigs.k8s.io/controller-runtime/pkg/webhook"
)

Expand Down Expand Up @@ -119,22 +120,29 @@ func RunManager() {
"renewDeadline", Options.LeaderElectionRenewDeadline,
"retryPeriod", Options.LeaderElectionRetryPeriod)

webhookServer := k8swebhook.NewServer(k8swebhook.Options{
TLSMinVersion: appsubv1.TLSMinVersionString,
webhookOption := k8swebhook.Options{}
webhookOption.TLSOpts = append(webhookOption.TLSOpts, func(config *tls.Config) {
config.MinVersion = appsubv1.TLSMinVersionInt
})
webhookServer := k8swebhook.NewServer(webhookOption)

// Create a new Cmd to provide shared dependencies and start components
mgr, err := ctrl.NewManager(cfg, ctrl.Options{
MetricsBindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort),
Port: operatorMetricsPort,
Metrics: metricsserver.Options{
BindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort),
},
LeaderElection: enableLeaderElection,
LeaderElectionID: leaderElectionID,
LeaderElectionNamespace: "kube-system",
LeaseDuration: &Options.LeaderElectionLeaseDuration,
RenewDeadline: &Options.LeaderElectionRenewDeadline,
RetryPeriod: &Options.LeaderElectionRetryPeriod,
WebhookServer: webhookServer,
ClientDisableCacheFor: []client.Object{&corev1.Secret{}, &corev1.ServiceAccount{}},
Client: client.Options{
Cache: &client.CacheOptions{
DisableFor: []client.Object{&corev1.Secret{}, &corev1.ServiceAccount{}},
},
},
})

if err != nil {
Expand Down
13 changes: 9 additions & 4 deletions cmd/placementrule/exec/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package exec

import (
"crypto/tls"
"fmt"
"os"

Expand All @@ -29,6 +30,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
k8swebhook "sigs.k8s.io/controller-runtime/pkg/webhook"
)

Expand Down Expand Up @@ -77,13 +79,16 @@ func RunManager() {
"renewDeadline", options.LeaderElectionRenewDeadline,
"retryPeriod", options.LeaderElectionRetryPeriod)

webhookServer := k8swebhook.NewServer(k8swebhook.Options{
TLSMinVersion: appsubv1.TLSMinVersionString,
webhookOption := k8swebhook.Options{}
webhookOption.TLSOpts = append(webhookOption.TLSOpts, func(config *tls.Config) {
config.MinVersion = appsubv1.TLSMinVersionInt
})
webhookServer := k8swebhook.NewServer(webhookOption)

mgr, err := ctrl.NewManager(cfg, ctrl.Options{
MetricsBindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort),
Port: operatorMetricsPort,
Metrics: metricsserver.Options{
BindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort),
},
LeaderElection: enableLeaderElection,
LeaderElectionID: "multicloud-operators-placementrule-leader.open-cluster-management.io",
LeaderElectionNamespace: "kube-system",
Expand Down
8 changes: 4 additions & 4 deletions cmd/uninstall-crd/uninstall-crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (

subapis "open-cluster-management.io/multicloud-operators-subscription/pkg/apis"
"open-cluster-management.io/multicloud-operators-subscription/pkg/utils"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
)

var (
Expand All @@ -37,8 +38,6 @@ var (
)

func main() {
namespace := v1.NamespaceAll

cfg, err := config.GetConfig()
if err != nil {
klog.Error(err, "")
Expand All @@ -55,8 +54,9 @@ func main() {

// create the clientset for the CR
mgr, err := manager.New(cfg, manager.Options{
Namespace: namespace,
MetricsBindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort),
Metrics: metricsserver.Options{
BindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort),
},
})
if err != nil {
klog.Error(err, "")
Expand Down
Loading

0 comments on commit 4319162

Please sign in to comment.