Skip to content

Commit

Permalink
removing hard coded annotation value
Browse files Browse the repository at this point in the history
  • Loading branch information
STollenaar committed Nov 22, 2023
1 parent 69ce0b5 commit 0d1286f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions api/v1alpha1/cmtemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
type Template struct {
AnnotationReplace map[string]string `json:"annotationreplace"`
CMTemplate map[string]string `json:"cmtemplate"`
TargetAnnotation string `json:"targetAnnotation"`
}

// CMTemplateSpec defines the desired state of CMTemplate
Expand Down
4 changes: 2 additions & 2 deletions charts/cmstate-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.2
version: 0.2.3
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.2.2"
appVersion: "0.2.3"
3 changes: 3 additions & 0 deletions charts/cmstate-operator/templates/cmtemplates-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ spec:
additionalProperties:
type: string
type: object
targetAnnotation:
type: string
required:
- annotationreplace
- cmtemplate
- targetAnnotation
type: object
type: object
status:
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/cache.spices.dev_cmtemplates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ spec:
additionalProperties:
type: string
type: object
targetAnnotation:
type: string
required:
- annotationreplace
- cmtemplate
- targetAnnotation
type: object
type: object
status:
Expand Down
2 changes: 1 addition & 1 deletion webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (hook *cmStateCreator) handlePodCreate(req admission.Request, cmState *cach
}
}

pod.Annotations["vault.hashicorp.com/agent-configmap"] = cmState.Name
pod.Annotations[cmTemplate.Spec.Template.TargetAnnotation] = cmState.Name

pData, err := json.Marshal(pod)
if err != nil {
Expand Down

0 comments on commit 0d1286f

Please sign in to comment.