Skip to content

Commit

Permalink
Cluster API v1.6.0
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Makhov <[email protected]>
  • Loading branch information
makhov committed Jan 2, 2024
1 parent 1575fa2 commit e2cf510
Show file tree
Hide file tree
Showing 6 changed files with 289 additions and 228 deletions.
25 changes: 13 additions & 12 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ import (
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/client-go/tools/clientcmd"

"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/kubernetes"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

bootstrapv1beta1 "github.com/k0sproject/k0smotron/api/bootstrap/v1beta1"
controlplanev1beta1 "github.com/k0sproject/k0smotron/api/controlplane/v1beta1"
infrastructurev1beta1 "github.com/k0sproject/k0smotron/api/infrastructure/v1beta1"
Expand All @@ -42,6 +33,15 @@ import (
"github.com/k0sproject/k0smotron/internal/controller/controlplane"
"github.com/k0sproject/k0smotron/internal/controller/infrastructure"
controller "github.com/k0sproject/k0smotron/internal/controller/k0smotron.io"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/kubernetes"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
//+kubebuilder:scaffold:imports
Expand Down Expand Up @@ -104,9 +104,10 @@ func main() {
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
Scheme: scheme,
Metrics: metricsserver.Options{
BindAddress: metricsAddr,
},
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "639dd9c3.k0smotron.io",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1944,26 +1944,83 @@ spec:
items:
type: string
type: array
allocatedResourceStatuses:
additionalProperties:
description: When a controller receives persistentvolume
claim update with ClaimResourceStatus for a resource
that it does not recognizes, then it should ignore
that update and let other controllers handle it.
type: string
description: "allocatedResourceStatuses stores status
of resource being resized for the given PVC. Key names
follow standard Kubernetes label syntax. Valid values
are either: * Un-prefixed keys: - storage - the capacity
of the volume. * Custom resources must use implementation-defined
prefixed names such as \"example.com/my-custom-resource\"
Apart from above values - keys that are unprefixed or
have kubernetes.io prefix are considered reserved and
hence may not be used. \n ClaimResourceStatus can be
in any of following states: - ControllerResizeInProgress:
State set when resize controller starts resizing the
volume in control-plane. - ControllerResizeFailed: State
set when resize has failed in resize controller with
a terminal error. - NodeResizePending: State set when
resize controller has finished resizing the volume but
further resizing of volume is needed on the node. -
NodeResizeInProgress: State set when kubelet starts
resizing the volume. - NodeResizeFailed: State set when
resizing has failed in kubelet with a terminal error.
Transient errors don't set NodeResizeFailed. For example:
if expanding a PVC for more capacity - this field can
be one of the following states: - pvc.status.allocatedResourceStatus['storage']
= \"ControllerResizeInProgress\" - pvc.status.allocatedResourceStatus['storage']
= \"ControllerResizeFailed\" - pvc.status.allocatedResourceStatus['storage']
= \"NodeResizePending\" - pvc.status.allocatedResourceStatus['storage']
= \"NodeResizeInProgress\" - pvc.status.allocatedResourceStatus['storage']
= \"NodeResizeFailed\" When this field is not set, it
means that no resize operation is in progress for the
given PVC. \n A controller that receives PVC update
with previously unknown resourceName or ClaimResourceStatus
should ignore the update for the purpose it was designed.
For example - a controller that only is responsible
for resizing capacity of the volume, should ignore PVC
updates that change other valid resources associated
with PVC. \n This is an alpha field and requires enabling
RecoverVolumeExpansionFailure feature."
type: object
x-kubernetes-map-type: granular
allocatedResources:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: allocatedResources is the storage resource
within AllocatedResources tracks the capacity allocated
to a PVC. It may be larger than the actual capacity
when a volume expansion operation is requested. For
storage quota, the larger value from allocatedResources
and PVC.spec.resources is used. If allocatedResources
is not set, PVC.spec.resources alone is used for quota
calculation. If a volume expansion capacity request
is lowered, allocatedResources is only lowered if there
are no expansion operations in progress and if the actual
volume capacity is equal or lower than the requested
capacity. This is an alpha field and requires enabling
RecoverVolumeExpansionFailure feature.
description: "allocatedResources tracks the resources
allocated to a PVC including its capacity. Key names
follow standard Kubernetes label syntax. Valid values
are either: * Un-prefixed keys: - storage - the capacity
of the volume. * Custom resources must use implementation-defined
prefixed names such as \"example.com/my-custom-resource\"
Apart from above values - keys that are unprefixed or
have kubernetes.io prefix are considered reserved and
hence may not be used. \n Capacity reported here may
be larger than the actual capacity when a volume expansion
operation is requested. For storage quota, the larger
value from allocatedResources and PVC.spec.resources
is used. If allocatedResources is not set, PVC.spec.resources
alone is used for quota calculation. If a volume expansion
capacity request is lowered, allocatedResources is only
lowered if there are no expansion operations in progress
and if the actual volume capacity is equal or lower
than the requested capacity. \n A controller that receives
PVC update with previously unknown resourceName should
ignore the update for the purpose it was designed. For
example - a controller that only is responsible for
resizing capacity of the volume, should ignore PVC updates
that change other valid resources associated with PVC.
\n This is an alpha field and requires enabling RecoverVolumeExpansionFailure
feature."
type: object
capacity:
additionalProperties:
Expand Down Expand Up @@ -2018,13 +2075,6 @@ spec:
phase:
description: phase represents the current phase of PersistentVolumeClaim.
type: string
resizeStatus:
description: resizeStatus stores status of resize operation.
ResizeStatus is not set by default but when expansion
is complete resizeStatus is set to empty string by resize
controller or kubelet. This is an alpha field and requires
enabling RecoverVolumeExpansionFailure feature.
type: string
type: object
type: object
type:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1944,26 +1944,83 @@ spec:
items:
type: string
type: array
allocatedResourceStatuses:
additionalProperties:
description: When a controller receives persistentvolume
claim update with ClaimResourceStatus for a resource
that it does not recognizes, then it should ignore
that update and let other controllers handle it.
type: string
description: "allocatedResourceStatuses stores status
of resource being resized for the given PVC. Key names
follow standard Kubernetes label syntax. Valid values
are either: * Un-prefixed keys: - storage - the capacity
of the volume. * Custom resources must use implementation-defined
prefixed names such as \"example.com/my-custom-resource\"
Apart from above values - keys that are unprefixed or
have kubernetes.io prefix are considered reserved and
hence may not be used. \n ClaimResourceStatus can be
in any of following states: - ControllerResizeInProgress:
State set when resize controller starts resizing the
volume in control-plane. - ControllerResizeFailed: State
set when resize has failed in resize controller with
a terminal error. - NodeResizePending: State set when
resize controller has finished resizing the volume but
further resizing of volume is needed on the node. -
NodeResizeInProgress: State set when kubelet starts
resizing the volume. - NodeResizeFailed: State set when
resizing has failed in kubelet with a terminal error.
Transient errors don't set NodeResizeFailed. For example:
if expanding a PVC for more capacity - this field can
be one of the following states: - pvc.status.allocatedResourceStatus['storage']
= \"ControllerResizeInProgress\" - pvc.status.allocatedResourceStatus['storage']
= \"ControllerResizeFailed\" - pvc.status.allocatedResourceStatus['storage']
= \"NodeResizePending\" - pvc.status.allocatedResourceStatus['storage']
= \"NodeResizeInProgress\" - pvc.status.allocatedResourceStatus['storage']
= \"NodeResizeFailed\" When this field is not set, it
means that no resize operation is in progress for the
given PVC. \n A controller that receives PVC update
with previously unknown resourceName or ClaimResourceStatus
should ignore the update for the purpose it was designed.
For example - a controller that only is responsible
for resizing capacity of the volume, should ignore PVC
updates that change other valid resources associated
with PVC. \n This is an alpha field and requires enabling
RecoverVolumeExpansionFailure feature."
type: object
x-kubernetes-map-type: granular
allocatedResources:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: allocatedResources is the storage resource
within AllocatedResources tracks the capacity allocated
to a PVC. It may be larger than the actual capacity
when a volume expansion operation is requested. For
storage quota, the larger value from allocatedResources
and PVC.spec.resources is used. If allocatedResources
is not set, PVC.spec.resources alone is used for quota
calculation. If a volume expansion capacity request
is lowered, allocatedResources is only lowered if there
are no expansion operations in progress and if the actual
volume capacity is equal or lower than the requested
capacity. This is an alpha field and requires enabling
RecoverVolumeExpansionFailure feature.
description: "allocatedResources tracks the resources
allocated to a PVC including its capacity. Key names
follow standard Kubernetes label syntax. Valid values
are either: * Un-prefixed keys: - storage - the capacity
of the volume. * Custom resources must use implementation-defined
prefixed names such as \"example.com/my-custom-resource\"
Apart from above values - keys that are unprefixed or
have kubernetes.io prefix are considered reserved and
hence may not be used. \n Capacity reported here may
be larger than the actual capacity when a volume expansion
operation is requested. For storage quota, the larger
value from allocatedResources and PVC.spec.resources
is used. If allocatedResources is not set, PVC.spec.resources
alone is used for quota calculation. If a volume expansion
capacity request is lowered, allocatedResources is only
lowered if there are no expansion operations in progress
and if the actual volume capacity is equal or lower
than the requested capacity. \n A controller that receives
PVC update with previously unknown resourceName should
ignore the update for the purpose it was designed. For
example - a controller that only is responsible for
resizing capacity of the volume, should ignore PVC updates
that change other valid resources associated with PVC.
\n This is an alpha field and requires enabling RecoverVolumeExpansionFailure
feature."
type: object
capacity:
additionalProperties:
Expand Down Expand Up @@ -2018,13 +2075,6 @@ spec:
phase:
description: phase represents the current phase of PersistentVolumeClaim.
type: string
resizeStatus:
description: resizeStatus stores status of resize operation.
ResizeStatus is not set by default but when expansion
is complete resizeStatus is set to empty string by resize
controller or kubelet. This is an alpha field and requires
enabling RecoverVolumeExpansionFailure feature.
type: string
type: object
type: object
type:
Expand Down
Loading

0 comments on commit e2cf510

Please sign in to comment.