Skip to content

Commit

Permalink
fix(config): remove name field from service endpoint spec
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
Endpoint names will have to be removed from module configs.
  • Loading branch information
eysi09 committed Sep 10, 2018
1 parent 7f010f9 commit 9f6f9f0
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 39 deletions.
7 changes: 1 addition & 6 deletions docs/reference/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -501,12 +501,7 @@ module:
#
# Optional.
endpoints:
- # A name to assign to the endpoint.
#
# Optional.
name: default

# The hostname that should route to this service. Defaults to the default hostname
- # The hostname that should route to this service. Defaults to the default hostname
# configured
# in the provider configuration.
#
Expand Down
3 changes: 1 addition & 2 deletions examples/local-tls/services/node-service/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ module:
endpoints:
- path: /hello
port: http
- name: call-go
path: /call-go-service
- path: /call-go-service
port: http
dependencies:
- go-service
Expand Down
5 changes: 0 additions & 5 deletions garden-cli/src/plugins/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import { ModuleSpec, ModuleConfig } from "../config/module"
import { BaseServiceSpec, ServiceConfig, baseServiceSchema } from "../config/service"

export interface ContainerEndpointSpec {
name: string
hostname?: string
path: string
port: string
Expand Down Expand Up @@ -86,9 +85,6 @@ export type ContainerServiceConfig = ServiceConfig<ContainerServiceSpec>

const endpointSchema = Joi.object()
.keys({
name: joiIdentifier()
.default("default")
.description("A name to assign to the endpoint."),
hostname: endpointHostnameSchema,
path: Joi.string().uri(<any>{ relativeOnly: true })
.default("/")
Expand Down Expand Up @@ -160,7 +156,6 @@ const serviceSchema = baseServiceSchema
.default(false)
.description("Whether to run the service as a daemon (to ensure only one runs per node)."),
endpoints: joiArray(endpointSchema)
.unique("name")
.description("List of endpoints that the service exposes.")
.example([{
path: "/api",
Expand Down
1 change: 0 additions & 1 deletion garden-cli/src/plugins/openfaas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ async function getServiceStatus({ ctx, provider, service }: GetServiceStatusPara
const k8sProvider = getK8sProvider(ctx)

const endpoints: ServiceEndpoint[] = [{
name: "default",
hostname: getExternalGatewayHostname(provider, k8sProvider),
path: getServicePath(service),
port: k8sProvider.config.ingressHttpPort,
Expand Down
5 changes: 0 additions & 5 deletions garden-cli/src/types/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export type ServiceState = "ready" | "deploying" | "stopped" | "unhealthy" | "un
export type ServiceProtocol = "http" | "https" // | "tcp" | "udp"

export interface ServiceEndpointSpec {
name: string
hostname?: string
path: string
port: number
Expand Down Expand Up @@ -67,9 +66,6 @@ const portSchema = Joi.number()

export const serviceEndpointSpecSchema = Joi.object()
.keys({
name: Joi.string()
.default("default")
.description("A unique name for this endpoint."),
hostname: endpointHostnameSchema,
port: portSchema,
path: Joi.string()
Expand Down Expand Up @@ -122,7 +118,6 @@ export const serviceStatusSchema = Joi.object()
.description("How many replicas of the service are currently running."),
endpoints: Joi.array()
.items(serviceEndpointSchema)
.unique("name")
.description("List of currently deployed endpoints for the service."),
lastMessage: Joi.string()
.allow("")
Expand Down
2 changes: 0 additions & 2 deletions garden-cli/test/src/commands/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const testProvider: PluginFactory = () => {
"service-a": {
state: "ready",
endpoints: [{
name: "default",
hostname: "service-a.test-project-b.local.app.garden",
path: "/path-a",
protocol: "http",
Expand All @@ -23,7 +22,6 @@ const testProvider: PluginFactory = () => {
"service-b": {
state: "ready",
endpoints: [{
name: "default",
hostname: "service-b.test-project-b.local.app.garden",
path: "/",
port: 32000,
Expand Down
1 change: 0 additions & 1 deletion garden-cli/test/src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const testProvider: PluginFactory = () => {
"service-a": {
state: "ready",
endpoints: [{
name: "default",
hostname: "service-a.test-project-b.local.app.garden",
path: "/path-a",
port: 80,
Expand Down
4 changes: 0 additions & 4 deletions garden-cli/test/src/plugins/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ describe("plugins.container", () => {
daemon: false,
endpoints: [
{
name: "default",
path: "/",
port: "http",
},
Expand Down Expand Up @@ -269,7 +268,6 @@ describe("plugins.container", () => {
dependencies: [],
daemon: false,
endpoints: [{
name: "default",
path: "/",
port: "http",
}],
Expand Down Expand Up @@ -303,7 +301,6 @@ describe("plugins.container", () => {
dependencies: [],
daemon: false,
endpoints: [{
name: "default",
path: "/",
port: "http",
}],
Expand Down Expand Up @@ -355,7 +352,6 @@ describe("plugins.container", () => {
daemon: false,
endpoints: [
{
name: "bla",
path: "/",
port: "bla",
},
Expand Down
13 changes: 0 additions & 13 deletions garden-cli/test/src/plugins/kubernetes/ingress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ describe("createIngresses", () => {

it("should create an ingress for a basic container service", async () => {
const service = await getTestService({
name: "default",
path: "/",
port: "http",
})
Expand Down Expand Up @@ -422,12 +421,10 @@ describe("createIngresses", () => {
it("should group endpoints by hostname", async () => {
const service = await getTestService(
{
name: "a",
path: "/here",
port: "http",
},
{
name: "b",
path: "/there",
port: "http",
},
Expand Down Expand Up @@ -478,13 +475,11 @@ describe("createIngresses", () => {
it("should create a rule for each hostname", async () => {
const service = await getTestService(
{
name: "a",
hostname: "foo",
path: "/",
port: "http",
},
{
name: "b",
hostname: "bar",
path: "/",
port: "http",
Expand Down Expand Up @@ -543,7 +538,6 @@ describe("createIngresses", () => {
it("should map a configured TLS certificate to an endpoint", async () => {
const service = await getTestService(
{
name: "default",
path: "/",
port: "http",
},
Expand Down Expand Up @@ -592,12 +586,10 @@ describe("createIngresses", () => {
it("should group multiple endpoints by TLS certificate", async () => {
const service = await getTestService(
{
name: "default",
path: "/",
port: "http",
},
{
name: "other",
hostname: "other.domain.com",
path: "/",
port: "http",
Expand Down Expand Up @@ -680,7 +672,6 @@ describe("createIngresses", () => {
it("should throw if a configured certificate doesn't exist", async () => {
const service = await getTestService(
{
name: "default",
path: "/",
port: "http",
},
Expand All @@ -704,7 +695,6 @@ describe("createIngresses", () => {
it("should throw if a secret for a configured certificate doesn't contain a certificate", async () => {
const service = await getTestService(
{
name: "default",
path: "/",
port: "http",
},
Expand Down Expand Up @@ -732,7 +722,6 @@ describe("createIngresses", () => {
it("should throw if a secret for a configured certificate contains an invalid certificate", async () => {
const service = await getTestService(
{
name: "default",
path: "/",
port: "http",
},
Expand Down Expand Up @@ -762,7 +751,6 @@ describe("createIngresses", () => {
it("should correctly match an endpoint to a wildcard certificate", async () => {
const service = await getTestService(
{
name: "default",
hostname: "something.wildcarddomain.com",
path: "/",
port: "http",
Expand Down Expand Up @@ -812,7 +800,6 @@ describe("createIngresses", () => {
it("should use configured hostnames for a certificate when specified", async () => {
const service = await getTestService(
{
name: "default",
hostname: "madeup.domain.com",
path: "/",
port: "http",
Expand Down

0 comments on commit 9f6f9f0

Please sign in to comment.