Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Commit be694cc

Browse files
authored
Merge branch 'master' into viccuad/add-yaml-linting
2 parents b28a520 + 2c4a04c commit be694cc

File tree

10 files changed

+64
-15
lines changed

10 files changed

+64
-15
lines changed

def.bzl

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ project = struct(
66
),
77
cf_operator = struct(
88
chart = struct(
9-
url = "https://cf-operators.s3.amazonaws.com/helm-charts/cf-operator-v0.4.2-146.ge5d49c17.tgz",
10-
sha256 = "676e7e1c2dd589598c04f3960266daf7c11c62d3af9fbf621aeb06707b25e1bf",
9+
url = "https://s3.amazonaws.com/cf-operators/helm-charts/cf-operator-v0.4.2-147.gb88e4296.tgz",
10+
sha256 = "7cc0c23df3aa5fb7f2075e3dbd77d2dc51c1ee283060ae9cb46ed680b1deb1d0",
1111
),
1212
namespace = "cfo",
1313
),

deploy/helm/kubecf/BUILD.bazel

+15-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,23 @@ package(default_visibility = ["//visibility:public"])
22

33
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
44
load("//rules/helm:def.bzl", helm_package = "package")
5+
load("//:def.bzl", "project")
6+
load("//deploy/helm/kubecf:defs.bzl", "metadata_file_generator")
7+
8+
metadata_file_generator(
9+
name = "metadata",
10+
file = "Metadata.yaml",
11+
operator_chart = project.cf_operator.chart.url
12+
)
513

614
filegroup(
715
name = "chart_files_static",
816
srcs = glob(
917
["**/*"],
10-
exclude = ["**/BUILD.bazel"],
18+
exclude = [
19+
"**/BUILD.bazel",
20+
"**/defs.bzl",
21+
],
1122
),
1223
)
1324

