Skip to content

Commit

Permalink
addressed code review comments
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Kostecki <[email protected]>
Co-authored-by: Sagar Arora <[email protected]>
Co-authored-by: Vishwanath Jayaraman <[email protected]>
  • Loading branch information
3 people committed Feb 9, 2025
1 parent e0f33e9 commit e7351b8
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 34 deletions.
2 changes: 1 addition & 1 deletion operators/o2ims-operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###########################################################################
# Copyright 2022-2025 The Nephio Authors.
# Copyright 2025 The Nephio Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion operators/o2ims-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ kind load docker-image o2ims:latest -n mgmt
Deploy the O2 IMS operator:

```bash
kubectl -f tests/deployment/operator.yaml
kubectl create -f tests/deployment/operator.yaml
```

### To Start the Operator:
Expand Down
2 changes: 1 addition & 1 deletion operators/o2ims-operator/controllers/manager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###########################################################################
# Copyright 2022-2025 The Nephio Authors.
# Copyright 2025 The Nephio Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###########################################################################
# Copyright 2022-2025 The Nephio Authors.
# Copyright 2025 The Nephio Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -70,7 +70,7 @@ def cluster_creation_request(
"""

# Git repository location
repo_location = GIT_REPOSITORY
repo_location = UPSTREAM_PKG_REPO
# Add validation for clusterName
cluster_name = params["clusterName"]
params.pop("clusterName")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###########################################################################
# Copyright 2022-2025 The Nephio Authors.
# Copyright 2025 The Nephio Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,8 +14,6 @@
# limitations under the License.
##########################################################################

from utils import *


def validate_cluster_creation_request(params: dict = None):
"""
Expand Down
4 changes: 2 additions & 2 deletions operators/o2ims-operator/controllers/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###########################################################################
# Copyright 2022-2025 The Nephio Authors.
# Copyright 2025 The Nephio Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,7 +35,7 @@
TOKEN = os.getenv("TOKEN", "/var/run/secrets/kubernetes.io/serviceaccount/token")
TOKEN = os.popen(f"cat {TOKEN}").read()
KUBERNETES_BASE_URL = str(os.getenv("KUBERNETES_BASE_URL", "http://127.0.0.1:8080"))
GIT_REPOSITORY = os.getenv("GIT_REPOSITORY", "catalog-infra-capi")
UPSTREAM_PKG_REPO = os.getenv("UPSTREAM_PKG_REPO", "catalog-infra-capi")


