Skip to content

Commit

Permalink
Merge pull request k0smotron#26 from juanluisvaladas/minor-fixes
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
juanluisvaladas authored Apr 21, 2023
2 parents c7886e8 + 0cc614c commit ed91834
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 7 deletions.
2 changes: 2 additions & 0 deletions api/v1beta1/k0smotroncluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ type ServiceSpec struct {
// APIPort defines the kubernetes API port. If empty k0smotron
// will pick it automatically.
//+kubebuilder:validation:Optional
//+kubebuilder:default=30443
APIPort int `json:"apiPort,omitempty"`
// KonnectivityPort defines the konnectivity port. If empty k0smotron
// will pick it automatically.
//+kubebuilder:validation:Optional
//+kubebuilder:default=30132
KonnectivityPort int `json:"konnectivityPort,omitempty"`
}

Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/k0smotron.io_k0smotronclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,12 @@ spec:
description: Service defines the service configuration.
properties:
apiPort:
default: 30443
description: APIPort defines the kubernetes API port. If empty
k0smotron will pick it automatically.
type: integer
konnectivityPort:
default: 30132
description: KonnectivityPort defines the konnectivity port. If
empty k0smotron will pick it automatically.
type: integer
Expand Down
25 changes: 25 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,31 @@ rules:
- patch
- update
- watch
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
- apiGroups:
- ""
resources:
- pods/exec
verbs:
- create
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
Expand Down
27 changes: 27 additions & 0 deletions install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ spec:
description: K0smotronClusterSpec defines the desired state of K0smotronCluster
properties:
apiPort:
default: 30443
description: APIPort defines the kubernetes API port. If empty k0smotron
will pick it automatically.
type: integer
Expand All @@ -64,6 +65,7 @@ spec:
empty k0smotron will pick it automatically.
type: string
konnectivityPort:
default: 30132
description: KonnectivityPort defines the konnectivity port. If empty
k0smotron will pick it automatically.
type: integer
Expand Down Expand Up @@ -511,6 +513,31 @@ rules:
- patch
- update
- watch
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
- apiGroups:
- ""
resources:
- pods/exec
verbs:
- create
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
Expand Down
10 changes: 3 additions & 7 deletions internal/controller/k0smotroncluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ type K0smotronClusterReconciler struct {
//+kubebuilder:rbac:groups=k0smotron.io,resources=k0smotronclusters/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=k0smotron.io,resources=k0smotronclusters/finalizers,verbs=update
// +kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=secrets,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=pods,verbs=get;list
// +kubebuilder:rbac:groups=core,resources=pods/exec,verbs=create
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete

// Reconcile is part of the main kubernetes reconciliation loop which aims to
Expand All @@ -85,13 +88,6 @@ func (r *K0smotronClusterReconciler) Reconcile(ctx context.Context, req ctrl.Req
return ctrl.Result{}, client.IgnoreNotFound(err)
}

if kmc.Spec.Service.APIPort == 0 {
kmc.Spec.Service.APIPort = defaultAPIPort
}
if kmc.Spec.Service.KonnectivityPort == 0 {
kmc.Spec.Service.APIPort = defaultKonnectivityPort
}

logger.Info("Reconciling")

logger.Info("Reconciling services")
Expand Down

0 comments on commit ed91834

Please sign in to comment.