Skip to content

Commit

Permalink
✨ Add openstack plugin logic (#4)
Browse files Browse the repository at this point in the history
* Add openstack plugin logic

Signed-off-by: michal.gubricky <[email protected]>

* Move imageDir to the config.yaml file

Signed-off-by: michal.gubricky <[email protected]>

* Add optional node-image-registry-path flag

Signed-off-by: michal.gubricky <[email protected]>

* Move copy of node-images.yaml file outside of for loop

Signed-off-by: michal.gubricky <[email protected]>

* Add reference to the DiskFormat,ContainerFormat fields in CreateOpts struct

Signed-off-by: michal.gubricky <[email protected]>

* Incorporate comments from review

Signed-off-by: michal.gubricky <[email protected]>

* Fix typo

Co-authored-by: Roman Hros <[email protected]>
Signed-off-by: Michal Gubricky <[email protected]>

* Adjust updateURLNodeImages function

Signed-off-by: michal.gubricky <[email protected]>

* Import CreateOpts from gophercloud images package

Signed-off-by: michal.gubricky <[email protected]>

* Fail if <node-image-registry-path> is empty in build method

Signed-off-by: michal.gubricky <[email protected]>

* Add verify field into registry.yaml file

Signed-off-by: michal.gubricky <[email protected]>

* Add cacert field to the registry.yaml

Related to #11

Signed-off-by: michal.gubricky <[email protected]>

* Update main.go

Co-authored-by: Roman Hros <[email protected]>
Signed-off-by: Michal Gubricky <[email protected]>

* Update main.go

Co-authored-by: Roman Hros <[email protected]>
Signed-off-by: Michal Gubricky <[email protected]>

* Change csctl version to pseudo version

Signed-off-by: michal.gubricky <[email protected]>

* Fix lint error

Signed-off-by: michal.gubricky <[email protected]>

* Remove linter for docker

Signed-off-by: michal.gubricky <[email protected]>

---------

Signed-off-by: michal.gubricky <[email protected]>
Signed-off-by: Michal Gubricky <[email protected]>
Co-authored-by: Roman Hros <[email protected]>
  • Loading branch information
michal-gubricky and chess-knight authored May 7, 2024
1 parent 032044a commit e8dc966
Show file tree
Hide file tree
Showing 1,311 changed files with 515,409 additions and 3 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,3 @@ jobs:

- name: Lint YAML
run: make BUILD_IN_CONTAINER=false lint-yaml-ci

- name: Lint Dockerfile
run: make BUILD_IN_CONTAINER=false lint-dockerfile
1 change: 1 addition & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ ignore:
- '.cache'
- _artifacts
- dist
- example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
values: |
metrics-server:
commonLabels:
domain: "{{ .Cluster.spec.controlPlaneEndpoint.host }}"
clusterAddonVersion: "v2"
23 changes: 23 additions & 0 deletions example/cluster-stacks/openstack/ferrol/cluster-addon/.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/
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: metrics-server
repository: https://kubernetes-sigs.github.io/metrics-server/
version: 3.11.0
digest: sha256:d92caa34d06b047b0390aa33a6f5d15d4fe0566143625204ebbbc69085133c4e
generated: "2023-09-12T12:02:23.747094767+02:00"
14 changes: 14 additions & 0 deletions example/cluster-stacks/openstack/ferrol/cluster-addon/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v2
dependencies:
- alias: metrics-server
name: metrics-server
repository: https://kubernetes-sigs.github.io/metrics-server/
version: 3.11.0
description: 'This chart installs and configures: * Openstack Ferrol Cluster Class '
maintainers:
- email: [email protected]
name: Syself
url: https://github.com/syself
name: openstack-ferrol-1-27-cluster-addon
type: application
version: << .ClusterAddonVersion >>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cluster-addon.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "cluster-addon.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "cluster-addon.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "cluster-addon.labels" -}}
helm.sh/chart: {{ include "cluster-addon.chart" . }}
{{ include "cluster-addon.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "cluster-addon.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cluster-addon.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "cluster-addon.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "cluster-addon.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# kindnetd networking manifest
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kindnet
rules:
- apiGroups:
- ""
resources:
- nodes
verbs:
- list
- watch
- patch
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kindnet
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kindnet
subjects:
- kind: ServiceAccount
name: kindnet
namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kindnet
namespace: kube-system
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: kindnet
namespace: kube-system
labels:
tier: node
app: kindnet
k8s-app: kindnet
spec:
selector:
matchLabels:
app: kindnet
template:
metadata:
labels:
tier: node
app: kindnet
k8s-app: kindnet
spec:
hostNetwork: true
tolerations:
- operator: Exists
effect: NoSchedule
serviceAccountName: kindnet
containers:
- name: kindnet-cni
image: kindest/kindnetd:v20230511-dc714da8
env:
- name: HOST_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
# We're using the dualstack CIDRs here. The order doesn't matter for kindnet as the loops are run concurrently.
# REF: https://github.com/kubernetes-sigs/kind/blob/3dbeb894e3092a336ab4278d3823e73a1d66aff7/images/kindnetd/cmd/kindnetd/main.go#L149-L175
- name: POD_SUBNET
value: '${OPENSTACK_POD_CIDRS},${OPENSTACK_POD_IPV6_CIDRS}'
volumeMounts:
- name: cni-cfg
mountPath: /etc/cni/net.d
- name: xtables-lock
mountPath: /run/xtables.lock
readOnly: false
- name: lib-modules
mountPath: /lib/modules
readOnly: true
resources:
requests:
cpu: "100m"
memory: "50Mi"
limits:
cpu: "100m"
memory: "50Mi"
securityContext:
privileged: false
capabilities:
add: ["NET_RAW", "NET_ADMIN"]
volumes:
- name: cni-bin
hostPath:
path: /opt/cni/bin
type: DirectoryOrCreate
- name: cni-cfg
hostPath:
path: /etc/cni/net.d
type: DirectoryOrCreate
- name: xtables-lock
hostPath:
path: /run/xtables.lock
type: FileOrCreate
- name: lib-modules
hostPath:
path: /lib/modules
44 changes: 44 additions & 0 deletions example/cluster-stacks/openstack/ferrol/cluster-addon/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
metrics-server:
fullnameOverride: metrics-server
replicas: 1
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1

podDisruptionBudget:
apiVersion: policy/v1
enabled: true
minAvailable: 1

tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
- key: CriticalAddonsOnly
operator: Exists

service:
labels:
kubernetes.io/cluster-service: "true"
kubernetes.io/name: "metrics-server"

defaultArgs:
- --cert-dir=/tmp
- --kubelet-preferred-address-types=ExternalIP,Hostname
- --kubelet-use-node-status-port
- --metric-resolution=15s

args:
- --kubelet-insecure-tls

affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- metrics-server
topologyKey: "kubernetes.io/hostname"
23 changes: 23 additions & 0 deletions example/cluster-stacks/openstack/ferrol/cluster-class/.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/
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v2
description: 'This chart installs and configures: * OPENSTACK Ferrol Cluster Class '
maintainers:
- email: [email protected]
name: Syself
url: https://github.com/syself
name: openstack-ferrol-1-27-cluster-class
type: application
version: << .ClusterClassVersion >>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cluster-class.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "cluster-class.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "cluster-class.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "cluster-class.labels" -}}
helm.sh/chart: {{ include "cluster-class.chart" . }}
{{ include "cluster-class.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "cluster-class.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cluster-class.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "cluster-class.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "cluster-class.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Loading

0 comments on commit e8dc966

Please sign in to comment.