Skip to content

Commit

Permalink
vault cleanup, added type to release policy
Browse files Browse the repository at this point in the history
  • Loading branch information
xadhatter committed Jan 24, 2024
1 parent f572b27 commit 4c4bc88
Show file tree
Hide file tree
Showing 41 changed files with 906 additions and 847 deletions.
2 changes: 1 addition & 1 deletion api/crds/kubefox.xigxog.io_appdeployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- jsonPath: .spec.appName
name: App
type: string
- jsonPath: .spec.Version
- jsonPath: .spec.version
name: Version
type: string
- jsonPath: .status.conditions[?(@.type=='Available')].status
Expand Down
45 changes: 20 additions & 25 deletions api/crds/kubefox.xigxog.io_environments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,7 @@ spec:
singular: environment
scope: Cluster
versions:
- additionalPrinterColumns:
- jsonPath: .spec.releasePolicy.versionRequired
name: Version Required
type: boolean
- jsonPath: .spec.releasePolicy.pendingDeadlineSeconds
name: Pending Deadline
type: integer
name: v1alpha1
- name: v1alpha1
schema:
openAPIV3Schema:
properties:
Expand Down Expand Up @@ -85,40 +78,42 @@ spec:
properties:
releasePolicy:
properties:
activationDeadlineSeconds:
default: 300
description: If the pending Release cannot be activated before
the activation deadline it will be considered failed and the
Release will automatically rolled back to the current active
Release. Pointer is used to distinguish between not set and
false.
minimum: 3
type: integer
historyLimits:
properties:
ageDays:
description: Maximum age of the Release to keep in history.
Once the limit is reached the oldest Release in history
will be deleted. Age is based on archiveTime. Set to 0 to
disable.
disable. Pointer is used to distinguish between not set
and false.
minimum: 0
type: integer
count:
default: 10
description: Maximum number of Releases to keep in history.
Once the limit is reached the oldest Release in history
will be deleted. Age is based on archiveTime.
will be deleted. Age is based on archiveTime. Pointer is
used to distinguish between not set and false.
minimum: 0
type: integer
type: object
pendingDeadlineSeconds:
default: 300
description: If the pending Request cannot be activated before
the deadline it will be considered failed. If the Release becomes
available for activation after the deadline has been exceeded,
it will not be activated.
minimum: 3
type: integer
versionRequired:
default: true
description: If true '.spec.release.appDeployment.version' is
required. Pointer is used to distinguish between not set and
false.
type: boolean
type:
default: Stable
enum:
- Stable
- Testing
type: string
type: object
type: object
type: object
served: true
storage: true
subresources: {}
34 changes: 25 additions & 9 deletions api/crds/kubefox.xigxog.io_releasemanifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .spec.id
- jsonPath: .spec.releaseId
name: Id
type: string
- jsonPath: .spec.virtualEnvironment.name
- jsonPath: .spec.environment.name
name: Environment
type: string
- jsonPath: .spec.virtualEnvironment.environment
- jsonPath: .spec.virtualEnvironment.name
name: VirtualEnvironment
type: string
name: v1alpha1
Expand Down Expand Up @@ -277,14 +277,30 @@ spec:
type: object
minProperties: 1
type: object
id:
environment:
properties:
name:
minLength: 1
type: string
resourceVersion:
minLength: 1
type: string
uid:
description: UID is a type that holds unique ID values, including
UUIDs. Because we don't ONLY use UUIDs, this is an alias to
string. Being a type captures intent and helps make sure that
UIDs and names do not get conflated.
type: string
required:
- name
- resourceVersion
- uid
type: object
releaseId:
minLength: 1
type: string
virtualEnvironment:
properties:
environment:
minLength: 1
type: string
name:
minLength: 1
type: string
Expand All @@ -298,14 +314,14 @@ spec:
UIDs and names do not get conflated.
type: string
required:
- environment
- name
- resourceVersion
- uid
type: object
required:
- apps
- id
- environment
- releaseId
- virtualEnvironment
type: object
required:
Expand Down
33 changes: 16 additions & 17 deletions api/crds/kubefox.xigxog.io_virtualenvironments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .spec.environment
name: Environment
type: string
- jsonPath: .status.activeRelease.releaseManifest
name: Manifest
type: string
Expand Down Expand Up @@ -117,15 +120,19 @@ spec:
type: object
minProperties: 1
type: object
id:
minLength: 1
type: string
required:
- apps
- id
type: object
releasePolicy:
properties:
activationDeadlineSeconds:
description: If the pending Release cannot be activated before
the activation deadline it will be considered failed and the
Release will automatically rolled back to the current active
Release. Pointer is used to distinguish between not set and
false.
minimum: 3
type: integer
historyLimits:
properties:
ageDays:
Expand All @@ -144,19 +151,11 @@ spec:
minimum: 0
type: integer
type: object
pendingDeadlineSeconds:
description: If the pending Request cannot be activated before
the deadline it will be considered failed. If the Release becomes
available for activation after the deadline has been exceeded,
it will not be activated. Pointer is used to distinguish between
not set and false.
minimum: 3
type: integer
versionRequired:
description: If true '.spec.release.appDeployment.version' is
required. Pointer is used to distinguish between not set and
false.
type: boolean
type:
enum:
- Stable
- Testing
type: string
type: object
required:
- environment
Expand Down
16 changes: 4 additions & 12 deletions api/data_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

package api

import "fmt"

