-
Notifications
You must be signed in to change notification settings - Fork 1
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
Capi self filtering #28
Changes from 3 commits
97bf813
92b7c14
8aa9a9d
403d665
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,8 @@ limitations under the License. | |
package v1alpha1 | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/fluxcd/pkg/apis/meta" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
@@ -28,6 +30,24 @@ type AKS struct { | |
SubscriptionID string `json:"subscriptionID"` | ||
} | ||
|
||
// CAPI defines the desired state of CAPI | ||
type CAPI struct { | ||
// Current Cluster name indicating the management cluster | ||
// used to avoid choosing the cluster the controller is running in | ||
CurrentClusterRef Cluster `json:"currentClusterRef,omitempty"` | ||
} | ||
|
||
type Cluster struct { | ||
// Name is the name of the cluster | ||
// +required | ||
Name string `json:"name"` | ||
} | ||
|
||
// String returns the string representation of the Cluster | ||
func (c Cluster) String() string { | ||
return fmt.Sprintf("%v", c.Name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could just return |
||
} | ||
|
||
// AutomatedClusterDiscoverySpec defines the desired state of AutomatedClusterDiscovery | ||
type AutomatedClusterDiscoverySpec struct { | ||
// Name is the name of the cluster | ||
|
@@ -45,6 +65,9 @@ type AutomatedClusterDiscoverySpec struct { | |
// AKS configures discovery of AKS clusters from Azure. | ||
AKS *AKS `json:"aks,omitempty"` | ||
|
||
// CAPI configures discovery of CAPI clusters | ||
CAPI *CAPI `json:"capi,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍🏻 |
||
|
||
// The interval at which to run the discovery | ||
// +required | ||
Interval metav1.Duration `json:"interval"` | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,6 @@ metadata: | |
spec: | ||
type: capi | ||
interval: 10m | ||
capi: | ||
currentClusterRef: | ||
name: testcapicluster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One idea here is to implement Stringer this way in
CAPIProvider.ClusterID
you could just callp.ManagementClusterRef.String()
if/when Cluster grows a Namespace, that code remains the same?