-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e725c6
commit 22a2e8b
Showing
22 changed files
with
904 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Development | ||
|
||
## How to run the test suite | ||
|
||
Prerequisites: | ||
* Go >= 1.17 | ||
* clusterctl >= 1.1.3 | ||
|
||
You can run the test suite by simply doing | ||
|
||
```sh | ||
make test | ||
``` | ||
|
||
## How to run the controller locally | ||
|
||
Ensure the cluster you are using has the CAPI CRDs installed as the controller references them. If necessary, run the `clusterctl init` command: | ||
```sh | ||
clusterctl init | ||
``` | ||
|
||
Install the controller's CRDs on your test cluster: | ||
|
||
```sh | ||
make install | ||
``` | ||
|
||
Run the controller locally: | ||
|
||
```sh | ||
make run | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package v1alpha1 | ||
|
||
const ( | ||
// SecretFoundReason signals that a given secret has been found. | ||
SecretFoundReason string = "SecretFound" | ||
// WaitingForSecretReason signals that a given secret has not been found. | ||
WaitingForSecretReason string = "WaitingForSecret" | ||
// CAPIClusterFoundReason signals that a given CAPI cluster has been found. | ||
CAPIClusterFoundReason string = "CAPIClusterFound" | ||
// WaitingForCAPIClusterReason signals that a given CAPI cluster has not been found. | ||
WaitingForCAPIClusterReason string = "WaitingForCAPICluster" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
Copyright 2022. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
"github.com/fluxcd/pkg/apis/meta" | ||
) | ||
|
||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! | ||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
||
// GitopsClusterSpec defines the desired state of GitopsCluster | ||
type GitopsClusterSpec struct { | ||
// SecretRef specifies the Secret containing the kubeconfig for a cluster. | ||
// +optional | ||
SecretRef *meta.LocalObjectReference `json:"secretRef,omitempty"` | ||
// CAPIClusterRef specifies the CAPI Cluster. | ||
// +optional | ||
CAPIClusterRef *meta.LocalObjectReference `json:"capiClusterRef,omitempty"` | ||
} | ||
|
||
// GitopsClusterStatus defines the observed state of GitopsCluster | ||
type GitopsClusterStatus struct { | ||
// Conditions holds the conditions for the Cluster. | ||
// +optional | ||
Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
} | ||
|
||
// GetConditions returns the status conditions of the object. | ||
func (in GitopsCluster) GetConditions() []metav1.Condition { | ||
return in.Status.Conditions | ||
} | ||
|
||
// SetConditions sets the status conditions on the object. | ||
func (in *GitopsCluster) SetConditions(conditions []metav1.Condition) { | ||
in.Status.Conditions = conditions | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="" | ||
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description="" | ||
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",description="" | ||
|
||
// GitopsCluster is the Schema for the gitopsclusters API | ||
type GitopsCluster struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec GitopsClusterSpec `json:"spec,omitempty"` | ||
Status GitopsClusterStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// GitopsClusterList contains a list of GitopsCluster | ||
type GitopsClusterList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []GitopsCluster `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&GitopsCluster{}, &GitopsClusterList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.