@@ -24,6 +35,9 @@ helm_package(
2435
srcs = [
2536
":chart_files_static",
2637
],
38+
generated = [
39+
":metadata",
40+
],
2741
tars = [
2842
":cf_deployment",
2943
"//bosh/releases:pre_render_scripts",

deploy/helm/kubecf/assets/operations/instance_groups/bits.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,14 @@
5050
value: local
5151

5252
# Attach a persistent disk to bits-service VM to store eirinifs
53-
# TODO: storage class type should be configurable
54-
# - type: replace
55-
# path: /instance_groups/name=bits/persistent_disk_type?
56-
# value: ???
5753
- type: replace
5854
path: /instance_groups/name=bits/persistent_disk?
5955
value: 20480 # 20GB
56+
{{- if .Values.kube.storage_class }}
57+
- type: replace
58+
path: /instance_groups/name=bits/persistent_disk_type?
59+
value: {{ .Values.kube.storage_class }}
60+
{{- end }}
6061

6162
- type: replace
6263
path: /instance_groups/name=api/jobs/name=cloud_controller_ng/properties/cc/bits_service?/enabled?

deploy/helm/kubecf/assets/operations/instance_groups/database.yaml

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@
1616
sha1: ~
1717

1818
# Configure the persistent disk in the way that cf-operator can provision.
19-
- type: remove
20-
path: /instance_groups/name=database/persistent_disk_type
2119
- type: replace
2220
path: /instance_groups/name=database/persistent_disk?
2321
value: 20480 # 20GB
22+
{{- if .Values.kube.storage_class }}
23+
- type: replace
24+
path: /instance_groups/name=database/persistent_disk_type
25+
value: {{ .Values.kube.storage_class }}
26+
{{- else }}
27+
- type: remove
28+
path: /instance_groups/name=database/persistent_disk_type
29+
{{- end }}
2430

2531
# Replace the jobs using the cf-mysql-release.
2632
- type: replace

deploy/helm/kubecf/assets/operations/instance_groups/singleton-blobstore.yaml

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
# Configure the persistent disk in the way that cf-operator can provision.
2-
- type: remove
3-
path: /instance_groups/name=singleton-blobstore/persistent_disk_type
41
- type: replace
52
path: /instance_groups/name=singleton-blobstore/persistent_disk?
63
value: 102400 # 100GB
4+
{{- if .Values.kube.storage_class }}
5+
- type: replace
6+
path: /instance_groups/name=singleton-blobstore/persistent_disk_type
7+
value: {{ .Values.kube.storage_class }}
8+
{{- else }}
9+
- type: remove
10+
path: /instance_groups/name=singleton-blobstore/persistent_disk_type
11+
{{- end }}
712

813
- type: replace
914
path: /instance_groups/name=singleton-blobstore/jobs/name=blobstore/properties/blobstore/internal_access_rules?

deploy/helm/kubecf/defs.bzl

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def metadata_file_generator(name, file, operator_chart, visibility=None):
2+
native.genrule(
3+
name = name,
4+
srcs = [],
5+
outs = [file],
6+
cmd = "echo 'operatorChartUrl: \"{}\"' > $@".format(operator_chart),
7+
visibility = visibility,
8+
)

deploy/helm/kubecf/templates/ingress.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ metadata:
2222
data:
2323
tls.crt: {{ .Values.features.ingress.tls.crt | b64enc | quote }}
2424
tls.key: {{ .Values.features.ingress.tls.key | b64enc | quote }}
25-
{{- end -}}
25+
{{- end }}
2626
---
2727
# This ingress specifies routing and access for the cloud controller public Kubecf service, e.g.
2828
# "api.<domain>" and other services in that domain hierarchy.

deploy/helm/kubecf/values.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ deployment_name: kubecf
1212
# addr: kubecf-log-api:8082
1313
properties: {}
1414

15+
# The the storage class to be used for the instance groups that need it (e.g. bits, database and singleton-blobstore)
16+
# If it's not set, the default storage class will be used.
17+
kube:
18+
storage_class: ~
19+
1520
releases:
1621
# The defaults for all releases, where we do not otherwise override them.
1722
defaults:

rules/helm/def.bzl

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ def _package_impl(ctx):
33
output_tgz = ctx.actions.declare_file(output_filename)
44
outputs = [output_tgz]
55
ctx.actions.run(
6-
inputs = [] + ctx.files.srcs + ctx.files.tars,
6+
inputs = [] + ctx.files.srcs + ctx.files.tars + ctx.files.generated,
77
outputs = outputs,
88
tools = [ctx.executable._helm],
99
progress_message = "Generating Helm package archive {}".format(output_filename),
@@ -12,6 +12,8 @@ def _package_impl(ctx):
1212
"PACKAGE_DIR": ctx.attr.package_dir,
1313
# TODO(f0rmiga): Figure out a way of working with paths that contain spaces.
1414
"TARS": " ".join([f.path for f in ctx.files.tars]),
15+
# TODO(mudler): Support also nested folders and paths with spaces
16+
"GENERATED": " ".join([f.path for f in ctx.files.generated]),
1517
"HELM": ctx.executable._helm.path,
1618
"CHART_VERSION": ctx.attr.chart_version,
1719
"APP_VERSION": ctx.attr.app_version,
@@ -27,6 +29,7 @@ _package = rule(
2729
"srcs": attr.label_list(
2830
mandatory = True,
2931
),
32+
"generated": attr.label_list(),
3033
"tars": attr.label_list(),
3134
"package_dir": attr.string(
3235
mandatory = True,

rules/helm/package.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@ set -o errexit -o nounset
44

55
build_dir="tmp/build/${PACKAGE_DIR}"
66
mkdir -p "${build_dir}"
7+
78
cp -L -R "${PACKAGE_DIR}"/* "${build_dir}"
89

10+
# Generated files ( here TARS, GENERATED ) are not part of the source code
11+
# to be able to use them, we have to copy them
912
for t in ${TARS}; do
10-
tar xf "${t}" -C "${build_dir}"
13+
tar xf "${t}" -C "${build_dir}" > /dev/null
14+
done
15+
16+
for g in ${GENERATED}; do
17+
cp "${g}" "${build_dir}"/ > /dev/null
1118
done
1219

1320
"${HELM}" init --client-only > /dev/null

0 commit comments

Comments
 (0)