Skip to content

Commit

Permalink
fixup! fix: Add contribution documenation to project
Browse files Browse the repository at this point in the history
Signed-off-by: Mateus Oliveira <[email protected]>
  • Loading branch information
mateusoliveira43 committed Mar 26, 2024
1 parent 41f27b0 commit 11fc185
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/oadp-compatibility-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ jobs:
- name: Check Non Admin Controller (NAC) manifests
run: |
NON_ADMIN_CONTROLLER_PATH=./oadp-non-admin make update-non-admin-manifests
test -z "$(git status --short)" || (echo "run 'make update-non-admin-manifests' in OADP repository to update Non Admin Controller (NAC) manifests" && exit 1)
test -z "$(git status --short -- ':!oadp-non-admin')" || (echo "run 'make update-non-admin-manifests' in OADP repository to update Non Admin Controller (NAC) manifests" && exit 1)
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ help: ## Display this help.

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) rbac:roleName=non-admin-controller-manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
Expand Down
4 changes: 2 additions & 2 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Adds namespace to all resources.
namespace: oadp-nac-system
namespace: openshift-adp-system

# Value of this field is prepended to the
# names of all resources, e.g. a deployment named
# "wordpress" becomes "alices-wordpress".
# Note that it should also match with the prefix (text before '-') of the namespace
# field above.
namePrefix: oadp-nac-
namePrefix: openshift-adp-

# Labels to add to all resources and selectors.
#labels:
Expand Down
4 changes: 2 additions & 2 deletions config/default/manager_oadp_patch.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
name: non-admin-controller-manager
namespace: system
spec:
template:
metadata:
annotations:
spec:
containers:
- name: manager
- name: non-admin-manager
imagePullPolicy: Always
args:
command:
Expand Down
27 changes: 15 additions & 12 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,42 @@ apiVersion: v1
kind: Namespace
metadata:
labels:
control-plane: controller-manager
control-plane: non-admin-controller-manager
app.kubernetes.io/name: namespace
app.kubernetes.io/instance: system
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: oadp-nac
app.kubernetes.io/part-of: oadp-nac
app.kubernetes.io/created-by: oadp-operator
app.kubernetes.io/part-of: oadp-operator
app.kubernetes.io/managed-by: kustomize
name: system
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
name: non-admin-controller-manager
namespace: system
labels:
control-plane: controller-manager
control-plane: non-admin-controller-manager
app.kubernetes.io/name: deployment
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/instance: non-admin-controller-manager
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: oadp-nac
app.kubernetes.io/part-of: oadp-nac
app.kubernetes.io/created-by: oadp-operator
app.kubernetes.io/part-of: oadp-operator
app.kubernetes.io/managed-by: kustomize
component: non-admin-controller
spec:
selector:
matchLabels:
control-plane: controller-manager
control-plane: non-admin-controller-manager
component: non-admin-controller
replicas: 1
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
labels:
control-plane: controller-manager
control-plane: non-admin-controller-manager
component: non-admin-controller
spec:
# TODO(user): Uncomment the following code to configure the nodeAffinity expression
# according to the platforms which are supported by your solution.
Expand Down Expand Up @@ -71,7 +74,7 @@ spec:
args:
- --leader-elect
image: controller:latest
name: manager
name: non-admin-manager
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand All @@ -98,5 +101,5 @@ spec:
requests:
cpu: 10m
memory: 64Mi
serviceAccountName: controller-manager
serviceAccountName: non-admin-controller-manager
terminationGracePeriodSeconds: 10
8 changes: 6 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## OADP integration

Normally, to ship a controller to users, the project would present the file created by `make build-installer` command (which contains Namespace, ServiceAccount, Deployment, etc, objects), to user to install the controller. But since NAC needs OADP operator to properly work, those Kubernetes objects are shipped within OADP operator.
Normally, to ship a controller to users, the project would present the file created by `make build-installer` command (which include various Kubernetes objects, like Namespace, ServiceAccount, Deployment, etc), to user to install the controller. But since NAC needs OADP operator to properly work, those Kubernetes objects are shipped within OADP operator (and also Kubernetes objects in `config/samples/` folder). Because of this restriction, generated Kubernetes objects names and labels in `config/` folder, may need to be updated to match OADP operator standards (and avoid duplications).

Because of this restriction, generated Kubernetes object names and labels in `config` folder, may need to be updated to match OADP operator standards.
> **NOTE:** If needed, you can test NAC alone by running `make build-installer` and `oc apply -f ./dist/install.yaml`. You may want to customize namespace and container image in that file prior to deploying it to your cluster.
NAC objects are included in OADP operator through `make update-non-admin-manifests` command, which is run in OADP operator repository. To run the command:
- switch to OADP operator repository branch you want to update
Expand All @@ -18,6 +18,10 @@ NAC objects are included in OADP operator through `make update-non-admin-manifes
```
- create pull request targeting OADP operator repository branch you want to update

> **NOTE:** To `make update-non-admin-manifests` command properly work, `RELATED_IMAGE_NON_ADMIN_CONTROLLER` must be already set in `config/manager/manager.yaml` file of OADP operator repository branch.

> **NOTE:** `make update-non-admin-manifests` command does not work for deletion, i.e., if a file that was previously managed by the command is deleted (or renamed), it needs to be manually deleted.

The continuos integration (CI) pipeline of the project verifies if OADP operator repository compatible branches have up to date NAC objects included. OADP version compatibility check configuration in [`.github/workflows/oadp-compatibility-check.yml`](../.github/workflows/oadp-compatibility-check.yml) file.

## Kubebuilder
Expand Down

0 comments on commit 11fc185

Please sign in to comment.