Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1545 from kinvolk/imran/packet-to-equinixmetal
Browse files Browse the repository at this point in the history
Code and config change: Packet to equinixmetal
  • Loading branch information
ipochi authored Sep 9, 2021
2 parents b2aad7a + 1136eb2 commit bb28af1
Show file tree
Hide file tree
Showing 110 changed files with 1,010 additions and 755 deletions.
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
run:
build-tags:
- aws
- packet
- equinixmetal
- aks
- e2e
- baremetal
- disruptivee2e
- poste2e
- packet_fluo
- equinixmetal_fluo

modules-download-mode: vendor

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ VERSION :=
MOD ?= vendor
DOCS_DIR ?= docs/cli

ALL_BUILD_TAGS := "aws,packet,aks,e2e,baremetal,disruptivee2e,poste2e,packet_fluo"
ALL_BUILD_TAGS := "aws,equinixmetal,aks,e2e,baremetal,disruptivee2e,poste2e,equinixmetal_fluo"

ADMISSION_WEBHOOK_SERVER := "quay.io/kinvolk/lokomotive-admission-webhook-server"

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Check the [installation guide](https://kinvolk.io/docs/lokomotive/latest/install

Follow one of the quickstart guides for the supported platforms:

* [Packet quickstart](https://kinvolk.io/docs/lokomotive/latest/quickstarts/packet)
* [Equinix Metal quickstart](https://kinvolk.io/docs/lokomotive/latest/quickstarts/equinix-metal)
* [AWS quickstart](https://kinvolk.io/docs/lokomotive/latest/quickstarts/aws)
* [Bare metal quickstart](https://kinvolk.io/docs/lokomotive/latest/quickstarts/baremetal)

Expand All @@ -47,9 +47,9 @@ Follow one of the quickstart guides for the supported platforms:
### How to guides

* [Backup Rook Ceph volume on S3 using Velero](https://kinvolk.io/docs/lokomotive/latest/how-to-guides/backup-rook-ceph-volumes)
* [Kubernetes storage with Rook Ceph on Packet cloud](https://kinvolk.io/docs/lokomotive/latest/how-to-guides/rook-ceph-storage)
* [Kubernetes storage with Rook Ceph on Equinix Metal](https://kinvolk.io/docs/lokomotive/latest/how-to-guides/rook-ceph-storage)
* [Set up monitoring on Lokomotive](https://kinvolk.io/docs/lokomotive/latest/how-to-guides/monitoring-with-prometheus-operator)
* [Setting up an HTTP ingress controller on Lokomotive with MetalLB and Contour on Packet](https://kinvolk.io/docs/lokomotive/latest/how-to-guides/ingress-with-contour-metallb)
* [Setting up an HTTP ingress controller on Lokomotive with MetalLB and Contour on Equinix Metal](https://kinvolk.io/docs/lokomotive/latest/how-to-guides/ingress-with-contour-metallb)
* [Setting up cluster authentication on Lokomotive with GitHub, Dex and Gangway](https://kinvolk.io/docs/lokomotive/latest/how-to-guides/authentication-with-dex-gangway)
* [Setting up third party OAuth for Grafana](https://kinvolk.io/docs/lokomotive/latest/how-to-guides/setup-thirdparty-auth-for-grafana)
* [Upgrading bootstrap kubelet](https://kinvolk.io/docs/lokomotive/latest/how-to-guides/upgrade-bootstrap-kubelet)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: cloud-provider-equinix-metal
description: Kubernetes Cloud Provider for Equinix Metal
type: application
version: "0.1.0"
appVersion: "master"
home: https://metal.equinix.com
sources:
- https://github.com/equinix/cloud-provider-equinix-metal

Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cloud-provider-equinix-metal.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 "cloud-provider-equinix-metal.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 "cloud-provider-equinix-metal.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{/*
Selector labels
*/}}
{{- define "cloud-provider-equinix-metal.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cloud-provider-equinix-metal.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

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

{{/*
Create the name of the secret containing the config file to use
*/}}
{{- define "cloud-provider-equinix-metal.configSecretName" -}}
{{- if .Values.configSecret.create }}
{{- default (include "cloud-provider-equinix-metal.fullname" .) .Values.configSecret.name }}
{{- else }}
{{- default "default" .Values.configSecret.name }}
{{- end }}
{{- end }}

{{/*
Create the image version tag
*/}}
{{- define "cloud-provider-equinix-metal.imageTag" -}}
{{- if eq .Chart.AppVersion "master" }}
{{- default "master" .Values.image.tag }}
{{- else }}
{{- default .Values.image.tag }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{{- if .Values.clusterRole.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
{{- include "cloud-provider-equinix-metal.labels" . | nindent 4 }}
{{- with .Values.clusterRole.annotations }}
annotations:
rbac.authorization.kubernetes.io/autoupdate: 'true'
{{- toYaml . | nindent 4 }}
{{- end }}
name: '{{ .Values.clusterRole.name }}'
rules:
- apiGroups:
- ''
resources:
- namespaces
verbs:
- get
- apiGroups:
- ''
resources:
- endpoints
verbs:
- create
- get
- list
- watch
- update
- apiGroups:
- ''
resources:
- nodes
verbs:
- '*'
- apiGroups:
- ''
resources:
- nodes/status
verbs:
- patch
- apiGroups:
- ''
resources:
- services
verbs:
- get
- list
- patch
- update
- watch
- create
- apiGroups:
- ''
resources:
- services/status
verbs:
- list
- patch
- update
- watch
- apiGroups:
- ''
resources:
- configmaps
verbs:
- create
- get
- list
- watch
- update
- patch
- apiGroups:
- ''
resources:
- events
verbs:
- create
- get
- list
- watch
- update
- patch
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.clusterRole.create -}}
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: '{{ .Values.clusterRole.name }}'
labels:
{{- include "cloud-provider-equinix-metal.labels" . | nindent 4 }}
{{- with .Values.clusterRole.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: '{{ .Values.clusterRole.name }}'
subjects:
- kind: ServiceAccount
name: {{ include "cloud-provider-equinix-metal.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cloud-provider-equinix-metal.fullname" . }}
labels:
{{- include "cloud-provider-equinix-metal.labels" . | nindent 4 }}
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
{{- include "cloud-provider-equinix-metal.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
scheduler.alpha.kubernetes.io/critical-pod: ''
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
labels:
{{- include "cloud-provider-equinix-metal.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
dnsPolicy: Default
hostNetwork: true
serviceAccountName: {{ include "cloud-provider-equinix-metal.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- with .Values.hostAliases }}
hostAliases:
{{- toYaml . | nindent 8 }}
{{- end }}
tolerations:
- key: node.cloudprovider.kubernetes.io/uninitialized
value: 'true'
effect: NoSchedule
- key: CriticalAddonsOnly
operator: Exists
- key: node-role.kubernetes.io/master
effect: NoSchedule
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ include "cloud-provider-equinix-metal.imageTag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- ./cloud-provider-equinix-metal
- '--cloud-provider=equinixmetal'
- '--leader-elect=false'
- '--authentication-skip-lookup=true'
- '--provider-config=/etc/cloud-sa/cloud-sa.json'
{{- with .Values.additionalCommands }}
{{- toYaml . | nindent 12 }}
{{- end }}
env:
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- with .Values.envFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: cloud-sa-volume
readOnly: true
mountPath: /etc/cloud-sa
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: cloud-sa-volume
secret:
secretName: {{ include "cloud-provider-equinix-metal.configSecretName" . }}
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{ if .Values.configSecret.create }}
{{- $unused := required "You must set an Equinix Metal API key" .Values.config.apiKey -}}
{{- $unused := required "You must set an Equinix Metal project ID" .Values.config.projectID -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "cloud-provider-equinix-metal.configSecretName" . }}
labels:
{{- include "cloud-provider-equinix-metal.labels" . | nindent 4 }}
type: Opaque
data:
cloud-sa.json: {{ .Values.config | toJson | b64enc | quote }}
{{ end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "cloud-provider-equinix-metal.serviceAccountName" . }}
labels:
{{- include "cloud-provider-equinix-metal.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading

0 comments on commit bb28af1

Please sign in to comment.