pfab 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36192c1d9882ed963296259ea22a27a4ffe2a91383cf655aa1392e301034513e
4
- data.tar.gz: 7c5a42aea011a6a4e0ce8b18c50a01a7b309921c7186ee47449c336fe077a99e
3
+ metadata.gz: 1d4e0472a9112fb68a842a98bc1851ae7acca8d6f89d18f383b1c0f51e1dfda9
4
+ data.tar.gz: f2b5a687241dd245a670bc2511478e260e9cfd258e77286dd996111ecc38995a
5
5
  SHA512:
6
- metadata.gz: 878bcbc12941d77f2d7cad35a2568afc194171c33239c6b3565abf2c506754a896fcffc3043e78a90cf3e4cfadf000ee22138ddb88c0069db81e1d5ea30152eb
7
- data.tar.gz: 6d7465ce4a0b3854cd814ad1069e834a1487d5399d6d2b0a6cae50747c27a24fe0904cae581240863ee9c981bb63ff98e2397557fa0a175d29ef0707f95f790a
6
+ metadata.gz: fb23d0a2422d5e9017eed252a475dff9ec48a5e66726b2e10011db46c21b30c5422856169b80aa3bee5eec55202f10a338202cfac1f90700ad8fffcc2b02a13c
7
+ data.tar.gz: e4039db2b30cf27f472b408ee9e8f41bc2fd68fa8464ef0b0b1e27ad187cd8ab01d0feb9b7371cbad180568e903ced20785b62c842bed5c5f2d2ab184620ff9a
data/README.markdown CHANGED
@@ -7,6 +7,8 @@ nothing to see here
7
7
  set ~/.pfab.yaml
8
8
  ```
9
9
  container.repository: "gcr.io/$$$$$$$"
10
+ default_cpu_string: "50m/250m"
11
+ default_memory_string: "256Mi/500Mi"
10
12
  envs:
11
13
  staging:
12
14
  context: "k8s-staging-context"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
data/lib/pfab/cli.rb CHANGED
@@ -56,9 +56,11 @@ module Pfab
56
56
  c.syntax = "pfab shipit"
57
57
  c.summary = "build, generate, apply"
58
58
  c.action do
59
- cmd_build
60
- cmd_generate_yaml
61
- cmd_apply
59
+ success = cmd_build
60
+ if success
61
+ cmd_generate_yaml
62
+ cmd_apply
63
+ end
62
64
  end
63
65
  end
64
66
 
@@ -127,7 +129,12 @@ module Pfab
127
129
  uncommitted_changes = `git diff-index HEAD --`.empty?
128
130
  if uncommitted_changes
129
131
  say "FYI! There are uncommitted changes."
130
- say "carrying on and pushing local code to #{rev}"
132
+ continue = agree("Continue anyway?")
133
+ if continue
134
+ say "carrying on and pushing local code to #{rev}"
135
+ else
136
+ return false
137
+ end
131
138
  end
132
139
 
133
140
  prebuild = @application_yaml["prebuild"]
@@ -137,7 +144,7 @@ module Pfab
137
144
  say "Prebuild, running system(#{prebuild})"
138
145
  result = system(prebuild)
139
146
  if result
140
- notify_ok 'Pfab prebuild success'
147
+ say 'Pfab prebuild success'
141
148
  else
142
149
  say "Pfab prebuild did not return success. Exiting"
143
150
  return false
@@ -27,7 +27,7 @@ module Pfab
27
27
  {
28
28
  name: "http",
29
29
  port: 80,
30
- targetPort: 3000,
30
+ targetPort: get("port"),
31
31
  }
32
32
  ]
33
33
  }
@@ -57,7 +57,7 @@ module Pfab
57
57
  path: "/",
58
58
  backend: {
59
59
  serviceName: @data['deployed_name'],
60
- servicePort: get("service_port") || "http",
60
+ servicePort: "http",
61
61
  },
62
62
  },
63
63
  ],
@@ -69,15 +69,35 @@ module Pfab
69
69
  end
70
70
 
71
71
  def ingress_annotations
72
- {
72
+ h = {
73
73
  "kubernetes.io/ingress.class" => "traefik",
74
74
  "traefik.frontend.passHostHeader" => "false",
75
75
  "traefik.frontend.priority" => "1",
76
76
  "traefik.frontend.entryPoints" => "https",
77
- "traefik.protocol" => "http",
77
+ "traefik.protocol" => get("protocol") || "http",
78
78
  "traefik.frontend.headers.SSLRedirect" => "true",
79
79
  "traefik.docker.network" => "traefik",
80
80
  }
81
+ h["ingress.kubernetes.io/protocol"] = "h2c" if get("protocol") == "h2c"
82
+ h
83
+ end
84
+
85
+ def default_probe
86
+ {
87
+ httpGet: {
88
+ path: get("health_check_path") || "/",
89
+ port: get("port"),
90
+ },
91
+ initialDelaySeconds: 5,
92
+ }
93
+ end
94
+
95
+ def livenessProbe
96
+ get("livenessProbe") || default_probe
97
+ end
98
+
99
+ def readinessProbe
100
+ get("readinessProbe") || default_probe
81
101
  end
82
102
 
83
103
  def deployment
@@ -125,20 +145,8 @@ module Pfab
125
145
  command: get("command").split(" "),
126
146
  env: env_vars,
127
147
  resources: resources,
128
- livenessProbe: {
129
- httpGet: {
130
- path: get("health_check_path") || "/",
131
- port: get("port"),
132
- },
133
- initialDelaySeconds: 5,
134
- },
135
- readinessProbe: {
136
- httpGet: {
137
- path: get("health_check_path") || "/",
138
- port: get("port"),
139
- },
140
- initialDelaySeconds: 5,
141
- },
148
+ livenessProbe: livenessProbe,
149
+ readinessProbe: readinessProbe,
142
150
  }
143
151
  ]
144
152
  },
data/lib/pfab/yamls.rb CHANGED
@@ -3,7 +3,7 @@ module Pfab
3
3
  class Yamls
4
4
  def self.generate_for(apps:, application_yaml:, image_name:, env:, sha:, config:)
5
5
 
6
- apps.each do |app, props|
6
+ apps.map do |app, props|
7
7
  puts app
8
8
 
9
9
  data = {
@@ -18,7 +18,8 @@ module Pfab
18
18
  'application_yaml' => application_yaml
19
19
  }
20
20
 
21
- File.open(".application-k8s-#{env}-#{app}.yaml", "w") do |f|
21
+ filename = ".application-k8s-#{env}-#{app}.yaml"
22
+ File.open(filename, "w") do |f|
22
23
  case props[:deployable_type]
23
24
  when "web" then
24
25
  processed = Pfab::Templates::Web.new(data).write_to(f)
@@ -28,6 +29,7 @@ module Pfab
28
29
  processed = Pfab::Templates::Daemon.new(data).write_to(f)
29
30
  end
30
31
  end
32
+ filename
31
33
  end
32
34
 
33
35
  end
data/pfab.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: pfab 0.3.0 ruby lib
5
+ # stub: pfab 0.4.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "pfab".freeze
9
- s.version = "0.3.0"
9
+ s.version = "0.4.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Jeff Dwyer".freeze]
14
- s.date = "2018-12-31"
14
+ s.date = "2019-01-02"
15
15
  s.description = "k8s helper".freeze
16
16
  s.email = "jdwyer@prefab.cloud".freeze
17
17
  s.executables = ["pfab".freeze]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pfab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Dwyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-31 00:00:00.000000000 Z
11
+ date: 2019-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander