devfile 0.0.4.pre.alpha1-arm64-darwin → 0.0.5.pre.alpha1-arm64-darwin
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 +4 -4
- data/bin/devfile +0 -0
- data/ext/devfile.go +16 -7
- data/ext/main.go +4 -4
- data/lib/devfile.rb +12 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7213c30bd262a47cc7230b2766d8af2af0d2d9e14f13d5deede4c80fc565abd7
|
4
|
+
data.tar.gz: 14fb2059088725869adfb122c9da334d2890220be97dd46ec39eca2f9d502941
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b0f12ae00f9f5752cb2da4c4805ce2323a7b0c79ce021a311a576ffea9d3436fbbeba04eab05037a7cf1b5cb9818461436e9ae5b3c2b55199b2a770d25c118f
|
7
|
+
data.tar.gz: d483b86fd468e4d42104e7596b2e1a228de720a2b00889b34d43869f7817b667832f2e5d467f3bfa04444537c5ce922fb610dc44f17c6ffb8d0d914e3e222348
|
data/bin/devfile
CHANGED
Binary file
|
data/ext/devfile.go
CHANGED
@@ -3,7 +3,9 @@ package main
|
|
3
3
|
import "C"
|
4
4
|
import (
|
5
5
|
"bytes"
|
6
|
-
"
|
6
|
+
"strconv"
|
7
|
+
"text/template"
|
8
|
+
|
7
9
|
"github.com/devfile/library/v2/pkg/devfile/generator"
|
8
10
|
"github.com/devfile/library/v2/pkg/devfile/parser"
|
9
11
|
"github.com/devfile/library/v2/pkg/devfile/parser/data/v2/common"
|
@@ -63,7 +65,7 @@ func (d Devfile) getService(name, namespace string, labels, annotations map[stri
|
|
63
65
|
return service, err
|
64
66
|
}
|
65
67
|
|
66
|
-
func (d Devfile) getIngress(name, namespace string, labels, annotations map[string]string,
|
68
|
+
func (d Devfile) getIngress(name, namespace string, labels, annotations map[string]string, domainTemplate, ingressClass string) (runtime.Object, error) {
|
67
69
|
components, err := d.devfileObj.Data.GetDevfileContainerComponents(common.DevfileOptions{})
|
68
70
|
if err != nil {
|
69
71
|
return nil, err
|
@@ -72,12 +74,19 @@ func (d Devfile) getIngress(name, namespace string, labels, annotations map[stri
|
|
72
74
|
var hosts []string
|
73
75
|
var rules []networkingv1.IngressRule
|
74
76
|
|
77
|
+
// Create a new template and parse the letter into it.
|
78
|
+
t := template.Must(template.New("domainTemplate").Parse(domainTemplate))
|
79
|
+
|
75
80
|
for _, component := range components {
|
76
81
|
for _, endpoint := range component.Container.Endpoints {
|
77
|
-
domain
|
78
|
-
|
82
|
+
var domain bytes.Buffer
|
83
|
+
err := t.Execute(&domain, map[string]string{"port": strconv.Itoa(endpoint.TargetPort)})
|
84
|
+
if err != nil {
|
85
|
+
return nil, err
|
86
|
+
}
|
87
|
+
hosts = append(hosts, domain.String())
|
79
88
|
rules = append(rules, networkingv1.IngressRule{
|
80
|
-
Host: domain,
|
89
|
+
Host: domain.String(),
|
81
90
|
IngressRuleValue: networkingv1.IngressRuleValue{
|
82
91
|
HTTP: &networkingv1.HTTPIngressRuleValue{
|
83
92
|
Paths: []networkingv1.HTTPIngressPath{
|
@@ -134,7 +143,7 @@ func (d Devfile) getIngress(name, namespace string, labels, annotations map[stri
|
|
134
143
|
return ingress, nil
|
135
144
|
}
|
136
145
|
|
137
|
-
func (d Devfile) getAll(name, namespace string, labels, annotations map[string]string, replicas int,
|
146
|
+
func (d Devfile) getAll(name, namespace string, labels, annotations map[string]string, replicas int, domainTemplate, ingressClass string) ([]runtime.Object, error) {
|
138
147
|
deployment, err := d.getDeployment(name, namespace, labels, annotations, replicas)
|
139
148
|
if err != nil {
|
140
149
|
return nil, err
|
@@ -143,7 +152,7 @@ func (d Devfile) getAll(name, namespace string, labels, annotations map[string]s
|
|
143
152
|
if err != nil {
|
144
153
|
return nil, err
|
145
154
|
}
|
146
|
-
ingress, err := d.getIngress(name, namespace, labels, annotations,
|
155
|
+
ingress, err := d.getIngress(name, namespace, labels, annotations, domainTemplate, ingressClass)
|
147
156
|
if err != nil {
|
148
157
|
return nil, err
|
149
158
|
}
|
data/ext/main.go
CHANGED
@@ -123,7 +123,7 @@ func getService(devfile, name, namespace, labelsStr, annotationsStr string) Resu
|
|
123
123
|
return Result{content, nil}
|
124
124
|
}
|
125
125
|
|
126
|
-
func getIngress(devfile, name, namespace, labelsStr, annotationsStr,
|
126
|
+
func getIngress(devfile, name, namespace, labelsStr, annotationsStr, domainTemplate, ingressClass string) Result {
|
127
127
|
d, err := parseDevfile(devfile)
|
128
128
|
if err != nil {
|
129
129
|
return Result{"", err}
|
@@ -143,7 +143,7 @@ func getIngress(devfile, name, namespace, labelsStr, annotationsStr, domainSuffi
|
|
143
143
|
if err != nil {
|
144
144
|
return Result{"", err}
|
145
145
|
}
|
146
|
-
ingress, err := d.getIngress(name, namespace, labels, annotations,
|
146
|
+
ingress, err := d.getIngress(name, namespace, labels, annotations, domainTemplate, ingressClass)
|
147
147
|
if err != nil {
|
148
148
|
return Result{"", err}
|
149
149
|
}
|
@@ -154,7 +154,7 @@ func getIngress(devfile, name, namespace, labelsStr, annotationsStr, domainSuffi
|
|
154
154
|
return Result{content, nil}
|
155
155
|
}
|
156
156
|
|
157
|
-
func getAll(devfile string, name, namespace, labelsStr, annotationsStr, replicas,
|
157
|
+
func getAll(devfile string, name, namespace, labelsStr, annotationsStr, replicas, domainTemplate, ingressClass string) Result {
|
158
158
|
d, err := parseDevfile(devfile)
|
159
159
|
if err != nil {
|
160
160
|
return Result{"", err}
|
@@ -178,7 +178,7 @@ func getAll(devfile string, name, namespace, labelsStr, annotationsStr, replicas
|
|
178
178
|
if err != nil {
|
179
179
|
return Result{"", err}
|
180
180
|
}
|
181
|
-
resources, err := d.getAll(name, namespace, labels, annotations, replicasInt,
|
181
|
+
resources, err := d.getAll(name, namespace, labels, annotations, replicasInt, domainTemplate, ingressClass)
|
182
182
|
if err != nil {
|
183
183
|
return Result{"", err}
|
184
184
|
}
|
data/lib/devfile.rb
CHANGED
@@ -10,7 +10,9 @@ module Devfile
|
|
10
10
|
|
11
11
|
class << self
|
12
12
|
def get_deployment(devfile, name, namespace, labels, annotations, replicas)
|
13
|
-
stdout, stderr, status = Open3.capture3(
|
13
|
+
stdout, stderr, status = Open3.capture3(
|
14
|
+
"#{FILE_PATH} deployment '#{devfile}' #{name} #{namespace} '#{labels}' '#{annotations}' #{replicas}"
|
15
|
+
)
|
14
16
|
|
15
17
|
raise stderr unless status.success?
|
16
18
|
|
@@ -18,24 +20,28 @@ module Devfile
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def get_service(devfile, name, namespace, labels, annotations)
|
21
|
-
stdout, stderr, status = Open3.capture3(
|
23
|
+
stdout, stderr, status = Open3.capture3(
|
24
|
+
"#{FILE_PATH} service '#{devfile}' #{name} #{namespace} '#{labels}' '#{annotations}'"
|
25
|
+
)
|
22
26
|
|
23
27
|
raise stderr unless status.success?
|
24
28
|
|
25
29
|
stdout
|
26
30
|
end
|
27
31
|
|
28
|
-
def get_ingress(devfile, name, namespace, labels, annotations,
|
29
|
-
stdout, stderr, status = Open3.capture3(
|
32
|
+
def get_ingress(devfile, name, namespace, labels, annotations, domain_template, ingress_class)
|
33
|
+
stdout, stderr, status = Open3.capture3(
|
34
|
+
"#{FILE_PATH} ingress '#{devfile}' #{name} #{namespace} '#{labels}' '#{annotations}' #{domain_template} #{ingress_class}"
|
35
|
+
)
|
30
36
|
|
31
37
|
raise stderr unless status.success?
|
32
38
|
|
33
39
|
stdout
|
34
40
|
end
|
35
41
|
|
36
|
-
def get_all(devfile, name, namespace, labels, annotations, replicas,
|
42
|
+
def get_all(devfile, name, namespace, labels, annotations, replicas, domain_template, ingress_class)
|
37
43
|
stdout, stderr, status = Open3.capture3(
|
38
|
-
"#{FILE_PATH} all '#{devfile}' #{name} #{namespace} '#{labels}' '#{annotations}' #{replicas} #{
|
44
|
+
"#{FILE_PATH} all '#{devfile}' #{name} #{namespace} '#{labels}' '#{annotations}' #{replicas} #{domain_template} #{ingress_class}"
|
39
45
|
)
|
40
46
|
|
41
47
|
raise stderr unless status.success?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devfile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5.pre.alpha1
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Library used to generate kubernetes manifests from a Devfile.
|
14
14
|
email: spatnaik@gitlab.com
|