Skip to content

Commit

Permalink
rename helm-chart (#80)
Browse files Browse the repository at this point in the history
* rename helm-chart

* rename folder

* change dir name

* updated values/versions

* add labels so that glooctl version works

* make new commands more flexible

* file for CRDs, add programmed condition

* bad comment

* change version to alpha1 instead

* comments

* rename the gateway class name

* use standar

* use relative dir
  • Loading branch information
EItanya authored and jenshu committed Jan 18, 2024
1 parent 1075c36 commit 8159d37
Show file tree
Hide file tree
Showing 28 changed files with 3,985 additions and 8,034 deletions.
2 changes: 1 addition & 1 deletion projects/gateway2/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# ignore binary that may be created in the current dir
/gloo-gateway2
/gloo-gateway
/.bin
4 changes: 2 additions & 2 deletions projects/gateway2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ FROM gcr.io/distroless/base-debian11

WORKDIR /

COPY gloo-gateway2 /usr/local/bin/gloo-gateway2
COPY gloo-gateway /usr/local/bin/gloo-gateway

USER nonroot:nonroot

ENTRYPOINT ["/usr/local/bin/gloo-gateway2"]
ENTRYPOINT ["/usr/local/bin/gloo-gateway"]
10 changes: 5 additions & 5 deletions projects/gateway2/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
build:
CGO_ENABLED=0 GOOS=linux go build -o gloo-gateway2
CGO_ENABLED=0 GOOS=linux go build -o gloo-gateway

docker: build
docker build -t docker.io/soloio/gloo-gateway2:latest .
docker build -t us-docker.pkg.dev/gloo-gateway/docker/gloo-gateway-cp:latest .

crds/gateway-crds.yaml:
kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd/experimental?ref=adbd9968d4ff7995af21cb9cd0913288e2b4ca27" -o crds/gateway-crds.yaml

kind:
./kind.sh
kind load docker-image docker.io/soloio/gloo-gateway2:latest
helm upgrade -i gloo-gateway2 ./helm/gloo-gateway2/ --set controlPlane.image.tag=latest --set gateway.enabled=false --set develop=true
kind load docker-image us-docker.pkg.dev/gloo-gateway/docker/gloo-gateway-cp:latest
helm upgrade -i gloo-gateway ./helm/gloo-gateway/ --set controlPlane.image.tag=latest --set gateway.enabled=false --set develop=true
kubectl delete rs --all

tests/conformance/conformance_test.go:
Expand All @@ -21,7 +21,7 @@ tests/conformance/conformance_test.go:
.PHONY: conformance
conformance: tests/conformance/conformance_test.go
go test -test.v ./tests/conformance/... -args \
-gateway-class=solo-gateway \
-gateway-class=gloo-gateway \
-supported-features=Gateway,HTTPRoute

# internal target used by controller_suite_test.go
Expand Down
4 changes: 2 additions & 2 deletions projects/gateway2/cmd/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ var controllerCmd = &cobra.Command{

func init() {
rootCmd.AddCommand(controllerCmd)
controllerCmd.Flags().StringVar(&cfg.GatewayClassName, "class-name", "solo-gateway", "The gateway class name that we own")
controllerCmd.Flags().StringVar(&cfg.GatewayControllerName, "controller-name", "solo.io/gloo-gateway2", "The gateway class controller name")
controllerCmd.Flags().StringVar(&cfg.GatewayClassName, "class-name", "gloo-gateway", "The gateway class name that we own")
controllerCmd.Flags().StringVar(&cfg.GatewayControllerName, "controller-name", "solo.io/gloo-gateway", "The gateway class controller name")
controllerCmd.Flags().StringVar(&cfg.Release, "release-name", "", "The release name for gateway resources")
controllerCmd.Flags().BoolVar(&cfg.Dev, "dev-mode", false, "Turn on dev mode (more verbose logging, etc.)")
controllerCmd.Flags().BoolVar(&cfg.AutoProvision, "auto-provision", false, "Auto provision gateway resources")
Expand Down
11,736 changes: 3,824 additions & 7,912 deletions projects/gateway2/crds/gateway-crds.yaml

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion projects/gateway2/deployer/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type Deployer struct {

func NewDeployer(scheme *runtime.Scheme, dev bool, release, controllerName, host string, port uint16) (*Deployer, error) {

chart, err := loadFs(helm.GlooGateway2HelmChart)
chart, err := loadFs(helm.GlooGatewayHelmChart)
if err != nil {
// don't retrun an error is requeueing won't help here
return nil, err
Expand Down Expand Up @@ -273,6 +273,9 @@ func ConvertYAMLToObjects(scheme *runtime.Scheme, yamlData []byte) ([]client.Obj
continue
}
}
} else if len(obj.Object) == 0 {
// This can happen with an "empty" document
continue
}

objs = append(objs, &obj)
Expand Down
2 changes: 1 addition & 1 deletion projects/gateway2/deployer/deployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var _ = Describe("Deployer", func() {
)
BeforeEach(func() {
var err error
d, err = deployer.NewDeployer(scheme.NewScheme(), false, "gloo-gateway2", "foo", "xds", 8080)
d, err = deployer.NewDeployer(scheme.NewScheme(), false, "gloo-gateway", "foo", "xds", 8080)
Expect(err).NotTo(HaveOccurred())
})

Expand Down
2 changes: 1 addition & 1 deletion projects/gateway2/examples/example-gw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: gateway.networking.k8s.io/v1beta1
metadata:
name: gw
spec:
gatewayClassName: solo-gateway
gatewayClassName: gloo-gateway
listeners:
- protocol: HTTP
port: 8080
Expand Down
4 changes: 2 additions & 2 deletions projects/gateway2/helm/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import (
"embed"
)

//go:embed all:gloo-gateway2
var GlooGateway2HelmChart embed.FS
//go:embed all:gloo-gateway
var GlooGatewayHelmChart embed.FS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: gloo-gateway2
name: gloo-gateway
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
Expand All @@ -15,10 +15,10 @@ 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
version: 0.0.1-alpha1

# 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: "2.0.0"
appVersion: "2.0.0-alpha1"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "gloo-gateway2.chart" -}}
{{- define "gloo-gateway.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -14,7 +14,7 @@ Control-plane related macros:
{{/*
Expand the name of the chart.
*/}}
{{- define "gloo-gateway2.controlPlane.name" -}}
{{- define "gloo-gateway.controlPlane.name" -}}
{{- default .Chart.Name .Values.controlPlane.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -23,7 +23,7 @@ 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 "gloo-gateway2.controlPlane.fullname" -}}
{{- define "gloo-gateway.controlPlane.fullname" -}}
{{- if .Values.controlPlane.fullnameOverride }}
{{- .Values.controlPlane.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -39,9 +39,9 @@ If release name contains chart name it will be used as a full name.
{{/*
Common labels
*/}}
{{- define "gloo-gateway2.controlPlane.labels" -}}
helm.sh/chart: {{ include "gloo-gateway2.chart" . }}
{{ include "gloo-gateway2.controlPlane.selectorLabels" . }}
{{- define "gloo-gateway.controlPlane.labels" -}}
helm.sh/chart: {{ include "gloo-gateway.chart" . }}
{{ include "gloo-gateway.controlPlane.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -51,17 +51,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "gloo-gateway2.controlPlane.selectorLabels" -}}
app.kubernetes.io/name: {{ include "gloo-gateway2.controlPlane.name" . }}
{{- define "gloo-gateway.controlPlane.selectorLabels" -}}
app.kubernetes.io/name: {{ include "gloo-gateway.controlPlane.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "gloo-gateway2.controlPlane.serviceAccountName" -}}
{{- define "gloo-gateway.controlPlane.serviceAccountName" -}}
{{- if .Values.controlPlane.serviceAccount.create }}
{{- default (include "gloo-gateway2.controlPlane.fullname" .) .Values.controlPlane.serviceAccount.name }}
{{- default (include "gloo-gateway.controlPlane.fullname" .) .Values.controlPlane.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.controlPlane.serviceAccount.name }}
{{- end }}
Expand All @@ -76,7 +76,7 @@ Data-plane related macros:
{{/*
Expand the name of the chart.
*/}}
{{- define "gloo-gateway2.gateway.name" -}}
{{- define "gloo-gateway.gateway.name" -}}
{{- if .Values.gateway.name }}
{{- .Values.gateway.name | printf "%s-dp" | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -89,7 +89,7 @@ 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 "gloo-gateway2.gateway.fullname" -}}
{{- define "gloo-gateway.gateway.fullname" -}}
{{- if .Values.gateway.fullnameOverride }}
{{- .Values.gateway.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else if .Values.gateway.name }}
Expand All @@ -112,9 +112,9 @@ If release name contains chart name it will be used as a full name.
{{/*
Common labels
*/}}
{{- define "gloo-gateway2.gateway.labels" -}}
helm.sh/chart: {{ include "gloo-gateway2.chart" . }}
{{ include "gloo-gateway2.gateway.selectorLabels" . }}
{{- define "gloo-gateway.gateway.labels" -}}
helm.sh/chart: {{ include "gloo-gateway.chart" . }}
{{ include "gloo-gateway.gateway.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -124,17 +124,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "gloo-gateway2.gateway.selectorLabels" -}}
app.kubernetes.io/name: {{ include "gloo-gateway2.gateway.name" . }}
{{- define "gloo-gateway.gateway.selectorLabels" -}}
app.kubernetes.io/name: {{ include "gloo-gateway.gateway.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "gloo-gateway2.gateway.serviceAccountName" -}}
{{- define "gloo-gateway.gateway.serviceAccountName" -}}
{{- if .Values.gateway.serviceAccount.create }}
{{- default (include "gloo-gateway2.gateway.fullname" .) .Values.gateway.serviceAccount.name }}
{{- default (include "gloo-gateway.gateway.fullname" .) .Values.gateway.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.gateway.serviceAccount.name }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "gloo-gateway2.controlPlane.fullname" . }}
name: {{ include "gloo-gateway.controlPlane.fullname" . }}
labels:
{{- include "gloo-gateway2.controlPlane.labels" . | nindent 4 }}
app: gloo
{{- include "gloo-gateway.controlPlane.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.controlPlane.replicaCount }}
selector:
matchLabels:
{{- include "gloo-gateway2.controlPlane.selectorLabels" . | nindent 6 }}
{{- include "gloo-gateway.controlPlane.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.controlPlane.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "gloo-gateway2.controlPlane.selectorLabels" . | nindent 8 }}
{{- include "gloo-gateway.controlPlane.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.controlPlane.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "gloo-gateway2.controlPlane.serviceAccountName" . }}
serviceAccountName: {{ include "gloo-gateway.controlPlane.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.controlPlane.podSecurityContext | nindent 8 }}
containers:
Expand All @@ -45,7 +46,7 @@ spec:
- "--auto-provision"
{{- end }}
- --xds-server
- {{ printf "%s.%s" (include "gloo-gateway2.controlPlane.fullname" . ) .Release.Namespace }}
- {{ printf "%s.%s" (include "gloo-gateway.controlPlane.fullname" . ) .Release.Namespace }}
- --xds-port
- "{{ .Values.controlPlane.service.port }}"
- --release-name={{ .Release.Name }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "gloo-gateway2.gateway.fullname" . }}
name: {{ include "gloo-gateway.gateway.fullname" . }}
labels:
{{- include "gloo-gateway2.gateway.labels" . | nindent 4 }}
app: gloo
{{- include "gloo-gateway.gateway.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "gloo-gateway2.gateway.fullname" . }}
name: {{ include "gloo-gateway.gateway.fullname" . }}
minReplicas: {{ .Values.gateway.autoscaling.minReplicas }}
maxReplicas: {{ .Values.gateway.autoscaling.maxReplicas }}
metrics:
Expand Down
Loading

0 comments on commit 8159d37

Please sign in to comment.