Skip to content

Commit 272b2ed

Browse files
authored
Merge pull request #74 from microsoft/eedorenko/add-parameters
Add workspace and application config values
2 parents 14de689 + 3dcb58d commit 272b2ed

File tree

12 files changed

+118
-13
lines changed

12 files changed

+118
-13
lines changed

config/manager/manager.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ spec:
7878
configMapKeyRef:
7979
key: STORAGE_SERVICE_ADDRESS
8080
name: controller-manager-config
81+
- name: WORKSPACE
82+
valueFrom:
83+
configMapKeyRef:
84+
key: WORKSPACE
85+
name: controller-manager-config
86+
optional: true
87+
- name: APPLICATION
88+
valueFrom:
89+
configMapKeyRef:
90+
key: APPLICATION
91+
name: controller-manager-config
92+
optional: true
8193
securityContext:
8294
allowPrivilegeEscalation: false
8395
capabilities:
@@ -122,4 +134,7 @@ metadata:
122134
app.kubernetes.io/part-of: kalypso-observability-hub
123135
app.kubernetes.io/managed-by: kustomize
124136
data:
125-
STORAGE_SERVICE_ADDRESS: "kalypso-observability-hub-api-server:50051"
137+
STORAGE_SERVICE_ADDRESS: "kalypso-observability-hub-api-server:50051"
138+
WORKSPACE: "workspace"
139+
APPLICATION: "application"
140+

config/rbac/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ resources:
99
- role_binding.yaml
1010
- leader_election_role.yaml
1111
- leader_election_role_binding.yaml
12+
- secret_viewer_role.yaml
13+
- secret_viewer_role_binding.yaml
1214
# Comment the following 4 lines if you want to disable
1315
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
1416
# which protects your /metrics endpoint.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: secret-viewer-role
6+
rules:
7+
- apiGroups:
8+
- ""
9+
resources:
10+
- configmaps
11+
- secrets
12+
verbs:
13+
- get
14+
- watch
15+
- list
16+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: secret-viewer-rolebinding
5+
roleRef:
6+
apiGroup: rbac.authorization.k8s.io
7+
kind: ClusterRole
8+
name: secret-viewer-role
9+
subjects:
10+
- kind: ServiceAccount
11+
name: controller-manager
12+
namespace: system

controllers/azureresourcegraph_controller.go

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,14 @@ func (r *AzureResourceGraphReconciler) getReconcilersDataFromChildKalypsoObjects
339339
return nil, err
340340
}
341341
}
342+
var environmentName string
343+
var workspace string
344+
var application string
345+
var workloadName string
346+
var deploymentTargetName string
347+
348+
workspace = os.Getenv("WORKSPACE")
349+
application = os.Getenv("APPLICATION")
342350

343351
fluxConfigurationDetal := res.FluxConfiguration
344352
// iteretae over the statuses and log them
@@ -347,17 +355,20 @@ func (r *AzureResourceGraphReconciler) getReconcilersDataFromChildKalypsoObjects
347355
continue
348356
}
349357

350-
//TODO Update Kalypso: name deployment target as workload.deploymentTarget or without workload at all
351358
// expected flux resource name format: env.workspace.application.workload.deploymentTarget[.clusterType]
352359
nameParts := strings.Split(*status.Name, ".")
353-
if len(nameParts) < 5 {
354-
continue
360+
361+
if len(nameParts) >= 5 {
362+
environmentName = nameParts[0]
363+
workspace = nameParts[1]
364+
application = nameParts[2]
365+
workloadName = nameParts[3]
366+
deploymentTargetName = nameParts[4]
367+
} else if len(nameParts) >= 3 {
368+
environmentName = nameParts[0]
369+
workloadName = nameParts[1]
370+
deploymentTargetName = nameParts[2]
355371
}
356-
environmentName := nameParts[0]
357-
workspace := nameParts[1]
358-
application := nameParts[2]
359-
workloadName := nameParts[3]
360-
deploymentTargetName := nameParts[4]
361372

362373
dt, err := storageClient.GetDeploymentTarget(ctx, &pb.DeploymentTargetSearch{
363374
WorkloadName: workloadName,

helm/kalypso-observability-hub/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ appVersion: "1.1.2"
2222

2323
dependencies:
2424
- name: api-server
25-
version: 1.1.1
25+
version: 1.1.2
2626

2727
- name: postgres
2828
version: 0.1.0

helm/kalypso-observability-hub/charts/api-server/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ type: application
1313
# This is the chart version. This version number should be incremented each time you make changes
1414
# to the chart and its templates, including the app version.
1515
# Versions are expected to follow Semantic Versioning (https://semver.org/)
16-
version: "1.1.1"
16+
version: "1.1.2"
1717
# This is the version number of the application being deployed. This version number should be
1818
# incremented each time you make changes to the application. Versions are not expected to
1919
# follow Semantic Versioning. They should reflect the version the application is using.
2020
# It is recommended to use it with quotes.
21-
appVersion: "1.1.1"
21+
appVersion: "1.1.2"

helm/kalypso-observability-hub/crds/deploymentdescriptor-crd.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ spec:
193193
- type
194194
type: object
195195
type: array
196+
gitOpsCommitId:
197+
type: string
196198
type: object
197199
type: object
198200
served: true

helm/kalypso-observability-hub/templates/controller-manager-config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ metadata:
99
control-plane: controller-manager
1010
{{- include "tmp.labels" . | nindent 4 }}
1111
data:
12+
APPLICATION: {{ .Values.controllerManagerConfig.application | quote }}
1213
STORAGE_SERVICE_ADDRESS: {{ .Values.controllerManagerConfig.storageServiceAddress
13-
| quote }}
14+
| quote }}
15+
WORKSPACE: {{ .Values.controllerManagerConfig.workspace | quote }}

helm/kalypso-observability-hub/templates/deployment.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@ spec:
8383
configMapKeyRef:
8484
key: STORAGE_SERVICE_ADDRESS
8585
name: {{ include "tmp.fullname" . }}-controller-manager-config
86+
- name: WORKSPACE
87+
valueFrom:
88+
configMapKeyRef:
89+
key: WORKSPACE
90+
name: {{ include "tmp.fullname" . }}-controller-manager-config
91+
optional: true
92+
- name: APPLICATION
93+
valueFrom:
94+
configMapKeyRef:
95+
key: APPLICATION
96+
name: {{ include "tmp.fullname" . }}-controller-manager-config
97+
optional: true
8698
- name: KUBERNETES_CLUSTER_DOMAIN
8799
value: {{ .Values.kubernetesClusterDomain }}
88100
image: {{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag

0 commit comments

Comments
 (0)