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
8 changes: 8 additions & 0 deletions keptn-operator/PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,12 @@ resources:
kind: KeptnInstance
path: github.com/keptn-sandbox/keptn-gitops-operator/keptn-operator/api/v1
version: v1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: keptn.sh
kind: KeptnServiceLevelIndicator
path: github.com/keptn-sandbox/keptn-gitops-operator/keptn-operator/api/v1
version: v1
version: "3"
69 changes: 69 additions & 0 deletions keptn-operator/api/v1/keptnservicelevelindicator_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
Copyright 2021.

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 v1

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.

// KeptnServiceLevelIndicatorSpec defines the desired state of KeptnServiceLevelIndicator
type KeptnServiceLevelIndicatorSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of KeptnServiceLevelIndicator. Edit keptnservicelevelindicator_types.go to remove/update
Project string `json:"project"`
Stage string `json:"stage,omitempty"`
Service string `json:"service,omitempty"`

Provider string `json:"provider"`
Indicators map[string]string `json:"indicators"`
}

// KeptnServiceLevelIndicatorStatus defines the observed state of KeptnServiceLevelIndicator
type KeptnServiceLevelIndicatorStatus 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

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

Spec KeptnServiceLevelIndicatorSpec `json:"spec,omitempty"`
Status KeptnServiceLevelIndicatorStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&KeptnServiceLevelIndicator{}, &KeptnServiceLevelIndicatorList{})
}
96 changes: 96 additions & 0 deletions keptn-operator/api/v1/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,74 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
name: keptnservicelevelindicators.keptn.sh
spec:
group: keptn.sh
names:
kind: KeptnServiceLevelIndicator
listKind: KeptnServiceLevelIndicatorList
plural: keptnservicelevelindicators
singular: keptnservicelevelindicator
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: KeptnServiceLevelIndicator is the Schema for the keptnservicelevelindicators
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: KeptnServiceLevelIndicatorSpec defines the desired state
of KeptnServiceLevelIndicator
properties:
indicators:
additionalProperties:
type: string
type: object
project:
description: Foo is an example field of KeptnServiceLevelIndicator.
Edit keptnservicelevelindicator_types.go to remove/update
type: string
provider:
type: string
service:
type: string
stage:
type: string
required:
- indicators
- project
- provider
type: object
status:
description: KeptnServiceLevelIndicatorStatus defines the observed state
of KeptnServiceLevelIndicator
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
3 changes: 3 additions & 0 deletions keptn-operator/config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ resources:
- bases/keptn.sh_keptnservicedeployments.yaml
- bases/keptn.sh_keptndeploymentcontexts.yaml
- bases/keptn.sh_keptninstances.yaml
- bases/keptn.sh_keptnservicelevelindicators.yaml
#+kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
Expand All @@ -27,6 +28,7 @@ patchesStrategicMerge:
#- patches/webhook_in_keptnservicedeployments.yaml
#- patches/webhook_in_keptndeploymentcontexts.yaml
#- patches/webhook_in_keptninstances.yaml
#- patches/webhook_in_keptnservicelevelindicators.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
Expand All @@ -41,6 +43,7 @@ patchesStrategicMerge:
#- patches/cainjection_in_keptnservicedeployments.yaml
#- patches/cainjection_in_keptndeploymentcontexts.yaml
#- patches/cainjection_in_keptninstances.yaml
#- patches/cainjection_in_keptnservicelevelindicators.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# 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,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: keptnservicelevelindicators.keptn.sh
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: keptnservicelevelindicators.keptn.sh
spec:
conversion:
strategy: Webhook
webhook:
clientConfig:
service:
namespace: system
name: webhook-service
path: /convert
conversionReviewVersions:
- v1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# permissions for end users to edit keptnservicelevelindicators.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: keptnservicelevelindicator-editor-role
rules:
- apiGroups:
- keptn.sh
resources:
- keptnservicelevelindicators
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- keptn.sh
resources:
- keptnservicelevelindicators/status
verbs:
- get
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# permissions for end users to view keptnservicelevelindicators.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: keptnservicelevelindicator-viewer-role
rules:
- apiGroups:
- keptn.sh
resources:
- keptnservicelevelindicators
verbs:
- get
- list
- watch
- apiGroups:
- keptn.sh
resources:
- keptnservicelevelindicators/status
verbs:
- get
26 changes: 26 additions & 0 deletions keptn-operator/config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,32 @@ rules:
- get
- patch
- update
- apiGroups:
- keptn.sh
resources:
- keptnservicelevelindicators
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- keptn.sh
resources:
- keptnservicelevelindicators/finalizers
verbs:
- update
- apiGroups:
- keptn.sh
resources:
- keptnservicelevelindicators/status
verbs:
- get
- patch
- update
- apiGroups:
- keptn.sh
resources:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: keptn.sh/v1
kind: KeptnServiceLevelIndicator
metadata:
name: keptnservicelevelindicator-sample
spec:
# TODO(user): Add fields here
Loading