Skip to content

Commit

Permalink
feat(operator): Copy annotations from parent resource if not defined …
Browse files Browse the repository at this point in the history
…on pod (#305)

Signed-off-by: Moritz Wiesinger <[email protected]>
Signed-off-by: Florian Bacher <[email protected]>
Co-authored-by: Florian Bacher <[email protected]>
  • Loading branch information
mowies and bacherfl authored Nov 14, 2022
1 parent 4d16a77 commit c21f015
Show file tree
Hide file tree
Showing 10 changed files with 1,204 additions and 72 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ For this reason, the Keptn Lifecycle Toolkit is agnostic to deployment tools tha
## How to use

The Keptn Lifecycle Toolkit monitors manifests that have been applied against the Kubernetes API and reacts if it finds a workload with special annotations/labels.
For this, you should annotate your [Workload](https://kubernetes.io/docs/concepts/workloads/) with (at least) the following two annotations:
For this, you should annotate your [Workload](https://kubernetes.io/docs/concepts/workloads/) with (at least) the following annotations:

```yaml
keptn.sh/app: myAwesomeAppName
Expand Down
4 changes: 2 additions & 2 deletions examples/single-service/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Namespace
metadata:
name: single-service
name: klt-test
annotations:
keptn.sh/lifecycle-toolkit: "enabled"
---
Expand All @@ -13,7 +13,7 @@ metadata:
labels:
app: test
name: test
namespace: single-service
namespace: klt-test
spec:
replicas: 1
selector:
Expand Down
2 changes: 1 addition & 1 deletion examples/single-service/pre-deployment-tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: lifecycle.keptn.sh/v1alpha1
kind: KeptnTaskDefinition
metadata:
name: pre-deployment-hello
namespace: single-service
namespace: klt-test
spec:
function:
inline:
Expand Down
4 changes: 2 additions & 2 deletions operator/api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v1alpha1 contains API Schema definitions for the lifecycle v1alpha1 API group
//+kubebuilder:object:generate=true
//+groupName=lifecycle.keptn.sh
// +kubebuilder:object:generate=true
// +groupName=lifecycle.keptn.sh
package v1alpha1

import (
Expand Down
11 changes: 9 additions & 2 deletions operator/config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ metadata:
creationTimestamp: null
name: manager-role
rules:
- apiGroups:
- apps
resources:
- daemonsets
- deployments
- replicasets
- statefulsets
verbs:
- get
- apiGroups:
- apps
resources:
Expand Down Expand Up @@ -56,8 +65,6 @@ rules:
- namespaces
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand Down
23 changes: 12 additions & 11 deletions operator/controllers/common/fake/tracer.go

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

3 changes: 1 addition & 2 deletions operator/controllers/keptnapp/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"testing"
)

//EXample Unit test on help function
// Example Unit test on help function
func TestKeptnAppReconciler_createAppVersionSuccess(t *testing.T) {

app := &lfcv1alpha1.KeptnApp{
Expand Down Expand Up @@ -135,7 +135,6 @@ func setupReconciler(t *testing.T) (*KeptnAppReconciler, chan string, *fake.ITra
fakeClient, err := fake.NewClient()
if err != nil {
t.Errorf("Reconcile() error when setting up fake client %v", err)

}
recorder := record.NewFakeRecorder(100)
r := &KeptnAppReconciler{
Expand Down
Loading

0 comments on commit c21f015

Please sign in to comment.