-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
832 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package v1beta1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// UpgradeSuspensionWindowSpec defines the desired state of UpgradeSuspensionWindow | ||
type UpgradeSuspensionWindowSpec struct { | ||
// Start is the time when the suspension window starts. | ||
// +kubebuilder:validation:Required | ||
// +required | ||
Start metav1.Time `json:"start"` | ||
// End is the time when the suspension window ends. | ||
// +kubebuilder:validation:Required | ||
// +required | ||
End metav1.Time `json:"end"` | ||
Reason string `json:"reason"` | ||
|
||
// ConfigSelector is the selector for UpgradeConfigs to suspend upgrades for. | ||
// An empty label selector matches all objects. A null label selector matches no objects. | ||
// Matching UpgradeConfig objects won’t create UpgradeJob objects during the time window. | ||
ConfigSelector *metav1.LabelSelector `json:"configSelector,omitempty"` | ||
// JobSelector is the selector for UpgradeJobs to suspend upgrades for. | ||
// An empty label selector matches all objects. A null label selector matches no objects. | ||
// Matching UpgradeJob objects won’t start the upgrade during the time window. | ||
// Skipped jobs will be marked as successful with reason skipped. | ||
// Success and Finish hooks will be executed as normal. | ||
// If the job was owned by a UpgradeConfig object, the object creates a new job with the current (possibly same) version in the next non-suspended time window. | ||
// Already running jobs will be allowed to finish. | ||
JobSelector *metav1.LabelSelector `json:"jobSelector,omitempty"` | ||
} | ||
|
||
// UpgradeSuspensionWindowStatus defines the observed state of UpgradeSuspensionWindow | ||
type UpgradeSuspensionWindowStatus struct { | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
|
||
// UpgradeSuspensionWindow is the Schema for the upgradejobs API | ||
type UpgradeSuspensionWindow struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec UpgradeSuspensionWindowSpec `json:"spec,omitempty"` | ||
Status UpgradeSuspensionWindowStatus `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// UpgradeSuspensionWindowList contains a list of UpgradeSuspensionWindow | ||
type UpgradeSuspensionWindowList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []UpgradeSuspensionWindow `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&UpgradeSuspensionWindow{}, &UpgradeSuspensionWindowList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
168 changes: 168 additions & 0 deletions
168
config/crd/bases/managedupgrade.appuio.io_upgradesuspensionwindows.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.15.0 | ||
name: upgradesuspensionwindows.managedupgrade.appuio.io | ||
spec: | ||
group: managedupgrade.appuio.io | ||
names: | ||
kind: UpgradeSuspensionWindow | ||
listKind: UpgradeSuspensionWindowList | ||
plural: upgradesuspensionwindows | ||
singular: upgradesuspensionwindow | ||
scope: Namespaced | ||
versions: | ||
- name: v1beta1 | ||
schema: | ||
openAPIV3Schema: | ||
description: UpgradeSuspensionWindow is the Schema for the upgradejobs API | ||
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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: UpgradeSuspensionWindowSpec defines the desired state of | ||
UpgradeSuspensionWindow | ||
properties: | ||
configSelector: | ||
description: |- | ||
ConfigSelector is the selector for UpgradeConfigs to suspend upgrades for. | ||
An empty label selector matches all objects. A null label selector matches no objects. | ||
Matching UpgradeConfig objects won’t create UpgradeJob objects during the time window. | ||
properties: | ||
matchExpressions: | ||
description: matchExpressions is a list of label selector requirements. | ||
The requirements are ANDed. | ||
items: | ||
description: |- | ||
A label selector requirement is a selector that contains values, a key, and an operator that | ||
relates the key and values. | ||
properties: | ||
key: | ||
description: key is the label key that the selector applies | ||
to. | ||
type: string | ||
operator: | ||
description: |- | ||
operator represents a key's relationship to a set of values. | ||
Valid operators are In, NotIn, Exists and DoesNotExist. | ||
type: string | ||
values: | ||
description: |- | ||
values is an array of string values. If the operator is In or NotIn, | ||
the values array must be non-empty. If the operator is Exists or DoesNotExist, | ||
the values array must be empty. This array is replaced during a strategic | ||
merge patch. | ||
items: | ||
type: string | ||
type: array | ||
x-kubernetes-list-type: atomic | ||
required: | ||
- key | ||
- operator | ||
type: object | ||
type: array | ||
x-kubernetes-list-type: atomic | ||
matchLabels: | ||
additionalProperties: | ||
type: string | ||
description: |- | ||
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels | ||
map is equivalent to an element of matchExpressions, whose key field is "key", the | ||
operator is "In", and the values array contains only "value". The requirements are ANDed. | ||
type: object | ||
type: object | ||
x-kubernetes-map-type: atomic | ||
end: | ||
description: End is the time when the suspension window ends. | ||
format: date-time | ||
type: string | ||
jobSelector: | ||
description: |- | ||
JobSelector is the selector for UpgradeJobs to suspend upgrades for. | ||
An empty label selector matches all objects. A null label selector matches no objects. | ||
Matching UpgradeJob objects won’t start the upgrade during the time window. | ||
Skipped jobs will be marked as successful with reason skipped. | ||
Success and Finish hooks will be executed as normal. | ||
If the job was owned by a UpgradeConfig object, the object creates a new job with the current (possibly same) version in the next non-suspended time window. | ||
Already running jobs will be allowed to finish. | ||
properties: | ||
matchExpressions: | ||
description: matchExpressions is a list of label selector requirements. | ||
The requirements are ANDed. | ||
items: | ||
description: |- | ||
A label selector requirement is a selector that contains values, a key, and an operator that | ||
relates the key and values. | ||
properties: | ||
key: | ||
description: key is the label key that the selector applies | ||
to. | ||
type: string | ||
operator: | ||
description: |- | ||
operator represents a key's relationship to a set of values. | ||
Valid operators are In, NotIn, Exists and DoesNotExist. | ||
type: string | ||
values: | ||
description: |- | ||
values is an array of string values. If the operator is In or NotIn, | ||
the values array must be non-empty. If the operator is Exists or DoesNotExist, | ||
the values array must be empty. This array is replaced during a strategic | ||
merge patch. | ||
items: | ||
type: string | ||
type: array | ||
x-kubernetes-list-type: atomic | ||
required: | ||
- key | ||
- operator | ||
type: object | ||
type: array | ||
x-kubernetes-list-type: atomic | ||
matchLabels: | ||
additionalProperties: | ||
type: string | ||
description: |- | ||
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels | ||
map is equivalent to an element of matchExpressions, whose key field is "key", the | ||
operator is "In", and the values array contains only "value". The requirements are ANDed. | ||
type: object | ||
type: object | ||
x-kubernetes-map-type: atomic | ||
reason: | ||
type: string | ||
start: | ||
description: Start is the time when the suspension window starts. | ||
format: date-time | ||
type: string | ||
required: | ||
- end | ||
- reason | ||
- start | ||
type: object | ||
status: | ||
description: UpgradeSuspensionWindowStatus defines the observed state | ||
of UpgradeSuspensionWindow | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
config/crd/patches/cainjection_in_upgradesuspensionwindows.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# The following patch adds a directive for certmanager to inject CA into the CRD | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) | ||
name: upgradesuspensionwindows.managedupgrade.appuio.io |
16 changes: 16 additions & 0 deletions
16
config/crd/patches/webhook_in_upgradesuspensionwindows.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# The following patch enables a conversion webhook for the CRD | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: upgradesuspensionwindows.managedupgrade.appuio.io | ||
spec: | ||
conversion: | ||
strategy: Webhook | ||
webhook: | ||
clientConfig: | ||
service: | ||
namespace: system | ||
name: webhook-service | ||
path: /convert | ||
conversionReviewVersions: | ||
- v1 |
Oops, something went wrong.