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"`
|
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
|
@ -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:
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
|
|
4
main.go
4
main.go
|
@ -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",
|
||||||
|
|
Loading…
Reference in New Issue