Skip to content

refactor(cloud): extract public IPs service in CAPG style - #35

Draft
LSchu wants to merge 4 commits into
feat/refactor-service-implementationsfrom
feat/refactor-public-ip
Draft

LSchu wants to merge 4 commits into
feat/refactor-service-implementationsfrom
feat/refactor-public-ip

Conversation

@LSchu

@LSchu LSchu commented Oct 27, 2026

Copy link
Copy Markdown

No description provided.

type PublicIP struct {
ID string
IP string
NetworkInterfaceID string

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a network or a network interface on a server?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This refers to the NetworkInterface of the (bastion) host. If empty, it means that the IP is not yet associated to any server.

Comment thread cloud/services/publicip/reconcile.go Resolved
Comment thread cloud/services/publicip/reconcile.go Resolved
Comment thread cloud/errors.go
Comment on lines 25 to +41
// IsNotFound reports whether err wraps ErrNotFound.
func IsNotFound(err error) bool { return errors.Is(err, ErrNotFound) }
func IsNotFound(err error) bool { return shared.IsNotFound(err) }

// IsUnauthorized reports whether err wraps ErrUnauthorized.
func IsUnauthorized(err error) bool { return errors.Is(err, ErrUnauthorized) }
func IsUnauthorized(err error) bool { return shared.IsUnauthorized(err) }

// IsInvalidInput reports whether err wraps ErrInvalidInput.
func IsInvalidInput(err error) bool { return errors.Is(err, ErrInvalidInput) }
func IsInvalidInput(err error) bool { return shared.IsInvalidInput(err) }

// IsConflict reports whether err wraps ErrConflict.
func IsConflict(err error) bool { return errors.Is(err, ErrConflict) }
func IsConflict(err error) bool { return shared.IsConflict(err) }

// IsTransient reports whether err wraps ErrTransient.
func IsTransient(err error) bool { return errors.Is(err, ErrTransient) }
func IsTransient(err error) bool { return shared.IsTransient(err) }

// IsRetryable reports whether err should trigger a requeue (conflict or
// transient).
func IsRetryable(err error) bool {
return IsConflict(err) || IsTransient(err)
}
// IsRetryable reports whether err should trigger a requeue (conflict or transient).
func IsRetryable(err error) bool { return shared.IsRetryable(err) }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why even keep these wrappers instead o using the shared package instead? or is this just a transient step while you are refactoring?

Comment thread cloud/types.go

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is for an easier transition but not meant to be kept this way, right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am open for both solutions, we can also do the "shotgun surgery" as discussed.

Comment thread scope/cluster_scope.go
Comment on lines +131 to +137
func (s *ClusterScope) BastionSpec() infrav1.StackitBastionSpec {
return s.StackitCluster.Spec.Bastion
}

func (s *ClusterScope) BastionStatus() infrav1.StackitBastionStatus {
return s.StackitCluster.Status.Bastion
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be aware this creates a reference by value not by pointer

why expose it like this anyways? just for the better ergonomics?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is based on the CRD schema, where these fields are defined as values and not as pointers.
In the future this will probably move to a dedicated scope for the bastion service anyway, so it is kind of temporary.

@LSchu
LSchu changed the base branch from main to feat/refactor-service-implementations October 29, 2026 10:13

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants