Skip to content

Commit 8c1a7f3

Browse files
authored
Add OpenShift UBI image support (#42)
Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent 2f2a32f commit 8c1a7f3

File tree

2,239 files changed

+298206
-6
lines changed

Some content is hidden

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

2,239 files changed

+298206
-6
lines changed

apis/installer/v1alpha1/aws_credential_manager_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package v1alpha1
1919
import (
2020
core "k8s.io/api/core/v1"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
"kmodules.xyz/resource-metadata/apis/shared"
2223
)
2324

2425
const (
@@ -82,6 +83,8 @@ type AwsCredentialManagerSpec struct {
8283
ServiceAccount ServiceAccountSpec `json:"serviceAccount"`
8384
Volumes []core.Volume `json:"volumes"`
8485
VolumeMounts []core.VolumeMount `json:"volumeMounts"`
86+
// +optional
87+
Distro shared.DistroSpec `json:"distro"`
8588
}
8689

8790
type ImageReference struct {

apis/installer/v1alpha1/capa_vpc_peering_operator_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package v1alpha1
1919
import (
2020
core "k8s.io/api/core/v1"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
"kmodules.xyz/resource-metadata/apis/shared"
2223
)
2324

2425
const (
@@ -70,6 +71,8 @@ type CapaVpcPeeringOperatorSpec struct {
7071
// +optional
7172
Affinity *core.Affinity `json:"affinity"`
7273
Monitoring Monitoring `json:"monitoring"`
74+
// +optional
75+
Distro shared.DistroSpec `json:"distro"`
7376
}
7477

7578
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

apis/installer/v1alpha1/capi_ops_manager_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package v1alpha1
1919
import (
2020
core "k8s.io/api/core/v1"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
"kmodules.xyz/resource-metadata/apis/shared"
2223
)
2324

2425
const (
@@ -80,6 +81,8 @@ type CapiOpsManagerSpec struct {
8081
// +optional
8182
Apiserver CapiOpsManagerApiserver `json:"apiserver"`
8283
Monitoring Monitoring `json:"monitoring"`
84+
// +optional
85+
Distro shared.DistroSpec `json:"distro"`
8386
}
8487

8588
type CapiOpsManagerApiserver struct {

apis/installer/v1alpha1/docker_machine_operator_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package v1alpha1
1919
import (
2020
core "k8s.io/api/core/v1"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
"kmodules.xyz/resource-metadata/apis/shared"
2223
)
2324

2425
const (
@@ -70,6 +71,8 @@ type DockerMachineOperatorSpec struct {
7071
// +optional
7172
Affinity *core.Affinity `json:"affinity"`
7273
Monitoring Monitoring `json:"monitoring"`
74+
// +optional
75+
Distro shared.DistroSpec `json:"distro"`
7376
}
7477

7578
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

apis/installer/v1alpha1/zz_generated.deepcopy.go

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

charts/aws-credential-manager/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ The following table lists the configurable parameters of the `aws-credential-man
7979
| nodeSelector | | <code>{}</code> |
8080
| tolerations | | <code>[]</code> |
8181
| affinity | | <code>{}</code> |
82+
| distro.openshift | Set true, if installed in OpenShift | <code>false</code> |
83+
| distro.ubi | Set operator or all to use ubi images | <code>""</code> |
8284

8385

8486
Specify each parameter using the `--set key=value[,key=value]` argument to `helm upgrade -i`. For example:

charts/aws-credential-manager/templates/_helpers.tpl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,17 @@ imagePullSecrets:
7474
{{- toYaml . | nindent 2 }}
7575
{{- end }}
7676
{{- end }}
77+
78+
{{/*
79+
Returns whether the OpenShift distribution is used
80+
*/}}
81+
{{- define "distro.openshift" -}}
82+
{{- or (.Capabilities.APIVersions.Has "project.openshift.io/v1/Project") .Values.distro.openshift -}}
83+
{{- end }}
84+
85+
{{/*
86+
Returns if ubi images are to be used
87+
*/}}
88+
{{- define "operator.ubi" -}}
89+
{{ ternary "-ubi" "" (list "operator" "all" | has .Values.distro.ubi) }}
90+
{{- end }}

charts/aws-credential-manager/templates/deployment.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,23 @@ spec:
2424
spec:
2525
{{- include "appscode.imagePullSecrets" . | nindent 6 }}
2626
serviceAccountName: {{ include "aws-credential-manager.serviceAccountName" . }}
27+
{{- if eq "true" ( include "distro.openshift" . ) }}
28+
securityContext:
29+
{{- toYaml (omit .Values.podSecurityContext "runAsUser" "runAsGroup" "fsGroup" "supplementalGroups") | nindent 8 }}
30+
{{- else }}
2731
securityContext:
2832
{{- toYaml .Values.podSecurityContext | nindent 8 }}
33+
{{- end }}
2934
containers:
3035
- name: {{ .Chart.Name }}
36+
{{- if eq "true" ( include "distro.openshift" . ) }}
37+
securityContext:
38+
{{- toYaml (omit .Values.securityContext "runAsUser" "runAsGroup" "fsGroup" "supplementalGroups") | nindent 12 }}
39+
{{- else }}
3140
securityContext:
3241
{{- toYaml .Values.securityContext | nindent 12 }}
33-
image: "{{ include "image.registry" . }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
42+
{{- end }}
43+
image: {{ include "image.registry" . }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}{{ include "operator.ubi" . }}
3444
imagePullPolicy: {{ .Values.image.pullPolicy }}
3545
args:
3646
- run

charts/aws-credential-manager/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,9 @@ volumeMounts: []
8181
nodeSelector: {}
8282
tolerations: []
8383
affinity: {}
84+
85+
distro:
86+
# Set true, if installed in OpenShift
87+
openshift: false
88+
# Set operator or all to use ubi images
89+
ubi: ""

charts/capa-vpc-peering-operator/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ The following table lists the configurable parameters of the `capa-vpc-peering-o
6868
| affinity | | <code>{}</code> |
6969
| monitoring.agent | Name of monitoring agent (one of "prometheus.io", "prometheus.io/operator", "prometheus.io/builtin") | <code>""</code> |
7070
| monitoring.serviceMonitor.labels | Specify the labels for ServiceMonitor. Prometheus crd will select ServiceMonitor using these labels. Only usable when monitoring agent is `prometheus.io/operator`. | <code>{}</code> |
71+
| distro.openshift | Set true, if installed in OpenShift | <code>false</code> |
72+
| distro.ubi | Set operator or all to use ubi images | <code>""</code> |
7173

7274

7375
Specify each parameter using the `--set key=value[,key=value]` argument to `helm upgrade -i`. For example:

0 commit comments

Comments
 (0)