Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helm chart for hypershift #698

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 27 additions & 56 deletions hypershiftoperator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,64 +10,35 @@ AZURE_TENANT_ID ?= $(shell az account show --query tenantId --output tsv)
AZURE_SUBSCRIPTION_ID ?= $(shell az account show --query id --output tsv)

HO_IMAGE ?= ${ARO_HCP_IMAGE_ACR}.azurecr.io/acm-d/rhtap-hypershift-operator:99a256f
EDO_IMAGE ?= ${ARO_HCP_IMAGE_ACR}.azurecr.io/external-dns/external-dns:v0.14.2

create-edo-azure-creds:
@echo '{' > deploy/overlays/dev/edo-azure-credentials.json
@echo ' "tenantId": "${AZURE_TENANT_ID}",' >> deploy/overlays/dev/edo-azure-credentials.json
@echo ' "subscriptionId": "${AZURE_SUBSCRIPTION_ID}",' >> deploy/overlays/dev/edo-azure-credentials.json
@echo ' "resourceGroup": "${REGIONAL_RESOURCEGROUP}",' >> deploy/overlays/dev/edo-azure-credentials.json
@echo ' "useWorkloadIdentityExtension": true,' >> deploy/overlays/dev/edo-azure-credentials.json
@echo ' "userAssignedIdentityID": "${EXTERNAL_DNS_OPERATOR_MI_CLIENT_ID}"' >> deploy/overlays/dev/edo-azure-credentials.json
@echo '}' >> deploy/overlays/dev/edo-azure-credentials.json

create-edo-sa-patch:
@echo '[{"op": "add", "path": "/metadata/annotations/azure.workload.identity~1client-id", "value": "${EXTERNAL_DNS_OPERATOR_MI_CLIENT_ID}"}]' > deploy/overlays/dev/patch-serviceaccount-external-dns.json

create-domain-file:
@echo "${ZONE_NAME}" > deploy/overlays/dev/domain.txt

create-txt-owner-id-file:
@echo "${RESOURCEGROUP}" > deploy/overlays/dev/txt_owner_id.txt

deploy: create-edo-azure-creds create-edo-sa-patch create-domain-file create-txt-owner-id-file
kubectl apply --server-side --force-conflicts -k deploy/crds
kubectl apply --server-side --force-conflicts -k deploy/overlays/dev
ED_IMAGE ?= ${ARO_HCP_IMAGE_ACR}.azurecr.io/external-dns/external-dns:v0.14.2
HO_CHART_DIR = deploy/helm/charts/hypershift-operator