// +kubebuilder:object:generate=false
type DataProvider interface {
Object
Expand All @@ -19,9 +17,10 @@ type DataProvider interface {
}

type DataKey struct {
Instance string
Namespace string
Kind string
Name string
Namespace string
}

type Data struct {
Expand Down Expand Up @@ -63,12 +62,5 @@ func (lhs Data) MergeInto(rhs *Data) *Data {
return rhs
}

func (k DataKey) Path(instance string) string {
if k.Namespace == "" {
return fmt.Sprintf("kubefox/instance/%s/cluster/data/%s/%s",
instance, k.Kind, k.Name)
} else {
return fmt.Sprintf("kubefox/instance/%s/namespace/%s/data/%s/%s",
instance, k.Namespace, k.Kind, k.Name)
}
}
// POST /:secret-mount-path/data/:path
// DELETE /:secret-mount-path/metadata/:path
14 changes: 7 additions & 7 deletions api/kubernetes/types.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
Copyright © 2023 XigXog
This Source Code Form is subject to the terms of the Mozilla Public License,
v2.0. If a copy of the MPL was not distributed with this file, You can obtain
one at https://mozilla.org/MPL/2.0/.
*/
// Copyright 2023 XigXog
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//
// SPDX-License-Identifier: MPL-2.0

// +kubebuilder:object:generate=true
package kubernetes
Expand Down
16 changes: 8 additions & 8 deletions api/kubernetes/v1alpha1/app_deployment_types.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
Copyright © 2023 XigXog
This Source Code Form is subject to the terms of the Mozilla Public License,
v2.0. If a copy of the MPL was not distributed with this file, You can obtain
one at https://mozilla.org/MPL/2.0/.
*/
// Copyright 2023 XigXog
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//
// SPDX-License-Identifier: MPL-2.0

package v1alpha1

Expand Down Expand Up @@ -78,7 +78,7 @@ type AppDeploymentDetails struct {
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=appdeployments,shortName=appdep;app
// +kubebuilder:printcolumn:name="App",type=string,JSONPath=`.spec.appName`
// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.Version`
// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version`
// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=`.status.conditions[?(@.type=='Available')].status`
// +kubebuilder:printcolumn:name="Reason",type=string,JSONPath=`.status.conditions[?(@.type=='Available')].reason`
// +kubebuilder:printcolumn:name="Progressing",type=string,JSONPath=`.status.conditions[?(@.type=='Progressing')].status`
Expand Down
52 changes: 24 additions & 28 deletions api/kubernetes/v1alpha1/environment_types.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
Copyright © 2023 XigXog
This Source Code Form is subject to the terms of the Mozilla Public License,
v2.0. If a copy of the MPL was not distributed with this file, You can obtain
one at https://mozilla.org/MPL/2.0/.
*/
// Copyright 2023 XigXog
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//
// SPDX-License-Identifier: MPL-2.0

package v1alpha1

Expand All @@ -18,47 +18,43 @@ type EnvironmentSpec struct {
}

type EnvReleasePolicy struct {
// +kubebuilder:validation:Minimum=3
// +kubebuilder:default=300
// +kubebuilder:validation:Enum=Stable;Testing
// +kubebuilder:default=Stable

// If the pending Request cannot be activated before the deadline it will be
// considered failed. If the Release becomes available for activation after
// the deadline has been exceeded, it will not be activated.
PendingDeadlineSeconds uint `json:"pendingDeadlineSeconds,omitempty"`
Type api.ReleaseType `json:"type,omitempty"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=true

// If true '.spec.release.appDeployment.version' is required. Pointer is
// used to distinguish between not set and false.
VersionRequired *bool `json:"versionRequired"`
// +kubebuilder:validation:Minimum=3
// +kubebuilder:default=300

// +kubebuilder:validation:Optional
// If the pending Release cannot be activated before the activation deadline
// it will be considered failed and the Release will automatically rolled
// back to the current active Release. Pointer is used to distinguish
// between not set and false.
ActivationDeadlineSeconds *uint `json:"activationDeadlineSeconds,omitempty"`

HistoryLimits EnvReleaseHistoryLimits `json:"historyLimits"`
HistoryLimits EnvHistoryLimits `json:"historyLimits,omitempty"`
}

type EnvReleaseHistoryLimits struct {
type EnvHistoryLimits struct {
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=10

// Maximum number of Releases to keep in history. Once the limit is reached
// the oldest Release in history will be deleted. Age is based on
// archiveTime.
Count uint `json:"count,omitempty"`
// archiveTime. Pointer is used to distinguish between not set and false.
Count *uint `json:"count,omitempty"`

// +kubebuilder:validation:Minimum=0

// Maximum age of the Release to keep in history. Once the limit is reached
// the oldest Release in history will be deleted. Age is based on
// archiveTime. Set to 0 to disable.
AgeDays uint `json:"ageDays,omitempty"`
// archiveTime. Set to 0 to disable. Pointer is used to distinguish between
// not set and false.
AgeDays *uint `json:"ageDays,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:resource:path=environments,scope=Cluster,shortName=env
// +kubebuilder:printcolumn:name="Version Required",type=boolean,JSONPath=`.spec.releasePolicy.versionRequired`
// +kubebuilder:printcolumn:name="Pending Deadline",type=integer,JSONPath=`.spec.releasePolicy.pendingDeadlineSeconds`

type Environment struct {
metav1.TypeMeta `json:",inline"`
Expand Down
14 changes: 7 additions & 7 deletions api/kubernetes/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
Copyright © 2023 XigXog
This Source Code Form is subject to the terms of the Mozilla Public License,
v2.0. If a copy of the MPL was not distributed with this file, You can obtain
one at https://mozilla.org/MPL/2.0/.
*/
// Copyright 2023 XigXog
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//
// SPDX-License-Identifier: MPL-2.0

// Package v1alpha1 contains API Schema definitions for the k8s v1alpha1 API group
// +kubebuilder:object:generate=true
Expand Down
Loading

0 comments on commit 4c4bc88

Please sign in to comment.