Skip to content

Commit

Permalink
Merge pull request #354 from mochizuki875/feature_hnc_helm
Browse files Browse the repository at this point in the history
Helm Chart for HNC installation
  • Loading branch information
k8s-ci-robot authored Mar 19, 2024
2 parents f8af5aa + 324a67a commit a0351d2
Show file tree
Hide file tree
Showing 26 changed files with 1,380 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ HNC_KREW_TAR_SHA256=$(shell sha256sum bin/kubectl-hns.tar.gz | cut -d " " -f 1)
DIRS=./api/... ./cmd/... ./internal/...
GOFMT_DIRS=$(DIRS:/...=)


YQ ?= ${CURDIR}/bin/yq
MANIFESTDIR ?= ${CURDIR}/manifests
HELMPATCHESDIR ?= ${CURDIR}/hack/helm_patches
CAHRTDIR ?= ${CURDIR}/charts/hnc
TEMPLATESDIR ?= ${CAHRTDIR}/templates
HA_MANAGERNAME ?= "hnc-controller-manager-ha"


all: test docker-build

###################### LOCAL ARTIFACTS #########################
Expand Down Expand Up @@ -489,3 +498,31 @@ krew-install: krew-build
# Uninstall kubectl plugin locally using krew.
krew-uninstall:
-kubectl krew uninstall hns

.PHONY: yq
yq: ## Download yq locally if necessary.
@GOBIN=${CURDIR}/bin GO111MODULE=on go install github.com/mikefarah/yq/[email protected]

charts: yq manifests
# Generate CRDs template from manifests/crds.yaml
@rm -rf charts/hnc/crds/*
@cd charts/hnc/crds && \
cat ${MANIFESTDIR}/crds.yaml | ${YQ} -N -s '.metadata.name + ".yaml"'

# Generate helm templates from manifests
@rm -rf charts/hnc/templates/*
@cd charts/hnc/templates && \
cat ${MANIFESTDIR}/default.yaml | ${YQ} -N -s '.metadata.name + ".yaml"' && \
cat ${MANIFESTDIR}/ha.yaml | ${YQ} 'select(.kind=="Deployment") | select(.metadata.name==${HA_MANAGERNAME})' | ${YQ} -N -s '.metadata.name + ".yaml"' && \
rm -f ${TEMPLATESDIR}/hnc-system.yaml

@cp ${HELMPATCHESDIR}/_helpers.tpl ${TEMPLATESDIR}
@cp ${HELMPATCHESDIR}/NOTES.txt ${TEMPLATESDIR}

# Update image repository and tag from environment variables
@yq -N -i '.image.repository = "${HNC_REGISTRY}/${HNC_IMG_NAME}"' ${CAHRTDIR}/values.yaml
@yq -N -i '.image.tag = "${HNC_IMG_TAG}"' ${CAHRTDIR}/values.yaml

# Update helm templates
${HELMPATCHESDIR}/update-helm.sh

23 changes: 23 additions & 0 deletions charts/hnc/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions charts/hnc/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: hnc
description: A Helm chart to install hnc on Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
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.1.0

# 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: "1.1.0"
82 changes: 82 additions & 0 deletions charts/hnc/crds/hierarchicalresourcequotas.hnc.x-k8s.io.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.4
name: hierarchicalresourcequotas.hnc.x-k8s.io
spec:
group: hnc.x-k8s.io
names:
kind: HierarchicalResourceQuota
listKind: HierarchicalResourceQuotaList
plural: hierarchicalresourcequotas
shortNames:
- hrq
singular: hierarchicalresourcequota
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .status.requestsSummary
name: Request
type: string
- jsonPath: .status.limitsSummary
name: Limit
type: string
name: v1alpha2
schema:
openAPIV3Schema:
description: HierarchicalResourceQuota sets aggregate quota restrictions enforced for a namespace and descendant namespaces
properties:
apiVersion:
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'
type: string
kind:
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'
type: string
metadata:
type: object
spec:
description: Spec defines the desired quota
properties:
hard:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: Hard is the set of desired hard limits for each named resource
type: object
type: object
status:
description: Status defines the actual enforced quota and its current usage
properties:
hard:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: Hard is the set of enforced hard limits for each named resource
type: object
limitsSummary:
description: LimitsSummary is used by kubectl get hrq, and summarizes the relevant information from .status.hard.limits and .status.used.limits.
type: string
requestsSummary:
description: RequestsSummary is used by kubectl get hrq, and summarizes the relevant information from .status.hard.requests and .status.used.requests.
type: string
used:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: Used is the current observed total usage of the resource in the namespace and its descendant namespaces.
type: object
type: object
type: object
served: true
storage: true
subresources: {}
131 changes: 131 additions & 0 deletions charts/hnc/crds/hierarchyconfigurations.hnc.x-k8s.io.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.4
name: hierarchyconfigurations.hnc.x-k8s.io
spec:
group: hnc.x-k8s.io
names:
kind: HierarchyConfiguration
listKind: HierarchyConfigurationList
plural: hierarchyconfigurations
singular: hierarchyconfiguration
scope: Namespaced
versions:
- name: v1alpha2
schema:
openAPIV3Schema:
description: Hierarchy is the Schema for the hierarchies API
properties:
apiVersion:
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'
type: string
kind:
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'
type: string
metadata:
properties:
name:
enum:
- hierarchy
type: string
type: object
spec:
description: HierarchySpec defines the desired state of Hierarchy
properties:
allowCascadingDeletion:
description: AllowCascadingDeletion indicates if the subnamespaces of this namespace are allowed to cascading delete.
type: boolean
annotations:
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.
items:
description: MetaKVP represents a label or annotation
properties:
key:
description: Key is the name of the label or annotation. It must conform to the normal rules for Kubernetes label/annotation keys.
type: string
value:
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.
type: string
required:
- key
- value
type: object
type: array
labels:
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.
items:
description: MetaKVP represents a label or annotation
properties:
key:
description: Key is the name of the label or annotation. It must conform to the normal rules for Kubernetes label/annotation keys.
type: string
value:
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.
type: string
required:
- key
- value
type: object
type: array
parent:
description: Parent indicates the parent of this namespace, if any.
type: string
type: object
status:
description: HierarchyStatus defines the observed state of Hierarchy
properties:
children:
description: Children indicates the direct children of this namespace, if any.
items:
type: string
type: array
conditions:
description: Conditions describes the errors, if any.
items:
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 }"
properties:
lastTransitionTime:
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.
format: date-time
type: string
message:
description: message is a human readable message indicating details about the transition. This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
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.
format: int64
minimum: 0
type: integer
reason:
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.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
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)
maxLength: 316
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])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
type: object
type: object
served: true
storage: true
Loading

0 comments on commit a0351d2

Please sign in to comment.