Skip to content

Commit 80d425e

Browse files
Merge pull request #950 from tkashem/pod-configuration
Pod configuration
2 parents c17daba + 1797228 commit 80d425e

File tree

90 files changed

+6039
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+6039
-19
lines changed

cmd/olm/main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010
"time"
1111

12+
configclientset "github.com/openshift/client-go/config/clientset/versioned"
1213
configv1client "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1"
1314
"github.com/prometheus/client_golang/prometheus/promhttp"
1415
log "github.com/sirupsen/logrus"
@@ -158,6 +159,11 @@ func main() {
158159
if err != nil {
159160
log.Fatalf("error configuring client: %s", err.Error())
160161
}
162+
versionedConfigClient, err := configclientset.NewForConfig(config)
163+
if err != nil {
164+
err = fmt.Errorf("error configuring OpenShift Proxy client: %v", err)
165+
return
166+
}
161167
configClient, err := configv1client.NewForConfig(config)
162168
if err != nil {
163169
log.Fatalf("error configuring client: %s", err.Error())
@@ -179,6 +185,7 @@ func main() {
179185
olm.WithExternalClient(crClient),
180186
olm.WithOperatorClient(opClient),
181187
olm.WithRestConfig(config),
188+
olm.WithConfigClient(versionedConfigClient),
182189
)
183190
if err != nil {
184191
log.WithError(err).Fatalf("error configuring operator")
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{{- if .Values.e2eLocalMode }}
2+
apiVersion: apiextensions.k8s.io/v1beta1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
creationTimestamp: "2019-07-08T17:25:44Z"
6+
generation: 1
7+
name: proxies.config.openshift.io
8+
resourceVersion: "403"
9+
selfLink: /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/proxies.config.openshift.io
10+
uid: 6af86a13-a1a5-11e9-b519-0a2c4a2d8fc8
11+
spec:
12+
conversion:
13+
strategy: None
14+
group: config.openshift.io
15+
names:
16+
kind: Proxy
17+
listKind: ProxyList
18+
plural: proxies
19+
singular: proxy
20+
scope: Cluster
21+
subresources:
22+
status: {}
23+
validation:
24+
openAPIV3Schema:
25+
properties:
26+
apiVersion:
27+
description: 'APIVersion defines the versioned schema of this representation
28+
of an object. Servers should convert recognized schemas to the latest
29+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
30+
type: string
31+
kind:
32+
description: 'Kind is a string value representing the REST resource this
33+
object represents. Servers may infer this from the endpoint the client
34+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
35+
type: string
36+
metadata:
37+
type: object
38+
spec:
39+
description: Spec holds user-settable values for the proxy configuration
40+
properties:
41+
httpProxy:
42+
description: httpProxy is the URL of the proxy for HTTP requests. Empty
43+
means unset and will not result in an env var.
44+
type: string
45+
httpsProxy:
46+
description: httpsProxy is the URL of the proxy for HTTPS requests. Empty
47+
means unset and will not result in an env var.
48+
type: string
49+
noProxy:
50+
description: noProxy is a comma-separated list of hostnames and/or CIDRs
51+
for which the proxy should not be used. Empty means unset and will
52+
not result in an env var.
53+
type: string
54+
type: object
55+
status:
56+
description: status holds observed values from the cluster. They may not
57+
be overridden.
58+
properties:
59+
httpProxy:
60+
description: httpProxy is the URL of the proxy for HTTP requests.
61+
type: string
62+
httpsProxy:
63+
description: httpsProxy is the URL of the proxy for HTTPS requests.
64+
type: string
65+
noProxy:
66+
description: noProxy is a comma-separated list of hostnames and/or CIDRs
67+
for which the proxy should not be used.
68+
type: string
69+
type: object
70+
required:
71+
- spec
72+
version: v1
73+
versions:
74+
- name: v1
75+
served: true
76+
storage: true
77+
status:
78+
acceptedNames:
79+
kind: Proxy
80+
listKind: ProxyList
81+
plural: proxies
82+
singular: proxy
83+
conditions:
84+
- lastTransitionTime: "2019-07-08T17:25:44Z"
85+
message: no conflicts found
86+
reason: NoConflicts
87+
status: "True"
88+
type: NamesAccepted
89+
- lastTransitionTime: null
90+
message: the initial names have been accepted
91+
reason: InitialNamesAccepted
92+
status: "True"
93+
type: Established
94+
storedVersions:
95+
- v1
96+
{{- end }}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{- if .Values.e2eLocalMode }}
2+
apiVersion: config.openshift.io/v1
3+
kind: Proxy
4+
metadata:
5+
name: cluster
6+
spec:
7+
httpProxy: "http://foo.com:8080"
8+
httpsProxy: "https://foo.com:8080"
9+
noProxy: "a,b,c"
10+
{{- end }}

deploy/chart/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ minKubeVersion: 1.11.0
77
writeStatusName: '""'
88
imagestream: false
99
debug: false
10+
e2eLocalMode: false
1011
installType: upstream
1112
olm:
1213
replicaCount: 1

pkg/api/apis/operators/subscription_types.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,46 @@ type SubscriptionSpec struct {
3333
Channel string
3434
StartingCSV string
3535
InstallPlanApproval Approval
36+
Config SubscriptionConfig
37+
}
38+
39+
// SubscriptionConfig contains configuration specified for a subscription.
40+
type SubscriptionConfig struct {
41+
// Label selector for pods. Existing ReplicaSets whose pods are
42+
// selected by this will be the ones affected by this deployment.
43+
// It must match the pod template's labels.
44+
Selector *metav1.LabelSelector `json:"selector,omitempty"`
45+
46+
// NodeSelector is a selector which must be true for the pod to fit on a node.
47+
// Selector which must match a node's labels for the pod to be scheduled on that node.
48+
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
49+
// +optional
50+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
51+
52+
// If specified, the pod's tolerations.
53+
// +optional
54+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
55+
56+
// Compute Resources required by this container.
57+
// Cannot be updated.
58+
// More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
59+
// +optional
60+
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
61+
62+
// List of sources to populate environment variables in the container.
63+
// The keys defined within a source must be a C_IDENTIFIER. All invalid keys
64+
// will be reported as an event when the container is starting. When a key exists in multiple
65+
// sources, the value associated with the last source will take precedence.
66+
// Values defined by an Env with a duplicate key will take precedence.
67+
// Cannot be updated.
68+
// +optional
69+
EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`
70+
// List of environment variables to set in the container.
71+
// Cannot be updated.
72+
// +optional
73+
// +patchMergeKey=name
74+
// +patchStrategy=merge
75+
Env []corev1.EnvVar `json:"env,omitempty"`
3676
}
3777

3878
// SubscriptionConditionType indicates an explicit state condition about a Subscription in "abnormal-true"

pkg/api/apis/operators/v1alpha1/subscription_types.go

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,52 @@ const (
2929

3030
// SubscriptionSpec defines an Application that can be installed
3131
type SubscriptionSpec struct {
32-
CatalogSource string `json:"source"`
33-
CatalogSourceNamespace string `json:"sourceNamespace"`
34-
Package string `json:"name"`
35-
Channel string `json:"channel,omitempty"`
36-
StartingCSV string `json:"startingCSV,omitempty"`
37-
InstallPlanApproval Approval `json:"installPlanApproval,omitempty"`
32+
CatalogSource string `json:"source"`
33+
CatalogSourceNamespace string `json:"sourceNamespace"`
34+
Package string `json:"name"`
35+
Channel string `json:"channel,omitempty"`
36+
StartingCSV string `json:"startingCSV,omitempty"`
37+
InstallPlanApproval Approval `json:"installPlanApproval,omitempty"`
38+
Config SubscriptionConfig `json:"config,omitempty"`
39+
}
40+
41+
// SubscriptionConfig contains configuration specified for a subscription.
42+
type SubscriptionConfig struct {
43+
// Label selector for pods. Existing ReplicaSets whose pods are
44+
// selected by this will be the ones affected by this deployment.
45+
// It must match the pod template's labels.
46+
Selector *metav1.LabelSelector `json:"selector,omitempty"`
47+
48+
// NodeSelector is a selector which must be true for the pod to fit on a node.
49+
// Selector which must match a node's labels for the pod to be scheduled on that node.
50+
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
51+
// +optional
52+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
53+
54+
// If specified, the pod's tolerations.
55+
// +optional
56+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
57+
58+
// Compute Resources required by this container.
59+
// Cannot be updated.
60+
// More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
61+
// +optional
62+
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
63+
64+
// List of sources to populate environment variables in the container.
65+
// The keys defined within a source must be a C_IDENTIFIER. All invalid keys
66+
// will be reported as an event when the container is starting. When a key exists in multiple
67+
// sources, the value associated with the last source will take precedence.
68+
// Values defined by an Env with a duplicate key will take precedence.
69+
// Cannot be updated.
70+
// +optional
71+
EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`
72+
// List of environment variables to set in the container.
73+
// Cannot be updated.
74+
// +optional
75+
// +patchMergeKey=name
76+
// +patchStrategy=merge
77+
Env []corev1.EnvVar `json:"env,omitempty"`
3878
}
3979

4080
// SubscriptionConditionType indicates an explicit state condition about a Subscription in "abnormal-true"
@@ -81,7 +121,7 @@ const (
81121
InstallPlanNotYetReconciled = "InstallPlanNotYetReconciled"
82122

83123
// InstallPlanFailed is a reason string for Subscriptions that transitioned due to a referenced InstallPlan failing without setting an explicit failure condition.
84-
InstallPlanFailed = "InstallPlanFailed"
124+
InstallPlanFailed = "InstallPlanFailed"
85125
)
86126

87127
// SubscriptionCondition represents the latest available observations of a Subscription's state.

pkg/api/apis/operators/v1alpha1/zz_generated.conversion.go

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)