# run this task whenever HO_IMAGE or EDO_IMAGE is updated
# commit the changes to deploy/base to the repo since we don't have podman or docker in CI
prepare-ho-manifests:
@curl -sfLo - "https://github.com/patrickdappollonio/kubectl-slice/releases/download/v1.3.1/kubectl-slice_${shell uname -s | tr '[:upper:]' '[:lower:]'}_${shell uname -m}.tar.gz" | tar xzf - kubectl-slice
@rm deploy/base/*
curl https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml -o deploy/base/customresourcedefinition-monitoring.coreos.com_servicemonitors.yaml
curl https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_prometheusrules.yaml -o deploy/base/customresourcedefinition-monitoring.coreos.com_prometheusrules.yaml
curl https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml -o deploy/base/customresourcedefinition-monitoring.coreos.com_podmonitors.yaml
curl https://raw.githubusercontent.com/openshift/api/master/route/v1/zz_generated.crd-manifests/routes-Default.crd.yaml -o deploy/base/customresourcedefinition-routes-default.crd.yaml
# Currently the hypershift install render command prints an error out to stdout if there is no available kubeconfig
# TODO: Get a fix into the hypershift install render command so we don't have to do this
@podman run -it --rm ${HO_IMAGE} install render \
--hypershift-image ${HO_IMAGE} \
build-helm-chart:
@rm -rf ${HO_CHART_DIR}
@mkdir -p ${HO_CHART_DIR}/crds
@curl https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml -o ${HO_CHART_DIR}/crds/customresourcedefinition-monitoring.coreos.com_servicemonitors.yaml
@curl https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_prometheusrules.yaml -o ${HO_CHART_DIR}/crds/customresourcedefinition-monitoring.coreos.com_prometheusrules.yaml
@curl https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml -o ${HO_CHART_DIR}/crds/customresourcedefinition-monitoring.coreos.com_podmonitors.yaml
@curl https://raw.githubusercontent.com/openshift/api/master/route/v1/zz_generated.crd-manifests/routes-Default.crd.yaml -o ${HO_CHART_DIR}/crds/customresourcedefinition-routes-default.crd.yaml
@podman run -it --rm ${HO_IMAGE} install helm \
--enable-conversion-webhook=false \
--external-dns-provider azure \
--external-dns-secret external-dns-azure \
--external-dns-domain-filter \$$\(DOMAIN\) \
--external-dns-image ${EDO_IMAGE} \
--external-dns-txt-owner-id \$$\(TXT_OWNER_ID\) \
--managed-service ARO-HCP \
| tail -n +2 \
| ./kubectl-slice -f - -o deploy/base
@rm deploy/crds/*
@mkdir -p deploy/crds
@mv deploy/base/customresourcedefinition*.yaml deploy/crds

@echo "apiVersion: kustomize.config.k8s.io/v1beta1" > deploy/crds/kustomization.yml
@echo "kind: Kustomization" >> deploy/crds/kustomization.yml
@echo "resources:" >> deploy/crds/kustomization.yml
@find deploy/crds -type f -name "customresourcedefinition*.yaml" ! -name "kustomization.yml" | sed 's/^deploy\/crds\// - /' >> deploy/crds/kustomization.yml

@echo "apiVersion: kustomize.config.k8s.io/v1beta1" > deploy/base/kustomization.yml
@echo "kind: Kustomization" >> deploy/base/kustomization.yml
@echo "resources:" >> deploy/base/kustomization.yml
@find deploy/base -type f -name "*.yaml" ! -name "kustomization.yml" | sed 's/^deploy\/base\// - /' >> deploy/base/kustomization.yml

.PHONY: create-edo-azure-creds create-edo-sa-patch create-domain-file create-txt-owner-id-file deploy unpack-ho-manifests
--pull-secret pull-secret.json \
--output-dir=${HO_CHART_DIR}

deploy:
helm upgrade --install hypershift deploy/helm \
--create-namespace --namespace hypershift \
--set hypershift-operator.image=${HO_IMAGE} \
--set hypershift-operator.registryOverrides="quay.io/openshift-release-dev/ocp-v4.0-art-dev=${ARO_HCP_IMAGE_ACR}.azurecr.io/openshift/release\,quay.io/openshift-release-dev/ocp-release=${ARO_HCP_IMAGE_ACR}.azurecr.io/openshift/release-images\,${ARO_HCP_IMAGE_ACR}.redhat.io/redhat=arohcpdev.azurecr.io/redhat" \
--set external-dns.image=${ED_IMAGE} \
--set external-dns.txtOwnerId=${RESOURCEGROUP} \
--set external-dns.domain=${ZONE_NAME} \
--set external-dns.credentials.tenantId=${AZURE_TENANT_ID} \
--set external-dns.credentials.subscriptionId=${AZURE_SUBSCRIPTION_ID} \
--set external-dns.credentials.resourceGroup=${REGIONAL_RESOURCEGROUP} \
--set external-dns.credentials.userAssignedIdentityID=${EXTERNAL_DNS_OPERATOR_MI_CLIENT_ID}

.PHONY: build-helm-chart create-edo-azure-creds create-edo-sa-patch create-domain-file create-txt-owner-id-file deploy unpack-ho-manifests
2 changes: 1 addition & 1 deletion hypershiftoperator/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# HyperShift Operator

To promote HyperShift Operator, increment the `HO_IMAGE` variable in the Makefile, then run `make prepare-ho-manifests` to generate the corresponding manifests for that image.
To promote HyperShift Operator, increment the `HO_IMAGE` variable in the Makefile, then run `make build-helm-chart` to generate the corresponding manifests for that image.
26 changes: 0 additions & 26 deletions hypershiftoperator/deploy/base/kustomization.yml

This file was deleted.

10 changes: 0 additions & 10 deletions hypershiftoperator/deploy/base/namespace-hypershift.yaml

This file was deleted.

This file was deleted.

66 changes: 0 additions & 66 deletions hypershiftoperator/deploy/crds/kustomization.yml

This file was deleted.

11 changes: 11 additions & 0 deletions hypershiftoperator/deploy/helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v2
description: A Helm chart to install the Hypershift Operator and deps for ARO
name: aor-hcp-hypershift-operator
type: application
version: 0.1.0

dependencies:
- name: "hypershift-operator"
version: "0.1.0"
- name: "external-dns"
version: "0.14.2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v2
description: A Helm chart for External DNS
name: external-dns
type: application
version: 0.14.2
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: external-dns
rules:
- apiGroups:
- route.openshift.io
resources:
- '*'
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- endpoints
- services
- nodes
- pods
verbs:
- get
- list
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: external-dns
rules:
- apiGroups:
- route.openshift.io
resources:
- '*'
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- endpoints
- services
- nodes
- pods
verbs:
- get
- list
- watch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: null
name: external-dns
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: external-dns
subjects:
- kind: ServiceAccount
name: external-dns
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: null
name: external-dns
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: external-dns
subjects:
- kind: ServiceAccount
name: external-dns
namespace: hypershift
Loading