Skip to content

Commit

Permalink
chore: change namespace to hns-system instead of sns-system
Browse files Browse the repository at this point in the history
Signed-off-by: mzeevi <meytar80@gmail.com>
  • Loading branch information
mzeevi committed Sep 24, 2024
1 parent 5e75dd6 commit 8b42b89
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ jobs:
run: make test-e2e

- name: Undeploy HNS
run: make undeploy
run: make undeploy
if: always()
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ dev: manifests kustomize
$(KUSTOMIZE) build config/dev | oc apply -f -
mkdir -p $(LOCAL_CERT_DIR)
sleep 3
kubectl get secret webhook-server-cert -n sns-system -o jsonpath="{.data.tls\.crt}" | base64 --decode > $(LOCAL_CERT_DIR)/tls.crt
kubectl get secret webhook-server-cert -n sns-system -o jsonpath="{.data.tls\.key}" | base64 --decode > $(LOCAL_CERT_DIR)/tls.key
kubectl get secret webhook-server-cert -n hns-system -o jsonpath="{.data.tls\.crt}" | base64 --decode > $(LOCAL_CERT_DIR)/tls.crt
kubectl get secret webhook-server-cert -n hns-system -o jsonpath="{.data.tls\.key}" | base64 --decode > $(LOCAL_CERT_DIR)/tls.key

.PHONY: undev
undev: manifests kustomize
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ In order to use `HNS`, you need to have:

## Install with Helm

Helm chart docs are available on `charts/hns` directory. The release name must be `sns`:
Helm chart docs are available on `charts/hns` directory.

```bash
$ helm upgrade sns --install --namespace sns-system --create-namespace oci://ghcr.io/dana-team/helm-charts/hns --version <release>
$ helm upgrade hns --install --namespace hns-system --create-namespace oci://ghcr.io/dana-team/helm-charts/hns --version <release>
```

### Build
Expand Down
4 changes: 2 additions & 2 deletions api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ type Phase string
const MetaGroup = "dana.hns.io/"

const (
SNSNamespace = "sns-system"
SNSServiceAccount = "sns-controller-manager"
SNSNamespace = "hns-system"
SNSServiceAccount = "hns-controller-manager"
)

var DefaultAnnotations = []string{"scheduler.alpha.kubernetes.io/defaultTolerations", "openshift.io/node-selector"}
Expand Down
2 changes: 1 addition & 1 deletion charts/hns/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: sns
name: hns
description: A Helm chart for the hns operator.

# A chart can be either an 'application' or a 'library' chart.
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: sns-system
namespace: hns-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: sns-
namePrefix: hns-

# Labels to add to all resources and selectors.
#labels:
Expand Down
4 changes: 2 additions & 2 deletions config/dev/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Adds namespace to all resources.
namespace: sns-system
namespace: hns-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: sns-
namePrefix: hns-

# Labels to add to all resources and selectors.
#labels:
Expand Down
1 change: 0 additions & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ configMapGenerator:
- literals:
- resources="basic.storageclass.storage.k8s.io/requests.storage,cpu,memory,pods,requests.nvidia.com/gpu"
name: quota-resources
namespace: sns-system
options:
disableNameSuffixHash: true
7 changes: 4 additions & 3 deletions internal/quota/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"
"fmt"

danav1 "github.com/dana-team/hns/api/v1"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/types"
Expand All @@ -26,14 +28,13 @@ type resourceQuantities struct {
}

const (
namespaceName = "sns-system"
configMapName = "sns-config"
configMapName = "hns-config"
)

// getConfigMapData retrieves the ConfigMap data from the cluster.
func getConfigMapData(ctx context.Context, k8sClient client.Client, key string) (string, error) {
cm := &corev1.ConfigMap{}
err := k8sClient.Get(ctx, types.NamespacedName{Name: configMapName, Namespace: namespaceName}, cm)
err := k8sClient.Get(ctx, types.NamespacedName{Name: configMapName, Namespace: danav1.SNSNamespace}, cm)
if err != nil {
return "", err
}
Expand Down
6 changes: 4 additions & 2 deletions internal/quota/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"fmt"
"strings"

danav1 "github.com/dana-team/hns/api/v1"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -32,7 +34,7 @@ var (
imagestreams = resource.NewQuantity(100, resource.DecimalSI)
ZeroDecimal = resource.NewQuantity(0, resource.DecimalSI)

quotaConfig = "sns-quota-resources"
quotaConfig = "hns-quota-resources"

DefaultQuota = corev1.ResourceQuotaSpec{Hard: DefaultQuotaHard}

Expand All @@ -46,7 +48,7 @@ var (
// The observed resources are read from a configMap.
func GetObservedResources(ctx context.Context, k8sClient client.Client) (corev1.ResourceQuotaSpec, error) {
resourcesConfig := &corev1.ConfigMap{}
if err := k8sClient.Get(ctx, types.NamespacedName{Name: quotaConfig, Namespace: namespaceName}, resourcesConfig); err != nil {
if err := k8sClient.Get(ctx, types.NamespacedName{Name: quotaConfig, Namespace: danav1.SNSNamespace}, resourcesConfig); err != nil {
return corev1.ResourceQuotaSpec{}, fmt.Errorf("failed to get ConfigMap %q: %v", resourcesConfig, err)
}

Expand Down

0 comments on commit 8b42b89

Please sign in to comment.