Skip to content

Commit

Permalink
Generate MachineDisruptionBudget via gen-crd
Browse files Browse the repository at this point in the history
  • Loading branch information
Artyom Lukianov committed Apr 28, 2019
1 parent f5cc409 commit feace95
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 2 deletions.
1 change: 1 addition & 0 deletions hack/gen-crd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ popd

echo "Coping generated CRDs"
cp $dir/src/github.com/openshift/machine-api-operator/config/crds/healthchecking_v1alpha1_machinehealthcheck.yaml install/0000_30_machine-api-operator_07_machinehealthcheck.crd.yaml
cp $dir/src/github.com/openshift/machine-api-operator/config/crds/healthchecking_v1alpha1_machinedisruptionbudget.yaml install/0000_30_machine-api-operator_08_machinedisruptionbudget.crd.yaml
cp $dir/src/github.com/openshift/machine-api-operator/config/crds/machine_v1beta1_machineset.yaml install/0000_30_machine-api-operator_03_machineset.crd.yaml
cp $dir/src/github.com/openshift/machine-api-operator/config/crds/machine_v1beta1_machine.yaml install/0000_30_machine-api-operator_02_machine.crd.yaml

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
labels:
controller-tools.k8s.io: "1.0"
name: machinedisruptionbudgets.healthchecking.openshift.io
spec:
additionalPrinterColumns:
- JSONPath: .status.currentHealthy
description: The number of healthy machines
name: Healthy
type: integer
- JSONPath: .status.ExpectedMachines
description: The total number of machines
name: Total
type: integer
- JSONPath: .status.desiredHealthy
description: The desired number of healthy machines
name: Desired
type: integer
group: healthchecking.openshift.io
names:
kind: MachineDisruptionBudget
plural: machinedisruptionbudgets
scope: Namespaced
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Specification of the desired behavior of the MachineDisruptionBudget.
properties:
maxUnavailable:
description: An deletion is allowed if at most "maxUnavailable" machines
selected by "selector" are unavailable after the deletion. For example,
one can prevent all voluntary deletions by specifying 0. This is a
mutually exclusive setting with "minAvailable".
format: int32
type: integer
minAvailable:
description: An deletion of the machine is allowed if at least "minAvailable"
machines selected by "selector" will still be available after the
deletion. So for example you can prevent all voluntary deletions by
specifying "100%".
format: int32
type: integer
selector:
description: Label query over machines whose deletions are managed by
the disruption budget.
type: object
type: object
status:
description: Most recently observed status of the MachineDisruptionBudget.
properties:
DisruptedMachines:
description: DisruptedMachines contains information about machines whose
deletion was processed by the API server but has not yet been observed
by the MachineDisruptionBudget controller. A machine will be in this
map from the time when the API server processed the deletion request
to the time when the machine is seen by MDB controller as having been
marked for deletion (or after a timeout). The key in the map is the
name of the machine and the value is the time when the API server
processed the deletion request. If the deletion didn't occur and a
machine is still there it will be removed from the list automatically
by MachineDisruptionBudget controller after some time. If everything
goes smooth this map should be empty for the most of the time. Large
number of entries in the map may indicate problems with machines deletions.
type: object
ExpectedMachines:
description: total number of machines counted by this disruption budget
format: int32
type: integer
currentHealthy:
description: current number of healthy machines
format: int32
type: integer
desiredHealthy:
description: minimum desired number of healthy machines
format: int32
type: integer
disruptionsAllowed:
description: Number of machines disruptions that are currently allowed.
format: int32
type: integer
observedGeneration:
description: Most recent generation observed when updating this MDB
status. MachineDisruptionsAllowed and other status information is
valid only if observedGeneration equals to MDB's object generation.
format: int64
type: integer
required:
- disruptionsAllowed
- currentHealthy
- desiredHealthy
- ExpectedMachines
type: object
version: v1alpha1
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
5 changes: 3 additions & 2 deletions kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ resources:
- install/0000_30_machine-api-operator_02_machine.crd.yaml
- install/0000_30_machine-api-operator_03_machineset.crd.yaml
- install/0000_30_machine-api-operator_07_machinehealthcheck.crd.yaml
- install/0000_30_machine-api-operator_08_rbac.yaml
- install/0000_30_machine-api-operator_09_deployment.yaml
- install/0000_30_machine-api-operator_08_machinedisruptionbudget.crd.yaml
- install/0000_30_machine-api-operator_09_rbac.yaml
- install/0000_30_machine-api-operator_10_deployment.yaml

patches:
- config/machine-api-operator-patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ type MachineDisruptionBudgetStatus struct {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// MachineDisruptionBudget is an object to define the max disruption that a collection of machines can experience
// kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Healthy",type="integer",JSONPath=".status.currentHealthy",description="The number of healthy machines"
// +kubebuilder:printcolumn:name="Total",type="integer",JSONPath=".status.ExpectedMachines",description="The total number of machines"
// +kubebuilder:printcolumn:name="Desired",type="integer",JSONPath=".status.desiredHealthy",description="The desired number of healthy machines"
type MachineDisruptionBudget struct {
metav1.TypeMeta `json:",inline"`
// +optional
Expand Down

0 comments on commit feace95

Please sign in to comment.