-
Notifications
You must be signed in to change notification settings - Fork 16
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
Feat/external api #74
base: main
Are you sure you want to change the base?
Changes from 11 commits
442d4ca
92c57b1
1ab5584
8446d6d
d15b1c3
ad08d14
396503c
2aa1d1b
5b182ef
4057205
e89536f
03e0c8e
57620de
7a44d58
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 |
---|---|---|
|
@@ -35,13 +35,18 @@ const ( | |
|
||
type ReproviderStrategy string | ||
|
||
type ExternalStrategy string | ||
|
||
const ( | ||
// ReproviderStrategyAll Announces the CID of every stored block. | ||
ReproviderStrategyAll ReproviderStrategy = "all" | ||
// ReproviderStrategyPinned Only announces the pinned CIDs recursively. | ||
ReproviderStrategyPinned ReproviderStrategy = "pinned" | ||
// ReproviderStrategyRoots Only announces the root block of explicitly pinned CIDs. | ||
ReproviderStrategyRoots ReproviderStrategy = "roots" | ||
ReproviderStrategyRoots ReproviderStrategy = "roots" | ||
ExternalStrategyNone ExternalStrategy = "none" | ||
ExternalStrategyIngress ExternalStrategy = "ingress" | ||
ExternalStrategyLoadBalancer ExternalStrategy = "loadbalancer" | ||
) | ||
|
||
type ReprovideSettings struct { | ||
|
@@ -55,6 +60,14 @@ type ReprovideSettings struct { | |
Interval string `json:"interval,omitempty"` | ||
} | ||
|
||
type ExternalSettings struct { | ||
// +kubebuilder:validation:Enum={ingress,loadbalancer,none} | ||
// +optional | ||
Strategy ExternalStrategy `json:"strategy,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. What exactly are these fields supposed to change or control? Could you please include a one-sentence comment above the new fields and structs being added? |
||
// +optional | ||
Annotations map[string]string `json:"interval,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. What is this for? |
||
} | ||
|
||
type followParams struct { | ||
Name string `json:"name"` | ||
Template string `json:"template"` | ||
|
@@ -69,6 +82,7 @@ type networkConfig struct { | |
type IpfsClusterSpec struct { | ||
// url defines the URL to be using as an ingress controller. | ||
// +kubebuilder:validation:Optional | ||
// Reprovider Describes the settings that each IPFS node | ||
URL string `json:"url"` | ||
// public determines whether or not we should be exposing this IPFS Cluster to the public. | ||
Public bool `json:"public"` | ||
|
@@ -91,6 +105,8 @@ type IpfsClusterSpec struct { | |
// should use when reproviding content. | ||
// +optional | ||
Reprovider ReprovideSettings `json:"reprovider,omitempty"` | ||
Gateway ExternalSettings `json:"gateway"` | ||
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. Needs a description |
||
ClusterAPI ExternalSettings `json:"clusterApi"` | ||
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. I think we can make 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. Good call. Setting these to omitempty |
||
} | ||
|
||
type IpfsClusterStatus struct { | ||
|
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 |
---|---|---|
|
@@ -136,21 +136,26 @@ func (r *IpfsClusterReconciler) createTrackedObjects( | |
) map[client.Object]controllerutil.MutateFn { | ||
sa := corev1.ServiceAccount{} | ||
svc := corev1.Service{} | ||
gwsvc := corev1.Service{} | ||
apisvc := corev1.Service{} | ||
cmScripts := corev1.ConfigMap{} | ||
secConfig := corev1.Secret{} | ||
sts := appsv1.StatefulSet{} | ||
|
||
mutsa := r.serviceAccount(instance, &sa) | ||
mutsvc, svcName := r.serviceCluster(instance, &svc) | ||
|
||
mutgwsvc, _ := r.serviceGateway(instance, &gwsvc) | ||
mutapisvc, _ := r.serviceAPI(instance, &apisvc) | ||
|
||
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. Should we consider moving this under the below if condition on line 170? |
||
mutCmScripts, cmScriptName := r.ConfigMapScripts(ctx, instance, &cmScripts) | ||
mutSecConfig, secConfigName := r.SecretConfig( | ||
ctx, | ||
instance, | ||
&secConfig, | ||
[]byte(clusterSecret), | ||
[]byte(peerID.String()), | ||
[]byte(privateString), | ||
peerID.String(), | ||
) | ||
mutSts := r.StatefulSet(instance, &sts, svcName, secConfigName, cmScriptName) | ||
|
||
|
@@ -161,6 +166,13 @@ func (r *IpfsClusterReconciler) createTrackedObjects( | |
&secConfig: mutSecConfig, | ||
&sts: mutSts, | ||
} | ||
|
||
if instance.Spec.Gateway.Strategy == clusterv1alpha1.ExternalStrategyLoadBalancer { | ||
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. So in other words, only LoadBalancer is currently supported? |
||
trackedObjects[&gwsvc] = mutgwsvc | ||
} | ||
if instance.Spec.ClusterAPI.Strategy == clusterv1alpha1.ExternalStrategyLoadBalancer { | ||
trackedObjects[&apisvc] = mutapisvc | ||
} | ||
return trackedObjects | ||
} | ||
|
||
|
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.
The string values themselves should be in Pascal case to be consistent with the Kubernetes style.
So these would be
None
,LoadBalancer
,Ingress