Make sure the operator is runnable

Signed-off-by: Howard Lau <howardlau1999@hotmail.com>
This commit is contained in:
Howard Lau 2020-10-29 11:56:59 +00:00
parent c06204b5b6
commit c5fbce3700
No known key found for this signature in database
GPG Key ID: 5CCC55849E3CF8E2
6 changed files with 10226 additions and 21 deletions

View File

@ -100,7 +100,7 @@ type SeaweedSpec struct {
VolumeServerDiskCount int32 `json:"volumeServerDiskCount,omitempty"` VolumeServerDiskCount int32 `json:"volumeServerDiskCount,omitempty"`
// Ingresses // Ingresses
Hosts []string `json:"hosts"` Hosts []string `json:"hosts,omitempty"`
} }
// SeaweedStatus defines the observed state of Seaweed // SeaweedStatus defines the observed state of Seaweed
@ -204,6 +204,7 @@ type ComponentSpec struct {
StatefulSetUpdateStrategy appsv1.StatefulSetUpdateStrategyType `json:"statefulSetUpdateStrategy,omitempty"` StatefulSetUpdateStrategy appsv1.StatefulSetUpdateStrategyType `json:"statefulSetUpdateStrategy,omitempty"`
} }
// ServiceSpec is a subset of the original k8s spec
type ServiceSpec struct { type ServiceSpec struct {
// Type of the real kubernetes service // Type of the real kubernetes service
Type corev1.ServiceType `json:"type,omitempty"` Type corev1.ServiceType `json:"type,omitempty"`

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,61 @@ metadata:
creationTimestamp: null creationTimestamp: null
name: manager-role name: manager-role
rules: rules:
- apiGroups:
- apps
resources:
- statefulsets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
- apiGroups:
- ""
resources:
- services
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups: - apiGroups:
- seaweed.seaweedfs.com - seaweed.seaweedfs.com
resources: resources:

View File

@ -5,8 +5,13 @@ metadata:
spec: spec:
# Add fields here # Add fields here
image: chrislusf/seaweedfs:2.07 image: chrislusf/seaweedfs:2.07
volumeServerCount: 4 volumeServerDiskCount: 1
filerCount: 2 master:
hosts: replicas: 3
- "*" volume:
replicas: 1
requests:
storage: 2Gi
filer:
replicas: 2

View File

@ -38,6 +38,11 @@ type SeaweedReconciler struct {
// +kubebuilder:rbac:groups=seaweed.seaweedfs.com,resources=seaweeds,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=seaweed.seaweedfs.com,resources=seaweeds,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=seaweed.seaweedfs.com,resources=seaweeds/status,verbs=get;update;patch // +kubebuilder:rbac:groups=seaweed.seaweedfs.com,resources=seaweeds/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=apps,resources=statefulsets,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=services,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=networking.k8s.io,resources=ingresses,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;
func (r *SeaweedReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { func (r *SeaweedReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
ctx := context.Background() ctx := context.Background()

View File

@ -45,7 +45,9 @@ func init() {
} }
func main() { func main() {
var metricsAddr string
var enableLeaderElection bool var enableLeaderElection bool
flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "enable-leader-election", false, flag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
"Enable leader election for controller manager. "+ "Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.") "Enabling this will ensure there is only one active controller manager.")
@ -55,7 +57,7 @@ func main() {
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme, Scheme: scheme,
MetricsBindAddress: "0", MetricsBindAddress: metricsAddr,
Port: 9443, Port: 9443,
LeaderElection: enableLeaderElection, LeaderElection: enableLeaderElection,
LeaderElectionID: "674006ec.seaweedfs.com", LeaderElectionID: "674006ec.seaweedfs.com",