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

Update CAPI dependencies to 1.2.0, add json logging, Kubernetes 1.24 change #118

Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
21 changes: 21 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ spec:
- "--leader-elect"
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=false}"
- "--metrics-bind-address=127.0.0.1:8080"
- "--logging-format=${LOG_FORMAT:=text}"
image: controller:latest
name: manager
securityContext:
Expand All @@ -47,3 +48,23 @@ spec:
periodSeconds: 10
serviceAccountName: controller-manager
terminationGracePeriodSeconds: 10
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 10
preference:
matchExpressions:
- key: ${K8S_CP_LABEL:=node-role.kubernetes.io/control-plane}
operator: Exists
# remove once usage of node-role.kubernetes.io/master is removed from Kubernetes
- weight: 10
preference:
matchExpressions:
- key: node-role.kubernetes.io/master
operator: Exists

23 changes: 12 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ go 1.16
require (
github.com/go-logr/logr v1.2.2
github.com/golang/mock v1.6.0
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.17.0
github.com/onsi/gomega v1.18.1
github.com/oracle/oci-go-sdk/v63 v63.0.0
github.com/pkg/errors v0.9.1
github.com/spf13/pflag v1.0.5
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.23.0
k8s.io/apimachinery v0.23.0
k8s.io/client-go v0.23.0
k8s.io/component-base v0.23.0
k8s.io/klog/v2 v2.30.0
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b
sigs.k8s.io/cluster-api v1.0.1-0.20211111175208-4cc2fce2111a
sigs.k8s.io/cluster-api/test v1.1.0-beta.2.0.20220225180551-56d99d7bca51
sigs.k8s.io/controller-runtime v0.11.1
k8s.io/api v0.24.2
k8s.io/apimachinery v0.24.2
k8s.io/client-go v0.24.2
k8s.io/component-base v0.24.2
k8s.io/klog/v2 v2.60.1
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
sigs.k8s.io/cluster-api v1.2.0
sigs.k8s.io/cluster-api/test v1.2.0
sigs.k8s.io/controller-runtime v0.12.3
)

replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.0.1-0.20211111175208-4cc2fce2111a
replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.2.0
304 changes: 304 additions & 0 deletions go.sum

Large diffs are not rendered by default.

32 changes: 21 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,32 @@ import (
"os"

infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1"
"github.com/oracle/cluster-api-provider-oci/cloud/config"
"github.com/oracle/cluster-api-provider-oci/cloud/scope"
"github.com/oracle/cluster-api-provider-oci/controllers"
expV1Beta1 "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1"
expcontrollers "github.com/oracle/cluster-api-provider-oci/exp/controllers"
"github.com/oracle/cluster-api-provider-oci/feature"
"github.com/spf13/pflag"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/component-base/logs"
_ "k8s.io/component-base/logs/json/register"
"k8s.io/klog/v2"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
ctrl "sigs.k8s.io/controller-runtime"

expV1Beta1 "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1"
expcontrollers "github.com/oracle/cluster-api-provider-oci/exp/controllers"
expclusterv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"

"github.com/oracle/cluster-api-provider-oci/cloud/config"
"github.com/oracle/cluster-api-provider-oci/cloud/scope"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/klog/v2/klogr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
//+kubebuilder:scaffold:imports
)

var (
scheme = runtime.NewScheme()
setupLog = ctrl.Log.WithName("setup")
logOptions = logs.NewOptions()
webhookPort int
webhookCertDir string
)
Expand All @@ -70,6 +70,10 @@ func main() {
var probeAddr string
var webhookPort int

fs := pflag.CommandLine
logs.AddFlags(fs, logs.SkipLoggingConfigurationFlags())
logOptions.AddFlags(fs)

flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
Expand All @@ -93,7 +97,13 @@ func main() {
feature.MutableGates.AddFlag(pflag.CommandLine)
pflag.Parse()

ctrl.SetLogger(klogr.New())
if err := logOptions.ValidateAndApply(nil); err != nil {
setupLog.Error(err, "unable to start manager")
os.Exit(1)
}

// klog.Background will automatically use the right logger.
ctrl.SetLogger(klog.Background())

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Expand Down
12 changes: 6 additions & 6 deletions test/e2e/config/e2e_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ providers:
- name: cluster-api
type: CoreProvider
versions:
- name: v1.1.4
value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.1.4/core-components.yaml
- name: v1.2.0
value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.2.0/core-components.yaml
type: url
files:
- sourcePath: "../data/shared/v1beta1/metadata.yaml"
Expand All @@ -21,8 +21,8 @@ providers:
- name: kubeadm
type: BootstrapProvider
versions:
- name: v1.1.4
value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.1.4/bootstrap-components.yaml
- name: v1.2.0
value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.2.0/bootstrap-components.yaml
type: url
files:
- sourcePath: "../data/shared/v1beta1/metadata.yaml"
Expand All @@ -34,8 +34,8 @@ providers:
- name: kubeadm
type: ControlPlaneProvider
versions:
- name: v1.1.4
value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.1.4/control-plane-components.yaml
- name: v1.2.0
value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.2.0/control-plane-components.yaml
type: url
files:
- sourcePath: "../data/shared/v1beta1/metadata.yaml"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/data/shared/v1beta1/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3
kind: Metadata
releaseSeries:
- major: 1
minor: 1
minor: 2
contract: v1beta1
3 changes: 0 additions & 3 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,11 @@ func setupBootstrapCluster(config *clusterctl.E2EConfig, scheme *runtime.Scheme,
}

func initBootstrapCluster(bootstrapClusterProxy framework.ClusterProxy, config *clusterctl.E2EConfig, clusterctlConfig, artifactFolder string) {
// TODO we are hardcoding test to use clusterctl in initial version as we cant update dependency now, we need
// to remove this once we have updated dependency
clusterctl.InitManagementClusterAndWatchControllerLogs(context.TODO(), clusterctl.InitManagementClusterAndWatchControllerLogsInput{
ClusterProxy: bootstrapClusterProxy,
ClusterctlConfigPath: clusterctlConfig,
InfrastructureProviders: config.InfrastructureProviders(),
LogFolder: filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName()),
ClusterctlBinaryPath: "clusterctl",
}, config.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)
}

Expand Down
48 changes: 35 additions & 13 deletions vendor/cloud.google.com/go/compute/metadata/metadata.go

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

114 changes: 114 additions & 0 deletions vendor/cloud.google.com/go/compute/metadata/retry.go

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

Loading