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

PoC: Application discovery #559

Closed
wants to merge 6 commits into from
Closed
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
46 changes: 23 additions & 23 deletions examples/podtatohead-deployment/app.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
apiVersion: lifecycle.keptn.sh/v1alpha2
kind: KeptnApp
metadata:
name: podtato-head
namespace: podtato-kubectl
spec:
version: "1.3"
revision: "1"
workloads:
- name: podtato-head-left-arm
version: 0.2.7
- name: podtato-head-left-leg
version: 0.2.7
- name: podtato-head-entry
version: 0.2.7
- name: podtato-head-right-arm
version: 0.1.0
- name: podtato-head-right-leg
version: 0.2.7
- name: podtato-head-hat
version: 0.1.0
postDeploymentTasks:
- post-deployment-hello
#apiVersion: lifecycle.keptn.sh/v1alpha2
#kind: KeptnApp
#metadata:
# name: podtato-head
# namespace: podtato-kubectl
#spec:
# version: "1.3"
# revision: "1"
# workloads:
# - name: podtato-head-left-arm
# version: 0.2.7
# - name: podtato-head-left-leg
# version: 0.2.7
# - name: podtato-head-entry
# version: 0.2.7
# - name: podtato-head-right-arm
# version: 0.1.0
# - name: podtato-head-right-leg
# version: 0.2.7
# - name: podtato-head-hat
# version: 0.1.0
# postDeploymentTasks:
# - post-deployment-hello

12 changes: 0 additions & 12 deletions examples/podtatohead-deployment/check_entry.yaml

This file was deleted.

66 changes: 66 additions & 0 deletions examples/podtatohead-deployment/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ metadata:
annotations:
keptn.sh/lifecycle-toolkit: "enabled"
---
apiVersion: lifecycle.keptn.sh/v1alpha2
kind: KeptnTaskDefinition
metadata:
name: check-entry-service
namespace: podtato-kubectl
spec:
function:
httpRef:
url: https://raw.githubusercontent.com/keptn/lifecycle-toolkit/main/functions-runtime/samples/ts/http.ts
parameters:
map:
url: http://podtato-head-entry.podtato-kubectl.svc.cluster.local:9000
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -23,6 +36,7 @@ spec:
component: podtato-head-entry
keptn.sh/app: podtato-head
keptn.sh/workload: podtato-head-entry
keptn.sh/version: 0.6.0
spec:
terminationGracePeriodSeconds: 5
initContainers:
Expand All @@ -38,6 +52,8 @@ spec:
env:
- name: PODTATO_PORT
value: "9000"
- name: SOME_ENV
value: "hello"
---
apiVersion: v1
kind: Service
Expand Down Expand Up @@ -300,3 +316,53 @@ spec:
protocol: TCP
targetPort: 9000
type: ClusterIP
---
#apiVersion: apps/v1
#kind: Deployment
#metadata:
# name: podtato-head-third-arm
# namespace: podtato-kubectl
# labels:
# app: podtato-head
#spec:
# selector:
# matchLabels:
# component: podtato-head-third-arm
# template:
# metadata:
# labels:
# component: podtato-head-third-arm
# annotations:
# app.kubernetes.io/part-of: podtato-head
# keptn.sh/workload: podtato-head-third-arm
# keptn.sh/version: 0.2.0
# keptn.sh/pre-deployment-tasks: check-entry-service
# spec:
# terminationGracePeriodSeconds: 5
# containers:
# - name: server
# image: ghcr.io/podtato-head/right-arm:0.2.7
# imagePullPolicy: Always
# ports:
# - containerPort: 9000
# env:
# - name: PODTATO_PORT
# value: "9000"
#---
#apiVersion: v1
#kind: Service
#metadata:
# name: podtato-head-third-arm
# namespace: podtato-kubectl
# labels:
# app: podtato-head
#spec:
# selector:
# component: podtato-head-third-arm
# ports:
# - name: http
# port: 9005
# protocol: TCP
# targetPort: 9000
# type: ClusterIP
#
9 changes: 9 additions & 0 deletions operator/PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,13 @@ resources:
kind: KeptnEvaluation
path: github.com/keptn/lifecycle-toolkit/operator/api/v1alpha2
version: v1alpha2
- api:
crdVersion: v1
namespaced: true
controller: true
domain: keptn.sh
group: lifecycle
kind: KeptnAppCreationRequest
path: github.com/keptn/lifecycle-toolkit/operator/api/v1alpha2
version: v1alpha2
version: "3"
65 changes: 65 additions & 0 deletions operator/api/v1alpha2/keptnappcreationrequest_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
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 v1alpha2

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

AppName string `json:"appName"`
// +kubebuilder:default=30
DiscoveryDeadlineSeconds *int64 `json:"discoveryDeadlineSeconds,omitempty"`
}

// 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{})
}
94 changes: 94 additions & 0 deletions operator/api/v1alpha2/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,57 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
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: v1alpha2
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:
type: string
discoveryDeadlineSeconds:
default: 30
format: int64
type: integer
required:
- appName
type: object
status:
description: KeptnAppCreationRequestStatus defines the observed state
of KeptnAppCreationRequest
type: object
type: object
served: true
storage: true
subresources:
status: {}
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: keptnappcreationrequests.lifecycle.keptn.sh
Loading