def create_package_variant(
Expand Down
29 changes: 15 additions & 14 deletions operators/o2ims-operator/tests/create-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
set -eo pipefail
NEPHIO_TAG=main #v3.0.0
kpt_dir=/tmp
CATALOG_REPO=https://github.com/nephio-project/catalog.git

# Create a kpt package
create_kpt_package() {
Expand All @@ -21,29 +22,29 @@ kind create cluster --config="$(dirname "$0")"/mgmt-cluster.yaml --wait 5m
kubectl cluster-info --context kind-mgmt

# Gitea
create_kpt_package https://github.com/nephio-project/catalog.git/distros/sandbox/gitea@origin gitea
create_kpt_package $CATALOG_REPO/distros/sandbox/gitea@origin gitea
# Porch
create_kpt_package https://github.com/nephio-project/catalog/nephio/core/porch@origin porch
create_kpt_package $CATALOG_REPO/nephio/core/porch@origin porch
# MetalLB
create_kpt_package https://github.com/nephio-project/catalog.git/distros/sandbox/metallb@origin metallb
create_kpt_package $CATALOG_REPO/distros/sandbox/metallb@origin metallb
# MetalLB Configuration
create_kpt_package https://github.com/nephio-project/catalog.git/distros/sandbox/metallb-sandbox-config@origin metallb-sandbox-config
create_kpt_package $CATALOG_REPO/distros/sandbox/metallb-sandbox-config@origin metallb-sandbox-config
# Gitea IP Address
kubectl get svc -n gitea gitea
# Cluster Provisioning Cert Manager
create_kpt_package https://github.com/nephio-project/catalog.git/distros/sandbox/cert-manager@origin cert-manager
create_kpt_package $CATALOG_REPO/distros/sandbox/cert-manager@origin cert-manager
# CAPI
create_kpt_package https://github.com/nephio-project/catalog.git/infra/capi/cluster-capi@origin cluster-capi
create_kpt_package $CATALOG_REPO/infra/capi/cluster-capi@origin cluster-capi
# CAPI Infra
create_kpt_package https://github.com/nephio-project/catalog.git/infra/capi/cluster-capi-infrastructure-docker@origin cluster-capi-infrastructure-docker
create_kpt_package $CATALOG_REPO/infra/capi/cluster-capi-infrastructure-docker@origin cluster-capi-infrastructure-docker
# CAPI Cluster Templates
create_kpt_package https://github.com/nephio-project/catalog.git/infra/capi/cluster-capi-kind-docker-templates@origin cluster-capi-kind-docker-templates
create_kpt_package $CATALOG_REPO/infra/capi/cluster-capi-kind-docker-templates@origin cluster-capi-kind-docker-templates
# ConfigSync
create_kpt_package https://github.com/nephio-project/catalog.git/nephio/core/configsync@origin configsync
create_kpt_package $CATALOG_REPO/nephio/core/configsync@origin configsync
# Resource Backend Operator
create_kpt_package https://github.com/nephio-project/catalog.git/nephio/optional/resource-backend@origin resource-backend
create_kpt_package $CATALOG_REPO/nephio/optional/resource-backend@origin resource-backend
# Nephio Core Opertaor
create_kpt_package https://github.com/nephio-project/catalog.git/nephio/core/nephio-operator@origin nephio-operator
create_kpt_package $CATALOG_REPO/nephio/core/nephio-operator@origin nephio-operator

# Create Gitea secret
kubectl apply -f - <<EOF
Expand All @@ -59,19 +60,19 @@ stringData:
EOF

# Gitea Repository for Management Cluster
create_kpt_package https://github.com/nephio-project/catalog.git/distros/sandbox/repository@origin mgmt
create_kpt_package $CATALOG_REPO/distros/sandbox/repository@origin mgmt

# RootSync Object (special case)
rm -rf $kpt_dir/rootsync
kpt pkg get --for-deployment https://github.com/nephio-project/catalog.git/nephio/optional/rootsync@origin/$NEPHIO_TAG $kpt_dir/rootsync
kpt pkg get --for-deployment $CATALOG_REPO/nephio/optional/rootsync@origin/$NEPHIO_TAG $kpt_dir/rootsync
kpt fn eval --image "gcr.io/kpt-fn/search-replace:v0.2" $kpt_dir/rootsync/package-context.yaml -- 'by-path=data.name' "put-value=mgmt"
kpt fn render $kpt_dir/rootsync
kpt live init $kpt_dir/rootsync
kpt live apply $kpt_dir/rootsync --reconcile-timeout=15m --output=table
rm -rf $kpt_dir/rootsync

# Stock Repositories
create_kpt_package https://github.com/nephio-project/catalog.git/nephio/optional/stock-repos@origin stock-repos
create_kpt_package $CATALOG_REPO/nephio/optional/stock-repos@origin stock-repos

# Check Token for SA
kubectl create -f "$(dirname "$0")"/sa-test-pod.yaml
Expand Down
10 changes: 2 additions & 8 deletions operators/o2ims-operator/tests/deployment/operator.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###########################################################################
# Copyright 2022-2025 The Nephio Authors.
# Copyright 2025 The Nephio Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -99,7 +99,7 @@ spec:
# command: ["sleep","10000"]
imagePullPolicy: IfNotPresent
env:
- name: 'GIT_REPOSITORY'
- name: 'UPSTREAM_PKG_REPO'
value: 'catalog-infra-capi'
- name: 'KUBERNETES_BASE_URL'
value: 'https://kubernetes.default.svc'
Expand All @@ -110,12 +110,6 @@ spec:
limits:
memory: "256Mi"
cpu: "100m"
# livenessProbe:
# httpGet:
# path: /healthz
# port: 8080
# initialDelaySeconds: 2
# periodSeconds: 5
dnsPolicy: ClusterFirst
restartPolicy: Always
serviceAccountName: o2ims-operator
Expand Down
2 changes: 1 addition & 1 deletion operators/o2ims-operator/tests/mgmt-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ networking:
serviceSubnet: "10.97.0.0/16"
nodes:
- role: control-plane
image: kindest/node:v1.27.1
image: kindest/node:v1.31.0
extraMounts:
- hostPath: /var/run/docker.sock
containerPath: /var/run/docker.sock
2 changes: 1 addition & 1 deletion operators/o2ims-operator/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###########################################################################
# Copyright 2022-2025 The Nephio Authors.
# Copyright 2025 The Nephio Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down

0 comments on commit e7351b8

Please sign in to comment.