Skip to content

Commit

Permalink
Rename namespace to directpv (#683)
Browse files Browse the repository at this point in the history
Signed-off-by: Bala.FA <bala@minio.io>
  • Loading branch information
balamurugana committed Dec 19, 2022
1 parent 5bc8801 commit 37b6103
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 146 deletions.
14 changes: 7 additions & 7 deletions functests/common.sh
Expand Up @@ -70,11 +70,11 @@ function remove_luks() {
# wait_for_service <service>
function wait_for_service() {
service="$1"
endpoints=$(kubectl get endpoints -n directpv-min-io "${service}" --no-headers | awk '{ print $2 }')
endpoints=$(kubectl get endpoints -n directpv "${service}" --no-headers | awk '{ print $2 }')
while [[ $endpoints == '<none>' ]]; do
echo "$ME: waiting for ${service} available"
sleep 5
endpoints=$(kubectl get endpoints -n directpv-min-io "${service}" --no-headers | awk '{ print $2 }')
endpoints=$(kubectl get endpoints -n directpv "${service}" --no-headers | awk '{ print $2 }')
done
}

Expand All @@ -87,7 +87,7 @@ function install_directpv() {
while [[ $running_count -lt $required_count ]]; do
echo "$ME: waiting for $(( required_count - running_count )) DirectPV pods to come up"
sleep $(( required_count - running_count ))
running_count=$(kubectl get pods --field-selector=status.phase=Running --no-headers --namespace=directpv-min-io | wc -l)
running_count=$(kubectl get pods --field-selector=status.phase=Running --no-headers --namespace=directpv | wc -l)
done

while ! "${DIRECTPV_CLIENT}" info --quiet; do
Expand All @@ -108,11 +108,11 @@ function uninstall_directpv() {
while [[ $pending -gt 0 ]]; do
echo "$ME: waiting for ${pending} DirectPV pods to go down"
sleep "${pending}"
pending=$(kubectl get pods --field-selector=status.phase=Running --no-headers --namespace=directpv-min-io | wc -l)
pending=$(kubectl get pods --field-selector=status.phase=Running --no-headers --namespace=directpv | wc -l)
done

while kubectl get namespace directpv-min-io --no-headers | grep -q .; do
echo "$ME: waiting for directpv-min-io namespace to be removed"
while kubectl get namespace directpv --no-headers | grep -q .; do
echo "$ME: waiting for directpv namespace to be removed"
sleep 5
done

Expand All @@ -135,7 +135,7 @@ function check_drives_status() {
}

function add_drives() {
url=$(minikube service --namespace=directpv-min-io admin-service --url)
url=$(minikube service --namespace=directpv admin-service --url)
admin_server=${url#"http://"}

config_file="$(mktemp)"
Expand Down
15 changes: 14 additions & 1 deletion functests/minio.yaml
@@ -1,3 +1,16 @@
kind: Service
apiVersion: v1
metadata:
name: minio
labels:
app: minio
spec:
selector:
app: minio
ports:
- name: minio
port: 9000
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
Expand Down Expand Up @@ -37,7 +50,7 @@ spec:
mountPath: /data4
args:
- "server"
- "http://minio-{0...3}.minio.default.svc:9000/data{1...4}"
- "http://minio-{0...3}.minio.default.svc.cluster.local:9000/data{1...4}"
volumeClaimTemplates: # This is the specification in which you reference the StorageClass
- metadata:
name: minio-data-1
Expand Down
88 changes: 0 additions & 88 deletions minio.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/admin/cred.go
Expand Up @@ -74,7 +74,7 @@ func getCredentialFromConfig(configFile string) (*Credential, error) {
}

func getCredentialFromSecrets(ctx context.Context) (*Credential, error) {
secrets, err := k8s.KubeClient().CoreV1().Secrets(consts.Namespace).Get(ctx, consts.CredentialsSecretName, metav1.GetOptions{})
secrets, err := k8s.KubeClient().CoreV1().Secrets(consts.AppName).Get(ctx, consts.CredentialsSecretName, metav1.GetOptions{})
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/admin/rpc.go
Expand Up @@ -330,7 +330,7 @@ func newRPCServer() *rpcServer {
}

func (server *rpcServer) getNodeClients() (map[string]*nodeClient, error) {
endpoints, err := k8s.KubeClient().CoreV1().Endpoints(consts.Namespace).Get(context.Background(), consts.NodeAPIServerHLSVC, metav1.GetOptions{})
endpoints, err := k8s.KubeClient().CoreV1().Endpoints(consts.AppName).Get(context.Background(), consts.NodeAPIServerHLSVC, metav1.GetOptions{})
if err != nil {
return nil, err
}
Expand Down
3 changes: 0 additions & 3 deletions pkg/consts/consts.go
Expand Up @@ -37,9 +37,6 @@ const (
// Identity denotes identity value.
Identity = AppName + "-min-io"

// Namespace denotes the namespace where the app is installed
Namespace = Identity

// StorageClassName denotes storage class name.
StorageClassName = Identity

Expand Down
3 changes: 0 additions & 3 deletions pkg/consts/consts.go.in
Expand Up @@ -35,9 +35,6 @@ const (
// Identity denotes identity value.
Identity = AppName + "-min-io"

// Namespace denotes the namespace where the app is installed
Namespace = Identity

// StorageClassName denotes storage class name.
StorageClassName = Identity

Expand Down
1 change: 1 addition & 0 deletions pkg/installer/consts.go
Expand Up @@ -22,6 +22,7 @@ const (
// UnixCSIEndpoint is csi drive control socket.
UnixCSIEndpoint = "unix:///csi/csi.sock"

namespace = consts.AppName
caCertFileName = "ca.crt"
healthZContainerPortName = "healthz"
healthZContainerPort = 9898
Expand Down
24 changes: 12 additions & 12 deletions pkg/installer/daemonset.go
Expand Up @@ -213,7 +213,7 @@ func newDaemonset(podSpec corev1.PodSpec, name, appArmorProfile string) *appsv1.
},
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: consts.Identity,
Namespace: namespace,
Annotations: map[string]string{},
Labels: defaultLabels,
},
Expand All @@ -222,7 +222,7 @@ func newDaemonset(podSpec corev1.PodSpec, name, appArmorProfile string) *appsv1.
Template: corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: consts.Identity,
Namespace: namespace,
Annotations: annotations,
Labels: map[string]string{
selectorKey: selectorValue,
Expand Down Expand Up @@ -314,7 +314,7 @@ func doCreateDaemonset(ctx context.Context, args *Args) error {
return nil
}

_, err := k8s.KubeClient().AppsV1().DaemonSets(consts.Identity).Create(
_, err := k8s.KubeClient().AppsV1().DaemonSets(namespace).Create(
ctx, daemonset, metav1.CreateOptions{},
)
if err != nil {
Expand Down Expand Up @@ -362,7 +362,7 @@ func doCreateLegacyDaemonset(ctx context.Context, args *Args) error {
return nil
}

_, err := k8s.KubeClient().AppsV1().DaemonSets(consts.Identity).Create(
_, err := k8s.KubeClient().AppsV1().DaemonSets(namespace).Create(
ctx, daemonset, metav1.CreateOptions{},
)
if err != nil {
Expand All @@ -389,7 +389,7 @@ func createDaemonset(ctx context.Context, args *Args) error {
return nil
}

_, err := k8s.KubeClient().AppsV1().DaemonSets(consts.Identity).Get(
_, err := k8s.KubeClient().AppsV1().DaemonSets(namespace).Get(
ctx, consts.NodeServerName, metav1.GetOptions{},
)
if err != nil {
Expand All @@ -405,7 +405,7 @@ func createDaemonset(ctx context.Context, args *Args) error {
return nil
}

_, err = k8s.KubeClient().AppsV1().DaemonSets(consts.Identity).Get(
_, err = k8s.KubeClient().AppsV1().DaemonSets(namespace).Get(
ctx, consts.LegacyNodeServerName, metav1.GetOptions{},
)
if err != nil {
Expand All @@ -421,36 +421,36 @@ func createDaemonset(ctx context.Context, args *Args) error {
}

func deleteDaemonset(ctx context.Context) error {
err := k8s.KubeClient().AppsV1().DaemonSets(consts.Identity).Delete(
err := k8s.KubeClient().AppsV1().DaemonSets(namespace).Delete(
ctx, consts.NodeServerName, metav1.DeleteOptions{},
)
if err != nil && !apierrors.IsNotFound(err) {
return err
}

err = k8s.KubeClient().CoreV1().Secrets(consts.Identity).Delete(ctx, nodeAPIServerCertsSecretName, metav1.DeleteOptions{})
err = k8s.KubeClient().CoreV1().Secrets(namespace).Delete(ctx, nodeAPIServerCertsSecretName, metav1.DeleteOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return err
}

err = k8s.KubeClient().CoreV1().Secrets(consts.Identity).Delete(ctx, nodeAPIServerCASecretName, metav1.DeleteOptions{})
err = k8s.KubeClient().CoreV1().Secrets(namespace).Delete(ctx, nodeAPIServerCASecretName, metav1.DeleteOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return err
}

err = k8s.KubeClient().AppsV1().DaemonSets(consts.Identity).Delete(
err = k8s.KubeClient().AppsV1().DaemonSets(namespace).Delete(
ctx, consts.LegacyNodeServerName, metav1.DeleteOptions{},
)
if err != nil && !apierrors.IsNotFound(err) {
return err
}

err = k8s.KubeClient().CoreV1().Secrets(consts.Identity).Delete(ctx, legacyNodeAPIServerCertsSecretName, metav1.DeleteOptions{})
err = k8s.KubeClient().CoreV1().Secrets(namespace).Delete(ctx, legacyNodeAPIServerCertsSecretName, metav1.DeleteOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return err
}

err = k8s.KubeClient().CoreV1().Secrets(consts.Identity).Delete(ctx, legacyNodeAPIServerCASecretName, metav1.DeleteOptions{})
err = k8s.KubeClient().CoreV1().Secrets(namespace).Delete(ctx, legacyNodeAPIServerCASecretName, metav1.DeleteOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return err
}
Expand Down

0 comments on commit 37b6103

Please sign in to comment.