-
Notifications
You must be signed in to change notification settings - Fork 80
Use helm for pko #1073
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
Use helm for pko #1073
Changes from all commits
36b9640
4c0452a
cc6cb46
01ec5cd
dcb7eff
8094b0b
44660a3
575c0c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,3 +157,30 @@ | |
run: | | ||
cd tooling/image-sync | ||
make push | ||
|
||
build_push_package_operator: | ||
permissions: | ||
id-token: 'write' | ||
contents: 'read' | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: "install azure-cli" | ||
if: inputs.push == true | ||
uses: "Azure/ARO-HCP@main" | ||
|
||
- name: 'Az CLI login' | ||
if: inputs.push == true | ||
uses: azure/login@v2 | ||
with: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
|
||
- name: Build package operator container image from [email protected]:package-operator/package-operator.git | ||
run: | | ||
cd pko | ||
make image |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,37 @@ | ||
SHELL = /bin/bash | ||
-include ../setup-env.mk | ||
-include ../helm-cmd.mk | ||
HELM_CMD ?= helm upgrade --install | ||
|
||
NAMESPACE ?= package-operator-system | ||
ARO_HCP_IMAGE_REGISTRY ?= ${ARO_HCP_IMAGE_ACR}.azurecr.io | ||
ARO_HCP_IMAGE_REPOSITORY ?= package-operator/package-operator-package | ||
|
||
deploy: | ||
kubectl apply -f https://github.com/package-operator/package-operator/releases/download/v1.15.0/self-bootstrap-job.yaml | ||
@kubectl create namespace ${NAMESPACE} --dry-run=client -o json | kubectl apply -f - | ||
IMAGE_PULLER_MI_CLIENT_ID=$$(az identity show \ | ||
-g ${RESOURCEGROUP} \ | ||
-n image-puller \ | ||
--query clientId -o tsv) && \ | ||
IMAGE_PULLER_MI_TENANT_ID=$$(az identity show \ | ||
-g ${RESOURCEGROUP} \ | ||
-n image-puller \ | ||
--query tenantId -o tsv) && \ | ||
${HELM_CMD} package-operator ./helm \ | ||
--namespace ${NAMESPACE} \ | ||
--set pkoImage=${PKO_IMAGE} \ | ||
--set pkoImageManager=${PKO_IMAGE_MANAGER} \ | ||
--set pkoImageTag=${PKO_IMAGE_TAG} \ | ||
--set pullBinding.workloadIdentityClientId="$${IMAGE_PULLER_MI_CLIENT_ID}" \ | ||
--set pullBinding.workloadIdentityTenantId="$${IMAGE_PULLER_MI_TENANT_ID}" \ | ||
--set pullBinding.registry=${ARO_HCP_IMAGE_REGISTRY} \ | ||
--set pullBinding.scope='repository:*:pull' | ||
|
||
image: | ||
az acr login --name ${ARO_HCP_IMAGE_ACR} && \ | ||
cd $$(mktemp -d) && \ | ||
git clone https://github.com/package-operator/package-operator.git && \ | ||
cd package-operator && \ | ||
git checkout ${PKO_IMAGE_TAG} && \ | ||
IMAGE_REGISTRY=${ARO_HCP_IMAGE_REGISTRY}/package-operator ./do ci:release | ||
|
||
.PHONY: deploy |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v2 | ||
name: package-operator | ||
description: A Helm chart for package-operator | ||
type: application | ||
|
||
version: 0.1.0 | ||
appVersion: "1.0.0" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: acrpull.microsoft.com/v1beta2 | ||
kind: AcrPullBinding | ||
metadata: | ||
name: pull-binding | ||
spec: | ||
acr: | ||
environment: PublicCloud | ||
server: {{ .Values.pullBinding.registry }} | ||
scope: {{ .Values.pullBinding.scope }} | ||
auth: | ||
workloadIdentity: | ||
serviceAccountRef: package-operator | ||
clientID: {{ .Values.pullBinding.workloadIdentityClientId }} | ||
tenantID: {{ .Values.pullBinding.workloadIdentityTenantId }} | ||
serviceAccountName: package-operator |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: package-operator | ||
labels: | ||
package-operator.run/cache: "True" | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: cluster-admin | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a more fine grained role we could use? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used the same role used by the PKO team: https://github.com/package-operator/package-operator/blob/f564bbba288a9e3748c871c0eaec329de2ec4cd2/config/self-bootstrap-job.yaml.tpl#L16 So I'll have to ask, if we can reduce the access. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think it also comes down to what packages this PKO instance will manage. as we develop a feeling about what kind of resources RVMO will bring in, we could narrow the role towards that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, cause the service account assigned to is used by the operator during runtime. |
||
subjects: | ||
- kind: ServiceAccount | ||
name: package-operator | ||
namespace: package-operator-system |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: package-operator-bootstrap | ||
namespace: package-operator-system | ||
spec: | ||
# delete right after completion | ||
ttlSecondsAfterFinished: 0 | ||
# set deadline to 30min | ||
activeDeadlineSeconds: 1800 | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
serviceAccountName: package-operator | ||
containers: | ||
- name: package-operator | ||
image: "{{ .Values.pkoImageManager }}:{{ .Values.pkoImageTag }}" | ||
args: ["-self-bootstrap={{ .Values.pkoImage }}:{{ .Values.pkoImageTag }}"] | ||
imagePullPolicy: Always | ||
env: | ||
- name: PKO_REGISTRY_HOST_OVERRIDES | ||
value: '' | ||
- name: PKO_CONFIG | ||
value: '' | ||
- name: PKO_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: PKO_SERVICE_ACCOUNT_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: PKO_SERVICE_ACCOUNT_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: spec.serviceAccountName | ||
backoffLimit: 3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: package-operator | ||
namespace: package-operator-system | ||
labels: | ||
package-operator.run/cache: "True" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pkoImage: "" | ||
pkoImageManager: "" | ||
pkoImageTag: "" | ||
pullBinding: | ||
registry: "" | ||
scope: "" | ||
workloadIdentityClientId: "" | ||
workloadIdentityTenantId: "" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
$schema: "pipeline.schema.v1" | ||
serviceGroup: Microsoft.Azure.ARO.HCP.RP.PKO | ||
rolloutName: RP PKO Rollout | ||
resourceGroups: | ||
- name: {{ .mgmt.rg }} | ||
subscription: {{ .svc.subscription }} | ||
aksCluster: {{ .aksName }} | ||
steps: | ||
- name: deploy | ||
action: Shell | ||
command: make deploy | ||
dryRun: | ||
variables: | ||
- name: DRY_RUN | ||
value: "true" | ||
variables: | ||
- name: ARO_HCP_IMAGE_ACR | ||
configRef: svcAcrName | ||
- name: PKO_IMAGE | ||
configRef: pko.image | ||
- name: PKO_IMAGE_MANAGER | ||
configRef: pko.imageManager | ||
- name: PKO_IMAGE_TAG | ||
configRef: pko.imageTag | ||
- name: RESOURCEGROUP | ||
configRef: mgmt.rg |
Uh oh!
There was an error while loading. Please reload this page.