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

Add APIServerLoadBalancer setting to enable/disable API server LB, allow adding ports, configure firewall #26

Merged
merged 45 commits into from
Sep 2, 2024
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
bd8117b
refactor: rename OpenFirewallRules to CreateEgressFirewallRules
hrak Jul 23, 2024
90c6782
fix: update default registry and tag
hrak Aug 1, 2024
9238940
refactor: rename getOfferingID to getNetworkOfferingID
hrak Aug 1, 2024
72838bc
feat: add version flag and refactor flag handling
hrak Aug 1, 2024
1b5abba
chore: remove staticcheck
hrak Aug 3, 2024
878a2f9
fix: add generate-conversion to generate-all
hrak Aug 12, 2024
5e96113
chore: remove some unused code and update some comments
hrak Aug 12, 2024
8acd547
feat: Allow firewall rules to be defined for the API server load bala…
hrak Aug 12, 2024
795d4e0
chore: Update to k8s v1.27.16
hrak Aug 12, 2024
a5971d5
chore: Update to Go 1.22
hrak Aug 12, 2024
c10a42d
fix: use klog.FlushAndExit instead of os.Exit
hrak Aug 13, 2024
7e9e6e2
fix: fix LDFLAGS for docker build
hrak Aug 13, 2024
3b67bab
fix(ci): set fetch-depth 0 to get tags as well
hrak Aug 13, 2024
0e9a10a
fix: Add missing leader election flags, remove cloud-config-file flag
hrak Aug 13, 2024
bc2002e
fix: Add condition to AddToLBIfNeeded which checks if API server lb i…
hrak Aug 13, 2024
6dfe5bd
feat: Log end of reconciliation
hrak Aug 14, 2024
6362bc1
fix: Watch for changes in CloudStackCluster in the isonet controller …
hrak Aug 14, 2024
f01f7d5
chore: fix incorrect function name in comment
hrak Aug 15, 2024
df2577f
fix: Make sure lb rules are deleted when a port is removed from addit…
hrak Aug 15, 2024
af09d28
fix: Delete related fw rule when a port is removed from additionalPor…
hrak Aug 15, 2024
0447baf
fix: Add predicate to only reconcile on generation change of cscluster
hrak Aug 15, 2024
0c9fd17
fix: Use async cs client for fw/lb rule deletion
hrak Aug 15, 2024
4aa2d64
fix: Make sure VM's get assigned to lb rules when a change in lb rule…
hrak Aug 16, 2024
a0648f6
fix: Fetch clustername from isonet labels
hrak Aug 16, 2024
c289b43
fix: Add some type checking
hrak Aug 16, 2024
0bfddd7
fix: Updated the mapper funcs so they actually work
hrak Aug 16, 2024
0cdc08d
refactor: Refactor fw/lb reconcile functions for lower cyclomatic com…
hrak Aug 19, 2024
3758502
chore: add 0.5.x and 0.5.x series to the metadata.yaml
hrak Aug 21, 2024
5f6e709
fix: Solved several issues with the firewalling implementation
hrak Aug 23, 2024
04008c3
fix: Some old find/replace mistake
hrak Aug 27, 2024
c9f806c
feat: Consider that isonet outgoing IP might not be the same as LB IP
hrak Aug 27, 2024
cdf9f2a
feat: Allow isolated network CIDR to be configured
hrak Aug 27, 2024
f5ab380
fix(tests): Add webhook tests for validity of fd/network name and net…
hrak Aug 27, 2024
c26adc4
fix: Remove lint from test target
hrak Aug 27, 2024
8bd85c7
fix: Separate load balancer reconciliation from GetOrCreateIsolatedNe…
hrak Aug 27, 2024
e86ef49
fix: Tag the outgoing IP
hrak Aug 27, 2024
b010f50
fix(tests): Update the tests for ReconcileLoadBalancer
hrak Aug 27, 2024
2cca369
chore: Fix copy/pasta in DeleteLoadBalancerRule error msg
hrak Aug 27, 2024
8bda463
fix: The resource type for a lb rule is LoadBalancer, not LoadBalance…
hrak Aug 27, 2024
49040f3
fix: Remove double strings.ToLower
hrak Aug 28, 2024
8a0b6b3
fix: Break out of loop when instance is found
hrak Aug 28, 2024
5835fce
fix: Reduce excessive logging/events
hrak Aug 28, 2024
bf8d10a
fix: Revert to the old behavior of isonet outgoing IP = loadbalancer …
hrak Aug 29, 2024
00692df
fix(tests): Remove injection of ginkgo recover statements
hrak Aug 30, 2024
f472057
fix(tests): remove need for REPO_ROOT env var
hrak Aug 30, 2024
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
Prev Previous commit
Next Next commit
fix: Add some type checking
hrak committed Aug 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit c289b437cb9c95d10b00f4fb036331cbce0b62ac
19 changes: 16 additions & 3 deletions controllers/cloudstackmachine_controller.go
Original file line number Diff line number Diff line change
@@ -359,16 +359,20 @@ func (r *CloudStackMachineReconciliationRunner) ReconcileDelete() (retRes ctrl.R

// SetupWithManager registers the machine reconciler to the CAPI controller manager.
func (reconciler *CloudStackMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opts controller.Options) error {
log := ctrl.LoggerFrom(ctx)

reconciler.Recorder = mgr.GetEventRecorderFor("capc-machine-controller")

cloudStackClusterToCloudStackMachines, err := utils.CloudStackClusterToCloudStackMachines(reconciler.K8sClient, &infrav1.CloudStackMachineList{}, reconciler.Scheme, ctrl.LoggerFrom(ctx))
if err != nil {
return errors.Wrap(err, "failed to create CloudStackClusterToCloudStackMachines mapper")
}
//requeueCloudStackMachinesForUnpausedCluster := reconciler.requeueCloudStackMachinesForUnpausedCluster(ctx)

csMachineMapper, err := util.ClusterToTypedObjectsMapper(reconciler.K8sClient, &infrav1.CloudStackMachineList{}, reconciler.Scheme)
if err != nil {
return errors.Wrap(err, "failed to create mapper for Cluster to CloudStackMachines")
}

cloudStackIsolatedNetworkToControlPlaneCloudStackMachines, err := utils.CloudStackIsolatedNetworkToControlPlaneCloudStackMachines(reconciler.K8sClient, &infrav1.CloudStackMachineList{}, reconciler.Scheme, ctrl.LoggerFrom(ctx))
if err != nil {
return errors.Wrap(err, "failed to create CloudStackIsolatedNetworkToControlPlaneCloudStackMachines mapper")
@@ -383,7 +387,11 @@ func (reconciler *CloudStackMachineReconciler) SetupWithManager(ctx context.Cont
builder.WithPredicates(
predicate.Funcs{
UpdateFunc: func(e event.UpdateEvent) bool {
oldMachine := e.ObjectOld.(*clusterv1.Machine)
oldMachine, ok := e.ObjectOld.(*clusterv1.Machine)
if !ok {
log.V(4).Info("Expected Machine", "type", fmt.Sprintf("%T", e.ObjectOld))
return false
}
newMachine := e.ObjectNew.(*clusterv1.Machine)

return (oldMachine.Spec.Bootstrap.DataSecretName == nil && newMachine.Spec.Bootstrap.DataSecretName != nil)
@@ -447,7 +455,12 @@ func (reconciler *CloudStackMachineReconciler) SetupWithManager(ctx context.Cont
builder.WithPredicates(
predicate.Funcs{
UpdateFunc: func(e event.UpdateEvent) bool {
oldCSIsoNet := e.ObjectOld.(*infrav1.CloudStackIsolatedNetwork)
oldCSIsoNet, ok := e.ObjectOld.(*infrav1.CloudStackIsolatedNetwork)
if !ok {
log.V(4).Info("Expected CloudStackIsolatedNetwork", "type", fmt.Sprintf("%T", e.ObjectOld))
return false
}

newCSIsoNet := e.ObjectNew.(*infrav1.CloudStackIsolatedNetwork)

// We're only interested in status updates, not Spec updates