Skip to content

Commit

Permalink
add option to apply custom manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
loganmc10 committed Aug 6, 2024
1 parent 379b8f8 commit 182ecb2
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
sources:
- repoURL: 'https://loganmc10.github.io/hypershift-helm'
chart: deploy-cluster
targetRevision: 0.1.22
targetRevision: 0.1.23
helm:
valueFiles:
- $values/install-config.yaml
Expand Down
2 changes: 1 addition & 1 deletion chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ description: A Helm chart for deploying HyperShift clusters on bare metal

type: application

version: 0.1.22
version: 0.1.23
28 changes: 27 additions & 1 deletion chart/templates/PostSync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ data:
set -e
oc patch OperatorHub cluster --type json -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'
{{- end }}
{{- if hasKey .Values.hypershift "customManifests" }}
apply_custom_manifests.sh: |
set -e
cat << EOF | oc apply -f -
{{- .Values.hypershift.customManifests | nindent 4 }}
EOF
{{- end }}
wait_node.sh: |
set -e
Expand Down Expand Up @@ -144,7 +152,6 @@ spec:
- name: cluster-setup
mountPath: "/script"
readOnly: true
containers:
{{- if eq .Values.hypershift.disableAllDefaultSources true }}
- name: disable-default-catalog
image: {{ include "ocp_client" . }}
Expand All @@ -162,6 +169,25 @@ spec:
- name: cluster-setup
mountPath: "/script"
readOnly: true
{{- end }}
containers:
{{- if hasKey .Values.hypershift "customManifests" }}
- name: apply-custom-manifests
image: {{ include "ocp_client" . }}
command:
- bash
args:
- /script/apply_custom_manifests.sh
env:
- name: KUBECONFIG
value: "/secrets/kubeconfig"
volumeMounts:
- name: kubeconfig
mountPath: "/secrets"
readOnly: true
- name: cluster-setup
mountPath: "/script"
readOnly: true
{{- end }}
- name: configure-ingress
image: {{ include "ocp_client" . }}
Expand Down
10 changes: 10 additions & 0 deletions install-config-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ hypershift:
clusterConfiguration: # Optional, see https://hypershift-docs.netlify.app/how-to/cluster-configuration/
cliImage: mirror.example.com/openshift4/ose-cli:latest # Optional, may be needed in a disconnected environment. The Helm chart uses registry.redhat.io/openshift4/ose-cli:latest by default
olmCatalogPlacement: "guest" # Optional, defaults to "management"
customManifests:
| # Optional, can be used to apply some manifests post-install. Below is an example of a custom catalog source
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: redhat-operators
namespace: openshift-marketplace
spec:
image: mirror.com:8443/redhat/redhat-operator-index:v4.16
sourceType: grpc
disableAllDefaultSources: true # Optional, defaults to false. Disables default catalog sources. olmCatalogPlacement must be set to "guest"
nodePoolConfigs: # Optional, only required if you want to customize one of these values
- name: worker
Expand Down
9 changes: 9 additions & 0 deletions tests/configs/full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ hypershift:
cliImage: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:1fc458ece66c8d4184b45b5c495a372a96b47432ae5a39844cd5837e3981685b # 4.12.0-x86_64-cli
olmCatalogPlacement: guest
disableAllDefaultSources: true
customManifests: |
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: redhat-operators
namespace: openshift-marketplace
spec:
image: mirror.com:8443/redhat/redhat-operator-index:v4.16
sourceType: grpc
additionalNTPSources:
- pool.ntp.org
clusterConfiguration:
Expand Down
32 changes: 31 additions & 1 deletion tests/results/full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ data:
set -e
oc patch OperatorHub cluster --type json -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'
apply_custom_manifests.sh: |
set -e
cat << EOF | oc apply -f -
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: redhat-operators
namespace: openshift-marketplace
spec:
image: mirror.com:8443/redhat/redhat-operator-index:v4.16
sourceType: grpc
EOF
wait_node.sh: |
set -e
Expand Down Expand Up @@ -501,7 +515,6 @@ spec:
- name: cluster-setup
mountPath: "/script"
readOnly: true
containers:
- name: disable-default-catalog
image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:1fc458ece66c8d4184b45b5c495a372a96b47432ae5a39844cd5837e3981685b
command:
Expand All @@ -518,6 +531,23 @@ spec:
- name: cluster-setup
mountPath: "/script"
readOnly: true
containers:
- name: apply-custom-manifests
image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:1fc458ece66c8d4184b45b5c495a372a96b47432ae5a39844cd5837e3981685b
command:
- bash
args:
- /script/apply_custom_manifests.sh
env:
- name: KUBECONFIG
value: "/secrets/kubeconfig"
volumeMounts:
- name: kubeconfig
mountPath: "/secrets"
readOnly: true
- name: cluster-setup
mountPath: "/script"
readOnly: true
- name: configure-ingress
image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:1fc458ece66c8d4184b45b5c495a372a96b47432ae5a39844cd5837e3981685b
command:
Expand Down

0 comments on commit 182ecb2

Please sign in to comment.