Skip to content

Commit

Permalink
improve: helm template labels are consistent now (#695)
Browse files Browse the repository at this point in the history
  • Loading branch information
csviri authored Aug 22, 2023
1 parent 0191e07 commit d3384e1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private void addGeneratedDeployment(File helmDir, List<GeneratedKubernetesResour
.orElseThrow();
addActualNamespaceConfigPlaceholderToDeployment(deployment, controllerConfigurations);
var template = FileUtils.asYaml(deployment);
// a bit solution to get the exact placeholder without brackets
// a bit hacky solution to get the exact placeholder without brackets
String res = template.replace("\"{watchNamespaces}\"", "{{ .Values.watchNamespaces }}");
try {
Files.writeString(Path.of(helmDir.getPath(), TEMPLATES_DIR, "deployment.yaml"), res);
Expand All @@ -106,10 +106,7 @@ private void addActualNamespaceConfigPlaceholderToDeployment(Deployment deployme
var envs = deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv();
envs.add(new EnvVar("QUARKUS_OPERATOR_SDK_CONTROLLERS_" + c.getName().toUpperCase() + "_NAMESPACES",
"{watchNamespaces}", null));
// use this when the global variable issue is fixed
// envs.add(new EnvVar("QUARKUS_OPERATOR_SDK_NAMESPACES", "{watchNamespaces}", null));
});

}

@SuppressWarnings("rawtypes")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {reconciler-name}-role-binding
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/version: {{ .Values.version }}
app.kubernetes.io/managed-by: quarkus
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
Expand All @@ -15,6 +19,10 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {reconciler-name}-role-binding
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/version: {{ .Values.version }}
app.kubernetes.io/managed-by: quarkus
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
Expand All @@ -30,6 +38,10 @@ kind: RoleBinding
metadata:
name: {reconciler-name}-role-binding
namespace: {{ $anamespace }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/version: {{ .Values.version }}
app.kubernetes.io/managed-by: quarkus
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Chart.Name }}-crd-validating-role-binding
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/version: {{ .Values.version }}
app.kubernetes.io/managed-by: quarkus
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Chart.Name }}-crd-validating-cluster-role
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/version: {{ .Values.version }}
app.kubernetes.io/managed-by: quarkus
rules:
- apiGroups:
- apiextensions.k8s.io
Expand Down
3 changes: 0 additions & 3 deletions core/deployment/src/main/resources/helm/static/service.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
apiVersion: v1
kind: Service
metadata:
annotations:
app.quarkus.io/commit-id: 77d1e2545ac9dd0e6599bffdec4f892cd148984b
app.quarkus.io/build-timestamp: 2023-07-20 - 11:57:20 +0000
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/version: {{ .Values.version }}
Expand Down

0 comments on commit d3384e1

Please sign in to comment.