Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,553 changes: 2,770 additions & 1,783 deletions api/v1alpha1/generated.pb.go

Large diffs are not rendered by default.

62 changes: 60 additions & 2 deletions api/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&PromotionTaskList{},
&Warehouse{},
&WarehouseList{},
&PromotionWindow{},
&PromotionWindowList{},
)
metav1.AddToGroupVersion(scheme, GroupVersion)
return nil
Expand Down
8 changes: 6 additions & 2 deletions api/v1alpha1/project_config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,19 @@ type PromotionPolicy struct {
Stage string `json:"stage,omitempty" protobuf:"bytes,1,opt,name=stage"`
// StageSelector is a selector that matches the Stage resource to which
// this policy applies.
StageSelector *PromotionPolicySelector `json:"stageSelector,omitempty" protobuf:"bytes,3,opt,name=stageSelector"`
StageSelector *PromotionPolicySelector `json:"stageSelector,omitempty" protobuf:"bytes,2,opt,name=stageSelector"`
// AutoPromotionEnabled indicates whether new Freight can automatically be
// promoted into the Stage referenced by the Stage field. Note: There are may
// be other conditions also required for an auto-promotion to occur. This
// field defaults to false, but is commonly set to true for Stages that
// subscribe to Warehouses instead of other, upstream Stages. This allows
// users to define Stages that are automatically updated as soon as new
// artifacts are detected.
AutoPromotionEnabled bool `json:"autoPromotionEnabled,omitempty" protobuf:"varint,2,opt,name=autoPromotionEnabled"`
AutoPromotionEnabled bool `json:"autoPromotionEnabled,omitempty" protobuf:"varint,3,opt,name=autoPromotionEnabled"`
// PromotionWindows defines time windows during which automatic promotions
// are allowed to occur. If not specified, automatic promotions can occur at
// any time.
PromotionWindows []PromotionWindowReference `json:"promotionWindows,omitempty" protobuf:"bytes,4,rep,name=promotionWindows"`
}

// WebhookReceiverConfig describes the configuration for a single webhook
Expand Down
61 changes: 61 additions & 0 deletions api/v1alpha1/promotion_window_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +kubebuilder:resource:shortName={promotionwindow,promotionwindows}
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name=TimeZone,type=string,JSONPath=`.spec.timeZone`

type PromotionWindow struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

// Spec describes the composition of an AutoPromotionWindow, including the
// recurring time window and time zone.
//
// +kubebuilder:validation:Required
Spec PromotionWindowSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
}

type PromotionWindowSpec struct {
// Kind is either "deny" or "allow", indicating whether the time window
// represents a period during which promotions are denied or allowed.
//
// +kubebuilder:validation:Enum=deny;allow;
Kind string `json:"kind,omitempty" protobuf:"bytes,1,opt,name=kind"`
// Schedule describes a recurring time window.
// Example: "0 0 * * 1-5" means every weekday at midnight.
//
// +kubebuilder:validation:Required
Schedule string `json:"schedule" protobuf:"bytes,2,opt,name=schedule"`
// Duration is the length of time that the window lasts after the start
// time defined by the Schedule.
//
// +kubebuilder:validation:Required
Duration string `json:"duration,omitempty" protobuf:"bytes,3,opt,name=duration"`
// TimeZone is the IANA time zone name that applies to the time window.
// If not specified, UTC is assumed.
TimeZone string `json:"timeZone,omitempty" protobuf:"bytes,4,opt,name=timeZone"`
}

type PromotionWindowReference struct {
// Name is the name of the time window.
//
// +kubebuilder:validation:Required
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// Kind is the kind of the time window
//
// +kubebuilder:validation:Enum=PromotionWindow;ClusterPromotionWindow;
Kind string `json:"kind,omitempty" protobuf:"bytes,2,opt,name=kind"`
}

// +kubebuilder:object:root=true

// PromotionWindowList contains a list of PromotionWindows.
type PromotionWindowList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
Items []PromotionWindow `json:"items" protobuf:"bytes,2,rep,name=items"`
}
93 changes: 93 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions charts/kargo/resources/crds/kargo.akuity.io_projectconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,26 @@ spec:
users to define Stages that are automatically updated as soon as new
artifacts are detected.
type: boolean
promotionWindows:
description: |-
PromotionWindows defines time windows during which automatic promotions
are allowed to occur. If not specified, automatic promotions can occur at
any time.
items:
properties:
kind:
description: Kind is the kind of the time window
enum:
- PromotionWindow
- ClusterPromotionWindow
type: string
name:
description: Name is the name of the time window.
type: string
required:
- name
type: object
type: array
stage:
description: |-
Stage is the name of the Stage to which this policy applies.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.19.0
name: promotionwindows.kargo.akuity.io
spec:
group: kargo.akuity.io
names:
kind: PromotionWindow
listKind: PromotionWindowList
plural: promotionwindows
shortNames:
- promotionwindow
- promotionwindows
singular: promotionwindow
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .spec.timeZone
name: TimeZone
type: string
name: v1alpha1
schema:
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/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: |-
Spec describes the composition of an AutoPromotionWindow, including the
recurring time window and time zone.
properties:
duration:
description: |-
Duration is the length of time that the window lasts after the start
time defined by the Schedule.
type: string
kind:
description: |-
Kind is either "deny" or "allow", indicating whether the time window
represents a period during which promotions are denied or allowed.
enum:
- deny
- allow
type: string
schedule:
description: |-
Schedule describes a recurring time window.
Example: "0 0 * * 1-5" means every weekday at midnight.
type: string
timeZone:
description: |-
TimeZone is the IANA time zone name that applies to the time window.
If not specified, UTC is assumed.
type: string
required:
- duration
- schedule
type: object
required:
- spec
type: object
served: true
storage: true
subresources: {}
Loading