Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(operator): bootstrapped KeptnAppCreationRequest CRD #1134

Merged
merged 7 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
51 changes: 51 additions & 0 deletions docs/content/en/docs/crd-ref/lifecycle/v1alpha3/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Package v1alpha3 contains API Schema definitions for the lifecycle v1alpha3 API

### Resource Types
- [KeptnApp](#keptnapp)
- [KeptnAppCreationRequest](#keptnappcreationrequest)
- [KeptnAppCreationRequestList](#keptnappcreationrequestlist)
- [KeptnAppList](#keptnapplist)
- [KeptnAppVersion](#keptnappversion)
- [KeptnAppVersionList](#keptnappversionlist)
Expand Down Expand Up @@ -175,6 +177,55 @@ _Appears in:_
| `spec` _[KeptnAppSpec](#keptnappspec)_ | |


#### KeptnAppCreationRequest



KeptnAppCreationRequest is the Schema for the keptnappcreationrequests API

_Appears in:_
- [KeptnAppCreationRequestList](#keptnappcreationrequestlist)

| Field | Description |
| --- | --- |
| `apiVersion` _string_ | `lifecycle.keptn.sh/v1alpha3`
| `kind` _string_ | `KeptnAppCreationRequest`
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. |
| `spec` _[KeptnAppCreationRequestSpec](#keptnappcreationrequestspec)_ | |


#### KeptnAppCreationRequestList



KeptnAppCreationRequestList contains a list of KeptnAppCreationRequest



| Field | Description |
| --- | --- |
| `apiVersion` _string_ | `lifecycle.keptn.sh/v1alpha3`
| `kind` _string_ | `KeptnAppCreationRequestList`
| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. |
| `items` _[KeptnAppCreationRequest](#keptnappcreationrequest) array_ | |


#### KeptnAppCreationRequestSpec



KeptnAppCreationRequestSpec defines the desired state of KeptnAppCreationRequest

_Appears in:_
- [KeptnAppCreationRequest](#keptnappcreationrequest)

| Field | Description |
| --- | --- |
| `appName` _string_ | AppName is the name of the KeptnApp the KeptnAppCreationRequest should create if no user-defined object with that name is found. |




#### KeptnAppList


Expand Down
1 change: 1 addition & 0 deletions helm/chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ checks
| `lifecycleOperator.manager.containerSecurityContext.runAsUser` | | `65532` |
| `lifecycleOperator.manager.containerSecurityContext.seccompProfile.type` | | `RuntimeDefault` |
| `lifecycleOperator.manager.env.keptnAppControllerLogLevel` | sets the log level of Keptn App Controller | `0` |
| `lifecycleOperator.manager.env.keptnAppCreationRequestControllerLogLevel` | sets the log level of Keptn App Creation Request Controller | `0` |
| `lifecycleOperator.manager.env.keptnAppVersionControllerLogLevel` | sets the log level of Keptn AppVersion Controller | `0` |
| `lifecycleOperator.manager.env.keptnEvaluationControllerLogLevel` | sets the log level of Keptn Evaluation Controller | `0` |
| `lifecycleOperator.manager.env.keptnTaskControllerLogLevel` | sets the log level of Keptn Task Controller | `0` |
Expand Down
1 change: 1 addition & 0 deletions helm/chart/doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
## @param lifecycleOperator.manager.containerSecurityContext.seccompProfile.type

## @param lifecycleOperator.manager.env.keptnAppControllerLogLevel sets the log level of Keptn App Controller
## @param lifecycleOperator.manager.env.keptnAppCreationRequestControllerLogLevel sets the log level of Keptn App Creation Request Controller
## @param lifecycleOperator.manager.env.keptnAppVersionControllerLogLevel sets the log level of Keptn AppVersion Controller
## @param lifecycleOperator.manager.env.keptnEvaluationControllerLogLevel sets the log level of Keptn Evaluation Controller
## @param lifecycleOperator.manager.env.keptnTaskControllerLogLevel sets the log level of Keptn Task Controller
Expand Down
1 change: 1 addition & 0 deletions helm/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ lifecycleOperator:
env:
functionRunnerImage: ghcr.keptn.sh/keptn/functions-runtime:v0.7.0
keptnAppControllerLogLevel: "0"
keptnAppCreationRequestControllerLogLevel: "0"
keptnAppVersionControllerLogLevel: "0"
keptnEvaluationControllerLogLevel: "0"
keptnTaskControllerLogLevel: "0"
Expand Down
9 changes: 9 additions & 0 deletions operator/PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,13 @@ resources:
kind: KeptnEvaluationProvider
path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3
version: v1alpha3
- api:
crdVersion: v1
namespaced: true
controller: true
domain: keptn.sh
group: lifecycle
kind: KeptnAppCreationRequest
path: github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3
version: v1alpha3
version: "3"
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
Copyright 2022.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha3

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

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// KeptnAppCreationRequestSpec defines the desired state of KeptnAppCreationRequest
type KeptnAppCreationRequestSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
odubajDT marked this conversation as resolved.
Show resolved Hide resolved

// AppName is the name of the KeptnApp the KeptnAppCreationRequest should create if no user-defined object with that name is found.
AppName string `json:"appName"`
}

// KeptnAppCreationRequestStatus defines the observed state of KeptnAppCreationRequest
type KeptnAppCreationRequestStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// KeptnAppCreationRequest is the Schema for the keptnappcreationrequests API
type KeptnAppCreationRequest struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec KeptnAppCreationRequestSpec `json:"spec,omitempty"`
Status KeptnAppCreationRequestStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// KeptnAppCreationRequestList contains a list of KeptnAppCreationRequest
type KeptnAppCreationRequestList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []KeptnAppCreationRequest `json:"items"`
}

func init() {
SchemeBuilder.Register(&KeptnAppCreationRequest{}, &KeptnAppCreationRequestList{})
}
89 changes: 89 additions & 0 deletions operator/apis/lifecycle/v1alpha3/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
name: keptnappcreationrequests.lifecycle.keptn.sh
spec:
group: lifecycle.keptn.sh
names:
kind: KeptnAppCreationRequest
listKind: KeptnAppCreationRequestList
plural: keptnappcreationrequests
singular: keptnappcreationrequest
scope: Namespaced
versions:
- name: v1alpha3
schema:
openAPIV3Schema:
description: KeptnAppCreationRequest is the Schema for the keptnappcreationrequests
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: KeptnAppCreationRequestSpec defines the desired state of
KeptnAppCreationRequest
properties:
appName:
description: AppName is the name of the KeptnApp the KeptnAppCreationRequest
should create if no user-defined object with that name is found.
type: string
required:
- appName
type: object
status:
description: KeptnAppCreationRequestStatus defines the observed state
of KeptnAppCreationRequest
type: object
type: object
served: true
storage: true
subresources:
status: {}
2 changes: 2 additions & 0 deletions operator/config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ resources:
- bases/lifecycle.keptn.sh_keptnevaluationproviders.yaml
- bases/lifecycle.keptn.sh_keptnevaluations.yaml
- bases/options.keptn.sh_keptnconfigs.yaml
- bases/lifecycle.keptn.sh_keptnappcreationrequests.yaml
#+kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
Expand All @@ -31,6 +32,7 @@ patchesStrategicMerge:
#- patches/webhook_in_lifecycle_keptnappversions.yaml
#- patches/webhook_in_lifecycle_keptnworkloadinstances.yaml
#- patches/webhook_in_lifecycle_keptnevaluationproviders.yaml
#- patches/webhook_in_keptnappcreationrequests.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
Expand Down
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: keptnappcreationrequests.lifecycle.keptn.sh
spec:
conversion:
strategy: Webhook
webhook:
clientConfig:
service:
namespace: system
name: webhook-service
path: /convert
conversionReviewVersions:
- v1
2 changes: 2 additions & 0 deletions operator/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ spec:
value: otel-collector:4317
- name: KEPTN_APP_CONTROLLER_LOG_LEVEL
value: "0"
- name: KEPTN_APP_CREATION_REQUEST_CONTROLLER_LOG_LEVEL
value: "0"
- name: KEPTN_APP_VERSION_CONTROLLER_LOG_LEVEL
value: "0"
- name: KEPTN_EVALUATION_CONTROLLER_LOG_LEVEL
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# permissions for end users to edit keptnappcreationrequests.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: keptnappcreationrequest-editor-role
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: keptn-lifecycle-toolkit
app.kubernetes.io/part-of: keptn-lifecycle-toolkit
app.kubernetes.io/managed-by: kustomize
name: keptnappcreationrequest-editor-role
rules:
- apiGroups:
- lifecycle.keptn.sh
resources:
- keptnappcreationrequests
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- lifecycle.keptn.sh
resources:
- keptnappcreationrequests/status
verbs:
- get
Loading