Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into ipam
Browse files Browse the repository at this point in the history
# Conflicts:
#	test/e2e/capic_test.go
#	test/e2e/config/ionoscloud.yaml
#	test/e2e/env_test.go
  • Loading branch information
Mattes83 committed Aug 28, 2024
2 parents 1e46ddb + 33a3f06 commit ab98aa5
Show file tree
Hide file tree
Showing 22 changed files with 310 additions and 241 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ envfile

# editor and IDE paraphernalia
.idea
.run
.vscode
*.swp
*.swo
Expand Down
6 changes: 5 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ linters-settings:
allow:
- error
- generic
- "github.com/ionos-cloud/cluster-api-provider-ionoscloud/internal/ionoscloud.Client"
- ionoscloud.Client
- bootstrap.ClusterProvider
- framework.ClusterProxy
loggercheck:
require-string-key: true
no-printf-like: true
Expand Down Expand Up @@ -199,6 +201,8 @@ issues:
- mock*

run:
build-tags:
- e2e
timeout: 10m
allow-parallel-runners: true
go: "1.22"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest

## Tool Versions
KUSTOMIZE_VERSION ?= v5.1.1
CONTROLLER_TOOLS_VERSION ?= v0.14.0
CONTROLLER_TOOLS_VERSION ?= v0.16.1

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ If you need help with CAPIC, please visit the [#cluster-api-ionoscloud][slack] c

This provider's versions are compatible with the following versions of Cluster API:

| | Cluster API v1beta1 (v1.7) |
|------------------------|:--------------------------:|
| CAPIC v1alpha1 (v0.2) ||
| CAPIC v1alpha1 (v0.3) ||
| CAPIC v1alpha1 (v0.4) ||
| | Cluster API v1beta1 (v1.7) | Cluster API v1beta1 (v1.8) |
|------------------------|:--------------------------:|:--------------------------:|
| CAPIC v1alpha1 (v0.2) |||
| CAPIC v1alpha1 (v0.3) |||
| CAPIC v1alpha1 (v0.4) |||

### Kubernetes Versions

Expand Down
12 changes: 9 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var (
setupLog = ctrl.Log.WithName("setup")
healthProbeAddr string
enableLeaderElection bool
diagnosticOptions = flags.DiagnosticsOptions{}
managerOptions = flags.ManagerOptions{}

icClusterConcurrency int
icMachineConcurrency int
Expand All @@ -68,9 +68,15 @@ func main() {
initFlags()
pflag.Parse()

_, metricsOptions, err := flags.GetManagerOptions(managerOptions)
if err != nil {
setupLog.Error(err, "unable to get manager options")
os.Exit(1)
}

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Metrics: flags.GetDiagnosticsOptions(diagnosticOptions),
Metrics: *metricsOptions,
HealthProbeBindAddress: healthProbeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "15f3d3ca.cluster.x-k8s.io",
Expand Down Expand Up @@ -130,7 +136,7 @@ func main() {
func initFlags() {
klog.InitFlags(nil)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
flags.AddDiagnosticsOptions(pflag.CommandLine, &diagnosticOptions)
flags.AddManagerOptions(pflag.CommandLine, &managerOptions)
pflag.StringVar(&healthProbeAddr, "health-probe-bind-address", ":8081",
"The address the probe endpoint binds to.")
pflag.BoolVar(&enableLeaderElection, "leader-elect", false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.1
name: ionoscloudclusters.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down Expand Up @@ -61,8 +61,6 @@ spec:
description: |-
ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
TODO(gfariasalves): as of now, IP must be provided by the user as we still don't insert the
provider-provided block IP into the kube-vip manifest.
properties:
host:
Expand All @@ -85,10 +83,13 @@ spec:
the credentials to access the IONOS Cloud API.
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?
type: string
type: object
x-kubernetes-map-type: atomic
Expand All @@ -101,10 +102,13 @@ spec:
An empty loadBalancerProviderRef field is allowed and means to disable any load balancer logic.
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?
type: string
type: object
x-kubernetes-map-type: atomic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.1
name: ionoscloudclustertemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down Expand Up @@ -53,8 +53,6 @@ spec:
description: |-
ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
TODO(gfariasalves): as of now, IP must be provided by the user as we still don't insert the
provider-provided block IP into the kube-vip manifest.
properties:
host:
Expand All @@ -77,10 +75,13 @@ spec:
the credentials to access the IONOS Cloud API.
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?
type: string
type: object
x-kubernetes-map-type: atomic
Expand All @@ -93,10 +94,13 @@ spec:
An empty loadBalancerProviderRef field is allowed and means to disable any load balancer logic.
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?
type: string
type: object
x-kubernetes-map-type: atomic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.1
name: ionoscloudmachines.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down Expand Up @@ -165,7 +165,6 @@ spec:
CPUFamily defines the CPU architecture, which will be used for this VM.
Not all CPU architectures are available in all data centers.
If not specified, the cloud will select a suitable CPU family
based on the availability in the data center.
example: AMD_OPTERON
Expand Down Expand Up @@ -247,7 +246,6 @@ spec:
It can be either set to an already reserved IPv4 address, or it can be set to "AUTO"
which will automatically reserve an IPv4 address for the Failover Group.
If the machine is a control plane machine, this field will not be taken into account.
type: string
x-kubernetes-validations:
Expand Down Expand Up @@ -430,7 +428,6 @@ spec:
reconciling the Machine and will contain a more verbose string suitable
for logging and human consumption.
This field should not be set for transitive errors that a controller
faces that are expected to be fixed automatically over
time (like service outages), but instead indicate that something is
Expand All @@ -440,7 +437,6 @@ spec:
spec, values that are unsupported by the controller, or the
responsible controller itself being critically misconfigured.
Any transient errors that occur during the reconciliation of IonosCloudMachines
can be added as events to the IonosCloudMachine object and/or logged in the
controller's output.
Expand All @@ -451,7 +447,6 @@ spec:
reconciling the Machine and will contain a succinct value suitable
for machine interpretation.
This field should not be set for transitive errors that a controller
faces that are expected to be fixed automatically over
time (like service outages), but instead indicate that something is
Expand All @@ -461,7 +456,6 @@ spec:
spec, values that are unsupported by the controller, or the
responsible controller itself being critically misconfigured.
Any transient errors that occur during the reconciliation of IonosCloudMachines
can be added as events to the IonosCloudMachine object and/or logged in the
controller's output.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.1
name: ionoscloudmachinetemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down Expand Up @@ -185,7 +185,6 @@ spec:
CPUFamily defines the CPU architecture, which will be used for this VM.
Not all CPU architectures are available in all data centers.
If not specified, the cloud will select a suitable CPU family
based on the availability in the data center.
example: AMD_OPTERON
Expand Down Expand Up @@ -269,7 +268,6 @@ spec:
It can be either set to an already reserved IPv4 address, or it can be set to "AUTO"
which will automatically reserve an IPv4 address for the Failover Group.
If the machine is a control plane machine, this field will not be taken into account.
type: string
x-kubernetes-validations:
Expand Down
34 changes: 2 additions & 32 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ rules:
resources:
- clusters
- clusters/status
verbs:
- get
- list
- watch
- apiGroups:
- cluster.x-k8s.io
resources:
- machines
- machines/status
verbs:
Expand All @@ -58,31 +51,6 @@ rules:
- infrastructure.cluster.x-k8s.io
resources:
- ionoscloudclusters
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- ionoscloudclusters/finalizers
verbs:
- update
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- ionoscloudclusters/status
verbs:
- get
- patch
- update
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- ionoscloudmachines
verbs:
- create
Expand All @@ -95,12 +63,14 @@ rules:
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- ionoscloudclusters/finalizers
- ionoscloudmachines/finalizers
verbs:
- update
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- ionoscloudclusters/status
- ionoscloudmachines/status
verbs:
- get
Expand Down
Loading

0 comments on commit ab98aa5

Please sign in to comment.