-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update operatorhub bundle generation (#1410)
* Updated template ClusterServiceVersion with values from repo From upstream-community-operators. * Remove deployments field from template It'll be filled in by the kustomize output anyway. * Add new CRDs to ClusterServiceVersion template This shouldn't need to be done, but without them in the CSV yaml the descriptions aren't available. I haven't yet been able to find a different way of providing the descriptions - doc comments on the types go into the OpenAPI schema rather than being attached to the CRD directly. * Use a different service account in the operator bundle deployment We can't rely on the default service account because OLM deploys the operator in the `operators` namespace alongside other operators. Make sure that the service account used on the role bindings is also updated. * Rename bundle dir and CSV so it can be dropped into community-operators
- Loading branch information
1 parent
0c94d5a
commit 21c38a7
Showing
8 changed files
with
273 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
298 changes: 193 additions & 105 deletions
298
...rvice-operator.clusterserviceversion.yaml → ...rvice-operator.clusterserviceversion.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
resources: | ||
- ../default | ||
- ../samples | ||
|
||
patches: | ||
- patches/serviceaccountname_in_deployment.yaml | ||
- patches/serviceaccountname_in_rolebindings.yaml |
12 changes: 12 additions & 0 deletions
12
config/operator-bundle/patches/serviceaccountname_in_deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This sets the controller-manager deployment to use a non-default | ||
# service account on its pods, since installing the operator with OLM | ||
# puts it into the `operators` namespace alongside other operators. | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: azureoperator-controller-manager | ||
namespace: azureoperator-system | ||
spec: | ||
template: | ||
spec: | ||
serviceAccountName: azure-service-operator |
31 changes: 31 additions & 0 deletions
31
config/operator-bundle/patches/serviceaccountname_in_rolebindings.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This updates the different rolebindings to refer to the | ||
# azure-service-operator service account on its pods, since installing | ||
# the operator with OLM puts it into the `operators` namespace | ||
# alongside other operators. | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: azureoperator-leader-election-rolebinding | ||
namespace: azureoperator-system | ||
subjects: | ||
- kind: ServiceAccount | ||
name: azure-service-operator | ||
namespace: azureoperator-system | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: azureoperator-manager-rolebinding | ||
subjects: | ||
- kind: ServiceAccount | ||
name: azure-service-operator | ||
namespace: azureoperator-system | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: azureoperator-proxy-rolebinding | ||
subjects: | ||
- kind: ServiceAccount | ||
name: azure-service-operator | ||
namespace: azureoperator-system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
container_reference="$1" | ||
now="$(date --rfc-3339=seconds)" | ||
cluster_version_file="bundle/manifests/azure-service-operator.clusterserviceversion.yaml" | ||
|
||
# Replace the controller:latest reference in the deployment (embedded | ||
# in the CSV) with the SHA one. | ||
sed -i "s!controller:latest!${container_reference}!g" $cluster_version_file | ||
|
||
# Insert containerImage and createdAt into metadata.annotations. | ||
yq eval -i ".metadata.annotations.containerImage = \"${container_reference}\" | .metadata.annotations.createdAt = \"${now}\"" $cluster_version_file |