Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit a0351d2

Browse files
authored
Merge pull request #354 from mochizuki875/feature_hnc_helm
Helm Chart for HNC installation
2 parents f8af5aa + 324a67a commit a0351d2

26 files changed

+1380
-0
lines changed

Makefile

+37
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ HNC_KREW_TAR_SHA256=$(shell sha256sum bin/kubectl-hns.tar.gz | cut -d " " -f 1)
9999
DIRS=./api/... ./cmd/... ./internal/...
100100
GOFMT_DIRS=$(DIRS:/...=)
101101

102+
103+
YQ ?= ${CURDIR}/bin/yq
104+
MANIFESTDIR ?= ${CURDIR}/manifests
105+
HELMPATCHESDIR ?= ${CURDIR}/hack/helm_patches
106+
CAHRTDIR ?= ${CURDIR}/charts/hnc
107+
TEMPLATESDIR ?= ${CAHRTDIR}/templates
108+
HA_MANAGERNAME ?= "hnc-controller-manager-ha"
109+
110+
102111
all: test docker-build
103112

104113
###################### LOCAL ARTIFACTS #########################
@@ -489,3 +498,31 @@ krew-install: krew-build
489498
# Uninstall kubectl plugin locally using krew.
490499
krew-uninstall:
491500
-kubectl krew uninstall hns
501+
502+
.PHONY: yq
503+
yq: ## Download yq locally if necessary.
504+
@GOBIN=${CURDIR}/bin GO111MODULE=on go install github.com/mikefarah/yq/[email protected]
505+
506+
charts: yq manifests
507+
# Generate CRDs template from manifests/crds.yaml
508+
@rm -rf charts/hnc/crds/*
509+
@cd charts/hnc/crds && \
510+
cat ${MANIFESTDIR}/crds.yaml | ${YQ} -N -s '.metadata.name + ".yaml"'
511+
512+
# Generate helm templates from manifests
513+
@rm -rf charts/hnc/templates/*
514+
@cd charts/hnc/templates && \
515+
cat ${MANIFESTDIR}/default.yaml | ${YQ} -N -s '.metadata.name + ".yaml"' && \
516+
cat ${MANIFESTDIR}/ha.yaml | ${YQ} 'select(.kind=="Deployment") | select(.metadata.name==${HA_MANAGERNAME})' | ${YQ} -N -s '.metadata.name + ".yaml"' && \
517+
rm -f ${TEMPLATESDIR}/hnc-system.yaml
518+
519+
@cp ${HELMPATCHESDIR}/_helpers.tpl ${TEMPLATESDIR}
520+
@cp ${HELMPATCHESDIR}/NOTES.txt ${TEMPLATESDIR}
521+
522+
# Update image repository and tag from environment variables
523+
@yq -N -i '.image.repository = "${HNC_REGISTRY}/${HNC_IMG_NAME}"' ${CAHRTDIR}/values.yaml
524+
@yq -N -i '.image.tag = "${HNC_IMG_TAG}"' ${CAHRTDIR}/values.yaml
525+
526+
# Update helm templates
527+
${HELMPATCHESDIR}/update-helm.sh
528+

charts/hnc/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/hnc/Chart.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: hnc
3+
description: A Helm chart to install hnc on Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "1.1.0"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
annotations:
5+
controller-gen.kubebuilder.io/version: v0.11.4
6+
name: hierarchicalresourcequotas.hnc.x-k8s.io
7+
spec:
8+
group: hnc.x-k8s.io
9+
names:
10+
kind: HierarchicalResourceQuota
11+
listKind: HierarchicalResourceQuotaList
12+
plural: hierarchicalresourcequotas
13+
shortNames:
14+
- hrq
15+
singular: hierarchicalresourcequota
16+
scope: Namespaced
17+
versions:
18+
- additionalPrinterColumns:
19+
- jsonPath: .status.requestsSummary
20+
name: Request
21+
type: string
22+
- jsonPath: .status.limitsSummary
23+
name: Limit
24+
type: string
25+
name: v1alpha2
26+
schema:
27+
openAPIV3Schema:
28+
description: HierarchicalResourceQuota sets aggregate quota restrictions enforced for a namespace and descendant namespaces
29+
properties:
30+
apiVersion:
31+
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
32+
type: string
33+
kind:
34+
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
35+
type: string
36+
metadata:
37+
type: object
38+
spec:
39+
description: Spec defines the desired quota
40+
properties:
41+
hard:
42+
additionalProperties:
43+
anyOf:
44+
- type: integer
45+
- type: string
46+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
47+
x-kubernetes-int-or-string: true
48+
description: Hard is the set of desired hard limits for each named resource
49+
type: object
50+
type: object
51+
status:
52+
description: Status defines the actual enforced quota and its current usage
53+
properties:
54+
hard:
55+
additionalProperties:
56+
anyOf:
57+
- type: integer
58+
- type: string
59+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
60+
x-kubernetes-int-or-string: true
61+
description: Hard is the set of enforced hard limits for each named resource
62+
type: object
63+
limitsSummary:
64+
description: LimitsSummary is used by kubectl get hrq, and summarizes the relevant information from .status.hard.limits and .status.used.limits.
65+
type: string
66+
requestsSummary:
67+
description: RequestsSummary is used by kubectl get hrq, and summarizes the relevant information from .status.hard.requests and .status.used.requests.
68+
type: string
69+
used:
70+
additionalProperties:
71+
anyOf:
72+
- type: integer
73+
- type: string
74+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
75+
x-kubernetes-int-or-string: true
76+
description: Used is the current observed total usage of the resource in the namespace and its descendant namespaces.
77+
type: object
78+
type: object
79+
type: object
80+
served: true
81+
storage: true
82+
subresources: {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
annotations:
5+
controller-gen.kubebuilder.io/version: v0.11.4
6+
name: hierarchyconfigurations.hnc.x-k8s.io
7+
spec:
8+
group: hnc.x-k8s.io
9+
names:
10+
kind: HierarchyConfiguration
11+
listKind: HierarchyConfigurationList
12+
plural: hierarchyconfigurations
13+
singular: hierarchyconfiguration
14+
scope: Namespaced
15+
versions:
16+
- name: v1alpha2
17+
schema:
18+
openAPIV3Schema:
19+
description: Hierarchy is the Schema for the hierarchies API
20+
properties:
21+
apiVersion:
22+
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
23+
type: string
24+
kind:
25+
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
26+
type: string
27+
metadata:
28+
properties:
29+
name:
30+
enum:
31+
- hierarchy
32+
type: string
33+
type: object
34+
spec:
35+
description: HierarchySpec defines the desired state of Hierarchy
36+
properties:
37+
allowCascadingDeletion:
38+
description: AllowCascadingDeletion indicates if the subnamespaces of this namespace are allowed to cascading delete.
39+
type: boolean
40+
annotations:
41+
description: Annotations is a list of annotations and values to apply to the current namespace and all of its descendants. All annotation keys must match a regex specified on the command line by --managed-namespace-annotation. A namespace cannot have a KVP that conflicts with one of its ancestors.
42+
items:
43+
description: MetaKVP represents a label or annotation
44+
properties:
45+
key:
46+
description: Key is the name of the label or annotation. It must conform to the normal rules for Kubernetes label/annotation keys.
47+
type: string
48+
value:
49+
description: Value is the value of the label or annotation. It must confirm to the normal rules for Kubernetes label or annoation values, which are far more restrictive for labels than for anntations.
50+
type: string
51+
required:
52+
- key
53+
- value
54+
type: object
55+
type: array
56+
labels:
57+
description: Lables is a list of labels and values to apply to the current namespace and all of its descendants. All label keys must match a regex specified on the command line by --managed-namespace-label. A namespace cannot have a KVP that conflicts with one of its ancestors.
58+
items:
59+
description: MetaKVP represents a label or annotation
60+
properties:
61+
key:
62+
description: Key is the name of the label or annotation. It must conform to the normal rules for Kubernetes label/annotation keys.
63+
type: string
64+
value:
65+
description: Value is the value of the label or annotation. It must confirm to the normal rules for Kubernetes label or annoation values, which are far more restrictive for labels than for anntations.
66+
type: string
67+
required:
68+
- key
69+
- value
70+
type: object
71+
type: array
72+
parent:
73+
description: Parent indicates the parent of this namespace, if any.
74+
type: string
75+
type: object
76+
status:
77+
description: HierarchyStatus defines the observed state of Hierarchy
78+
properties:
79+
children:
80+
description: Children indicates the direct children of this namespace, if any.
81+
items:
82+
type: string
83+
type: array
84+
conditions:
85+
description: Conditions describes the errors, if any.
86+
items:
87+
description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, \n type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
88+
properties:
89+
lastTransitionTime:
90+
description: lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
91+
format: date-time
92+
type: string
93+
message:
94+
description: message is a human readable message indicating details about the transition. This may be an empty string.
95+
maxLength: 32768
96+
type: string
97+
observedGeneration:
98+
description: observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.
99+
format: int64
100+
minimum: 0
101+
type: integer
102+
reason:
103+
description: reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
104+
maxLength: 1024
105+
minLength: 1
106+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
107+
type: string
108+
status:
109+
description: status of the condition, one of True, False, Unknown.
110+
enum:
111+
- "True"
112+
- "False"
113+
- Unknown
114+
type: string
115+
type:
116+
description: type of condition in CamelCase or in foo.example.com/CamelCase. --- Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
117+
maxLength: 316
118+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
119+
type: string
120+
required:
121+
- lastTransitionTime
122+
- message
123+
- reason
124+
- status
125+
- type
126+
type: object
127+
type: array
128+
type: object
129+
type: object
130+
served: true
131+
storage: true

0 commit comments

Comments
 (0)