Skip to content

Commit 90cd361

Browse files
committed
rename NetworkMode -> Public
Signed-off-by: Oleg S <[email protected]>
1 parent a7304c9 commit 90cd361

12 files changed

+26
-44
lines changed

api/v1alpha1/ipfscluster_types.go

+3-14
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,6 @@ const (
4444
ReproviderStrategyRoots ReproviderStrategy = "roots"
4545
)
4646

47-
type NetworkMode string
48-
49-
const (
50-
// NetworkModePublic Defines an IPFSCluster running in public mode with its
51-
// content available to everyone.
52-
NetworkModePublic NetworkMode = "public"
53-
// NetworkModePrivate Defines an IPFSCluster running in a private network
54-
// with its content only available to other authorized nodes.
55-
NetworkModePrivate NetworkMode = "private"
56-
)
57-
5847
type ReprovideSettings struct {
5948
// Strategy specifies the reprovider strategy, defaults to 'all'.
6049
// +kubebuilder:validation:Enum={all,pinned,roots}
@@ -75,10 +64,10 @@ type followParams struct {
7564
type NetworkConfig struct {
7665
// circuitRelays defines how many CircuitRelays should be created.
7766
CircuitRelays int32 `json:"circuitRelays"`
78-
// networkMode is a switch which defines whether this IPFSCluster will use
67+
// public is a switch which defines whether this IPFSCluster will use
7968
// the global IPFS network or create its own.
80-
// +kubebuilder:validation:Enum={public,private}
81-
NetworkMode NetworkMode `json:"networkMode,omitempty"`
69+
// +kubebuilder:default:=true
70+
Public bool `json:"public,omitempty"`
8271
}
8372

8473
// IpfsClusterSpec defines the desired state of the IpfsCluster.

bundle/manifests/cluster.ipfs.io_ipfsclusters.yaml

+5-7
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,11 @@ spec:
101101
be created.
102102
format: int32
103103
type: integer
104-
networkMode:
105-
description: networkMode is a switch which defines whether this
106-
IPFSCluster will use the global IPFS network or create its own.
107-
enum:
108-
- public
109-
- private
110-
type: string
104+
public:
105+
default: true
106+
description: public is a switch which defines whether this IPFSCluster
107+
will use the global IPFS network or create its own.
108+
type: boolean
111109
required:
112110
- circuitRelays
113111
type: object

bundle/manifests/ipfs-operator.clusterserviceversion.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ metadata:
2222
}
2323
]
2424
capabilities: Basic Install
25-
createdAt: "2023-02-07T20:51:55Z"
25+
createdAt: "2023-02-15T21:07:11Z"
2626
operators.operatorframework.io/builder: operator-sdk-v1.26.0
2727
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
2828
name: ipfs-operator.v0.0.1

config/crd/bases/cluster.ipfs.io_ipfsclusters.yaml

+5-7
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,11 @@ spec:
102102
be created.
103103
format: int32
104104
type: integer
105-
networkMode:
106-
description: networkMode is a switch which defines whether this
107-
IPFSCluster will use the global IPFS network or create its own.
108-
enum:
109-
- public
110-
- private
111-
type: string
105+
public:
106+
default: true
107+
description: public is a switch which defines whether this IPFSCluster
108+
will use the global IPFS network or create its own.
109+
type: boolean
112110
required:
113111
- circuitRelays
114112
type: object

controllers/ipfscluster_controller.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434

3535
"github.com/libp2p/go-libp2p/core/peer"
3636
ma "github.com/multiformats/go-multiaddr"
37-
"github.com/redhat-et/ipfs-operator/api/v1alpha1"
3837
clusterv1alpha1 "github.com/redhat-et/ipfs-operator/api/v1alpha1"
3938
)
4039

@@ -122,7 +121,7 @@ func (r *IpfsClusterReconciler) createTrackedObjects(
122121
return fmt.Errorf("could not retrieve information from the relay circuit: %w", err)
123122
}
124123
// initialize bootstrap peers if we are on a private network
125-
if instance.Spec.Networking.NetworkMode == v1alpha1.NetworkModePrivate {
124+
if !instance.Spec.Networking.Public {
126125
if instance.Spec.Replicas < 1 {
127126
return fmt.Errorf("number of replicas must be at least 1 to run in private mode")
128127
}

controllers/statefulset.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (r *IpfsClusterReconciler) StatefulSet(
100100
Name: "IPFS_FD_MAX",
101101
Value: "4096",
102102
}}
103-
if m.Spec.Networking.NetworkMode == clusterv1alpha1.NetworkModePrivate {
103+
if !m.Spec.Networking.Public {
104104
swarmKeySecret := corev1.EnvVar{
105105
Name: EnvIPFSSwarmKey,
106106
ValueFrom: &corev1.EnvVarSource{

examples/ipfs-medium-private.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ spec:
1212
follows: []
1313
networking:
1414
circuitRelays: 1
15-
networkMode: private
15+
public: false

examples/ipfs-small-private.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ spec:
1212
follows: []
1313
networking:
1414
circuitRelays: 1
15-
networkMode: private
15+
public: false

helm/ipfs-operator/crds/cluster.ipfs.io_ipfsclusters.yaml

+5-7
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,11 @@ spec:
102102
be created.
103103
format: int32
104104
type: integer
105-
networkMode:
106-
description: networkMode is a switch which defines whether this
107-
IPFSCluster will use the global IPFS network or create its own.
108-
enum:
109-
- public
110-
- private
111-
type: string
105+
public:
106+
default: true
107+
description: public is a switch which defines whether this IPFSCluster
108+
will use the global IPFS network or create its own.
109+
type: boolean
112110
required:
113111
- circuitRelays
114112
type: object

test-kuttl/e2e-release/cluster-follow/00-create-cluster.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ spec:
99
replicas: 1
1010
networking:
1111
circuitRelays: 1
12-
networkMode: public
12+
public: false
1313
ipfsResources:
1414
limits:
1515
cpu: 250m

test-kuttl/e2e/ipfs/05-create-ipfs-cluster.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ spec:
1313
cpu: 250m
1414
memory: 512M
1515
networking:
16-
networkMode: public
16+
public: true
1717
circuitRelays: 0

test-kuttl/e2e/private-network/00-create-ipfs-cluster.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ spec:
1313
cpu: 100m
1414
memory: 128M
1515
networking:
16-
networkMode: private
16+
public: false
1717
circuitRelays: 1

0 commit comments

Comments
 (0)