Merge pull request #8 from howardlau1999/rbac
Fix RBAC problem and restore metrics
This commit is contained in:
commit
5341512045
|
@ -100,7 +100,7 @@ type SeaweedSpec struct {
|
|||
VolumeServerDiskCount int32 `json:"volumeServerDiskCount,omitempty"`
|
||||
|
||||
// Ingresses
|
||||
Hosts []string `json:"hosts"`
|
||||
Hosts []string `json:"hosts,omitempty"`
|
||||
}
|
||||
|
||||
// SeaweedStatus defines the observed state of Seaweed
|
||||
|
@ -204,6 +204,7 @@ type ComponentSpec struct {
|
|||
StatefulSetUpdateStrategy appsv1.StatefulSetUpdateStrategyType `json:"statefulSetUpdateStrategy,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceSpec is a subset of the original k8s spec
|
||||
type ServiceSpec struct {
|
||||
// Type of the real kubernetes service
|
||||
Type corev1.ServiceType `json:"type,omitempty"`
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,6 +6,61 @@ metadata:
|
|||
creationTimestamp: null
|
||||
name: manager-role
|
||||
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:
|
||||
- seaweed.seaweedfs.com
|
||||
resources:
|
||||
|
|
|
@ -5,8 +5,13 @@ metadata:
|
|||
spec:
|
||||
# Add fields here
|
||||
image: chrislusf/seaweedfs:2.07
|
||||
volumeServerCount: 4
|
||||
filerCount: 2
|
||||
hosts:
|
||||
- "*"
|
||||
volumeServerDiskCount: 1
|
||||
master:
|
||||
replicas: 3
|
||||
volume:
|
||||
replicas: 1
|
||||
requests:
|
||||
storage: 2Gi
|
||||
filer:
|
||||
replicas: 2
|
||||
|
||||
|
|
|
@ -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/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) {
|
||||
ctx := context.Background()
|
||||
|
|
4
main.go
4
main.go
|
@ -45,7 +45,9 @@ func init() {
|
|||
}
|
||||
|
||||
func main() {
|
||||
var metricsAddr string
|
||||
var enableLeaderElection bool
|
||||
flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
|
||||
flag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
|
||||
"Enable leader election for 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{
|
||||
Scheme: scheme,
|
||||
MetricsBindAddress: "0",
|
||||
MetricsBindAddress: metricsAddr,
|
||||
Port: 9443,
|
||||
LeaderElection: enableLeaderElection,
|
||||
LeaderElectionID: "674006ec.seaweedfs.com",
|
||||
|
|
Loading…
Reference in New Issue