From cf603f518c916cc4a4a74b36b4a578445a5b9036 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Wed, 4 Jun 2025 11:57:28 +0200 Subject: [PATCH] Feature 11071: Modular OSM installation Change-Id: Ia9aa75afdce98d061b1b18b6efa6f33e19045d86 Signed-off-by: garciadeblas --- devops-stages/stage-build.sh | 2 +- installers/00-default-install-options.rc | 46 ++ installers/01-export-osm-install-options.sh | 66 ++ installers/10-install-client-tools.sh | 146 +++++ installers/15-install-k8s-cluster.sh | 55 ++ .../00-base-config.rc => 20-base-config.rc} | 4 +- ...ux-svc.sh => 20-deploy-aux-svc-cluster.sh} | 40 +- ...t-cluster.sh => 30-deploy-mgmt-cluster.sh} | 32 +- installers/40-deploy-osm.sh | 124 ++++ installers/45-osm-health.sh | 110 ++++ installers/50-provision-osm.sh | 47 ++ .../addons}/install_cluster_addons.sh | 32 +- .../{ => cluster/k3s}/install_k3s_cluster.sh | 64 +- .../kubeadm}/install_kubeadm_cluster.sh | 37 +- .../{ => cluster/kubeadm}/kubeadm-config.yaml | 0 .../microk8s}/install_microk8s_cluster.sh | 0 .../flux/scripts/add-age-key-to-cluster.sh | 0 .../flux/scripts/clone-relevant-repos.sh | 5 +- .../flux/scripts/create-age-keypair.sh | 0 .../create-new-cluster-folder-structure.sh | 12 +- .../flux/scripts/helper-functions.rc | 0 .../scripts}/library/functions.sh | 0 .../minio => flux/scripts}/library/trap.sh | 0 .../flux/scripts/mgmt-cluster-bootstrap.sh | 8 +- .../flux/scripts/watch-mgmt-cluster.sh | 0 .../fleet/clusters/_management}/apps.yaml | 0 .../clusters/_management}/fleet-repo.yaml | 0 .../clusters/_management}/infra-configs.yaml | 0 .../_management}/infra-controllers.yaml | 0 .../clusters/_management}/kustomization.yaml | 0 .../_management}/managed-resources.yaml | 0 .../_management}/sw-catalogs-repo.yaml | 0 .../jenkins/manifests/bitnamicharts-repo.yaml | 0 .../apps/jenkins/manifests/jenkins-hr.yaml | 0 .../apps/jenkins/templates/jenkins-ks.yaml | 0 .../apps/namespace/manifests/namespace.yaml | 0 .../namespace/templates/namespace-ks.yaml | 0 .../testacme/manifests/testacme-deploy.yaml | 0 .../apps/testacme/manifests/testacme-svc.yaml | 0 .../apps/testacme/templates/testacme-ks.yaml | 0 .../cloud-resources/aks/manifests/aks.yaml | 0 .../cloud-resources/aks/templates/aks01.yaml | 0 .../azure-mysql/manifests/dbformysql.yaml | 0 .../azure-mysql/templates/azure-mysql01.yaml | 0 .../eks/manifests/addons/ebs-csi-addon.yaml | 0 .../manifests/eks-cluster/eks-cluster.yaml | 0 .../eks/manifests/eks-cluster/nodegroup.yaml | 0 .../eks/manifests/iam/policy.yaml | 0 .../manifests/iam/role-policy-attachment.yaml | 0 .../eks/manifests/iam/roles.yaml | 0 .../eks/manifests/network/gateways.yaml | 0 .../eks/manifests/network/routes.yaml | 0 .../eks/manifests/network/subnets.yaml | 0 .../eks/manifests/network/vpc.yaml | 0 .../cloud-resources/eks/templates/eks01.yaml | 0 .../manifests/namespaces/namespaces.yaml | 0 .../manifests/secret/secret-template.yaml | 0 .../templates/remote-cluster-bootstrap.yaml | 0 .../cluster-base/templates}/apps.yaml | 0 .../cluster-base/templates}/fleet-repo.yaml | 0 .../flux-system/gotk-components.yaml | 0 .../templates/flux-system/gotk-sync.yaml | 0 .../templates/flux-system/kustomization.yaml | 0 .../templates}/infra-configs.yaml | 0 .../templates}/infra-controllers.yaml | 0 .../templates}/kustomization.yaml | 0 .../templates}/managed-resources.yaml | 0 .../templates}/sw-catalogs-repo.yaml | 0 .../manifests/configmap/reference-cm.yaml | 0 .../templates/kustomization-placeholder.yaml | 0 .../cloud-resources/gke/manifests/gke.yaml | 0 .../cloud-resources/gke/templates/gke01.yaml | 0 .../crossplane-providerconfig-aws.yaml | 0 .../crossplane-providerconfig-azure.yaml | 0 .../crossplane-providerconfig-gcp.yaml | 0 .../cluster-role-binding-dashboard.yaml | 0 .../templates/sa-dashboard.yaml | 0 .../templates/secret-token-dashboard.yaml | 0 .../osm-workflows/templates/sa-and-role.yaml | 0 .../clone-transform-push-wft.yaml | 0 .../building-blocks/cloud-accounts-wft.yaml | 0 .../cluster-management-wft.yaml | 0 .../building-blocks/debugging-wft.yaml | 0 .../wf-templates/building-blocks/git-wft.yaml | 0 .../building-blocks/k8s-resources-wft.yaml | 0 .../building-blocks/ksu-management-wft.yaml | 0 .../building-blocks/oka-management-wft.yaml | 0 .../profile-management-wft.yaml | 0 .../full-attach-profile.yaml | 0 .../full-bootstrap-cluster-wft.yaml | 0 .../canned-operations/full-clone-ksu.yaml | 0 ...-create-aks-cluster-and-bootstrap-wft.yaml | 0 ...-crossplane-cluster-and-bootstrap-wft.yaml | 0 .../full-create-ksu-generated-hr.yaml | 0 .../canned-operations/full-create-ksu-hr.yaml | 0 .../canned-operations/full-create-oka.yaml | 0 .../full-create-profile.yaml | 0 .../full-create-providerconfig-wft.yaml | 0 .../full-delete-cluster-wft.yaml | 0 .../canned-operations/full-delete-ksu.yaml | 0 .../canned-operations/full-delete-oka.yaml | 0 .../full-delete-profile.yaml | 0 .../full-delete-providerconfig-wft.yaml | 0 .../full-detach-profile.yaml | 0 ...ll-disconnect-flux-remote-cluster-wft.yaml | 0 ...ull-uninstall-flux-remote-cluster-wft.yaml | 140 ++++ .../full-update-aks-cluster.yaml | 0 ...-crossplane-cluster-and-bootstrap-wft.yaml | 0 .../full-update-ksu-generated-hr.yaml | 0 .../canned-operations/full-update-ksu-hr.yaml | 0 .../canned-operations/full-update-oka.yaml | 0 .../full-update-providerconfig-wft.yaml | 0 .../manifests/argo-namespace.yaml | 0 .../manifests/argo-wf-controller.yaml | 0 .../templates/argo-workflows.yaml | 0 .../manifests/cert-manager-chart.yaml | 0 .../templates/cert-manager-ks.yaml | 0 .../manifests/crossplane-helmrelease.yaml | 0 .../manifests/crossplane-helmrepo.yaml | 0 .../manifests/crossplane-namespace.yaml | 0 .../controller/manifests/kustomization.yaml | 0 .../controller/templates/crossplane.yaml | 0 .../providers/aws/manifests/provider-ec2.yaml | 0 .../providers/aws/manifests/provider-eks.yaml | 0 .../providers/aws/manifests/provider-iam.yaml | 0 .../providers/aws/manifests/provider-vpc.yaml | 0 .../templates/crossplane-aws-providers.yaml | 0 .../manifests/provider-azure-container.yaml | 0 .../manifests/provider-azure-dbformysql.yaml | 0 .../templates/crossplane-azure-providers.yaml | 0 .../manifests/provider-gcp-cloudplatform.yaml | 0 .../gcp/manifests/provider-gcp-container.yaml | 0 .../templates/crossplane-gcp-providers.yaml | 0 .../manifests/ingress-nginx.yaml | 0 .../templates/ingress-nginx-ks.yaml | 0 .../istio/manifests/addons/grafana.yaml | 0 .../istio/manifests/addons/jaeger.yaml | 0 .../istio/manifests/addons/kiali.yaml | 0 .../istio/manifests/addons/loki.yaml | 0 .../istio/manifests/addons/prometheus.yaml | 0 .../istio/manifests/core/istio-hr.yaml | 0 .../istio/manifests/core/istio-namespace.yaml | 0 .../istio/manifests/core/istio-repo.yaml | 0 .../istio/templates/istio-addons-ks.yaml | 0 .../istio/templates/istio-core-ks.yaml | 0 .../komoplane/manifests/komodorio-repo.yaml | 0 .../komoplane/manifests/komoplane-hr.yaml | 0 .../komoplane/templates/komoplane-ks.yaml | 0 .../manifests/kubernetes-dashboard-hr.yaml | 0 .../manifests/kubernetes-dashboard-repo.yaml | 0 .../templates/kubernetes-dashboard-ks.yaml | 0 .../manifests/weave-gitops-dashboard.yaml | 0 .../templates/weave-gitops-ks.yaml | 0 installers/full_install_osm.sh | 598 +++--------------- .../gitea/00-custom-config.rc | 0 .../gitea/01-base-config.rc | 0 .../gitea/02-deploy-gitea.sh | 2 +- .../gitea/03-get-gitea-connection-info.rc | 0 .../04-fix-and-use-external-gitea-urls.sh | 0 .../gitea/05-export-connection-info.sh | 14 +- .../gitea/20-setup-gituser-and-sshkeygen.sh | 30 + .../gitea/90-provision-gitea-for-osm.sh | 0 .../gitea/91-provision-local-git-user.sh | 0 .../gitea/ALL-IN-ONE-Gitea-install.sh | 0 installers/{mgmt-cluster => }/gitea/README.md | 0 .../admin/add-collaborator-to-user-repo.sh | 0 .../{mgmt-cluster => }/gitea/admin/api.sh | 0 .../gitea/admin/create-api-access-token.sh | 0 .../gitea/admin/create-cmd-access-token.sh | 0 .../gitea/admin/create-org-repository.sh | 0 .../gitea/admin/create-org.sh | 0 .../gitea/admin/create-user-repository.sh | 0 .../gitea/admin/create-user-ssh-key.sh | 0 .../gitea/admin/create-user.sh | 0 .../gitea/admin/delete-org-repository.sh | 0 .../gitea/admin/delete-org.sh | 0 .../gitea/admin/delete-user-repository.sh | 0 .../{mgmt-cluster => }/gitea/admin/gitea.sh | 0 .../{mgmt-cluster => }/gitea/admin/shell.sh | 0 .../library/functions.sh | 0 .../gitea/library/helpers.sh | 0 .../library/trap.sh | 0 .../{mgmt-cluster => }/gitea/values-all.yaml | 0 .../values-standalone-ingress-ssh2222.yaml | 0 .../gitea/values-standalone-ingress.yaml | 0 .../gitea/values-standalone.yaml | 0 .../helm/osm/templates/osm-gitops-secret.yaml | 6 + installers/helm/osm/values.yaml | 2 + installers/install_docker_ce.sh | 34 +- installers/install_helm_client.sh | 74 --- installers/install_osm.sh | 9 +- .../02-provision-local-git-user.sh | 33 - installers/mgmt-cluster/README.md | 6 +- .../mgmt-cluster/install_mgmt_cluster.sh | 146 ----- installers/mgmt-cluster/setup-cli-tools.sh | 77 --- .../add-operators-and-crds.sh | 0 .../configure-workflows.sh | 0 .../library/functions.sh | 0 .../library/trap.sh | 0 .../minio/00-base-config.rc | 0 .../minio/01-deploy-minio-operator.sh | 0 .../minio/02-create-minio-tenant.sh | 0 .../minio/03-deploy-ingress-for-minio.sh | 0 .../minio/04-get-minio-connection-info.rc | 0 .../minio/05-export-connection-info.sh | 0 .../minio/ALL-IN-ONE-Minio-install.sh | 0 installers/{mgmt-cluster => }/minio/README.md | 0 .../console/ingress-console.yaml | 0 .../tenant/ingress-tenant.yaml | 0 .../gitea => minio}/library/functions.sh | 0 .../gitea => minio}/library/trap.sh | 0 installers/openstack/install_to_openstack.sh | 6 +- installers/osm_health.sh | 153 ----- installers/test_track.sh | 4 +- installers/uninstall_osm.sh | 331 ---------- jenkins/ci-pipelines/ci_stage_3.groovy | 2 +- {common => library}/all_funcs | 4 +- {common => library}/config | 0 {common => library}/container | 0 .../scripts/library => library}/functions.sh | 0 {common => library}/git_functions | 0 {common => library}/logging | 0 {common => library}/track | 0 .../flux/scripts/library => library}/trap.sh | 0 library/utils.sh | 121 ++++ 225 files changed, 1129 insertions(+), 1493 deletions(-) create mode 100644 installers/00-default-install-options.rc create mode 100755 installers/01-export-osm-install-options.sh create mode 100755 installers/10-install-client-tools.sh create mode 100755 installers/15-install-k8s-cluster.sh rename installers/{mgmt-cluster/00-base-config.rc => 20-base-config.rc} (87%) rename installers/{mgmt-cluster/01-provision-aux-svc.sh => 20-deploy-aux-svc-cluster.sh} (70%) rename installers/{mgmt-cluster/03-provision-mgmt-cluster.sh => 30-deploy-mgmt-cluster.sh} (85%) create mode 100755 installers/40-deploy-osm.sh create mode 100755 installers/45-osm-health.sh create mode 100755 installers/50-provision-osm.sh rename installers/{ => cluster/addons}/install_cluster_addons.sh (92%) rename installers/{ => cluster/k3s}/install_k3s_cluster.sh (83%) rename installers/{ => cluster/kubeadm}/install_kubeadm_cluster.sh (85%) rename installers/{ => cluster/kubeadm}/kubeadm-config.yaml (100%) rename installers/{ => cluster/microk8s}/install_microk8s_cluster.sh (100%) rename installers/{mgmt-cluster => }/flux/scripts/add-age-key-to-cluster.sh (100%) rename installers/{mgmt-cluster => }/flux/scripts/clone-relevant-repos.sh (89%) rename installers/{mgmt-cluster => }/flux/scripts/create-age-keypair.sh (100%) rename installers/{mgmt-cluster => }/flux/scripts/create-new-cluster-folder-structure.sh (94%) rename installers/{mgmt-cluster => }/flux/scripts/helper-functions.rc (100%) rename installers/{mgmt-cluster/minio => flux/scripts}/library/functions.sh (100%) rename installers/{mgmt-cluster/minio => flux/scripts}/library/trap.sh (100%) rename installers/{mgmt-cluster => }/flux/scripts/mgmt-cluster-bootstrap.sh (86%) rename installers/{mgmt-cluster => }/flux/scripts/watch-mgmt-cluster.sh (100%) rename installers/{mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates => flux/templates/fleet/clusters/_management}/apps.yaml (100%) rename installers/{mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates => flux/templates/fleet/clusters/_management}/fleet-repo.yaml (100%) rename installers/{mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates => flux/templates/fleet/clusters/_management}/infra-configs.yaml (100%) rename installers/{mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates => flux/templates/fleet/clusters/_management}/infra-controllers.yaml (100%) rename installers/{mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates => flux/templates/fleet/clusters/_management}/kustomization.yaml (100%) rename installers/{mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates => flux/templates/fleet/clusters/_management}/managed-resources.yaml (100%) rename installers/{mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates => flux/templates/fleet/clusters/_management}/sw-catalogs-repo.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/apps/jenkins/manifests/bitnamicharts-repo.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/apps/jenkins/manifests/jenkins-hr.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/apps/jenkins/templates/jenkins-ks.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/apps/namespace/manifests/namespace.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/apps/namespace/templates/namespace-ks.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/apps/testacme/manifests/testacme-deploy.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/apps/testacme/manifests/testacme-svc.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/apps/testacme/templates/testacme-ks.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/aks/manifests/aks.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/aks/templates/aks01.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/azure-mysql/manifests/dbformysql.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/azure-mysql/templates/azure-mysql01.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/eks/manifests/addons/ebs-csi-addon.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/eks/manifests/eks-cluster/eks-cluster.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/eks/manifests/eks-cluster/nodegroup.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/policy.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/role-policy-attachment.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/roles.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/gateways.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/routes.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/subnets.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/vpc.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/eks/templates/eks01.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/manifests/namespaces/namespaces.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/manifests/secret/secret-template.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/templates/remote-cluster-bootstrap.yaml (100%) rename installers/{mgmt-cluster/flux/templates/fleet/clusters/_management => flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates}/apps.yaml (100%) rename installers/{mgmt-cluster/flux/templates/fleet/clusters/_management => flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates}/fleet-repo.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/gotk-components.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/gotk-sync.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/kustomization.yaml (100%) rename installers/{mgmt-cluster/flux/templates/fleet/clusters/_management => flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates}/infra-configs.yaml (100%) rename installers/{mgmt-cluster/flux/templates/fleet/clusters/_management => flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates}/infra-controllers.yaml (100%) rename installers/{mgmt-cluster/flux/templates/fleet/clusters/_management => flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates}/kustomization.yaml (100%) rename installers/{mgmt-cluster/flux/templates/fleet/clusters/_management => flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates}/managed-resources.yaml (100%) rename installers/{mgmt-cluster/flux/templates/fleet/clusters/_management => flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates}/sw-catalogs-repo.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/empty-kustomization/manifests/configmap/reference-cm.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/empty-kustomization/templates/kustomization-placeholder.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/gke/manifests/gke.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/cloud-resources/gke/templates/gke01.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/crossplane/providers/aws/templates/crossplane-providerconfig-aws.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/crossplane/providers/azure/templates/crossplane-providerconfig-azure.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/crossplane/providers/gcp/templates/crossplane-providerconfig-gcp.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/cluster-role-binding-dashboard.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/sa-dashboard.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/secret-token-dashboard.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/sa-and-role.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/clone-transform-push-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/cloud-accounts-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/cluster-management-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/debugging-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/git-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/k8s-resources-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/ksu-management-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/oka-management-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/profile-management-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-attach-profile.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-bootstrap-cluster-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-clone-ksu.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-aks-cluster-and-bootstrap-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-crossplane-cluster-and-bootstrap-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-ksu-generated-hr.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-ksu-hr.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-oka.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-profile.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-providerconfig-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-cluster-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-ksu.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-oka.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-profile.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-providerconfig-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-detach-profile.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-disconnect-flux-remote-cluster-wft.yaml (100%) create mode 100644 installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-uninstall-flux-remote-cluster-wft.yaml rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-aks-cluster.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-crossplane-cluster-and-bootstrap-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-ksu-generated-hr.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-ksu-hr.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-oka.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-providerconfig-wft.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/argo-workflows/manifests/argo-namespace.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/argo-workflows/manifests/argo-wf-controller.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/argo-workflows/templates/argo-workflows.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/cert-manager/manifests/cert-manager-chart.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/cert-manager/templates/cert-manager-ks.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-helmrelease.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-helmrepo.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-namespace.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/kustomization.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/templates/crossplane.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-ec2.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-eks.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-iam.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-vpc.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/templates/crossplane-aws-providers.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/manifests/provider-azure-container.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/manifests/provider-azure-dbformysql.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/templates/crossplane-azure-providers.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/manifests/provider-gcp-cloudplatform.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/manifests/provider-gcp-container.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/templates/crossplane-gcp-providers.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/ingress-nginx/manifests/ingress-nginx.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/ingress-nginx/templates/ingress-nginx-ks.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/grafana.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/jaeger.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/kiali.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/loki.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/prometheus.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-hr.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-namespace.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-repo.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/istio/templates/istio-addons-ks.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/istio/templates/istio-core-ks.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/komoplane/manifests/komodorio-repo.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/komoplane/manifests/komoplane-hr.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/komoplane/templates/komoplane-ks.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/manifests/kubernetes-dashboard-hr.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/manifests/kubernetes-dashboard-repo.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/templates/kubernetes-dashboard-ks.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/weave-gitops/manifests/weave-gitops-dashboard.yaml (100%) rename installers/{mgmt-cluster => }/flux/templates/sw-catalogs/infra-controllers/weave-gitops/templates/weave-gitops-ks.yaml (100%) rename installers/{mgmt-cluster => }/gitea/00-custom-config.rc (100%) rename installers/{mgmt-cluster => }/gitea/01-base-config.rc (100%) rename installers/{mgmt-cluster => }/gitea/02-deploy-gitea.sh (97%) rename installers/{mgmt-cluster => }/gitea/03-get-gitea-connection-info.rc (100%) rename installers/{mgmt-cluster => }/gitea/04-fix-and-use-external-gitea-urls.sh (100%) rename installers/{mgmt-cluster => }/gitea/05-export-connection-info.sh (82%) create mode 100755 installers/gitea/20-setup-gituser-and-sshkeygen.sh rename installers/{mgmt-cluster => }/gitea/90-provision-gitea-for-osm.sh (100%) rename installers/{mgmt-cluster => }/gitea/91-provision-local-git-user.sh (100%) rename installers/{mgmt-cluster => }/gitea/ALL-IN-ONE-Gitea-install.sh (100%) rename installers/{mgmt-cluster => }/gitea/README.md (100%) rename installers/{mgmt-cluster => }/gitea/admin/add-collaborator-to-user-repo.sh (100%) rename installers/{mgmt-cluster => }/gitea/admin/api.sh (100%) rename installers/{mgmt-cluster => }/gitea/admin/create-api-access-token.sh (100%) rename installers/{mgmt-cluster => }/gitea/admin/create-cmd-access-token.sh (100%) rename installers/{mgmt-cluster => }/gitea/admin/create-org-repository.sh (100%) rename installers/{mgmt-cluster => }/gitea/admin/create-org.sh (100%) rename installers/{mgmt-cluster => }/gitea/admin/create-user-repository.sh (100%) rename installers/{mgmt-cluster => }/gitea/admin/create-user-ssh-key.sh (100%) rename installers/{mgmt-cluster => }/gitea/admin/create-user.sh (100%) rename installers/{mgmt-cluster => }/gitea/admin/delete-org-repository.sh (100%) rename installers/{mgmt-cluster => }/gitea/admin/delete-org.sh (100%) rename installers/{mgmt-cluster => }/gitea/admin/delete-user-repository.sh (100%) rename installers/{mgmt-cluster => }/gitea/admin/gitea.sh (100%) rename installers/{mgmt-cluster => }/gitea/admin/shell.sh (100%) rename installers/{mgmt-cluster/mgmt-operators-and-crds => gitea}/library/functions.sh (100%) rename installers/{mgmt-cluster => }/gitea/library/helpers.sh (100%) rename installers/{mgmt-cluster/mgmt-operators-and-crds => gitea}/library/trap.sh (100%) rename installers/{mgmt-cluster => }/gitea/values-all.yaml (100%) rename installers/{mgmt-cluster => }/gitea/values-standalone-ingress-ssh2222.yaml (100%) rename installers/{mgmt-cluster => }/gitea/values-standalone-ingress.yaml (100%) rename installers/{mgmt-cluster => }/gitea/values-standalone.yaml (100%) delete mode 100755 installers/install_helm_client.sh delete mode 100755 installers/mgmt-cluster/02-provision-local-git-user.sh delete mode 100755 installers/mgmt-cluster/install_mgmt_cluster.sh delete mode 100755 installers/mgmt-cluster/setup-cli-tools.sh rename installers/{mgmt-cluster => }/mgmt-operators-and-crds/add-operators-and-crds.sh (100%) rename installers/{mgmt-cluster => }/mgmt-operators-and-crds/configure-workflows.sh (100%) rename installers/{mgmt-cluster => mgmt-operators-and-crds}/library/functions.sh (100%) rename installers/{mgmt-cluster => mgmt-operators-and-crds}/library/trap.sh (100%) rename installers/{mgmt-cluster => }/minio/00-base-config.rc (100%) rename installers/{mgmt-cluster => }/minio/01-deploy-minio-operator.sh (100%) rename installers/{mgmt-cluster => }/minio/02-create-minio-tenant.sh (100%) rename installers/{mgmt-cluster => }/minio/03-deploy-ingress-for-minio.sh (100%) rename installers/{mgmt-cluster => }/minio/04-get-minio-connection-info.rc (100%) rename installers/{mgmt-cluster => }/minio/05-export-connection-info.sh (100%) rename installers/{mgmt-cluster => }/minio/ALL-IN-ONE-Minio-install.sh (100%) rename installers/{mgmt-cluster => }/minio/README.md (100%) rename installers/{mgmt-cluster => }/minio/ingress-manifests/console/ingress-console.yaml (100%) rename installers/{mgmt-cluster => }/minio/ingress-manifests/tenant/ingress-tenant.yaml (100%) rename installers/{mgmt-cluster/gitea => minio}/library/functions.sh (100%) rename installers/{mgmt-cluster/gitea => minio}/library/trap.sh (100%) delete mode 100755 installers/osm_health.sh delete mode 100755 installers/uninstall_osm.sh rename {common => library}/all_funcs (86%) rename {common => library}/config (100%) rename {common => library}/container (100%) rename {installers/mgmt-cluster/flux/scripts/library => library}/functions.sh (100%) rename {common => library}/git_functions (100%) rename {common => library}/logging (100%) rename {common => library}/track (100%) rename {installers/mgmt-cluster/flux/scripts/library => library}/trap.sh (100%) create mode 100755 library/utils.sh diff --git a/devops-stages/stage-build.sh b/devops-stages/stage-build.sh index f6ba3854..79d8654a 100755 --- a/devops-stages/stage-build.sh +++ b/devops-stages/stage-build.sh @@ -17,7 +17,7 @@ # Download helm chart dependencies helm dependency update installers/helm/osm -PKG_DIRECTORIES="common jenkins installers tools docker" +PKG_DIRECTORIES="library jenkins installers tools docker" MDG_NAME=devops DEB_INSTALL=debian/osm-$MDG_NAME.install export DEBEMAIL="OSM_TECH@LIST.ETSI.ORG" diff --git a/installers/00-default-install-options.rc b/installers/00-default-install-options.rc new file mode 100644 index 00000000..fa1fb0a6 --- /dev/null +++ b/installers/00-default-install-options.rc @@ -0,0 +1,46 @@ +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### + +export ASSUME_YES="" +export APT_PROXY_URL="" +export K8S_CLUSTER_ENGINE="k3s" +export DEBUG_INSTALL="" +export RELEASE="testing-daily" +export REPOSITORY="testing" +export REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg" +export REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/debian" +export INSTALL_AUX_CLUSTER="y" +export INSTALL_MGMT_CLUSTER="y" +export OSM_NAMESPACE=osm +export OSM_HELM_RELEASE=osm +export OSM_DOCKER_TAG="testing-daily" +export DOCKER_USER="opensourcemano" +export DOCKER_REGISTRY_USER= +export DOCKER_REGISTRY_PASSWORD= +export DOCKER_REGISTRY_URL= +export DOCKER_PROXY_URL= +export MODULE_DOCKER_TAG= +export OSM_CLIENT_VERSION="master" +export OSM_IM_VERSION="master" +export OSM_HOME_DIR=${OSM_HOME_DIR:-"$HOME/.osm"} +export CREDENTIALS_DIR="${OSM_HOME_DIR}/.credentials" +export WORK_REPOS_DIR="${OSM_HOME_DIR}/repos" +export INSTALL_MINIO=${INSTALL_MINIO:-"y"} +export KUBECONFIG_AUX_CLUSTER= +export KUBECONFIG_MGMT_CLUSTER= +export KUBECONFIG_OSM_CLUSTER= +export OSM_BEHIND_PROXY= diff --git a/installers/01-export-osm-install-options.sh b/installers/01-export-osm-install-options.sh new file mode 100755 index 00000000..4f2ed185 --- /dev/null +++ b/installers/01-export-osm-install-options.sh @@ -0,0 +1,66 @@ +#!/bin/bash +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### + +set -e + +HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") +source "${HERE}/../library/functions.sh" +source "${HERE}/../library/trap.sh" +source "${HERE}/../library/logging" +source "${HERE}/../library/track" + +# Saves locally to local environment at OSM home dir folder +m "Saving local enviroment to OSM_HOME_DIR folder..." + +OSM_HOME_DIR=${OSM_HOME_DIR:-"$HOME/.osm"} +mkdir -p "${OSM_HOME_DIR}" + +cat << EOF > "${OSM_HOME_DIR}/user-install-options.rc" +export ASSUME_YES=${ASSUME_YES} +export APT_PROXY_URL=${APT_PROXY_URL} +export K8S_CLUSTER_ENGINE=${K8S_CLUSTER_ENGINE} +export DEBUG_INSTALL=${DEBUG_INSTALL} +export RELEASE=${RELEASE} +export REPOSITORY=${REPOSITORY} +export REPOSITORY_KEY=${REPOSITORY_KEY} +export REPOSITORY_BASE=${REPOSITORY_BASE} +export INSTALL_AUX_CLUSTER=${INSTALL_AUX_CLUSTER} +export INSTALL_MGMT_CLUSTER=${INSTALL_MGMT_CLUSTER} +export OSM_NAMESPACE=${OSM_NAMESPACE} +export OSM_HELM_RELEASE=${OSM_HELM_RELEASE} +export OSM_DOCKER_TAG=${OSM_DOCKER_TAG} +export DOCKER_USER=${DOCKER_USER} +export DOCKER_REGISTRY_USER=${DOCKER_REGISTRY_USER} +export DOCKER_REGISTRY_PASSWORD=${DOCKER_REGISTRY_PASSWORD} +export DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL} +export DOCKER_PROXY_URL=${DOCKER_PROXY_URL} +export MODULE_DOCKER_TAG=${MODULE_DOCKER_TAG} +export OSM_CLIENT_VERSION=${OSM_CLIENT_VERSION} +export OSM_IM_VERSION=${OSM_IM_VERSION} +export OSM_HOME_DIR=${OSM_HOME_DIR} +export CREDENTIALS_DIR="${OSM_HOME_DIR}/.credentials" +export WORK_REPOS_DIR="${OSM_HOME_DIR}/repos" +export INSTALL_MINIO=${INSTALL_MINIO} +export KUBECONFIG_AUX_CLUSTER=${KUBECONFIG_AUX_CLUSTER} +export KUBECONFIG_MGMT_CLUSTER=${KUBECONFIG_MGMT_CLUSTER} +export KUBECONFIG_OSM_CLUSTER=${KUBECONFIG_OSM_CLUSTER} +export OSM_BEHIND_PROXY=${OSM_BEHIND_PROXY} +EOF + +m "Done." +echo diff --git a/installers/10-install-client-tools.sh b/installers/10-install-client-tools.sh new file mode 100755 index 00000000..1d8c86f0 --- /dev/null +++ b/installers/10-install-client-tools.sh @@ -0,0 +1,146 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e -o pipefail + +HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") +source "${HERE}/../library/functions.sh" +source "${HERE}/../library/trap.sh" +source "${HERE}/../library/logging" +source "${HERE}/../library/track" + +INSTALL_MINIO=${INSTALL_MINIO:-"y"} +echo "INSTALL_MINIO=$INSTALL_MINIO" + +pushd $HOME + +export DEBIAN_FRONTEND=noninteractive +sudo apt-get update + +# Install git, curl, tar +sudo DEBIAN_FRONTEND=noninteractive apt-get install -y git curl tar + +# Helm +HELM_VERSION="v3.15.1" +# Helm releases can be found here: https://github.com/helm/helm/releases +if ! [[ "$(helm version --short 2>/dev/null)" =~ ^v3.* ]]; then + # Helm is not installed. Install helm + echo "Helm3 is not installed, installing ..." + curl https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz -o helm-${HELM_VERSION}.tar.gz + tar -zxvf helm-${HELM_VERSION}.tar.gz + sudo mv linux-amd64/helm /usr/local/bin/helm + rm -r linux-amd64 + rm helm-${HELM_VERSION}.tar.gz +else + echo "Helm3 is already installed. Skipping installation..." +fi +helm version || FATAL_TRACK k8scluster "Could not obtain helm version. Maybe helm client was not installed" +helm repo add stable https://charts.helm.sh/stable || FATAL_TRACK k8scluster "Helm repo stable could not be added" +helm repo update || FATAL_TRACK k8scluster "Helm repo stable could not be updated" +echo "helm installed" + +# Install kubectl client +K8S_CLIENT_VERSION="v1.29.3" +curl -LO "https://dl.k8s.io/release/${K8S_CLIENT_VERSION}/bin/linux/amd64/kubectl" +sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl +rm kubectl +echo "kubectl installed" + +# Install `gnupg` and `gpg` - Typically pre-installed in Ubuntu +sudo DEBIAN_FRONTEND=noninteractive apt-get install gnupg gpg -y +echo "gnupg and gpg installed" + +# Install `sops` +curl -LO https://github.com/getsops/sops/releases/download/v3.8.1/sops-v3.8.1.linux.amd64 +sudo mv sops-v3.8.1.linux.amd64 /usr/local/bin/sops +sudo chmod +x /usr/local/bin/sops +echo "sops client installed" + +# Install `envsubst` +sudo DEBIAN_FRONTEND=noninteractive apt-get install gettext-base -y +echo "envsubst installed" + +# Install `age` +AGE_VERSION="v1.1.0" +curl -LO https://github.com/FiloSottile/age/releases/download/${AGE_VERSION}/age-${AGE_VERSION}-linux-amd64.tar.gz +tar xvfz age-${AGE_VERSION}-linux-amd64.tar.gz +sudo mv age/age age/age-keygen /usr/local/bin/ +sudo chmod +x /usr/local/bin/age* +rm -rf age age-${AGE_VERSION}-linux-amd64.tar.gz +echo "age installed" + +# (Only for Gitea) Install `apg` +sudo DEBIAN_FRONTEND=noninteractive apt-get install apg -y +echo "apg installed" + +# # (Only for Minio) `kubectl minio` plugin and Minio Client +MINIO_CLIENT_VERSION="5.0.12" +if [ -n "${INSTALL_MINIO}" ]; then + curl https://github.com/minio/operator/releases/download/v${MINIO_CLIENT_VERSION}/kubectl-minio_${MINIO_CLIENT_VERSION}_linux_amd64 -Lo kubectl-minio + curl https://dl.min.io/client/mc/release/linux-amd64/mc -o minioc + chmod +x kubectl-minio minioc + sudo mv kubectl-minio minioc /usr/local/bin/ + # (Only for HTTPS Ingress for Minio tenant) Install `openssl` + sudo DEBIAN_FRONTEND=noninteractive apt-get install openssl -y +fi +echo "minio client installed" + +# Flux client +FLUX_CLI_VERSION="2.4.0" +curl -s https://fluxcd.io/install.sh | sudo FLUX_VERSION=${FLUX_CLI_VERSION} bash +# Autocompletion +. <(flux completion bash) +echo "flux client installed" + +# Argo client +ARGO_VERSION="v3.5.7" +curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz +gunzip argo-linux-amd64.gz +chmod +x argo-linux-amd64 +sudo mv ./argo-linux-amd64 /usr/local/bin/argo +echo "argo client installed" + +# Kustomize +KUSTOMIZE_VERSION="5.4.3" +curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- ${KUSTOMIZE_VERSION} +sudo install -o root -g root -m 0755 kustomize /usr/local/bin/kustomize +rm kustomize +echo "kustomized installed" + +# yq +VERSION=v4.33.3 +BINARY=yq_linux_amd64 +curl -L https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -o yq +sudo mv yq /usr/local/bin/yq +sudo chmod +x /usr/local/bin/yq +echo "yq installed" + +# OSM client +OSM_CLIENT_VERSION=${OSM_CLIENT_VERSION:-"master"} +OSM_IM_VERSION=${OSM_IM_VERSION:-"master"} +sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-setuptools python3-dev python3-pip +sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libmagic1 +sudo DEBIAN_FRONTEND=noninteractive apt-get install -y make +sudo -H python3 -m pip install -U pip +# Install OSM IM and its dependencies via pip +python3 -m pip install -r "https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=${OSM_IM_VERSION}" +# Path needs to include $HOME/.local/bin in order to use pyang +[ "$(which pyang)" = "$HOME/.local/bin/pyang" ] || export PATH=$HOME/.local/bin:${PATH} +python3 -m pip install "git+https://osm.etsi.org/gerrit/osm/IM.git@${OSM_IM_VERSION}#egg=osm-im" --upgrade +python3 -m pip install -r "https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=${OSM_CLIENT_VERSION}" +python3 -m pip install git+https://osm.etsi.org/gerrit/osm/osmclient.git@${OSM_CLIENT_VERSION}#egg=osmclient +echo "OSM client installed" + +popd diff --git a/installers/15-install-k8s-cluster.sh b/installers/15-install-k8s-cluster.sh new file mode 100755 index 00000000..d0f2c4ba --- /dev/null +++ b/installers/15-install-k8s-cluster.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e -o pipefail + +HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") +source "${HERE}/../library/functions.sh" +source "${HERE}/../library/trap.sh" +source "${HERE}/../library/logging" +source "${HERE}/../library/track" + +source "${HERE}/00-default-install-options.rc" +[ ! -f "${OSM_HOME_DIR}/user-install-options.rc" ] || source "${OSM_HOME_DIR}/user-install-options.rc" + +export K8SCLUSTER_CONFIG_FOLDER=${K8SCLUSTER_CONFIG_FOLDER:-"/etc/osm"} +export DEFAULT_IP=${OSM_DEFAULT_IP:-"127.0.0.1"} + +echo "K8S_CLUSTER_ENGINE=$K8S_CLUSTER_ENGINE" +if [ "${K8S_CLUSTER_ENGINE}" == "kubeadm" ]; then + KUBEADM_INSTALL_OPTS="--debug" + ${HERE}/cluster/kubeadm/install_kubeadm_cluster.sh ${KUBEADM_INSTALL_OPTS} || \ + FATAL_TRACK k8scluster "install_kubeadm_cluster.sh failed" + K8SCLUSTER_ADDONS_INSTALL_OPTS="--all" + ${HERE}/cluster/addons/install_cluster_addons.sh ${K8SCLUSTER_ADDONS_INSTALL_OPTS} || \ + FATAL_TRACK k8scluster "install_cluster_addons.sh failed for kubeadm cluster" +elif [ "${K8S_CLUSTER_ENGINE}" == "k3s" ]; then + export K3S_PUBLIC_IP= + [ "${OSM_K8S_EXTERNAL_IP}" != "${OSM_DEFAULT_IP}" ] && K3S_PUBLIC_IP=${OSM_K8S_EXTERNAL_IP} + # The K3s installation script will automatically take the HTTP_PROXY, HTTPS_PROXY and NO_PROXY, + # as well as the CONTAINERD_HTTP_PROXY, CONTAINERD_HTTPS_PROXY and CONTAINERD_NO_PROXY variables + # from the shell, if they are present, and write them to the environment file of k3s systemd service, + ${HERE}/cluster/k3s/install_k3s_cluster.sh || \ + FATAL_TRACK k8scluster "install_k3s_cluster.sh failed" + K8SCLUSTER_ADDONS_INSTALL_OPTS="--certmgr --nginx" + ${HERE}/cluster/addons/install_cluster_addons.sh ${K8SCLUSTER_ADDONS_INSTALL_OPTS} || \ + FATAL_TRACK k8scluster "install_cluster_addons.sh failed for k3s cluster" +fi +echo "Updating fsnotify settings of the system kernel" +sudo bash -c "sysctl -w fs.inotify.max_user_watches=699050 > /etc/sysctl.d/99-custom-osm-sysctl.conf" +sudo bash -c "sysctl -w fs.inotify.max_user_instances=10922 >> /etc/sysctl.d/99-custom-osm-sysctl.conf" +sudo bash -c "sysctl -w fs.inotify.max_queued_events=1398101 >> /etc/sysctl.d/99-custom-osm-sysctl.conf" + +echo "K8s cluster installed" diff --git a/installers/mgmt-cluster/00-base-config.rc b/installers/20-base-config.rc similarity index 87% rename from installers/mgmt-cluster/00-base-config.rc rename to installers/20-base-config.rc index de0d4db8..68c9353f 100644 --- a/installers/mgmt-cluster/00-base-config.rc +++ b/installers/20-base-config.rc @@ -16,10 +16,10 @@ ####################################################################################### # Location where credentials should be saved -export CREDENTIALS_DIR=${CREDENTIALS_DIR:-../../.credentials}; export CREDENTIALS_DIR=$(readlink -f "${CREDENTIALS_DIR}") +export CREDENTIALS_DIR=${CREDENTIALS_DIR:-${OSM_HOME_DIR}/.credentials}; export CREDENTIALS_DIR=$(readlink -f "${CREDENTIALS_DIR}") # Base location where repos are cloned -export WORK_REPOS_DIR=${WORK_REPOS_DIR:-../../repos}; export WORK_REPOS_DIR=$(readlink -f "${WORK_REPOS_DIR}") +export WORK_REPOS_DIR=${WORK_REPOS_DIR:-${OSM_HOME_DIR}/repos}; export WORK_REPOS_DIR=$(readlink -f "${WORK_REPOS_DIR}") # Locations where each relevant repo is cloned export FLEET_REPO_DIR=${FLEET_REPO_DIR:-"${WORK_REPOS_DIR}/fleet-osm"} diff --git a/installers/mgmt-cluster/01-provision-aux-svc.sh b/installers/20-deploy-aux-svc-cluster.sh similarity index 70% rename from installers/mgmt-cluster/01-provision-aux-svc.sh rename to installers/20-deploy-aux-svc-cluster.sh index ddd3cbfd..3faca664 100755 --- a/installers/mgmt-cluster/01-provision-aux-svc.sh +++ b/installers/20-deploy-aux-svc-cluster.sh @@ -20,10 +20,26 @@ set -e -o pipefail # Warning!!!: Remember to select the desired kubeconfig profile before launching this script -export HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") -source "${HERE}/library/functions.sh" -source "${HERE}/library/trap.sh" +HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") +source "${HERE}/../library/functions.sh" +source "${HERE}/../library/trap.sh" + +pushd $HERE > /dev/null + +source "${HERE}/00-default-install-options.rc" +[ ! -f "${OSM_HOME_DIR}/user-install-options.rc" ] || source "${OSM_HOME_DIR}/user-install-options.rc" +echo "Loading env variables from 20-base-config.rc" +source "${HERE}/20-base-config.rc" + +# TODO: move this to a parent script that creates the VM +mkdir -p "${OSM_HOME_DIR}/clusters" +if [ -n "${KUBECONFIG_AUX_CLUSTER}" ]; then + cp "${KUBECONFIG_AUX_CLUSTER}" "${OSM_HOME_DIR}/clusters/kubeconfig-aux-svc.yaml" +else + cp "${HOME}/.kube/config" "${OSM_HOME_DIR}/clusters/kubeconfig-aux-svc.yaml" +fi +export KUBECONFIG="${OSM_HOME_DIR}/clusters/kubeconfig-aux-svc.yaml" ############################ NGINX Ingress controller m "\n#####################################################################" "${CYAN}" @@ -53,12 +69,17 @@ m "(2/3) Installing Gitea..." "${CYAN}" m "#####################################################################\n" "${CYAN}" # Enter the Gitea folder -pushd gitea > /dev/null +# TODO: Should we use pushd $HERE/gitea instead of pushd gitea? +pushd "${HERE}/gitea" > /dev/null # Install Gitea and expose web with Ingress export GITEA_CHART_VALUES_FILE=${GITEA_CHART_VALUES_FILE:-values-standalone-ingress.yaml} ./ALL-IN-ONE-Gitea-install.sh +# Setup Git user and SSH keys +m "\nSetting up Git user and SSH keys..." +./20-setup-gituser-and-sshkeygen.sh + # Provision for OSM m "\nProvisioning Gitea for OSM use..." source "${CREDENTIALS_DIR}/gitea_environment.rc" @@ -75,6 +96,8 @@ m "\n#####################################################################" "${C m "(3/3) Installing Minio..." "${CYAN}" m "#####################################################################\n" "${CYAN}" +INSTALL_MINIO=${INSTALL_MINIO:-"y"} +echo "INSTALL_MINIO=$INSTALL_MINIO" if [ -n "${INSTALL_MINIO}" ]; then # Enter the Minio folder pushd minio > /dev/null @@ -84,3 +107,12 @@ if [ -n "${INSTALL_MINIO}" ]; then popd > /dev/null fi ##################################################################### + + +# Source tokens +source "${CREDENTIALS_DIR}/gitea_tokens.rc" + +# Add the local Git user to Gitea as a profile, upload the public SSH key (to allow SSH operations), and add the user as "collaborator" to both repos +"${HERE}/gitea/91-provision-local-git-user.sh" + +popd > /dev/null diff --git a/installers/mgmt-cluster/03-provision-mgmt-cluster.sh b/installers/30-deploy-mgmt-cluster.sh similarity index 85% rename from installers/mgmt-cluster/03-provision-mgmt-cluster.sh rename to installers/30-deploy-mgmt-cluster.sh index 7b8fbf69..f99c6f91 100755 --- a/installers/mgmt-cluster/03-provision-mgmt-cluster.sh +++ b/installers/30-deploy-mgmt-cluster.sh @@ -20,20 +20,32 @@ set -e -o pipefail # Warning!!!: Remember to select the desired kubeconfig profile before launching this script -export HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") -source "${HERE}/library/functions.sh" -source "${HERE}/library/trap.sh" - +HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") +source "${HERE}/../library/functions.sh" +source "${HERE}/../library/trap.sh" + +source "${HERE}/00-default-install-options.rc" +[ ! -f "${OSM_HOME_DIR}/user-install-options.rc" ] || source "${OSM_HOME_DIR}/user-install-options.rc" +echo "Loading env variables from 20-base-config.rc" +source "${HERE}/20-base-config.rc" +source "${CREDENTIALS_DIR}/git_environment.rc" + +# TODO: check git config +# TODO: move this to a parent script that creates the VM +mkdir -p "${OSM_HOME_DIR}/clusters" +if [ -n "${KUBECONFIG_MGMT_CLUSTER}" ]; then + cp "${KUBECONFIG_MGMT_CLUSTER}" "${OSM_HOME_DIR}/clusters/kubeconfig-mgmt.yaml" +else + cp "${HOME}/.kube/config" "${OSM_HOME_DIR}/clusters/kubeconfig-mgmt.yaml" +fi + +export KUBECONFIG="${OSM_HOME_DIR}/clusters/kubeconfig-mgmt.yaml" ############################ Clone repos m "\n#####################################################################" "${CYAN}" m "(1/8) Cloning relevant repos..." "${CYAN}" m "#####################################################################\n" "${CYAN}" -# Load Gitea credentials -source "${CREDENTIALS_DIR}/gitea_environment.rc" -source "${CREDENTIALS_DIR}/gitea_tokens.rc" - # clone the relevant repos to well-known local folders "${HERE}/flux/scripts/clone-relevant-repos.sh" @@ -75,7 +87,7 @@ m "\n#####################################################################" "${C m "(4/8) Creating base kustomizations and default cluster profiles..." "${CYAN}" m "#####################################################################\n" "${CYAN}" -TEMPLATES_DIR="flux/templates/fleet/clusters/_management" +TEMPLATES_DIR="${HERE}/flux/templates/fleet/clusters/_management" TEMPLATES_DIR=$(readlink -f "${TEMPLATES_DIR}") # ARGUMENTS: @@ -99,7 +111,7 @@ m "\n#####################################################################" "${C m "(5/8) Populating the SW-Catalogs repo folder..." "${CYAN}" m "#####################################################################\n" "${CYAN}" -TEMPLATES_DIR="flux/templates/sw-catalogs" +TEMPLATES_DIR="${HERE}/flux/templates/sw-catalogs" TEMPLATES_DIR=$(readlink -f "${TEMPLATES_DIR}") # rsync -varhP "${TEMPLATES_DIR}" "${SW_CATALOGS_REPO_DIR}/" cp -r "${TEMPLATES_DIR}"/* "${SW_CATALOGS_REPO_DIR}/" diff --git a/installers/40-deploy-osm.sh b/installers/40-deploy-osm.sh new file mode 100755 index 00000000..82dc5d4b --- /dev/null +++ b/installers/40-deploy-osm.sh @@ -0,0 +1,124 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e -o pipefail + +HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") +source "${HERE}/../library/functions.sh" +source "${HERE}/../library/trap.sh" +source "${HERE}/../library/logging" +source "${HERE}/../library/track" + +source "${HERE}/00-default-install-options.rc" +[ ! -f "${OSM_HOME_DIR}/user-install-options.rc" ] || source "${OSM_HOME_DIR}/user-install-options.rc" +source "${CREDENTIALS_DIR}/git_environment.rc" + +OSM_HELM_WORK_DIR="/etc/osm/helm" +OSM_K8S_EXTERNAL_IP=${OSM_K8S_EXTERNAL_IP:-""} +KUBECONFIG_AUX_CLUSTER_FILE="${OSM_HOME_DIR}/clusters/kubeconfig-aux-svc.yaml" +KUBECONFIG_MGMT_CLUSTER_FILE="${OSM_HOME_DIR}/clusters/kubeconfig-mgmt.yaml" +[ "${HERE}" == "/usr/share/osm-devops/installers" ] || OSM_HELM_UPDATE_DEPENDENCIES="y" +OSM_GITOPS_ENABLED=${INSTALL_MGMT_CLUSTER:-"y"} + +# TODO: move this to a parent script that creates the VM +mkdir -p "${OSM_HOME_DIR}/clusters" +if [ -n "${KUBECONFIG_OSM_CLUSTER}" ]; then + cp "${KUBECONFIG_OSM_CLUSTER}" "${OSM_HOME_DIR}/clusters/kubeconfig-osm.yaml" +else + cp "${HOME}/.kube/config" "${OSM_HOME_DIR}/clusters/kubeconfig-osm.yaml" +fi + +export KUBECONFIG="${OSM_HOME_DIR}/clusters/kubeconfig-osm.yaml" + +# Create folder to store helm values +sudo mkdir -p ${OSM_HELM_WORK_DIR} + +# Saving secrets +echo "Creating namespace ${OSM_NAMESPACE}" +kubectl create ns ${OSM_NAMESPACE} +echo "Saving age keys in OSM cluster" +kubectl -n ${OSM_NAMESPACE} create secret generic mgmt-cluster-age-keys --from-file=privkey="${CREDENTIALS_DIR}/age.mgmt.key" --from-file=pubkey="${CREDENTIALS_DIR}/age.mgmt.pub" +echo "Creating secrets with kubeconfig files" +kubectl -n ${OSM_NAMESPACE} create secret generic auxcluster-secret --from-file=kubeconfig="${KUBECONFIG_AUX_CLUSTER_FILE}" +kubectl -n ${OSM_NAMESPACE} create secret generic mgmtcluster-secret --from-file=kubeconfig="${KUBECONFIG_MGMT_CLUSTER_FILE}" + +# Update helm dependencies +[ -n "${OSM_HELM_UPDATE_DEPENDENCIES}" ] && \ + echo "Updating helm dependencies" && \ + helm dependency update "${HERE}/helm/osm" + +# Generate helm values to be passed with --set +OSM_HELM_OPTS="" +# OSM_HELM_OPTS="${OSM_HELM_OPTS} --set nbi.useOsmSecret=false" + +# TODO: review if next line is really needed or should be conditional to DOCKER_REGISTRY_URL not empty +# [ -n "${DOCKER_REGISTRY_URL}" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.image.repository=${DOCKER_REGISTRY_URL}${DOCKER_USER}" +OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.image.repositoryBase=${DOCKER_REGISTRY_URL}${DOCKER_USER}" +[ ! "$OSM_DOCKER_TAG" == "testing-daily" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set-string global.image.tag=${OSM_DOCKER_TAG}" +[ ! "$OSM_DOCKER_TAG" == "testing-daily" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set prometheus.server.sidecarContainers.prometheus-config-sidecar.image=${DOCKER_REGISTRY_URL}${DOCKER_USER}/prometheus:${OSM_DOCKER_TAG}" + +OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.hostname=${OSM_K8S_EXTERNAL_IP}.nip.io" +OSM_HELM_OPTS="${OSM_HELM_OPTS} --set grafana.ingress.hosts={grafana.${OSM_K8S_EXTERNAL_IP}.nip.io}" +OSM_HELM_OPTS="${OSM_HELM_OPTS} --set prometheus.server.ingress.hosts={prometheus.${OSM_K8S_EXTERNAL_IP}.nip.io}" +# OSM_HELM_OPTS="${OSM_HELM_OPTS} --set prometheus.alertmanager.ingress.hosts={alertmanager.${OSM_K8S_EXTERNAL_IP}.nip.io}" +if [ -z "${OSM_GITOPS_ENABLED}" ]; then + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.gitops.enabled=false" +else + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.gitops.fleetRepoUrl=${FLEET_REPO_HTTP_URL}" + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.gitops.swcatalogsRepoUrl=${SW_CATALOGS_REPO_HTTP_URL}" + # TODO: evaluate if we need to set two git user names, one for fleet and one for sw-catalogs + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.gitops.gitUser=${FLEET_REPO_GIT_USERNAME}" + AGE_MGMT_PUBKEY=$(tr -d '\n' < ${CREDENTIALS_DIR}/age.mgmt.pub) + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.gitops.pubkey=${AGE_MGMT_PUBKEY}" +fi + +if [ -n "${OSM_BEHIND_PROXY}" ]; then + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.behindHttpProxy=true" + [ -n "${HTTP_PROXY}" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.httpProxy.HTTP_PROXY=\"${HTTP_PROXY}\"" + [ -n "${HTTPS_PROXY}" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.httpProxy.HTTPS_PROXY=\"${HTTPS_PROXY}\"" + if [ -n "${NO_PROXY}" ]; then + if [[ ! "${NO_PROXY}" =~ .*".svc".* ]]; then + NO_PROXY="${NO_PROXY},.svc" + fi + if [[ ! "${NO_PROXY}" =~ .*".cluster.local".* ]]; then + NO_PROXY="${NO_PROXY},.cluster.local" + fi + OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.httpProxy.NO_PROXY=\"${NO_PROXY//,/\,}\"" + fi +fi + +echo "helm upgrade --install -n $OSM_NAMESPACE --create-namespace $OSM_HELM_RELEASE ${HERE}/helm/osm ${OSM_HELM_OPTS}" +helm upgrade --install -n $OSM_NAMESPACE --create-namespace $OSM_HELM_RELEASE ${HERE}/helm/osm ${OSM_HELM_OPTS} +# Override existing values.yaml with the final values.yaml used to install OSM +helm -n $OSM_NAMESPACE get values $OSM_HELM_RELEASE | sudo tee -a ${OSM_HELM_WORK_DIR}/osm-values.yaml + +# Check OSM health state +echo -e "Checking OSM health state..." +set +e +${HERE}/45-osm-health.sh || \ +(echo -e "OSM is not healthy, but will probably converge to a healthy state soon." && \ +echo -e "Check OSM status with: kubectl -n ${OSM_NAMESPACE} get all" && \ +track healthchecks osm_unhealthy didnotconverge) +track healthchecks after_healthcheck_ok +set -e + +echo -e "Saving OSM enviroment to credentials folder..." +OSM_HOSTNAME=$(kubectl get --namespace osm -o jsonpath="{.spec.rules[0].host}" ingress nbi-ingress) +# OSM_HOSTNAME="nbi.${OSM_K8S_EXTERNAL_IP}.nip.io:443" +echo -e "OSM HOSTNAME: ${OSM_HOSTNAME}" + +cat << EOF > "${CREDENTIALS_DIR}/osm_environment.rc" +export OSM_HOSTNAME="${OSM_HOSTNAME}" +EOF diff --git a/installers/45-osm-health.sh b/installers/45-osm-health.sh new file mode 100755 index 00000000..c5d9cd81 --- /dev/null +++ b/installers/45-osm-health.sh @@ -0,0 +1,110 @@ +#!/usr/bin/env bash + +# Copyright 2020 Telefónica Investigación y Desarrollo S.A.U. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") + +source "${HERE}/00-default-install-options.rc" +[ ! -f "${OSM_HOME_DIR}/user-install-options.rc" ] || source "${OSM_HOME_DIR}/user-install-options.rc" +source "${CREDENTIALS_DIR}/git_environment.rc" +export KUBECONFIG="${OSM_HOME_DIR}/clusters/kubeconfig-osm.yaml" + +# Default values +sampling_period=5 # seconds +time_for_readiness=1 # minutes ready +time_for_failure=7 # minutes broken + +oks_threshold=$((time_for_readiness*60/${sampling_period})) # No. ok samples to declare the system ready +failures_threshold=$((time_for_failure*60/${sampling_period})) # No. nok samples to declare the system broken +failures_in_a_row=0 +oks_in_a_row=0 + + +# Show status of the OSM services deployed with helm +echo "helm -n ${OSM_NAMESPACE} list" +helm -n ${OSM_NAMESPACE} list +echo "helm -n ${OSM_NAMESPACE} status ${OSM_HELM_RELEASE}" +helm -n ${OSM_NAMESPACE} status ${OSM_HELM_RELEASE} + +#################################################################################### +# Loop to check system readiness +#################################################################################### +while [[ (${failures_in_a_row} -lt ${failures_threshold}) && (${oks_in_a_row} -lt ${oks_threshold}) ]] +do + + # State of Deployments + DEPLOYMENTS_STATE=$(kubectl get deployment -n ${OSM_NAMESPACE} --no-headers 2>&1) + DEPLOYMENTS_READY=$(echo "${DEPLOYMENTS_STATE}" | awk '$2=="1/1" && $4=="1" {printf ("%20s\t%s\t%s\n", $1, $2, $4)}') + DEPLOYMENTS_NOT_READY=$(echo "${DEPLOYMENTS_STATE}" | awk '$2!="1/1" || $4!="1" {printf ("%20s\t%s\t%s\n", $1, $2, $4)}') + COUNT_DEPLOYMENTS_READY=$(echo "${DEPLOYMENTS_READY}" | grep -v -e '^$' | wc -l || true) + COUNT_DEPLOYMENTS_NOT_READY=$(echo "${DEPLOYMENTS_NOT_READY}" | grep -v -e '^$' | wc -l || true) + + # State of Statefulsets + STS_STATE=$(kubectl get statefulset -n ${OSM_NAMESPACE} --no-headers 2>&1) + STS_READY=$(echo "${STS_STATE}" | awk '$2=="1/1" || $2=="2/2" || $2=="3/3" {printf ("%20s\t%s\t%s\n", $1, $2, $4)}') + STS_NOT_READY=$(echo "${STS_STATE}" | awk '$2!="1/1" && $2!="2/2" && $2!="3/3" {printf ("%20s\t%s\t%s\n", $1, $2, $4)}') + COUNT_STS_READY=$(echo "${STS_READY}" | grep -v -e '^$' | wc -l || true) + COUNT_STS_NOT_READY=$(echo "${STS_NOT_READY}" | grep -v -e '^$' | wc -l || true) + + # OK sample + if [[ $((${COUNT_DEPLOYMENTS_NOT_READY}+${COUNT_STS_NOT_READY})) -eq 0 ]] + then + ((++oks_in_a_row)) + failures_in_a_row=0 + echo -ne ===\> Successful checks: "${oks_in_a_row}"/${oks_threshold}\\r + # NOK sample + else + ((++failures_in_a_row)) + oks_in_a_row=0 + echo + echo Bootstraping... "${failures_in_a_row}" attempts of ${failures_threshold} + + # Reports failed deployments + if [[ "${COUNT_DEPLOYMENTS_NOT_READY}" -ne 0 ]] + then + echo ${COUNT_DEPLOYMENTS_NOT_READY} of $((${COUNT_DEPLOYMENTS_NOT_READY}+${COUNT_DEPLOYMENTS_READY})) deployments starting: + echo "${DEPLOYMENTS_NOT_READY}" + echo + fi + + # Reports failed statefulsets + if [[ "${COUNT_STS_NOT_READY}" -ne 0 ]] + then + echo ${COUNT_STS_NOT_READY} of $((${COUNT_STS_NOT_READY}+${COUNT_STS_READY})) statefulsets starting: + echo "${STS_NOT_READY}" + echo + fi + fi + + #------------ NEXT SAMPLE + sleep ${sampling_period} + +done + + +#################################################################################### +# OUTCOME +#################################################################################### +if [[ (${failures_in_a_row} -ge ${failures_threshold}) ]] +then + echo + echo SYSTEM IS BROKEN + exit 1 +else + echo + echo SYSTEM IS READY +fi + +exit 0 diff --git a/installers/50-provision-osm.sh b/installers/50-provision-osm.sh new file mode 100755 index 00000000..2f93b00f --- /dev/null +++ b/installers/50-provision-osm.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e -o pipefail +set -x + +HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") +source "${HERE}/../library/functions.sh" +source "${HERE}/../library/trap.sh" +source "${HERE}/../library/logging" +source "${HERE}/../library/track" + +source "${HERE}/00-default-install-options.rc" +[ ! -f "${OSM_HOME_DIR}/user-install-options.rc" ] || source "${OSM_HOME_DIR}/user-install-options.rc" +source "${CREDENTIALS_DIR}/osm_environment.rc" + +KUBECONFIG_OSM_CLUSTER_FILE="${OSM_HOME_DIR}/clusters/kubeconfig-osm.yaml" + +[ -n "${OSM_HOSTNAME}" ] || FATAL "OSM_HOSTNAME is not set" "${OSM_HOSTNAME}" \ + "Please set the OSM_HOSTNAME environment variable to the hostname of your OSM instance." +[ "$(which osm)" = "$HOME/.local/bin/osm" ] || export PATH=$HOME/.local/bin:${PATH} +osm --hostname ${OSM_HOSTNAME} --all-projects vim-create \ + --name _system-osm-vim \ + --account_type dummy \ + --auth_url http://dummy \ + --user osm --password osm --tenant osm \ + --description "dummy" \ + --config '{management_network_name: mgmt}' +osm --hostname ${OSM_HOSTNAME} --all-projects k8scluster-add \ + --creds ${KUBECONFIG_OSM_CLUSTER_FILE} \ + --vim _system-osm-vim \ + --k8s-nets '{"net1": null}' \ + --version '1.29' \ + --description "OSM Internal Cluster" \ + _system-osm-k8s diff --git a/installers/install_cluster_addons.sh b/installers/cluster/addons/install_cluster_addons.sh similarity index 92% rename from installers/install_cluster_addons.sh rename to installers/cluster/addons/install_cluster_addons.sh index 8f42c7f1..1bb9162f 100755 --- a/installers/install_cluster_addons.sh +++ b/installers/cluster/addons/install_cluster_addons.sh @@ -63,8 +63,8 @@ function install_helm_metallb() { function configure_ipaddresspool_metallb() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - echo "Creating IP address pool manifest: ${OSM_CLUSTER_WORK_DIR}/metallb-ipaddrpool.yaml" - [ ! -d "$OSM_CLUSTER_WORK_DIR" ] && sudo mkdir -p $OSM_CLUSTER_WORK_DIR + echo "Creating IP address pool manifest: ${K8SCLUSTER_CONFIG_FOLDER}/metallb-ipaddrpool.yaml" + [ ! -d "$K8SCLUSTER_CONFIG_FOLDER" ] && sudo mkdir -p $K8SCLUSTER_CONFIG_FOLDER METALLB_IP_RANGE="$DEFAULT_IP/32" echo "apiVersion: metallb.io/v1beta1 kind: IPAddressPool @@ -73,9 +73,9 @@ metadata: namespace: metallb-system spec: addresses: - - ${METALLB_IP_RANGE}" | sudo tee -a ${OSM_CLUSTER_WORK_DIR}/metallb-ipaddrpool.yaml - echo "Applying IP address pool manifest: kubectl apply -f ${OSM_CLUSTER_WORK_DIR}/metallb-ipaddrpool.yaml" - kubectl apply -f ${OSM_CLUSTER_WORK_DIR}/metallb-ipaddrpool.yaml || FATAL_TRACK k8scluster "Cannot create IP address Pool in MetalLB" + - ${METALLB_IP_RANGE}" | sudo tee -a ${K8SCLUSTER_CONFIG_FOLDER}/metallb-ipaddrpool.yaml + echo "Applying IP address pool manifest: kubectl apply -f ${K8SCLUSTER_CONFIG_FOLDER}/metallb-ipaddrpool.yaml" + kubectl apply -f ${K8SCLUSTER_CONFIG_FOLDER}/metallb-ipaddrpool.yaml || FATAL_TRACK k8scluster "Cannot create IP address Pool in MetalLB" [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } @@ -216,17 +216,8 @@ function check_for_readiness() { } # main -while getopts ":D:d:i:-: " o; do +while getopts ":-: " o; do case "${o}" in - i) - DEFAULT_IP="${OPTARG}" - ;; - d) - OSM_CLUSTER_WORK_DIR="${OPTARG}" - ;; - D) - OSM_DEVOPS="${OPTARG}" - ;; -) [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="y" && continue [ "${OPTARG}" == "storageclass" ] && INSTALL_STORAGECLASS="y" && continue @@ -253,19 +244,18 @@ done DEBUG_INSTALL=${DEBUG_INSTALL:-} DEFAULT_IP=${DEFAULT_IP:-} -OSM_DEVOPS=${OSM_DEVOPS:-} -OSM_CLUSTER_WORK_DIR=${OSM_CLUSTER_WORK_DIR:-} +K8SCLUSTER_CONFIG_FOLDER=${K8SCLUSTER_CONFIG_FOLDER:-} INSTALL_STORAGECLASS=${INSTALL_STORAGECLASS:-} INSTALL_METALLB=${INSTALL_METALLB:-} INSTALL_CERTMANAGER=${INSTALL_CERTMANAGER:-} INSTALL_NGINX=${INSTALL_NGINX:-} echo "DEBUG_INSTALL=${DEBUG_INSTALL}" echo "DEFAULT_IP=${DEFAULT_IP}" -echo "OSM_DEVOPS=${OSM_DEVOPS}" -echo "OSM_CLUSTER_WORK_DIR=${OSM_CLUSTER_WORK_DIR}" +echo "K8SCLUSTER_CONFIG_FOLDER=${K8SCLUSTER_CONFIG_FOLDER}" -source $OSM_DEVOPS/common/logging -source $OSM_DEVOPS/common/track +export HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") +source "${HERE}/../../../library/logging" +source "${HERE}/../../../library/track" if [ -n "${INSTALL_STORAGECLASS}" ]; then install_k8s_storageclass diff --git a/installers/install_k3s_cluster.sh b/installers/cluster/k3s/install_k3s_cluster.sh similarity index 83% rename from installers/install_k3s_cluster.sh rename to installers/cluster/k3s/install_k3s_cluster.sh index 68e61a6e..0368b641 100755 --- a/installers/install_k3s_cluster.sh +++ b/installers/cluster/k3s/install_k3s_cluster.sh @@ -172,15 +172,6 @@ function check_for_readiness() { [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } -# Install kubectl client -function install_kubectl() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - curl -LO "https://dl.k8s.io/release/${K8S_CLIENT_VERSION}/bin/linux/amd64/kubectl" - sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl - rm kubectl - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - # Initializes kubeconfig file function save_kubeconfig() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function @@ -198,52 +189,8 @@ function save_kubeconfig() { [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } -# main -while getopts ":D:i:e:p:d:u:P:-: " o; do - case "${o}" in - i) - DEFAULT_IP="${OPTARG}" - ;; - e) - K3S_PUBLIC_IP="${OPTARG}" - ;; - D) - OSM_DEVOPS="${OPTARG}" - ;; - p) - DOCKER_PROXY_URL="${OPTARG}" - ;; - d) - DOCKER_REGISTRY_URL="${OPTARG}" - ;; - u) - DOCKER_REGISTRY_USER="${OPTARG}" - ;; - P) - DOCKER_REGISTRY_PASSWORD="${OPTARG}" - ;; - -) - [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="y" && continue - echo -e "Invalid option: '--$OPTARG'\n" >&2 - exit 1 - ;; - :) - echo "Option -$OPTARG requires an argument" >&2 - exit 1 - ;; - \?) - echo -e "Invalid option: '-$OPTARG'\n" >&2 - exit 1 - ;; - *) - exit 1 - ;; - esac -done - DEBUG_INSTALL=${DEBUG_INSTALL:-} DEFAULT_IP=${DEFAULT_IP:-"127.0.0.1"} -OSM_DEVOPS=${OSM_DEVOPS:-"/usr/share/osm-devops"} DOCKER_PROXY_URL=${DOCKER_PROXY_URL:-} DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL:-} DOCKER_REGISTRY_USER=${DOCKER_REGISTRY_USER:-} @@ -251,24 +198,21 @@ DOCKER_REGISTRY_PASSWORD=${DOCKER_REGISTRY_PASSWORD:-} K3S_PUBLIC_IP=${K3S_PUBLIC_IP:-} echo "DEBUG_INSTALL=${DEBUG_INSTALL}" echo "DEFAULT_IP=${DEFAULT_IP}" -echo "OSM_DEVOPS=${OSM_DEVOPS}" echo "DOCKER_PROXY_URL=${DOCKER_PROXY_URL}" echo "DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL}" echo "DOCKER_REGISTRY_USER=${DOCKER_REGISTRY_USER}" echo "K3S_PUBLIC_IP=${K3S_PUBLIC_IP}" -echo "HOME=$HOME" -source $OSM_DEVOPS/common/logging -source $OSM_DEVOPS/common/track +export HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") +source "${HERE}/../../../library/logging" +source "${HERE}/../../../library/track" configure_registry install_k3s +save_kubeconfig track k8scluster k3s_install_ok check_for_readiness track k8scluster k3s_node_ready_ok # update_service_nodeport_range # check_for_readiness -# track k8scluster k3s_update_nodeport_range_ok -install_kubectl -save_kubeconfig track k8scluster k3s_creds_ok diff --git a/installers/install_kubeadm_cluster.sh b/installers/cluster/kubeadm/install_kubeadm_cluster.sh similarity index 85% rename from installers/install_kubeadm_cluster.sh rename to installers/cluster/kubeadm/install_kubeadm_cluster.sh index be978143..ecca8dcc 100755 --- a/installers/install_kubeadm_cluster.sh +++ b/installers/cluster/kubeadm/install_kubeadm_cluster.sh @@ -91,7 +91,7 @@ function deploy_cni_provider() { CNI_DIR="$(mktemp -d -q --tmpdir "flannel.XXXXXX")" trap 'rm -rf "${CNI_DIR}"' EXIT KUBE_FLANNEL_FILE_URL="https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml" - wget --retry-on-host-error --retry-on-http-error 404,429,503 --tries=5 "${KUBE_FLANNEL_FILE_URL}" -P $CNI_DIR + curl -f --retry 5 --retry-delay 2 --retry-connrefused "${KUBE_FLANNEL_FILE_URL}" -o "$CNI_DIR/$(basename ${KUBE_FLANNEL_FILE_URL})" [ ! -f $CNI_DIR/kube-flannel.yml ] && FATAL_TRACK k8scluster "Cannot Install Flannel because $CNI_DIR/kube-flannel.yml was not found. Maybe the file ${KUBE_FLANNEL_FILE_URL} is temporarily not accessible" kubectl apply -f $CNI_DIR [ $? -ne 0 ] && FATAL_TRACK k8scluster "Cannot Install Flannel" @@ -133,14 +133,8 @@ function remove_k8s_namespace() { } # main -while getopts ":D:d:-: " o; do +while getopts ":-: " o; do case "${o}" in - d) - OSM_CLUSTER_WORK_DIR="${OPTARG}" - ;; - D) - OSM_DEVOPS="${OPTARG}" - ;; -) [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="y" && continue echo -e "Invalid option: '--$OPTARG'\n" >&2 @@ -161,25 +155,24 @@ while getopts ":D:d:-: " o; do done DEBUG_INSTALL=${DEBUG_INSTALL:-} -OSM_DEVOPS=${OSM_DEVOPS:-"/usr/share/osm-devops"} -OSM_CLUSTER_WORK_DIR=${OSM_CLUSTER_WORK_DIR:-"/etc/osm"} +K8SCLUSTER_CONFIG_FOLDER=${K8SCLUSTER_CONFIG_FOLDER:-"/etc/osm"} echo "DEBUG_INSTALL=$DEBUG_INSTALL" -echo "OSM_DEVOPS=$OSM_DEVOPS" -echo "OSM_CLUSTER_WORK_DIR=$OSM_CLUSTER_WORK_DIR" +echo "K8SCLUSTER_CONFIG_FOLDER=$K8SCLUSTER_CONFIG_FOLDER" echo "HOME=$HOME" -source $OSM_DEVOPS/common/logging -source $OSM_DEVOPS/common/track +export HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") +source "${HERE}/../../../library/logging" +source "${HERE}/../../../library/track" echo "Creating folders for installation" -[ ! -d "$OSM_CLUSTER_WORK_DIR" ] && sudo mkdir -p $OSM_CLUSTER_WORK_DIR -echo "Copying kubeadm-config from $OSM_DEVOPS/installers/kubeadm-config.yaml to $OSM_CLUSTER_WORK_DIR/kubeadm-config.yaml" -sudo cp -b $OSM_DEVOPS/installers/kubeadm-config.yaml $OSM_CLUSTER_WORK_DIR/kubeadm-config.yaml +[ ! -d "$K8SCLUSTER_CONFIG_FOLDER" ] && sudo mkdir -p $K8SCLUSTER_CONFIG_FOLDER +echo "Copying kubeadm-config from ${HERE}/installers/kubeadm-config.yaml to $K8SCLUSTER_CONFIG_FOLDER/kubeadm-config.yaml" +sudo cp -b "${HERE}/kubeadm-config.yaml" "$K8SCLUSTER_CONFIG_FOLDER/kubeadm-config.yaml" install_kube check_and_track_kube_install -init_kubeadm $OSM_CLUSTER_WORK_DIR/kubeadm-config.yaml +init_kubeadm "${K8SCLUSTER_CONFIG_FOLDER}/kubeadm-config.yaml" save_kubeconfig check_and_track_init_k8s @@ -192,9 +185,5 @@ install_k8s_metrics # Clean existing namespace (idempotent installation) remove_k8s_namespace osm -# install_helm has been moved to install_helm_client.sh, run from full_install_osm.sh, -# but tracking is still here because the installation analytics still expects it -track k8scluster install_helm_ok - -# Installation of storage class, metallb and cert-manager has been moved -# to install_cluster_addons.sh, run from full_install_osm.sh +# Installation of storage class, metallb and cert-manager +# is done outside this script, by install_cluster_addons.sh diff --git a/installers/kubeadm-config.yaml b/installers/cluster/kubeadm/kubeadm-config.yaml similarity index 100% rename from installers/kubeadm-config.yaml rename to installers/cluster/kubeadm/kubeadm-config.yaml diff --git a/installers/install_microk8s_cluster.sh b/installers/cluster/microk8s/install_microk8s_cluster.sh similarity index 100% rename from installers/install_microk8s_cluster.sh rename to installers/cluster/microk8s/install_microk8s_cluster.sh diff --git a/installers/mgmt-cluster/flux/scripts/add-age-key-to-cluster.sh b/installers/flux/scripts/add-age-key-to-cluster.sh similarity index 100% rename from installers/mgmt-cluster/flux/scripts/add-age-key-to-cluster.sh rename to installers/flux/scripts/add-age-key-to-cluster.sh diff --git a/installers/mgmt-cluster/flux/scripts/clone-relevant-repos.sh b/installers/flux/scripts/clone-relevant-repos.sh similarity index 89% rename from installers/mgmt-cluster/flux/scripts/clone-relevant-repos.sh rename to installers/flux/scripts/clone-relevant-repos.sh index 93ffad9e..6bf3d93f 100755 --- a/installers/mgmt-cluster/flux/scripts/clone-relevant-repos.sh +++ b/installers/flux/scripts/clone-relevant-repos.sh @@ -24,15 +24,16 @@ source "${HERE}/library/trap.sh" # Creates base dir in case it did not exist +export WORK_REPOS_DIR="${OSM_HOME_DIR}/repos" mkdir -p "${WORK_REPOS_DIR}" # Clones `fleet-osm` repo [[ "${REMOVE_LOCAL_DIR_BEFORE_CLONING}" == "true" ]] && rm -rf "${FLEET_REPO_DIR}" -git clone ${GITEA_SSH_URL}/${GITEA_STD_USERNAME}/fleet-osm.git "${FLEET_REPO_DIR}" +git clone "${FLEET_REPO_SSH_URL}" "${FLEET_REPO_DIR}" # Clones `sw-catalogs-osm` repo [[ "${REMOVE_LOCAL_DIR_BEFORE_CLONING}" == "true" ]] && rm -rf "${SW_CATALOGS_REPO_DIR}" -git clone ${GITEA_SSH_URL}/${GITEA_STD_USERNAME}/sw-catalogs-osm.git "${SW_CATALOGS_REPO_DIR}" +git clone "${SW_CATALOGS_REPO_SSH_URL}" "${SW_CATALOGS_REPO_DIR}" # Forces `main` instead of `master` as default branch pushd "${FLEET_REPO_DIR}" > /dev/null diff --git a/installers/mgmt-cluster/flux/scripts/create-age-keypair.sh b/installers/flux/scripts/create-age-keypair.sh similarity index 100% rename from installers/mgmt-cluster/flux/scripts/create-age-keypair.sh rename to installers/flux/scripts/create-age-keypair.sh diff --git a/installers/mgmt-cluster/flux/scripts/create-new-cluster-folder-structure.sh b/installers/flux/scripts/create-new-cluster-folder-structure.sh similarity index 94% rename from installers/mgmt-cluster/flux/scripts/create-new-cluster-folder-structure.sh rename to installers/flux/scripts/create-new-cluster-folder-structure.sh index 9263d745..ef1b0cbb 100755 --- a/installers/mgmt-cluster/flux/scripts/create-new-cluster-folder-structure.sh +++ b/installers/flux/scripts/create-new-cluster-folder-structure.sh @@ -97,8 +97,8 @@ mkdir -p "${APPS_DIR}" cp "${TEMPLATES_DIR}"/* "${CLUSTER_DIR}/" # Repo URLs -export FLEET_REPO_URL="${GITEA_HTTP_URL}/${GITEA_STD_USERNAME}/fleet-osm.git" -export SW_CATALOGS_REPO_URL="${GITEA_HTTP_URL}/${GITEA_STD_USERNAME}/sw-catalogs-osm.git" +export FLEET_REPO_URL="${FLEET_REPO_HTTP_URL}" +export SW_CATALOGS_REPO_URL="${SW_CATALOGS_REPO_HTTP_URL}" export INFRA_CONTROLLERS_PATH="./${MGMT_PROJECT_NAME}/infra-controller-profiles/_management" export INFRA_CONFIGS_PATH="./${MGMT_PROJECT_NAME}/infra-config-profiles/_management" export MANAGED_RESOURCES_PATH="./${MGMT_PROJECT_NAME}/managed-resources/_management" @@ -113,14 +113,14 @@ envsubst < "${TEMPLATES_DIR}/sw-catalogs-repo.yaml" > "${CLUSTER_DIR}/sw-catalog kubectl delete secret fleet-repo --namespace flux-system 2> /dev/null || true kubectl create secret generic fleet-repo \ --namespace flux-system \ - --from-literal=username="${GITEA_STD_USERNAME}" \ - --from-literal=password="${GITEA_STD_USER_PASS}" + --from-literal=username="${FLEET_REPO_GIT_USERNAME}" \ + --from-literal=password="${FLEET_REPO_GIT_USER_PASS}" kubectl delete secret sw-catalogs --namespace flux-system 2> /dev/null || true kubectl create secret generic sw-catalogs \ --namespace flux-system \ - --from-literal=username="${GITEA_STD_USERNAME}" \ - --from-literal=password="${GITEA_STD_USER_PASS}" + --from-literal=username="${SW_CATALOGS_REPO_GIT_USERNAME}" \ + --from-literal=password="${SW_CATALOGS_REPO_GIT_USER_PASS}" # Render Flux `Kustomizations` to sync with default profiles envsubst < "${TEMPLATES_DIR}/infra-controllers.yaml" > "${CLUSTER_DIR}/infra-controllers.yaml" diff --git a/installers/mgmt-cluster/flux/scripts/helper-functions.rc b/installers/flux/scripts/helper-functions.rc similarity index 100% rename from installers/mgmt-cluster/flux/scripts/helper-functions.rc rename to installers/flux/scripts/helper-functions.rc diff --git a/installers/mgmt-cluster/minio/library/functions.sh b/installers/flux/scripts/library/functions.sh similarity index 100% rename from installers/mgmt-cluster/minio/library/functions.sh rename to installers/flux/scripts/library/functions.sh diff --git a/installers/mgmt-cluster/minio/library/trap.sh b/installers/flux/scripts/library/trap.sh similarity index 100% rename from installers/mgmt-cluster/minio/library/trap.sh rename to installers/flux/scripts/library/trap.sh diff --git a/installers/mgmt-cluster/flux/scripts/mgmt-cluster-bootstrap.sh b/installers/flux/scripts/mgmt-cluster-bootstrap.sh similarity index 86% rename from installers/mgmt-cluster/flux/scripts/mgmt-cluster-bootstrap.sh rename to installers/flux/scripts/mgmt-cluster-bootstrap.sh index 9cbda514..c4aa0fce 100755 --- a/installers/mgmt-cluster/flux/scripts/mgmt-cluster-bootstrap.sh +++ b/installers/flux/scripts/mgmt-cluster-bootstrap.sh @@ -24,15 +24,13 @@ source "${HERE}/library/trap.sh" # Bootstrap -REPO=fleet-osm GIT_PATH=./clusters/_management GIT_BRANCH=main -GIT_HTTP_URL=${GITEA_HTTP_URL}/${GITEA_STD_USERNAME}/${REPO}.git flux bootstrap git \ - --url=${GIT_HTTP_URL} \ + --url=${FLEET_REPO_HTTP_URL} \ --allow-insecure-http=true \ - --username=${GITEA_STD_USERNAME} \ - --password="${GITEA_STD_USER_PASS}" \ + --username=${FLEET_REPO_GIT_USERNAME} \ + --password="${FLEET_REPO_GIT_USER_PASS}" \ --token-auth=true \ --branch=${GIT_BRANCH} \ --path=${GIT_PATH} diff --git a/installers/mgmt-cluster/flux/scripts/watch-mgmt-cluster.sh b/installers/flux/scripts/watch-mgmt-cluster.sh similarity index 100% rename from installers/mgmt-cluster/flux/scripts/watch-mgmt-cluster.sh rename to installers/flux/scripts/watch-mgmt-cluster.sh diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/apps.yaml b/installers/flux/templates/fleet/clusters/_management/apps.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/apps.yaml rename to installers/flux/templates/fleet/clusters/_management/apps.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/fleet-repo.yaml b/installers/flux/templates/fleet/clusters/_management/fleet-repo.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/fleet-repo.yaml rename to installers/flux/templates/fleet/clusters/_management/fleet-repo.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/infra-configs.yaml b/installers/flux/templates/fleet/clusters/_management/infra-configs.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/infra-configs.yaml rename to installers/flux/templates/fleet/clusters/_management/infra-configs.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/infra-controllers.yaml b/installers/flux/templates/fleet/clusters/_management/infra-controllers.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/infra-controllers.yaml rename to installers/flux/templates/fleet/clusters/_management/infra-controllers.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/kustomization.yaml b/installers/flux/templates/fleet/clusters/_management/kustomization.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/kustomization.yaml rename to installers/flux/templates/fleet/clusters/_management/kustomization.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/managed-resources.yaml b/installers/flux/templates/fleet/clusters/_management/managed-resources.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/managed-resources.yaml rename to installers/flux/templates/fleet/clusters/_management/managed-resources.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/sw-catalogs-repo.yaml b/installers/flux/templates/fleet/clusters/_management/sw-catalogs-repo.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/sw-catalogs-repo.yaml rename to installers/flux/templates/fleet/clusters/_management/sw-catalogs-repo.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/apps/jenkins/manifests/bitnamicharts-repo.yaml b/installers/flux/templates/sw-catalogs/apps/jenkins/manifests/bitnamicharts-repo.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/apps/jenkins/manifests/bitnamicharts-repo.yaml rename to installers/flux/templates/sw-catalogs/apps/jenkins/manifests/bitnamicharts-repo.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/apps/jenkins/manifests/jenkins-hr.yaml b/installers/flux/templates/sw-catalogs/apps/jenkins/manifests/jenkins-hr.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/apps/jenkins/manifests/jenkins-hr.yaml rename to installers/flux/templates/sw-catalogs/apps/jenkins/manifests/jenkins-hr.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/apps/jenkins/templates/jenkins-ks.yaml b/installers/flux/templates/sw-catalogs/apps/jenkins/templates/jenkins-ks.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/apps/jenkins/templates/jenkins-ks.yaml rename to installers/flux/templates/sw-catalogs/apps/jenkins/templates/jenkins-ks.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/apps/namespace/manifests/namespace.yaml b/installers/flux/templates/sw-catalogs/apps/namespace/manifests/namespace.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/apps/namespace/manifests/namespace.yaml rename to installers/flux/templates/sw-catalogs/apps/namespace/manifests/namespace.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/apps/namespace/templates/namespace-ks.yaml b/installers/flux/templates/sw-catalogs/apps/namespace/templates/namespace-ks.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/apps/namespace/templates/namespace-ks.yaml rename to installers/flux/templates/sw-catalogs/apps/namespace/templates/namespace-ks.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/apps/testacme/manifests/testacme-deploy.yaml b/installers/flux/templates/sw-catalogs/apps/testacme/manifests/testacme-deploy.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/apps/testacme/manifests/testacme-deploy.yaml rename to installers/flux/templates/sw-catalogs/apps/testacme/manifests/testacme-deploy.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/apps/testacme/manifests/testacme-svc.yaml b/installers/flux/templates/sw-catalogs/apps/testacme/manifests/testacme-svc.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/apps/testacme/manifests/testacme-svc.yaml rename to installers/flux/templates/sw-catalogs/apps/testacme/manifests/testacme-svc.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/apps/testacme/templates/testacme-ks.yaml b/installers/flux/templates/sw-catalogs/apps/testacme/templates/testacme-ks.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/apps/testacme/templates/testacme-ks.yaml rename to installers/flux/templates/sw-catalogs/apps/testacme/templates/testacme-ks.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/aks/manifests/aks.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/aks/manifests/aks.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/aks/manifests/aks.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/aks/manifests/aks.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/aks/templates/aks01.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/aks/templates/aks01.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/aks/templates/aks01.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/aks/templates/aks01.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/azure-mysql/manifests/dbformysql.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/azure-mysql/manifests/dbformysql.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/azure-mysql/manifests/dbformysql.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/azure-mysql/manifests/dbformysql.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/azure-mysql/templates/azure-mysql01.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/azure-mysql/templates/azure-mysql01.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/azure-mysql/templates/azure-mysql01.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/azure-mysql/templates/azure-mysql01.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/addons/ebs-csi-addon.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/addons/ebs-csi-addon.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/addons/ebs-csi-addon.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/addons/ebs-csi-addon.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/eks-cluster/eks-cluster.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/eks-cluster/eks-cluster.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/eks-cluster/eks-cluster.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/eks-cluster/eks-cluster.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/eks-cluster/nodegroup.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/eks-cluster/nodegroup.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/eks-cluster/nodegroup.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/eks-cluster/nodegroup.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/policy.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/policy.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/policy.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/policy.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/role-policy-attachment.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/role-policy-attachment.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/role-policy-attachment.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/role-policy-attachment.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/roles.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/roles.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/roles.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/iam/roles.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/gateways.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/gateways.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/gateways.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/gateways.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/routes.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/routes.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/routes.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/routes.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/subnets.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/subnets.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/subnets.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/subnets.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/vpc.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/vpc.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/vpc.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/eks/manifests/network/vpc.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/templates/eks01.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/eks/templates/eks01.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/eks/templates/eks01.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/eks/templates/eks01.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/manifests/namespaces/namespaces.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/manifests/namespaces/namespaces.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/manifests/namespaces/namespaces.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/manifests/namespaces/namespaces.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/manifests/secret/secret-template.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/manifests/secret/secret-template.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/manifests/secret/secret-template.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/manifests/secret/secret-template.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/templates/remote-cluster-bootstrap.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/templates/remote-cluster-bootstrap.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/templates/remote-cluster-bootstrap.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/bootstrap/templates/remote-cluster-bootstrap.yaml diff --git a/installers/mgmt-cluster/flux/templates/fleet/clusters/_management/apps.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/apps.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/fleet/clusters/_management/apps.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/apps.yaml diff --git a/installers/mgmt-cluster/flux/templates/fleet/clusters/_management/fleet-repo.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/fleet-repo.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/fleet/clusters/_management/fleet-repo.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/fleet-repo.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/gotk-components.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/gotk-components.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/gotk-components.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/gotk-components.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/gotk-sync.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/gotk-sync.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/gotk-sync.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/gotk-sync.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/kustomization.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/kustomization.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/kustomization.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/flux-system/kustomization.yaml diff --git a/installers/mgmt-cluster/flux/templates/fleet/clusters/_management/infra-configs.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/infra-configs.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/fleet/clusters/_management/infra-configs.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/infra-configs.yaml diff --git a/installers/mgmt-cluster/flux/templates/fleet/clusters/_management/infra-controllers.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/infra-controllers.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/fleet/clusters/_management/infra-controllers.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/infra-controllers.yaml diff --git a/installers/mgmt-cluster/flux/templates/fleet/clusters/_management/kustomization.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/kustomization.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/fleet/clusters/_management/kustomization.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/kustomization.yaml diff --git a/installers/mgmt-cluster/flux/templates/fleet/clusters/_management/managed-resources.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/managed-resources.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/fleet/clusters/_management/managed-resources.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/managed-resources.yaml diff --git a/installers/mgmt-cluster/flux/templates/fleet/clusters/_management/sw-catalogs-repo.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/sw-catalogs-repo.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/fleet/clusters/_management/sw-catalogs-repo.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/cluster-base/templates/sw-catalogs-repo.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/empty-kustomization/manifests/configmap/reference-cm.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/empty-kustomization/manifests/configmap/reference-cm.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/empty-kustomization/manifests/configmap/reference-cm.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/empty-kustomization/manifests/configmap/reference-cm.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/empty-kustomization/templates/kustomization-placeholder.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/empty-kustomization/templates/kustomization-placeholder.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/empty-kustomization/templates/kustomization-placeholder.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/flux-remote-bootstrap/empty-kustomization/templates/kustomization-placeholder.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/gke/manifests/gke.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/gke/manifests/gke.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/gke/manifests/gke.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/gke/manifests/gke.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/gke/templates/gke01.yaml b/installers/flux/templates/sw-catalogs/cloud-resources/gke/templates/gke01.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/cloud-resources/gke/templates/gke01.yaml rename to installers/flux/templates/sw-catalogs/cloud-resources/gke/templates/gke01.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/crossplane/providers/aws/templates/crossplane-providerconfig-aws.yaml b/installers/flux/templates/sw-catalogs/infra-configs/crossplane/providers/aws/templates/crossplane-providerconfig-aws.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/crossplane/providers/aws/templates/crossplane-providerconfig-aws.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/crossplane/providers/aws/templates/crossplane-providerconfig-aws.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/crossplane/providers/azure/templates/crossplane-providerconfig-azure.yaml b/installers/flux/templates/sw-catalogs/infra-configs/crossplane/providers/azure/templates/crossplane-providerconfig-azure.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/crossplane/providers/azure/templates/crossplane-providerconfig-azure.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/crossplane/providers/azure/templates/crossplane-providerconfig-azure.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/crossplane/providers/gcp/templates/crossplane-providerconfig-gcp.yaml b/installers/flux/templates/sw-catalogs/infra-configs/crossplane/providers/gcp/templates/crossplane-providerconfig-gcp.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/crossplane/providers/gcp/templates/crossplane-providerconfig-gcp.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/crossplane/providers/gcp/templates/crossplane-providerconfig-gcp.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/cluster-role-binding-dashboard.yaml b/installers/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/cluster-role-binding-dashboard.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/cluster-role-binding-dashboard.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/cluster-role-binding-dashboard.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/sa-dashboard.yaml b/installers/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/sa-dashboard.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/sa-dashboard.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/sa-dashboard.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/secret-token-dashboard.yaml b/installers/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/secret-token-dashboard.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/secret-token-dashboard.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/kubernetes-dashboard/templates/secret-token-dashboard.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/sa-and-role.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/sa-and-role.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/sa-and-role.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/sa-and-role.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/clone-transform-push-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/clone-transform-push-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/clone-transform-push-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/clone-transform-push-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/cloud-accounts-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/cloud-accounts-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/cloud-accounts-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/cloud-accounts-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/cluster-management-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/cluster-management-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/cluster-management-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/cluster-management-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/debugging-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/debugging-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/debugging-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/debugging-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/git-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/git-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/git-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/git-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/k8s-resources-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/k8s-resources-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/k8s-resources-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/k8s-resources-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/ksu-management-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/ksu-management-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/ksu-management-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/ksu-management-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/oka-management-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/oka-management-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/oka-management-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/oka-management-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/profile-management-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/profile-management-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/profile-management-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/profile-management-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-attach-profile.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-attach-profile.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-attach-profile.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-attach-profile.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-bootstrap-cluster-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-bootstrap-cluster-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-bootstrap-cluster-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-bootstrap-cluster-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-clone-ksu.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-clone-ksu.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-clone-ksu.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-clone-ksu.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-aks-cluster-and-bootstrap-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-aks-cluster-and-bootstrap-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-aks-cluster-and-bootstrap-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-aks-cluster-and-bootstrap-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-crossplane-cluster-and-bootstrap-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-crossplane-cluster-and-bootstrap-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-crossplane-cluster-and-bootstrap-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-crossplane-cluster-and-bootstrap-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-ksu-generated-hr.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-ksu-generated-hr.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-ksu-generated-hr.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-ksu-generated-hr.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-ksu-hr.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-ksu-hr.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-ksu-hr.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-ksu-hr.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-oka.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-oka.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-oka.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-oka.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-profile.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-profile.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-profile.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-profile.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-providerconfig-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-providerconfig-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-providerconfig-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-providerconfig-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-cluster-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-cluster-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-cluster-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-cluster-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-ksu.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-ksu.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-ksu.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-ksu.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-oka.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-oka.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-oka.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-oka.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-profile.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-profile.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-profile.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-profile.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-providerconfig-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-providerconfig-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-providerconfig-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-providerconfig-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-detach-profile.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-detach-profile.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-detach-profile.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-detach-profile.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-disconnect-flux-remote-cluster-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-disconnect-flux-remote-cluster-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-disconnect-flux-remote-cluster-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-disconnect-flux-remote-cluster-wft.yaml diff --git a/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-uninstall-flux-remote-cluster-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-uninstall-flux-remote-cluster-wft.yaml new file mode 100644 index 00000000..b3ef1d78 --- /dev/null +++ b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-uninstall-flux-remote-cluster-wft.yaml @@ -0,0 +1,140 @@ +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### + +apiVersion: argoproj.io/v1alpha1 +kind: WorkflowTemplate +metadata: + name: full-uninstall-flux-remote-cluster-wft + namespace: osm-workflows + +spec: + arguments: + parameters: + + # Fleet repo + - name: git_fleet_url + - name: fleet_destination_folder + - name: git_fleet_cred_secret + + # Specific parameters + - name: cluster_kustomization_name + - name: project_name + value: "osm_admin" + + # Debugging + - name: dry_run + value: false + + + # # Cleanup policy + # ttlStrategy: + # secondsAfterCompletion: 100 # Time to live after workflow is completed, replaces ttlSecondsAfterFinished + # secondsAfterSuccess: 50 # Time to live after workflow is successful + # secondsAfterFailure: 50 # Time to live after workflow fails + + entrypoint: uninstall-flux + + templates: + + # Main template + - name: uninstall-flux + inputs: + parameters: + # Git repos + - name: git_fleet_url + - name: fleet_destination_folder + - name: git_fleet_cred_secret + + # Specific parameters + - name: cluster_kustomization_name + - name: project_name + + # Debugging + - name: dry_run + + steps: + + # ------ Preparations for transaction + - - name: generate-fleet-volume-repo + templateRef: + name: k8s-resources-wft + template: generate-volume + arguments: + parameters: + - name: pvc-size + value: '100Mi' + - - name: clone-fleet + templateRef: + name: git-wft + template: git-clone + arguments: + parameters: + - name: mount_path + value: "/fleet" + - name: repo_url + value: "{{inputs.parameters.git_fleet_url}}" + - name: destination_folder + value: "{{inputs.parameters.fleet_destination_folder}}" + - name: git_cred_secret + value: "{{inputs.parameters.git_fleet_cred_secret}}" + - name: git_volume_name + value: '{{steps.generate-fleet-volume-repo.outputs.parameters.pvc-name}}' + # ------ end of preparations for transaction + + # ------ Transformations + - - name: delete-cluster + templateRef: + name: cluster-management-wft + template: delete-cluster + arguments: + parameters: + # Volumes with cloned repos + - name: fleet_volume_name + value: '{{steps.generate-fleet-volume-repo.outputs.parameters.pvc-name}}' + - name: fleet_mount_path + value: "/fleet" + # Specific parameters + - name: cluster_kustomization_name + value: "{{inputs.parameters.cluster_kustomization_name}}" + - name: project_name + value: "{{inputs.parameters.project_name}}" + # ------ end of transformations + + # ------ Commit transaction + - - name: push-to-fleet + templateRef: + name: git-wft + template: git-commit-merge-push + arguments: + parameters: + - name: mount_path + value: "/fleet" + - name: repo_folder + value: "{{inputs.parameters.fleet_destination_folder}}" + - name: git_cred_secret + value: "{{inputs.parameters.git_fleet_cred_secret}}" + - name: git_volume_name + value: '{{steps.generate-fleet-volume-repo.outputs.parameters.pvc-name}}' + - name: commit_message + value: "Delete cluster {{inputs.parameters.cluster_kustomization_name}}" + - name: main_branch + value: main + - name: contrib_branch + value: osm_contrib + - name: dry_run + value: "{{inputs.parameters.dry_run}}" +# ------ end of commit transaction diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-aks-cluster.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-aks-cluster.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-aks-cluster.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-aks-cluster.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-crossplane-cluster-and-bootstrap-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-crossplane-cluster-and-bootstrap-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-crossplane-cluster-and-bootstrap-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-crossplane-cluster-and-bootstrap-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-ksu-generated-hr.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-ksu-generated-hr.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-ksu-generated-hr.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-ksu-generated-hr.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-ksu-hr.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-ksu-hr.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-ksu-hr.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-ksu-hr.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-oka.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-oka.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-oka.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-oka.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-providerconfig-wft.yaml b/installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-providerconfig-wft.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-providerconfig-wft.yaml rename to installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-update-providerconfig-wft.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/argo-workflows/manifests/argo-namespace.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/argo-workflows/manifests/argo-namespace.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/argo-workflows/manifests/argo-namespace.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/argo-workflows/manifests/argo-namespace.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/argo-workflows/manifests/argo-wf-controller.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/argo-workflows/manifests/argo-wf-controller.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/argo-workflows/manifests/argo-wf-controller.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/argo-workflows/manifests/argo-wf-controller.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/argo-workflows/templates/argo-workflows.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/argo-workflows/templates/argo-workflows.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/argo-workflows/templates/argo-workflows.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/argo-workflows/templates/argo-workflows.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/cert-manager/manifests/cert-manager-chart.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/cert-manager/manifests/cert-manager-chart.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/cert-manager/manifests/cert-manager-chart.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/cert-manager/manifests/cert-manager-chart.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/cert-manager/templates/cert-manager-ks.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/cert-manager/templates/cert-manager-ks.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/cert-manager/templates/cert-manager-ks.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/cert-manager/templates/cert-manager-ks.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-helmrelease.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-helmrelease.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-helmrelease.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-helmrelease.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-helmrepo.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-helmrepo.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-helmrepo.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-helmrepo.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-namespace.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-namespace.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-namespace.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/crossplane-namespace.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/kustomization.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/kustomization.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/kustomization.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/manifests/kustomization.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/templates/crossplane.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/templates/crossplane.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/templates/crossplane.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/controller/templates/crossplane.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-ec2.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-ec2.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-ec2.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-ec2.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-eks.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-eks.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-eks.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-eks.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-iam.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-iam.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-iam.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-iam.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-vpc.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-vpc.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-vpc.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/manifests/provider-vpc.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/templates/crossplane-aws-providers.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/templates/crossplane-aws-providers.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/templates/crossplane-aws-providers.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/aws/templates/crossplane-aws-providers.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/manifests/provider-azure-container.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/manifests/provider-azure-container.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/manifests/provider-azure-container.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/manifests/provider-azure-container.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/manifests/provider-azure-dbformysql.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/manifests/provider-azure-dbformysql.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/manifests/provider-azure-dbformysql.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/manifests/provider-azure-dbformysql.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/templates/crossplane-azure-providers.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/templates/crossplane-azure-providers.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/templates/crossplane-azure-providers.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/azure/templates/crossplane-azure-providers.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/manifests/provider-gcp-cloudplatform.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/manifests/provider-gcp-cloudplatform.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/manifests/provider-gcp-cloudplatform.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/manifests/provider-gcp-cloudplatform.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/manifests/provider-gcp-container.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/manifests/provider-gcp-container.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/manifests/provider-gcp-container.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/manifests/provider-gcp-container.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/templates/crossplane-gcp-providers.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/templates/crossplane-gcp-providers.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/templates/crossplane-gcp-providers.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/crossplane/providers/gcp/templates/crossplane-gcp-providers.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/ingress-nginx/manifests/ingress-nginx.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/ingress-nginx/manifests/ingress-nginx.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/ingress-nginx/manifests/ingress-nginx.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/ingress-nginx/manifests/ingress-nginx.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/ingress-nginx/templates/ingress-nginx-ks.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/ingress-nginx/templates/ingress-nginx-ks.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/ingress-nginx/templates/ingress-nginx-ks.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/ingress-nginx/templates/ingress-nginx-ks.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/grafana.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/grafana.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/grafana.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/grafana.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/jaeger.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/jaeger.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/jaeger.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/jaeger.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/kiali.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/kiali.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/kiali.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/kiali.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/loki.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/loki.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/loki.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/loki.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/prometheus.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/prometheus.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/prometheus.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/addons/prometheus.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-hr.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-hr.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-hr.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-hr.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-namespace.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-namespace.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-namespace.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-namespace.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-repo.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-repo.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-repo.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/istio/manifests/core/istio-repo.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/templates/istio-addons-ks.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/istio/templates/istio-addons-ks.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/templates/istio-addons-ks.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/istio/templates/istio-addons-ks.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/templates/istio-core-ks.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/istio/templates/istio-core-ks.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/istio/templates/istio-core-ks.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/istio/templates/istio-core-ks.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/komoplane/manifests/komodorio-repo.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/komoplane/manifests/komodorio-repo.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/komoplane/manifests/komodorio-repo.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/komoplane/manifests/komodorio-repo.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/komoplane/manifests/komoplane-hr.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/komoplane/manifests/komoplane-hr.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/komoplane/manifests/komoplane-hr.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/komoplane/manifests/komoplane-hr.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/komoplane/templates/komoplane-ks.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/komoplane/templates/komoplane-ks.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/komoplane/templates/komoplane-ks.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/komoplane/templates/komoplane-ks.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/manifests/kubernetes-dashboard-hr.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/manifests/kubernetes-dashboard-hr.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/manifests/kubernetes-dashboard-hr.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/manifests/kubernetes-dashboard-hr.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/manifests/kubernetes-dashboard-repo.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/manifests/kubernetes-dashboard-repo.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/manifests/kubernetes-dashboard-repo.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/manifests/kubernetes-dashboard-repo.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/templates/kubernetes-dashboard-ks.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/templates/kubernetes-dashboard-ks.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/templates/kubernetes-dashboard-ks.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/kubernetes-dashboard/templates/kubernetes-dashboard-ks.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/weave-gitops/manifests/weave-gitops-dashboard.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/weave-gitops/manifests/weave-gitops-dashboard.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/weave-gitops/manifests/weave-gitops-dashboard.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/weave-gitops/manifests/weave-gitops-dashboard.yaml diff --git a/installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/weave-gitops/templates/weave-gitops-ks.yaml b/installers/flux/templates/sw-catalogs/infra-controllers/weave-gitops/templates/weave-gitops-ks.yaml similarity index 100% rename from installers/mgmt-cluster/flux/templates/sw-catalogs/infra-controllers/weave-gitops/templates/weave-gitops-ks.yaml rename to installers/flux/templates/sw-catalogs/infra-controllers/weave-gitops/templates/weave-gitops-ks.yaml diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index eaf3bfbd..08d4916c 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -29,487 +29,28 @@ function usage(){ echo -e " -t specify osm docker tag (default is latest)" echo -e " -M : Kubeconfig of an existing cluster to be used as mgmt cluster instead of OSM cluster" echo -e " -G : Kubeconfig of an existing cluster to be used as auxiliary cluster instead of OSM cluster" + echo -e " -O : Kubeconfig of an existing cluster to be used as OSM cluster instead of creating a new one from scratch" echo -e " --no-mgmt-cluster: Do not provision a mgmt cluster for cloud-native gitops operations in OSM (NEW in Release SIXTEEN) (by default, it is installed)" echo -e " --no-aux-cluster: Do not provision an auxiliary cluster for cloud-native gitops operations in OSM (NEW in Release SIXTEEN) (by default, it is installed)" - echo -e " -D : use local devops installation path" - echo -e " -s namespace when installed using k8s, default is osm" - echo -e " -w : Location to store runtime installation" - echo -e " -K: Specifies the name of the controller to use - The controller must be already bootstrapped" + echo -e " -s namespace where OSM helm chart will be deployed (default is osm)" echo -e " -d use docker registry URL instead of dockerhub" echo -e " -p set docker proxy URL as part of docker CE configuration" echo -e " -T specify docker tag for the modules specified with option -m" + echo -e " -U : specify docker user to use when pulling images from a private registry" + echo -e " -D : use particular devops installation path" + echo -e " -e : set the external IP address of the OSM cluster (default is empty, which means autodetect)" echo -e " --debug: debug mode" - echo -e " --nodocker: do not install docker, do not initialize a swarm (assumes docker is already installed and a swarm has been initialized)" - echo -e " --nohostclient: do not install the osmclient" - echo -e " --uninstall: uninstall OSM: remove the containers and delete NAT rules" - echo -e " --showopts: print chosen options and exit (only for debugging)" [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } -function generate_secret() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32 - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function check_packages() { - NEEDED_PACKAGES="$1" - echo -e "Checking required packages: ${NEEDED_PACKAGES}" - for PACKAGE in ${NEEDED_PACKAGES} ; do - dpkg -L ${PACKAGE} - if [ $? -ne 0 ]; then - echo -e "Package ${PACKAGE} is not installed." - echo -e "Updating apt-cache ..." - sudo apt-get update - echo -e "Installing ${PACKAGE} ..." - sudo apt-get install -y ${PACKAGE} || FATAL "failed to install ${PACKAGE}" - fi - done - echo -e "Required packages are present: ${NEEDED_PACKAGES}" -} - -function ask_user(){ - # ask to the user and parse a response among 'y', 'yes', 'n' or 'no'. Case insensitive - # Params: $1 text to ask; $2 Action by default, can be 'y' for yes, 'n' for no, other or empty for not allowed - # Return: true(0) if user type 'yes'; false (1) if user type 'no' - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - read -e -p "$1" USER_CONFIRMATION - while true ; do - [ -z "$USER_CONFIRMATION" ] && [ "$2" == 'y' ] && return 0 - [ -z "$USER_CONFIRMATION" ] && [ "$2" == 'n' ] && return 1 - [ "${USER_CONFIRMATION,,}" == "yes" ] || [ "${USER_CONFIRMATION,,}" == "y" ] && return 0 - [ "${USER_CONFIRMATION,,}" == "no" ] || [ "${USER_CONFIRMATION,,}" == "n" ] && return 1 - read -e -p "Please type 'yes' or 'no': " USER_CONFIRMATION - done - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function install_osmclient(){ - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - CLIENT_RELEASE=${RELEASE#"-R "} - CLIENT_REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg" - CLIENT_REPOSITORY=${REPOSITORY#"-r "} - CLIENT_REPOSITORY_BASE=${REPOSITORY_BASE#"-u "} - key_location=$CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE/$CLIENT_REPOSITORY_KEY - curl $key_location | sudo APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - - sudo add-apt-repository -y "deb [arch=amd64] $CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE $CLIENT_REPOSITORY osmclient IM" - sudo apt-get -y update - sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3-pip - sudo -H LC_ALL=C python3 -m pip install -U pip - sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3-osm-im python3-osmclient - if [ -f /usr/lib/python3/dist-packages/osm_im/requirements.txt ]; then - python3 -m pip install -r /usr/lib/python3/dist-packages/osm_im/requirements.txt - fi - if [ -f /usr/lib/python3/dist-packages/osmclient/requirements.txt ]; then - sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libmagic1 - python3 -m pip install -r /usr/lib/python3/dist-packages/osmclient/requirements.txt - fi - echo -e "\nOSM client installed" - echo "You can get the OSM NBI endpoint using the following command" - echo ' kubectl -n osm get ingress nbi-ingress -o jsonpath="{.spec.rules[0].host}"' - echo "You will have to configure this env variable in your .bashrc file:" - echo " export OSM_HOSTNAME=nbi.${OSM_K8S_EXTERNAL_IP}.nip.io" - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function - return 0 -} - -function docker_login() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - echo "Docker login" - [ -z "${DEBUG_INSTALL}" ] || DEBUG "Docker registry user: ${DOCKER_REGISTRY_USER}" - sg docker -c "docker login -u ${DOCKER_REGISTRY_USER} -p ${DOCKER_REGISTRY_PASSWORD} --password-stdin" - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -#deploys osm pods and services -function deploy_osm_helm_chart() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - # Generate helm values to be passed with -f osm-values.yaml - sudo mkdir -p ${OSM_HELM_WORK_DIR} - - # Generate helm values to be passed with --set - OSM_HELM_OPTS="" - # OSM_HELM_OPTS="${OSM_HELM_OPTS} --set nbi.useOsmSecret=false" - - OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.image.repositoryBase=${DOCKER_REGISTRY_URL}${DOCKER_USER}" - [ ! "$OSM_DOCKER_TAG" == "testing-daily" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set-string global.image.tag=${OSM_DOCKER_TAG}" - [ ! "$OSM_DOCKER_TAG" == "testing-daily" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set prometheus.server.sidecarContainers.prometheus-config-sidecar.image=${DOCKER_REGISTRY_URL}${DOCKER_USER}/prometheus:${OSM_DOCKER_TAG}" - - OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.hostname=${OSM_K8S_EXTERNAL_IP}.nip.io" - OSM_HELM_OPTS="${OSM_HELM_OPTS} --set grafana.ingress.hosts={grafana.${OSM_K8S_EXTERNAL_IP}.nip.io}" - OSM_HELM_OPTS="${OSM_HELM_OPTS} --set prometheus.server.ingress.hosts={prometheus.${OSM_K8S_EXTERNAL_IP}.nip.io}" - # OSM_HELM_OPTS="${OSM_HELM_OPTS} --set prometheus.alertmanager.ingress.hosts={alertmanager.${OSM_K8S_EXTERNAL_IP}.nip.io}" - if [ -z "${INSTALL_MGMT_CLUSTER}" ]; then - OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.gitops.enabled=false" - else - source "${HOME}/.osm/.credentials/gitea_environment.rc" - OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.gitops.gitBaseUrl=${GITEA_HTTP_URL}" - OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.gitops.gitUser=${GITEA_STD_USERNAME}" - AGE_MGMT_PUBKEY=$(tr -d '\n' < ${HOME}/.osm/.credentials/age.mgmt.pub) - OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.gitops.pubkey=${AGE_MGMT_PUBKEY}" - fi - - if [ -n "${OSM_BEHIND_PROXY}" ]; then - OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.behindHttpProxy=true" - [ -n "${HTTP_PROXY}" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.httpProxy.HTTP_PROXY=\"${HTTP_PROXY}\"" - [ -n "${HTTPS_PROXY}" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.httpProxy.HTTPS_PROXY=\"${HTTPS_PROXY}\"" - if [ -n "${NO_PROXY}" ]; then - if [[ ! "${NO_PROXY}" =~ .*".svc".* ]]; then - NO_PROXY="${NO_PROXY},.svc" - fi - if [[ ! "${NO_PROXY}" =~ .*".cluster.local".* ]]; then - NO_PROXY="${NO_PROXY},.cluster.local" - fi - OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.httpProxy.NO_PROXY=\"${NO_PROXY//,/\,}\"" - fi - fi - - echo "helm upgrade --install -n $OSM_NAMESPACE --create-namespace $OSM_NAMESPACE $OSM_DEVOPS/installers/helm/osm ${OSM_HELM_OPTS}" - helm upgrade --install -n $OSM_NAMESPACE --create-namespace $OSM_NAMESPACE $OSM_DEVOPS/installers/helm/osm ${OSM_HELM_OPTS} - # Override existing values.yaml with the final values.yaml used to install OSM - helm -n $OSM_NAMESPACE get values $OSM_NAMESPACE | sudo tee -a ${OSM_HELM_WORK_DIR}/osm-values.yaml - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function add_local_k8scluster() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - # OSM_HOSTNAME=$(kubectl get --namespace osm -o jsonpath="{.spec.rules[0].host}" ingress nbi-ingress) - OSM_HOSTNAME="nbi.${OSM_K8S_EXTERNAL_IP}.nip.io:443" - /usr/bin/osm --hostname ${OSM_HOSTNAME} --all-projects vim-create \ - --name _system-osm-vim \ - --account_type dummy \ - --auth_url http://dummy \ - --user osm --password osm --tenant osm \ - --description "dummy" \ - --config '{management_network_name: mgmt}' - /usr/bin/osm --hostname ${OSM_HOSTNAME} --all-projects k8scluster-add \ - --creds ${HOME}/.kube/config \ - --vim _system-osm-vim \ - --k8s-nets '{"net1": null}' \ - --version '1.29' \ - --description "OSM Internal Cluster" \ - _system-osm-k8s - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function configure_apt_proxy() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - OSM_APT_PROXY=$1 - OSM_APT_PROXY_FILE="/etc/apt/apt.conf.d/osm-apt" - echo "Configuring apt proxy in file ${OSM_APT_PROXY_FILE}" - if [ ! -f ${OSM_APT_PROXY_FILE} ]; then - sudo bash -c "cat < ${OSM_APT_PROXY} -Acquire::http { Proxy \"${OSM_APT_PROXY}\"; } -EOF" - else - sudo sed -i "s|Proxy.*|Proxy \"${OSM_APT_PROXY}\"; }|" ${OSM_APT_PROXY_FILE} - fi - sudo apt-get update || FATAL "Configured apt proxy, but couldn't run 'apt-get update'. Check ${OSM_APT_PROXY_FILE}" - track prereq apt_proxy_configured_ok - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function ask_proceed() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - - [ -z "$ASSUME_YES" ] && ! ask_user "The installation will do the following - 1. Install required packages - 2. Install docker CE - 3. Disable swap space - 4. Install and initialize Kubernetes - as pre-requirements. - Do you want to proceed (Y/n)? " y && echo "Cancelled!" && exit 1 - - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function check_osm_behind_proxy() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - - export OSM_BEHIND_PROXY="" - export OSM_PROXY_ENV_VARIABLES="" - [ -n "${http_proxy}" ] && OSM_BEHIND_PROXY="y" && echo "http_proxy=${http_proxy}" && OSM_PROXY_ENV_VARIABLES="${OSM_PROXY_ENV_VARIABLES} http_proxy" - [ -n "${https_proxy}" ] && OSM_BEHIND_PROXY="y" && echo "https_proxy=${https_proxy}" && OSM_PROXY_ENV_VARIABLES="${OSM_PROXY_ENV_VARIABLES} https_proxy" - [ -n "${HTTP_PROXY}" ] && OSM_BEHIND_PROXY="y" && echo "HTTP_PROXY=${HTTP_PROXY}" && OSM_PROXY_ENV_VARIABLES="${OSM_PROXY_ENV_VARIABLES} HTTP_PROXY" - [ -n "${HTTPS_PROXY}" ] && OSM_BEHIND_PROXY="y" && echo "https_proxy=${HTTPS_PROXY}" && OSM_PROXY_ENV_VARIABLES="${OSM_PROXY_ENV_VARIABLES} HTTPS_PROXY" - [ -n "${no_proxy}" ] && echo "no_proxy=${no_proxy}" && OSM_PROXY_ENV_VARIABLES="${OSM_PROXY_ENV_VARIABLES} no_proxy" - [ -n "${NO_PROXY}" ] && echo "NO_PROXY=${NO_PROXY}" && OSM_PROXY_ENV_VARIABLES="${OSM_PROXY_ENV_VARIABLES} NO_PROXY" - - echo "OSM_BEHIND_PROXY=${OSM_BEHIND_PROXY}" - echo "OSM_PROXY_ENV_VARIABLES=${OSM_PROXY_ENV_VARIABLES}" - - if [ -n "${OSM_BEHIND_PROXY}" ]; then - [ -z "$ASSUME_YES" ] && ! ask_user " -The following env variables have been found for the current user: -${OSM_PROXY_ENV_VARIABLES}. - -This suggests that this machine is behind a proxy and a special configuration is required. -The installer will install Docker CE and a Kubernetes to work behind a proxy using those -env variables. - -Take into account that the installer uses apt, curl, wget and docker. -Depending on the program, the env variables to work behind a proxy might be different -(e.g. http_proxy vs HTTP_PROXY). - -For that reason, it is strongly recommended that at least http_proxy, https_proxy, HTTP_PROXY -and HTTPS_PROXY are defined. - -Finally, some of the programs (apt) are run as sudoer, requiring that those env variables -are also set for root user. If you are not sure whether those variables are configured for -the root user, you can stop the installation now. - -Do you want to proceed with the installation (Y/n)? " y && echo "Cancelled!" && exit 1 - else - echo "This machine is not behind a proxy" - fi - - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function find_devops_folder() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - if [ -z "$OSM_DEVOPS" ]; then - echo -e "\nCreating temporary dir for OSM installation" - OSM_DEVOPS="$(mktemp -d -q --tmpdir "installosm.XXXXXX")" - trap 'rm -rf "$OSM_DEVOPS"' EXIT - git clone https://osm.etsi.org/gerrit/osm/devops.git $OSM_DEVOPS - fi - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function install_docker_ce() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - DOCKER_CE_OPTS="-D ${OSM_DEVOPS} ${DEBUG_INSTALL}" - [ -n "${DOCKER_PROXY_URL}" ] && DOCKER_CE_OPTS="${DOCKER_CE_OPTS} -p ${DOCKER_PROXY_URL}" - [ -n "${OSM_BEHIND_PROXY}" ] && DOCKER_CE_OPTS="${DOCKER_CE_OPTS} -P" - $OSM_DEVOPS/installers/install_docker_ce.sh ${DOCKER_CE_OPTS} || FATAL_TRACK docker_ce "install_docker_ce.sh failed" - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function install_k8s_cluster() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - if [ "${K8S_CLUSTER_ENGINE}" == "kubeadm" ]; then - KUBEADM_INSTALL_OPTS="-d ${OSM_WORK_DIR} -D ${OSM_DEVOPS} ${DEBUG_INSTALL}" - $OSM_DEVOPS/installers/install_kubeadm_cluster.sh ${KUBEADM_INSTALL_OPTS} || \ - FATAL_TRACK k8scluster "install_kubeadm_cluster.sh failed" - K8SCLUSTER_ADDONS_INSTALL_OPTS="-i ${OSM_DEFAULT_IP} -d ${OSM_WORK_DIR} -D ${OSM_DEVOPS} ${DEBUG_INSTALL} --all" - $OSM_DEVOPS/installers/install_cluster_addons.sh ${K8SCLUSTER_ADDONS_INSTALL_OPTS} || \ - FATAL_TRACK k8scluster "install_cluster_addons.sh failed for kubeadm cluster" - elif [ "${K8S_CLUSTER_ENGINE}" == "k3s" ]; then - K3S_INSTALL_OPTS="-i ${OSM_DEFAULT_IP} -D ${OSM_DEVOPS} ${DEBUG_INSTALL}" - [ "${OSM_K8S_EXTERNAL_IP}" != "${OSM_DEFAULT_IP}" ] && K3S_INSTALL_OPTS="${K3S_INSTALL_OPTS} -e ${OSM_K8S_EXTERNAL_IP}" - [ -n "${DOCKER_PROXY_URL}" ] && K3S_INSTALL_OPTS="${K3S_INSTALL_OPTS} -p ${DOCKER_PROXY_URL}" - [ -n "${DOCKER_REGISTRY_URL}" ] && K3S_INSTALL_OPTS="${K3S_INSTALL_OPTS} -d ${DOCKER_REGISTRY_URL}" - [ -n "${DOCKER_REGISTRY_USER}" ] && K3S_INSTALL_OPTS="${K3S_INSTALL_OPTS} -u ${DOCKER_REGISTRY_USER}" - [ -n "${DOCKER_REGISTRY_PASSWORD}" ] && K3S_INSTALL_OPTS="${K3S_INSTALL_OPTS} -P ${DOCKER_REGISTRY_PASSWORD}" - # The K3s installation script will automatically take the HTTP_PROXY, HTTPS_PROXY and NO_PROXY, - # as well as the CONTAINERD_HTTP_PROXY, CONTAINERD_HTTPS_PROXY and CONTAINERD_NO_PROXY variables - # from the shell, if they are present, and write them to the environment file of k3s systemd service, - $OSM_DEVOPS/installers/install_k3s_cluster.sh ${K3S_INSTALL_OPTS} || \ - FATAL_TRACK k8scluster "install_k3s_cluster.sh failed" - K8SCLUSTER_ADDONS_INSTALL_OPTS="-i ${OSM_DEFAULT_IP} -d ${OSM_WORK_DIR} -D ${OSM_DEVOPS} ${DEBUG_INSTALL} --certmgr --nginx" - $OSM_DEVOPS/installers/install_cluster_addons.sh ${K8SCLUSTER_ADDONS_INSTALL_OPTS} || \ - FATAL_TRACK k8scluster "install_cluster_addons.sh failed for k3s cluster" - fi - echo "Updating fsnotify settings of the system kernel" - sudo bash -c "sysctl -w fs.inotify.max_user_watches=699050 > /etc/sysctl.d/99-custom-osm-sysctl.conf" - sudo bash -c "sysctl -w fs.inotify.max_user_instances=10922 >> /etc/sysctl.d/99-custom-osm-sysctl.conf" - sudo bash -c "sysctl -w fs.inotify.max_queued_events=1398101 >> /etc/sysctl.d/99-custom-osm-sysctl.conf" - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function deploy_osm() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - deploy_osm_helm_chart - track deploy_osm deploy_mongodb_ok - track deploy_osm deploy_osm_services_k8s_ok - track deploy_osm install_osm_ngsa_ok - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function setup_external_ip() { - echo "Determining IP address of the interface with the default route" - [ -z "$OSM_DEFAULT_IF" ] && OSM_DEFAULT_IF=$(ip route list|awk '$1=="default" {print $5; exit}') - [ -z "$OSM_DEFAULT_IF" ] && OSM_DEFAULT_IF=$(route -n |awk '$1~/^0.0.0.0/ {print $8; exit}') - [ -z "$OSM_DEFAULT_IF" ] && FATAL "Not possible to determine the interface with the default route 0.0.0.0" - OSM_DEFAULT_IP=`ip -o -4 a s ${OSM_DEFAULT_IF} |awk '{split($4,a,"/"); print a[1]; exit}'` - [ -z "$OSM_DEFAULT_IP" ] && FATAL "Not possible to determine the IP address of the interface with the default route" - OSM_K8S_EXTERNAL_IP=${OSM_K8S_EXTERNAL_IP:-${OSM_DEFAULT_IP}} -} - -function install_osm() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - - trap ctrl_c INT - - check_osm_behind_proxy - check_packages "git wget curl tar" - find_devops_folder - - track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none os_info $os_info none none - - track checks checkingroot_ok - [ "$USER" == "root" ] && FATAL "You are running the installer as root. The installer is prepared to be executed as a normal user with sudo privileges." - track checks noroot_ok - ask_proceed - track checks proceed_ok - - echo "Installing OSM" - - [ -n "$DOCKER_REGISTRY_URL" ] && parse_docker_registry_url - - echo "Setting up external IP address" - setup_external_ip - - # configure apt proxy - [ -n "$APT_PROXY_URL" ] && configure_apt_proxy $APT_PROXY_URL - - track prereq prereqok_ok - - if [ -n "$INSTALL_DOCKER" ] || [ "${K8S_CLUSTER_ENGINE}" == "kubeadm" ]; then - if [ "${K8S_CLUSTER_ENGINE}" == "kubeadm" ]; then - echo "Kubeadm requires docker, so docker will be installed." - fi - install_docker_ce - [ -n "${DOCKER_REGISTRY_URL}" ] && docker_login - fi - track docker_ce docker_ce_ok - - echo "Installing helm client ..." - $OSM_DEVOPS/installers/install_helm_client.sh -D ${OSM_DEVOPS} ${DEBUG_INSTALL} || \ - FATAL_TRACK k8scluster "install_helm_client.sh failed" - track helm_client install_helm_client_ok - - echo "Installing K8s cluster ..." - install_k8s_cluster - kubectl create namespace ${OSM_NAMESPACE} - track k8scluster k8scluster_ok - - # Install mgmt cluster - echo "Installing mgmt cluster ..." - MGMTCLUSTER_INSTALL_OPTS="-D ${OSM_DEVOPS} ${DEBUG_INSTALL}" - [ -n "${INSTALL_MGMT_CLUSTER}" ] || MGMTCLUSTER_INSTALL_OPTS="${MGMTCLUSTER_INSTALL_OPTS} --no-mgmt-cluster" - [ -n "${INSTALL_AUX_CLUSTER}" ] || MGMTCLUSTER_INSTALL_OPTS="${MGMTCLUSTER_INSTALL_OPTS} --no-aux-cluster" - export KUBECONFIG_MGMT_CLUSTER=${KUBECONFIG_MGMT_CLUSTER:-"$HOME/.kube/config"} - export KUBECONFIG_AUX_CLUSTER=${KUBECONFIG_AUX_CLUSTER:-"$HOME/.kube/config"} - MGMTCLUSTER_INSTALL_OPTS="${MGMTCLUSTER_INSTALL_OPTS} -M ${KUBECONFIG_MGMT_CLUSTER}" - MGMTCLUSTER_INSTALL_OPTS="${MGMTCLUSTER_INSTALL_OPTS} -G ${KUBECONFIG_AUX_CLUSTER}" - echo "Options: ${MGMTCLUSTER_INSTALL_OPTS}" - $OSM_DEVOPS/installers/mgmt-cluster/install_mgmt_cluster.sh ${MGMTCLUSTER_INSTALL_OPTS} || \ - FATAL_TRACK mgmtcluster "install_mgmt_cluster.sh failed" - if [ -n "${INSTALL_MGMT_CLUSTER}" ]; then - echo "Credentials stored under ${HOME}/.osm/.credentials" - echo "Repos stored under ${HOME}/.osm/repos" - fi - track mgmtcluster mgmt_and_aux_cluster_ok - - # Deploy OSM (OSM helm chart) - echo "Deploying OSM in the K8s cluster ..." - deploy_osm - - [ -z "$INSTALL_NOHOSTCLIENT" ] && echo "Installing osmclient ..." && install_osmclient - track osmclient osmclient_ok +HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") +OSM_DEVOPS="${OSM_DEVOPS:-"${HERE}/.."}" +source $OSM_DEVOPS/library/all_funcs +source $OSM_DEVOPS/installers/00-default-install-options.rc - echo -e "Checking OSM health state..." - $OSM_DEVOPS/installers/osm_health.sh -s ${OSM_NAMESPACE} -k || \ - (echo -e "OSM is not healthy, but will probably converge to a healthy state soon." && \ - echo -e "Check OSM status with: kubectl -n ${OSM_NAMESPACE} get all" && \ - track healthchecks osm_unhealthy didnotconverge) - track healthchecks after_healthcheck_ok - echo -e "Adding local K8s cluster _system-osm-k8s to OSM ..." - add_local_k8scluster - track final_ops add_local_k8scluster_ok - - wget -q -O- https://osm-download.etsi.org/ftp/osm-16.0-sixteen/README2.txt &> /dev/null - track end - sudo find /etc/osm - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function - return 0 -} - -function dump_vars(){ - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - echo "APT_PROXY_URL=$APT_PROXY_URL" - echo "K8S_CLUSTER_ENGINE=$K8S_CLUSTER_ENGINE" - echo "DEBUG_INSTALL=$DEBUG_INSTALL" - echo "DOCKER_PROXY_URL=$DOCKER_PROXY_URL" - echo "DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL" - echo "DOCKER_USER=$DOCKER_USER" - echo "INSTALL_DOCKER=$INSTALL_DOCKER" - echo "OSM_DEVOPS=$OSM_DEVOPS" - echo "OSM_DOCKER_TAG=$OSM_DOCKER_TAG" - echo "OSM_K8S_EXTERNAL_IP=$OSM_K8S_EXTERNAL_IP" - echo "OSM_HELM_WORK_DIR=$OSM_HELM_WORK_DIR" - echo "OSM_NAMESPACE=$OSM_NAMESPACE" - echo "OSM_WORK_DIR=$OSM_WORK_DIR" - echo "PULL_IMAGES=$PULL_IMAGES" - echo "RELEASE=$RELEASE" - echo "REPOSITORY=$REPOSITORY" - echo "REPOSITORY_BASE=$REPOSITORY_BASE" - echo "REPOSITORY_KEY=$REPOSITORY_KEY" - echo "SHOWOPTS=$SHOWOPTS" - echo "UNINSTALL=$UNINSTALL" - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function parse_docker_registry_url() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - DOCKER_REGISTRY_USER=$(echo "$DOCKER_REGISTRY_URL" | awk '{split($1,a,"@"); split(a[1],b,":"); print b[1]}') - DOCKER_REGISTRY_PASSWORD=$(echo "$DOCKER_REGISTRY_URL" | awk '{split($1,a,"@"); split(a[1],b,":"); print b[2]}') - DOCKER_REGISTRY_URL=$(echo "$DOCKER_REGISTRY_URL" | awk '{split($1,a,"@"); print a[2]}') - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function ctrl_c() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - echo "** Trapped CTRL-C" - FATAL "User stopped the installation" - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -UNINSTALL="" -SHOWOPTS="" -ASSUME_YES="" -APT_PROXY_URL="" -K8S_CLUSTER_ENGINE="k3s" -DEBUG_INSTALL="" -RELEASE="testing-daily" -REPOSITORY="testing" -INSTALL_DOCKER="" -INSTALL_NOHOSTCLIENT="" -INSTALL_AUX_CLUSTER="y" -INSTALL_MGMT_CLUSTER="y" -OSM_DEVOPS= -OSM_NAMESPACE=osm -REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg" -REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/debian" -OSM_WORK_DIR="/etc/osm" -OSM_HELM_WORK_DIR="${OSM_WORK_DIR}/helm" -OSM_HOST_VOL="/var/lib/osm" -OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_NAMESPACE}" -OSM_DOCKER_TAG="testing-daily" -DOCKER_USER=opensourcemano -PULL_IMAGES="y" -KAFKA_TAG=2.11-1.0.2 -KIWIGRID_K8S_SIDECAR_TAG="1.15.6" -PROMETHEUS_TAG=v2.28.1 -GRAFANA_TAG=8.1.1 -PROMETHEUS_NODE_EXPORTER_TAG=0.18.1 -PROMETHEUS_CADVISOR_TAG=latest -KEYSTONEDB_TAG=10 -OSM_DATABASE_COMMONKEY= -ELASTIC_VERSION=6.4.2 -ELASTIC_CURATOR_VERSION=5.5.4 -POD_NETWORK_CIDR=10.244.0.0/16 -K8S_MANIFEST_DIR="/etc/kubernetes/manifests" RE_CHECK='^[a-z0-9]([-a-z0-9]*[a-z0-9])?$' -DOCKER_REGISTRY_URL= -DOCKER_PROXY_URL= -MODULE_DOCKER_TAG= -OSM_INSTALLATION_TYPE="Default" - -while getopts ":a:c:e:r:n:k:u:R:D:o:O:N:s:t:U:l:L:K:d:p:T:f:F:G:M:-: hy" o; do +while getopts ":a:c:e:r:k:u:R:D:s:t:U:d:p:T:M:G:O:-: hy" o; do case "${o}" in a) APT_PROXY_URL=${OPTARG} @@ -553,11 +94,8 @@ while getopts ":a:c:e:r:n:k:u:R:D:o:O:N:s:t:U:l:L:K:d:p:T:f:F:G:M:-: hy" o; do U) DOCKER_USER="${OPTARG}" ;; - K) - CONTROLLER_NAME="${OPTARG}" - ;; d) - DOCKER_REGISTRY_URL="${OPTARG}" + parse_docker_registry_url "${OPTARG}" ;; p) DOCKER_PROXY_URL="${OPTARG}" @@ -571,16 +109,22 @@ while getopts ":a:c:e:r:n:k:u:R:D:o:O:N:s:t:U:l:L:K:d:p:T:f:F:G:M:-: hy" o; do G) KUBECONFIG_AUX_CLUSTER="${OPTARG}" ;; + O) + KUBECONFIG_OSM_CLUSTER="${OPTARG}" + ;; -) [ "${OPTARG}" == "help" ] && usage && exit 0 [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="--debug" && continue - [ "${OPTARG}" == "uninstall" ] && UNINSTALL="y" && continue [ "${OPTARG}" == "no-mgmt-cluster" ] && INSTALL_MGMT_CLUSTER="" && continue [ "${OPTARG}" == "no-aux-cluster" ] && INSTALL_AUX_CLUSTER="" && continue - [ "${OPTARG}" == "docker" ] && INSTALL_DOCKER="y" && continue - [ "${OPTARG}" == "nodocker" ] && INSTALL_DOCKER="" && continue - [ "${OPTARG}" == "showopts" ] && SHOWOPTS="y" && continue - [ "${OPTARG}" == "nohostclient" ] && INSTALL_NOHOSTCLIENT="y" && continue + if [[ "${OPTARG}" == "client-version" ]]; then + OSM_CLIENT_VERSION="${!OPTIND}"; OPTIND=$((OPTIND + 1)) + continue + fi + if [[ "${OPTARG}" == "im-version" ]]; then + OSM_IM_VERSION="${!OPTIND}"; OPTIND=$((OPTIND + 1)) + continue + fi echo -e "Invalid option: '--$OPTARG'\n" >&2 usage && exit 1 ;; @@ -604,23 +148,12 @@ while getopts ":a:c:e:r:n:k:u:R:D:o:O:N:s:t:U:l:L:K:d:p:T:f:F:G:M:-: hy" o; do esac done -source $OSM_DEVOPS/common/all_funcs [ -z "${DEBUG_INSTALL}" ] || DEBUG Debug is on -[ -n "$SHOWOPTS" ] && dump_vars && exit 0 - -# Uninstall if "--uninstall" -if [ -n "$UNINSTALL" ]; then - ${OSM_DEVOPS}/installers/uninstall_osm.sh "$@" || \ - FATAL_TRACK community_uninstall "uninstall_osm.sh failed" - echo -e "\nDONE" - exit 0 -fi - # Installation starts here # Get README and create OSM_TRACK_INSTALLATION_ID -wget -q -O- https://osm-download.etsi.org/ftp/osm-16.0-sixteen/README.txt &> /dev/null +curl -s https://osm-download.etsi.org/ftp/osm-16.0-sixteen/README.txt > /dev/null 2>&1 export OSM_TRACK_INSTALLATION_ID="$(date +%s)-$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16)" # Get OS info to be tracked @@ -631,8 +164,87 @@ echo $os_release os_info="${os_distro}_${os_release}" os_info="${os_info// /_}" -# Community_installer -# This is where installation starts -install_osm +# Initial checks: proxy, root user, proceed +check_osm_behind_proxy +track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type Default none none os_info $os_info none none +track checks checkingroot_ok +[ "$USER" == "root" ] && FATAL "You are running the installer as root. The installer is prepared to be executed as a normal user with sudo privileges." +track checks noroot_ok +ask_proceed +track checks proceed_ok + +# Setup prerequisites +echo "Setting up external IP address" +setup_external_ip +[ -n "$APT_PROXY_URL" ] && echo "Configuring APT proxy" && configure_apt_proxy $APT_PROXY_URL +track prereq prereqok_ok + +# Export installation options +echo "Load default options and export user installation options" +source $OSM_DEVOPS/installers/00-default-install-options.rc +$OSM_DEVOPS/installers/01-export-osm-install-options.sh || FATAL_TRACK exportinstallopts "01-export-osm-install-options.sh failed" +track exportinstallopts exportinstallopts_ok + +# Setup Client tools +echo "Setup CLI tools for mgmt and aux cluster" +$OSM_DEVOPS/installers/10-install-client-tools.sh || FATAL_TRACK installclitools "10-install-client-tools.sh failed" +track installclitools installclitools_ok + +# Install K8s cluster where all OSM components will be deployed +echo "Installing K8s cluster ..." +source "${HERE}/../library/utils.sh" +# setup_external_ip +export OSM_DEFAULT_IP +export OSM_K8S_EXTERNAL_IP +$OSM_DEVOPS/installers/15-install-k8s-cluster.sh || FATAL_TRACK k8scluster "15-install-k8s-cluster.sh" +track k8scluster k8scluster_ok + +# Deploy auxiliary services +if [ -n "${INSTALL_AUX_CLUSTER}" ]; then + echo "Deploy auxiliary services (Gitea, S3)" + $OSM_DEVOPS/installers/20-deploy-aux-svc-cluster.sh || FATAL_TRACK deployauxsvc "20-deploy-aux-svc-cluster.sh failed" +else + echo "Skipping deployment of auxiliary services." + echo "Using existing git credentials and repos defined in ${CREDENTIALS_DIR}/git_environment.rc" +# cat << EOF > "${CREDENTIALS_DIR}/git_environment.rc" +# export FLEET_REPO_HTTP_URL="${FLEET_REPO_HTTP_URL}" +# export FLEET_REPO_SSH_URL="${FLEET_REPO_SSH_URL}" +# export FLEET_REPO_GIT_USERNAME="${FLEET_REPO_GIT_USERNAME}" +# export FLEET_REPO_GIT_USER_PASS='${FLEET_REPO_GIT_USER_PASS}' +# export SW_CATALOGS_REPO_HTTP_URL="${SW_CATALOGS_REPO_HTTP_URL}" +# export SW_CATALOGS_REPO_SSH_URL="${SW_CATALOGS_REPO_SSH_URL}" +# export SW_CATALOGS_REPO_GIT_USERNAME="${SW_CATALOGS_REPO_GIT_USERNAME}" +# export SW_CATALOGS_REPO_GIT_USER_PASS='${SW_CATALOGS_REPO_GIT_USER_PASS}' +# EOF +fi +track deployauxsvc deployauxsvc_ok + +# Deploy mgmt services +if [ -n "${INSTALL_MGMT_CLUSTER}" ]; then + echo "Deploy mgmt cluster (Flux, etc.)" + $OSM_DEVOPS/installers/30-deploy-mgmt-cluster.sh || FATAL_TRACK mgmtcluster "30-deploy-mgmt-cluster.sh failed" +else + echo "Skipping deployment of mgmt cluster" + # TODO: write env variables to files" +fi +track mgmtcluster mgmtcluster_ok + +# Deploy OSM (OSM helm chart) +echo "Deploy OSM helm chart" +export OSM_K8S_EXTERNAL_IP +$OSM_DEVOPS/installers/40-deploy-osm.sh || FATAL_TRACK deployosm "40-deploy-osm.sh failed" +track deploy_osm deploy_osm_ok + +# Provision OSM +echo -e "Adding local K8s cluster _system-osm-k8s to OSM ..." +$OSM_DEVOPS/installers/50-provision-osm.sh || FATAL_TRACK provision-osm "50-provision-osm.sh failed" +track provisionosm provisionosm_ok + +curl -s https://osm-download.etsi.org/ftp/osm-16.0-sixteen/README2.txt > /dev/null 2>&1 +track end + +echo "Credentials stored under ${CREDENTIALS_DIR}" +echo "Git repos for OSM declarative framework stored under ${WORK_REPOS_DIR}" +echo "Kubeconfigs of the aux-svc cluster, mgmt cluster and OSM cluster stored under ${OSM_HOME_DIR}/clusters" echo -e "\nDONE" exit 0 diff --git a/installers/mgmt-cluster/gitea/00-custom-config.rc b/installers/gitea/00-custom-config.rc similarity index 100% rename from installers/mgmt-cluster/gitea/00-custom-config.rc rename to installers/gitea/00-custom-config.rc diff --git a/installers/mgmt-cluster/gitea/01-base-config.rc b/installers/gitea/01-base-config.rc similarity index 100% rename from installers/mgmt-cluster/gitea/01-base-config.rc rename to installers/gitea/01-base-config.rc diff --git a/installers/mgmt-cluster/gitea/02-deploy-gitea.sh b/installers/gitea/02-deploy-gitea.sh similarity index 97% rename from installers/mgmt-cluster/gitea/02-deploy-gitea.sh rename to installers/gitea/02-deploy-gitea.sh index f6e6001a..37d7bf36 100755 --- a/installers/mgmt-cluster/gitea/02-deploy-gitea.sh +++ b/installers/gitea/02-deploy-gitea.sh @@ -30,7 +30,7 @@ fi # Deploy Helm chart with required values helm repo add gitea-charts https://dl.gitea.io/charts/ m "Deploying Gitea's Helm chart..." -helm install gitea gitea-charts/gitea \ +helm upgrade --install gitea gitea-charts/gitea \ --version=7.0.4 \ --namespace=gitea \ --values "${HERE}/${GITEA_CHART_VALUES_FILE}" \ diff --git a/installers/mgmt-cluster/gitea/03-get-gitea-connection-info.rc b/installers/gitea/03-get-gitea-connection-info.rc similarity index 100% rename from installers/mgmt-cluster/gitea/03-get-gitea-connection-info.rc rename to installers/gitea/03-get-gitea-connection-info.rc diff --git a/installers/mgmt-cluster/gitea/04-fix-and-use-external-gitea-urls.sh b/installers/gitea/04-fix-and-use-external-gitea-urls.sh similarity index 100% rename from installers/mgmt-cluster/gitea/04-fix-and-use-external-gitea-urls.sh rename to installers/gitea/04-fix-and-use-external-gitea-urls.sh diff --git a/installers/mgmt-cluster/gitea/05-export-connection-info.sh b/installers/gitea/05-export-connection-info.sh similarity index 82% rename from installers/mgmt-cluster/gitea/05-export-connection-info.sh rename to installers/gitea/05-export-connection-info.sh index 8e903c07..acd90925 100755 --- a/installers/mgmt-cluster/gitea/05-export-connection-info.sh +++ b/installers/gitea/05-export-connection-info.sh @@ -32,7 +32,8 @@ echo # Saves locally to local environment at credentials folder m "Saving local enviroment to credentials folder..." - +export CREDENTIALS_DIR="${OSM_HOME_DIR}/.credentials" +mkdir -p "${CREDENTIALS_DIR}" cat << EOF > "${CREDENTIALS_DIR}/gitea_environment.rc" export GITEA_HTTP_URL=${GITEA_HTTP_URL} export GITEA_SSH_URL=${GITEA_SSH_URL} @@ -51,6 +52,17 @@ export GITEA_STD_USERNAME=${GITEA_STD_USERNAME} export GITEA_STD_USER_PASS='${GITEA_STD_USER_PASS}' EOF +cat << EOF > "${CREDENTIALS_DIR}/git_environment.rc" +export FLEET_REPO_HTTP_URL="${GITEA_HTTP_URL}/${GITEA_STD_USERNAME}/fleet-osm.git" +export FLEET_REPO_SSH_URL="${GITEA_SSH_URL}/${GITEA_STD_USERNAME}/fleet-osm.git" +export FLEET_REPO_GIT_USERNAME="${GITEA_STD_USERNAME}" +export FLEET_REPO_GIT_USER_PASS='${GITEA_STD_USER_PASS}' +export SW_CATALOGS_REPO_HTTP_URL="${GITEA_HTTP_URL}/${GITEA_STD_USERNAME}/sw-catalogs-osm.git" +export SW_CATALOGS_REPO_SSH_URL="${GITEA_SSH_URL}/${GITEA_STD_USERNAME}/sw-catalogs-osm.git" +export SW_CATALOGS_REPO_GIT_USERNAME="${GITEA_STD_USERNAME}" +export SW_CATALOGS_REPO_GIT_USER_PASS='${GITEA_STD_USER_PASS}' +EOF + m "Done." echo diff --git a/installers/gitea/20-setup-gituser-and-sshkeygen.sh b/installers/gitea/20-setup-gituser-and-sshkeygen.sh new file mode 100755 index 00000000..e3046fab --- /dev/null +++ b/installers/gitea/20-setup-gituser-and-sshkeygen.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e -o pipefail + +# Test if the user exists. Otherwise, create a git user +echo "Test if there is a git user. Otherwise, create it." +if [ ! -n "$(git config user.name)" ]; then + git config --global user.name osm_user + git config --global user.email osm_user@mydomain.com +fi + +# Test if the user exists. Otherwise, create a git user +echo "Checking if the user has an SSH key pair" +if [ ! -f "$HOME/.ssh/id_rsa" ]; then + echo "Generating an SSH key pair for the user" + ssh-keygen -t rsa -f "$HOME/.ssh/id_rsa" -N "" -q +fi diff --git a/installers/mgmt-cluster/gitea/90-provision-gitea-for-osm.sh b/installers/gitea/90-provision-gitea-for-osm.sh similarity index 100% rename from installers/mgmt-cluster/gitea/90-provision-gitea-for-osm.sh rename to installers/gitea/90-provision-gitea-for-osm.sh diff --git a/installers/mgmt-cluster/gitea/91-provision-local-git-user.sh b/installers/gitea/91-provision-local-git-user.sh similarity index 100% rename from installers/mgmt-cluster/gitea/91-provision-local-git-user.sh rename to installers/gitea/91-provision-local-git-user.sh diff --git a/installers/mgmt-cluster/gitea/ALL-IN-ONE-Gitea-install.sh b/installers/gitea/ALL-IN-ONE-Gitea-install.sh similarity index 100% rename from installers/mgmt-cluster/gitea/ALL-IN-ONE-Gitea-install.sh rename to installers/gitea/ALL-IN-ONE-Gitea-install.sh diff --git a/installers/mgmt-cluster/gitea/README.md b/installers/gitea/README.md similarity index 100% rename from installers/mgmt-cluster/gitea/README.md rename to installers/gitea/README.md diff --git a/installers/mgmt-cluster/gitea/admin/add-collaborator-to-user-repo.sh b/installers/gitea/admin/add-collaborator-to-user-repo.sh similarity index 100% rename from installers/mgmt-cluster/gitea/admin/add-collaborator-to-user-repo.sh rename to installers/gitea/admin/add-collaborator-to-user-repo.sh diff --git a/installers/mgmt-cluster/gitea/admin/api.sh b/installers/gitea/admin/api.sh similarity index 100% rename from installers/mgmt-cluster/gitea/admin/api.sh rename to installers/gitea/admin/api.sh diff --git a/installers/mgmt-cluster/gitea/admin/create-api-access-token.sh b/installers/gitea/admin/create-api-access-token.sh similarity index 100% rename from installers/mgmt-cluster/gitea/admin/create-api-access-token.sh rename to installers/gitea/admin/create-api-access-token.sh diff --git a/installers/mgmt-cluster/gitea/admin/create-cmd-access-token.sh b/installers/gitea/admin/create-cmd-access-token.sh similarity index 100% rename from installers/mgmt-cluster/gitea/admin/create-cmd-access-token.sh rename to installers/gitea/admin/create-cmd-access-token.sh diff --git a/installers/mgmt-cluster/gitea/admin/create-org-repository.sh b/installers/gitea/admin/create-org-repository.sh similarity index 100% rename from installers/mgmt-cluster/gitea/admin/create-org-repository.sh rename to installers/gitea/admin/create-org-repository.sh diff --git a/installers/mgmt-cluster/gitea/admin/create-org.sh b/installers/gitea/admin/create-org.sh similarity index 100% rename from installers/mgmt-cluster/gitea/admin/create-org.sh rename to installers/gitea/admin/create-org.sh diff --git a/installers/mgmt-cluster/gitea/admin/create-user-repository.sh b/installers/gitea/admin/create-user-repository.sh similarity index 100% rename from installers/mgmt-cluster/gitea/admin/create-user-repository.sh rename to installers/gitea/admin/create-user-repository.sh diff --git a/installers/mgmt-cluster/gitea/admin/create-user-ssh-key.sh b/installers/gitea/admin/create-user-ssh-key.sh similarity index 100% rename from installers/mgmt-cluster/gitea/admin/create-user-ssh-key.sh rename to installers/gitea/admin/create-user-ssh-key.sh diff --git a/installers/mgmt-cluster/gitea/admin/create-user.sh b/installers/gitea/admin/create-user.sh similarity index 100% rename from installers/mgmt-cluster/gitea/admin/create-user.sh rename to installers/gitea/admin/create-user.sh diff --git a/installers/mgmt-cluster/gitea/admin/delete-org-repository.sh b/installers/gitea/admin/delete-org-repository.sh similarity index 100% rename from installers/mgmt-cluster/gitea/admin/delete-org-repository.sh rename to installers/gitea/admin/delete-org-repository.sh diff --git a/installers/mgmt-cluster/gitea/admin/delete-org.sh b/installers/gitea/admin/delete-org.sh similarity index 100% rename from installers/mgmt-cluster/gitea/admin/delete-org.sh rename to installers/gitea/admin/delete-org.sh diff --git a/installers/mgmt-cluster/gitea/admin/delete-user-repository.sh b/installers/gitea/admin/delete-user-repository.sh similarity index 100% rename from installers/mgmt-cluster/gitea/admin/delete-user-repository.sh rename to installers/gitea/admin/delete-user-repository.sh diff --git a/installers/mgmt-cluster/gitea/admin/gitea.sh b/installers/gitea/admin/gitea.sh similarity index 100% rename from installers/mgmt-cluster/gitea/admin/gitea.sh rename to installers/gitea/admin/gitea.sh diff --git a/installers/mgmt-cluster/gitea/admin/shell.sh b/installers/gitea/admin/shell.sh similarity index 100% rename from installers/mgmt-cluster/gitea/admin/shell.sh rename to installers/gitea/admin/shell.sh diff --git a/installers/mgmt-cluster/mgmt-operators-and-crds/library/functions.sh b/installers/gitea/library/functions.sh similarity index 100% rename from installers/mgmt-cluster/mgmt-operators-and-crds/library/functions.sh rename to installers/gitea/library/functions.sh diff --git a/installers/mgmt-cluster/gitea/library/helpers.sh b/installers/gitea/library/helpers.sh similarity index 100% rename from installers/mgmt-cluster/gitea/library/helpers.sh rename to installers/gitea/library/helpers.sh diff --git a/installers/mgmt-cluster/mgmt-operators-and-crds/library/trap.sh b/installers/gitea/library/trap.sh similarity index 100% rename from installers/mgmt-cluster/mgmt-operators-and-crds/library/trap.sh rename to installers/gitea/library/trap.sh diff --git a/installers/mgmt-cluster/gitea/values-all.yaml b/installers/gitea/values-all.yaml similarity index 100% rename from installers/mgmt-cluster/gitea/values-all.yaml rename to installers/gitea/values-all.yaml diff --git a/installers/mgmt-cluster/gitea/values-standalone-ingress-ssh2222.yaml b/installers/gitea/values-standalone-ingress-ssh2222.yaml similarity index 100% rename from installers/mgmt-cluster/gitea/values-standalone-ingress-ssh2222.yaml rename to installers/gitea/values-standalone-ingress-ssh2222.yaml diff --git a/installers/mgmt-cluster/gitea/values-standalone-ingress.yaml b/installers/gitea/values-standalone-ingress.yaml similarity index 100% rename from installers/mgmt-cluster/gitea/values-standalone-ingress.yaml rename to installers/gitea/values-standalone-ingress.yaml diff --git a/installers/mgmt-cluster/gitea/values-standalone.yaml b/installers/gitea/values-standalone.yaml similarity index 100% rename from installers/mgmt-cluster/gitea/values-standalone.yaml rename to installers/gitea/values-standalone.yaml diff --git a/installers/helm/osm/templates/osm-gitops-secret.yaml b/installers/helm/osm/templates/osm-gitops-secret.yaml index 233b74c1..ed0e5694 100644 --- a/installers/helm/osm/templates/osm-gitops-secret.yaml +++ b/installers/helm/osm/templates/osm-gitops-secret.yaml @@ -26,4 +26,10 @@ data: OSM_GITOPS_GIT_BASE_URL: {{ ( .Values.global.gitops.gitBaseUrl | default "http://git.127.0.0.1.nip.io" ) | b64enc | quote }} OSM_GITOPS_USER: {{ ( .Values.global.gitops.gitUser | default "osm-developer" ) | b64enc | quote }} OSM_GITOPS_PUBKEY: {{ ( .Values.global.gitops.pubkey | default ( randAlphaNum 32 ) ) | b64enc | quote }} + {{- if .Values.global.gitops.fleetRepoUrl }} + OSM_GITOPS_FLEET_REPO_URL: {{ .Values.global.gitops.fleetRepoUrl | b64enc | quote }} + {{- end }} + {{- if .Values.global.gitops.swcatalogsRepoUrl }} + OSM_GITOPS_SW_CATALOGS_REPO_URL: {{ .Values.global.gitops.swcatalogsRepoUrl | b64enc | quote }} + {{- end }} {{- end }} \ No newline at end of file diff --git a/installers/helm/osm/values.yaml b/installers/helm/osm/values.yaml index 2190a51d..792e1458 100644 --- a/installers/helm/osm/values.yaml +++ b/installers/helm/osm/values.yaml @@ -65,6 +65,8 @@ global: gitUser: osm-developer # gitBaseUrl: http://git..nip.io # pubkey: AGEKEY + # fleetRepoUrl: http://git..nip.io + # swcatalogsRepoUrl: http://git..nip.io podAnnotations: {} diff --git a/installers/install_docker_ce.sh b/installers/install_docker_ce.sh index 16fb817a..023a9f98 100755 --- a/installers/install_docker_ce.sh +++ b/installers/install_docker_ce.sh @@ -116,44 +116,16 @@ EOF" return 0 } -while getopts ":D:p:-: P" o; do - case "${o}" in - D) - OSM_DEVOPS="${OPTARG}" - ;; - p) - DOCKER_PROXY_URL="${OPTARG}" - ;; - P) - OSM_BEHIND_PROXY="y" - ;; - -) - [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="y" && continue - echo -e "Invalid option: '--$OPTARG'\n" >&2 - exit 1 - ;; - :) - echo "Option -$OPTARG requires an argument" >&2 - exit 1 - ;; - \?) - echo -e "Invalid option: '-$OPTARG'\n" >&2 - exit 1 - ;; - *) - exit 1 - ;; - esac -done - DEBUG_INSTALL=${DEBUG_INSTALL:-} +OSM_DEVOPS=${OSM_DEVOPS:-"/usr/share/osm-devops"} DOCKER_PROXY_URL=${DOCKER_PROXY_URL:-} OSM_BEHIND_PROXY=${OSM_BEHIND_PROXY:-} echo "DEBUG_INSTALL=$DEBUG_INSTALL" +echo "OSM_DEVOPS=$OSM_DEVOPS" echo "DOCKER_PROXY_URL=$DOCKER_PROXY_URL" echo "OSM_BEHIND_PROXY=$OSM_BEHIND_PROXY" echo "USER=$USER" -source $OSM_DEVOPS/common/logging +source $OSM_DEVOPS/library/logging install_docker_ce diff --git a/installers/install_helm_client.sh b/installers/install_helm_client.sh deleted file mode 100755 index 427a2e12..00000000 --- a/installers/install_helm_client.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -set +eux - -HELM_VERSION="v3.15.1" - -#Install Helm v3 -#Helm releases can be found here: https://github.com/helm/helm/releases -function install_helm_client() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - if ! [[ "$(helm version --short 2>/dev/null)" =~ ^v3.* ]]; then - # Helm is not installed. Install helm - echo "Helm3 is not installed, installing ..." - curl https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz --output helm-${HELM_VERSION}.tar.gz - tar -zxvf helm-${HELM_VERSION}.tar.gz - sudo mv linux-amd64/helm /usr/local/bin/helm - rm -r linux-amd64 - rm helm-${HELM_VERSION}.tar.gz - else - echo "Helm3 is already installed. Skipping installation..." - fi - helm version || FATAL_TRACK k8scluster "Could not obtain helm version. Maybe helm client was not installed" - helm repo add stable https://charts.helm.sh/stable || FATAL_TRACK k8scluster "Helm repo stable could not be added" - helm repo update || FATAL_TRACK k8scluster "Helm repo stable could not be updated" - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -# main -while getopts ":D:-: " o; do - case "${o}" in - D) - OSM_DEVOPS="${OPTARG}" - ;; - -) - [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="y" && continue - echo -e "Invalid option: '--$OPTARG'\n" >&2 - exit 1 - ;; - :) - echo "Option -$OPTARG requires an argument" >&2 - exit 1 - ;; - \?) - echo -e "Invalid option: '-$OPTARG'\n" >&2 - exit 1 - ;; - *) - exit 1 - ;; - esac -done - -DEBUG_INSTALL=${DEBUG_INSTALL:-} -OSM_DEVOPS=${OSM_DEVOPS:-} -echo "DEBUG_INSTALL=$DEBUG_INSTALL" -echo "OSM_DEVOPS=$OSM_DEVOPS" - -source $OSM_DEVOPS/common/logging -source $OSM_DEVOPS/common/track - -install_helm_client diff --git a/installers/install_osm.sh b/installers/install_osm.sh index 49023576..870de5c6 100755 --- a/installers/install_osm.sh +++ b/installers/install_osm.sh @@ -33,6 +33,7 @@ function usage(){ echo -e " -t specify osm docker tag (default is latest)" echo -e " -M : Kubeconfig of an existing cluster to be used as mgmt cluster instead of OSM cluster" echo -e " -G : Kubeconfig of an existing cluster to be used as auxiliary cluster instead of OSM cluster" + echo -e " -O : Kubeconfig of an existing cluster to be used as OSM cluster instead of creating a new one from scratch" echo -e " --no-mgmt-cluster: Do not provision a mgmt cluster for cloud-native gitops operations in OSM (NEW in Release SIXTEEN) (by default, it is installed)" echo -e " --no-aux-cluster: Do not provision an auxiliary cluster for cloud-native gitops operations in OSM (NEW in Release SIXTEEN) (by default, it is installed)" echo -e " -D : use local devops installation path" @@ -43,10 +44,7 @@ function usage(){ echo -e " -p set docker proxy URL as part of docker CE configuration" echo -e " -T specify docker tag for the modules specified with option -m" echo -e " --debug: debug mode" - echo -e " --nodocker: do not install docker, do not initialize a swarm (assumes docker is already installed and a swarm has been initialized)" - echo -e " --nohostclient: do not install the osmclient" echo -e " --uninstall: uninstall OSM: remove the containers and delete NAT rules" - echo -e " --showopts: print chosen options and exit (only for debugging)" } add_repo() { @@ -66,7 +64,7 @@ add_repo() { || sudo apt-get install -y $need_packages_lw \ || ! echo "failed to install $need_packages_lw" \ || exit 1 - wget -q -O OSM-ETSI-Release-key.gpg "$REPOSITORY_BASE/$RELEASE/OSM%20ETSI%20Release%20Key.gpg" + curl -s -o OSM-ETSI-Release-key.gpg "$REPOSITORY_BASE/$RELEASE/OSM%20ETSI%20Release%20Key.gpg" sudo APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add OSM-ETSI-Release-key.gpg \ || ! echo -e "Could not add GPG key $REPOSITORY_BASE/$RELEASE/OSM%20ETSI%20Release%20Key.gpg" \ || exit 1 @@ -102,8 +100,7 @@ EOF" [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } -while getopts ":a:c:e:r:n:k:u:R:D:o:O:N:s:t:U:l:L:K:d:p:T:f:F:G:M:-: hy" o; do - +while getopts ":a:c:e:r:k:u:R:D:s:t:U:d:p:T:M:G:O:-: hy" o; do case "${o}" in D) DEVOPS_PATH="${OPTARG}" diff --git a/installers/mgmt-cluster/02-provision-local-git-user.sh b/installers/mgmt-cluster/02-provision-local-git-user.sh deleted file mode 100755 index 12346eb3..00000000 --- a/installers/mgmt-cluster/02-provision-local-git-user.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -####################################################################################### -# Copyright ETSI Contributors and Others. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. -####################################################################################### - -set -e -o pipefail - -# Warning!!!: Remember to select the desired kubeconfig profile before launching this script - -export HERE=$(dirname "$(readlink --canonicalize "$BASH_SOURCE")") -source "${HERE}/library/functions.sh" -source "${HERE}/library/trap.sh" - - -# Source credentials -source "${CREDENTIALS_DIR}/gitea_environment.rc" -source "${CREDENTIALS_DIR}/gitea_tokens.rc" - -# Add the local Git user to Gitea as a profile, upload the public SSH key (to allow SSH operations), and add the user as "collaborator" to both repos -"${HERE}/gitea/91-provision-local-git-user.sh" diff --git a/installers/mgmt-cluster/README.md b/installers/mgmt-cluster/README.md index 7581cda9..5513386e 100644 --- a/installers/mgmt-cluster/README.md +++ b/installers/mgmt-cluster/README.md @@ -38,7 +38,7 @@ This folder provides all required scripts and instructions for the full provisio First, you should load the environment variables with the key folders and configuration parameters. By default, in case some of them where still undefined, you may load sensible defaults by doing: ```bash -source 00-base-config.rc +source 20-base-config.rc ``` Then, you should select the appropriate `kubeconfig` to point to the cluster where you want to install the auxiliary services. For instance: @@ -64,7 +64,7 @@ First retrieve service's credentials and endpoints as environment variables: ```bash # Load Gitea environment -source "${CREDENTIALS_DIR}/gitea_environment.rc" +source "${CREDENTIALS_DIR}/git_environment.rc" source "${CREDENTIALS_DIR}/gitea_tokens.rc" # Load Minio environment @@ -238,7 +238,7 @@ Load the environment: ```bash source 00-base-config.rc -source "${CREDENTIALS_DIR}/gitea_environment.rc" +source "${CREDENTIALS_DIR}/git_environment.rc" source "${CREDENTIALS_DIR}/gitea_tokens.rc" ``` diff --git a/installers/mgmt-cluster/install_mgmt_cluster.sh b/installers/mgmt-cluster/install_mgmt_cluster.sh deleted file mode 100755 index c719b4b6..00000000 --- a/installers/mgmt-cluster/install_mgmt_cluster.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -set -x - -# main -while getopts ":D:d:G:M:-: " o; do - case "${o}" in - d) - OSM_HOME_DIR="${OPTARG}" - ;; - D) - OSM_DEVOPS="${OPTARG}" - ;; - M) - KUBECONFIG_MGMT_CLUSTER="${OPTARG}" - ;; - G) - KUBECONFIG_AUX_CLUSTER="${OPTARG}" - ;; - -) - [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="y" && continue - [ "${OPTARG}" == "no-mgmt-cluster" ] && INSTALL_MGMT_CLUSTER="" && continue - [ "${OPTARG}" == "no-aux-cluster" ] && INSTALL_AUX_CLUSTER="" && continue - [ "${OPTARG}" == "minio" ] && INSTALL_MINIO="y" && continue - [ "${OPTARG}" == "no-minio" ] && INSTALL_MINIO="" && continue - echo -e "Invalid option: '--$OPTARG'\n" >&2 - exit 1 - ;; - :) - echo "Option -$OPTARG requires an argument" >&2 - exit 1 - ;; - \?) - echo -e "Invalid option: '-$OPTARG'\n" >&2 - exit 1 - ;; - *) - exit 1 - ;; - esac -done - -DEBUG_INSTALL=${DEBUG_INSTALL:-} -OSM_DEVOPS=${OSM_DEVOPS:-"/usr/share/osm-devops"} -OSM_HOME_DIR=${OSM_HOME_DIR:-"$HOME/.osm"} -OSM_MGMTCLUSTER_BASE_FOLDER="${OSM_DEVOPS}/installers/mgmt-cluster" -INSTALL_MGMT_CLUSTER=${INSTALL_MGMT_CLUSTER:-"y"} -INSTALL_AUX_CLUSTER=${INSTALL_AUX_CLUSTER:-"y"} -KUBECONFIG_MGMT_CLUSTER=${KUBECONFIG_MGMT_CLUSTER:-"$HOME/.kube/config"} -KUBECONFIG_AUX_CLUSTER=${KUBECONFIG_AUX_CLUSTER:-"$HOME/.kube/config"} -KUBECONFIG_OLD=${KUBECONFIG:-"$HOME/.kube/config"} -export CREDENTIALS_DIR="${OSM_HOME_DIR}/.credentials" -export WORK_REPOS_DIR="${OSM_HOME_DIR}/repos" -export INSTALL_MINIO=${INSTALL_MINIO:-"y"} -echo "DEBUG_INSTALL=$DEBUG_INSTALL" -echo "OSM_DEVOPS=$OSM_DEVOPS" -echo "OSM_HOME_DIR=$OSM_HOME_DIR" -echo "OSM_MGMTCLUSTER_BASE_FOLDER=$OSM_MGMTCLUSTER_BASE_FOLDER" -echo "INSTALL_MGMT_CLUSTER=$INSTALL_MGMT_CLUSTER" -echo "INSTALL_AUX_CLUSTER=$INSTALL_AUX_CLUSTER" -echo "KUBECONFIG_MGMT_CLUSTER=$KUBECONFIG_MGMT_CLUSTER" -echo "KUBECONFIG_AUX_CLUSTER=$KUBECONFIG_AUX_CLUSTER" -echo "CREDENTIALS_DIR=$CREDENTIALS_DIR" -echo "WORK_REPOS_DIR=$WORK_REPOS_DIR" - -source $OSM_DEVOPS/common/logging -source $OSM_DEVOPS/common/track - -pushd $OSM_MGMTCLUSTER_BASE_FOLDER - -if [ -n "${INSTALL_AUX_CLUSTER}" ] || [ -n "${INSTALL_MGMT_CLUSTER}" ]; then - - echo "Setup CLI tools for mgmt and aux cluster" - ./setup-cli-tools.sh || FATAL_TRACK mgmtcluster "setup-cli-tools.sh failed" - track mgmtcluster setupclitools_ok - - echo "Creating folders under ${OSM_HOME_DIR} for credentials and repos" - mkdir -p "${CREDENTIALS_DIR}" - mkdir -p "${WORK_REPOS_DIR}" - track mgmtcluster folders_ok - - # Test if the user exists. Otherwise, create a git user - echo "Test if there is a git user. Otherwise, create it." - if [ ! -n "$(git config user.name)" ]; then - git config --global user.name osm_user - git config --global user.email osm_user@mydomain.com - fi - - # Test if the user exists. Otherwise, create a git user - echo "Checking if the user has an SSH key pair" - if [ ! -f "$HOME/.ssh/id_rsa" ]; then - echo "Generating an SSH key pair for the user" - ssh-keygen -t rsa -f "$HOME/.ssh/id_rsa" -N "" -q - fi - - echo "Loading env variables from 00-base-config.rc" - source 00-base-config.rc - -fi - -set +x - -# "aux-svc" cluster -if [ -n "${INSTALL_AUX_CLUSTER}" ]; then - echo "Provisioning auxiliary cluster with Gitea" - export KUBECONFIG="${KUBECONFIG_AUX_CLUSTER}" - ./01-provision-aux-svc.sh || FATAL_TRACK mgmtcluster "provision-aux-svc.sh failed" - track mgmtcluster aux_cluster_ok - - ./02-provision-local-git-user.sh || FATAL_TRACK mgmtcluster "provision-local-git-user.sh failed" - track mgmtcluster local_git_user_ok -fi - -# "mgmt" cluster -if [ -n "${INSTALL_MGMT_CLUSTER}" ]; then - echo "Provisioning mgmt cluster" - export KUBECONFIG="${KUBECONFIG_MGMT_CLUSTER}" - ./03-provision-mgmt-cluster.sh || FATAL_TRACK mgmtcluster "provision-mgmt-cluster.sh failed" - track mgmtcluster mgmt_cluster_ok -fi - -export KUBECONFIG=${KUBECONFIG_OLD} -if [ -n "${INSTALL_MGMT_CLUSTER}" ]; then - echo "Saving age keys in OSM cluster" - kubectl -n osm create secret generic mgmt-cluster-age-keys --from-file=privkey="${CREDENTIALS_DIR}/age.mgmt.key" --from-file=pubkey="${CREDENTIALS_DIR}/age.mgmt.pub" -fi - -echo "Creating secrets with kubeconfig files" -kubectl -n osm create secret generic auxcluster-secret --from-file=kubeconfig="${KUBECONFIG_AUX_CLUSTER}" -kubectl -n osm create secret generic mgmtcluster-secret --from-file=kubeconfig="${KUBECONFIG_MGMT_CLUSTER}" - -popd - diff --git a/installers/mgmt-cluster/setup-cli-tools.sh b/installers/mgmt-cluster/setup-cli-tools.sh deleted file mode 100755 index 7eb15512..00000000 --- a/installers/mgmt-cluster/setup-cli-tools.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -pushd $HOME - -export DEBIAN_FRONTEND=noninteractive - -# Install `gnupg` and `gpg` - Typically pre-installed in Ubuntu -sudo apt-get install gnupg gpg -y - -# Install `sops` -curl -LO https://github.com/getsops/sops/releases/download/v3.8.1/sops-v3.8.1.linux.amd64 -sudo mv sops-v3.8.1.linux.amd64 /usr/local/bin/sops -sudo chmod +x /usr/local/bin/sops - -# Install `envsubst` -sudo apt-get install gettext-base -y - -# Install `age` -curl -LO https://github.com/FiloSottile/age/releases/download/v1.1.0/age-v1.1.0-linux-amd64.tar.gz -tar xvfz age-v1.1.0-linux-amd64.tar.gz -sudo mv age/age age/age-keygen /usr/local/bin/ -sudo chmod +x /usr/local/bin/age* -rm -rf age age-v1.1.0-linux-amd64.tar.gz - -# (Only for Gitea) Install `apg` -sudo apt-get install apg -y - -# # (Only for Minio) `kubectl minio` plugin and Minio Client -if [ -n "${INSTALL_MINIO}" ]; then - curl https://github.com/minio/operator/releases/download/v5.0.12/kubectl-minio_5.0.12_linux_amd64 -Lo kubectl-minio - curl https://dl.min.io/client/mc/release/linux-amd64/mc -o minioc - chmod +x kubectl-minio minioc - sudo mv kubectl-minio minioc /usr/local/bin/ - # (Only for HTTPS Ingress for Minio tenant) Install `openssl` - sudo apt-get install openssl -y -fi - -# Flux client -FLUX_CLI_VERSION="2.4.0" -curl -s https://fluxcd.io/install.sh | sudo FLUX_VERSION=${FLUX_CLI_VERSION} bash -# Autocompletion -. <(flux completion bash) - -# Argo client -ARGO_VERSION="v3.5.7" -curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz -gunzip argo-linux-amd64.gz -chmod +x argo-linux-amd64 -sudo mv ./argo-linux-amd64 /usr/local/bin/argo - -# Kustomize -KUSTOMIZE_VERSION="5.4.3" -curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- ${KUSTOMIZE_VERSION} -sudo install -o root -g root -m 0755 kustomize /usr/local/bin/kustomize -rm kustomize - -# yq -VERSION=v4.33.3 -BINARY=yq_linux_amd64 -curl -L https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -o yq -sudo mv yq /usr/local/bin/yq -sudo chmod +x /usr/local/bin/yq - -popd diff --git a/installers/mgmt-cluster/mgmt-operators-and-crds/add-operators-and-crds.sh b/installers/mgmt-operators-and-crds/add-operators-and-crds.sh similarity index 100% rename from installers/mgmt-cluster/mgmt-operators-and-crds/add-operators-and-crds.sh rename to installers/mgmt-operators-and-crds/add-operators-and-crds.sh diff --git a/installers/mgmt-cluster/mgmt-operators-and-crds/configure-workflows.sh b/installers/mgmt-operators-and-crds/configure-workflows.sh similarity index 100% rename from installers/mgmt-cluster/mgmt-operators-and-crds/configure-workflows.sh rename to installers/mgmt-operators-and-crds/configure-workflows.sh diff --git a/installers/mgmt-cluster/library/functions.sh b/installers/mgmt-operators-and-crds/library/functions.sh similarity index 100% rename from installers/mgmt-cluster/library/functions.sh rename to installers/mgmt-operators-and-crds/library/functions.sh diff --git a/installers/mgmt-cluster/library/trap.sh b/installers/mgmt-operators-and-crds/library/trap.sh similarity index 100% rename from installers/mgmt-cluster/library/trap.sh rename to installers/mgmt-operators-and-crds/library/trap.sh diff --git a/installers/mgmt-cluster/minio/00-base-config.rc b/installers/minio/00-base-config.rc similarity index 100% rename from installers/mgmt-cluster/minio/00-base-config.rc rename to installers/minio/00-base-config.rc diff --git a/installers/mgmt-cluster/minio/01-deploy-minio-operator.sh b/installers/minio/01-deploy-minio-operator.sh similarity index 100% rename from installers/mgmt-cluster/minio/01-deploy-minio-operator.sh rename to installers/minio/01-deploy-minio-operator.sh diff --git a/installers/mgmt-cluster/minio/02-create-minio-tenant.sh b/installers/minio/02-create-minio-tenant.sh similarity index 100% rename from installers/mgmt-cluster/minio/02-create-minio-tenant.sh rename to installers/minio/02-create-minio-tenant.sh diff --git a/installers/mgmt-cluster/minio/03-deploy-ingress-for-minio.sh b/installers/minio/03-deploy-ingress-for-minio.sh similarity index 100% rename from installers/mgmt-cluster/minio/03-deploy-ingress-for-minio.sh rename to installers/minio/03-deploy-ingress-for-minio.sh diff --git a/installers/mgmt-cluster/minio/04-get-minio-connection-info.rc b/installers/minio/04-get-minio-connection-info.rc similarity index 100% rename from installers/mgmt-cluster/minio/04-get-minio-connection-info.rc rename to installers/minio/04-get-minio-connection-info.rc diff --git a/installers/mgmt-cluster/minio/05-export-connection-info.sh b/installers/minio/05-export-connection-info.sh similarity index 100% rename from installers/mgmt-cluster/minio/05-export-connection-info.sh rename to installers/minio/05-export-connection-info.sh diff --git a/installers/mgmt-cluster/minio/ALL-IN-ONE-Minio-install.sh b/installers/minio/ALL-IN-ONE-Minio-install.sh similarity index 100% rename from installers/mgmt-cluster/minio/ALL-IN-ONE-Minio-install.sh rename to installers/minio/ALL-IN-ONE-Minio-install.sh diff --git a/installers/mgmt-cluster/minio/README.md b/installers/minio/README.md similarity index 100% rename from installers/mgmt-cluster/minio/README.md rename to installers/minio/README.md diff --git a/installers/mgmt-cluster/minio/ingress-manifests/console/ingress-console.yaml b/installers/minio/ingress-manifests/console/ingress-console.yaml similarity index 100% rename from installers/mgmt-cluster/minio/ingress-manifests/console/ingress-console.yaml rename to installers/minio/ingress-manifests/console/ingress-console.yaml diff --git a/installers/mgmt-cluster/minio/ingress-manifests/tenant/ingress-tenant.yaml b/installers/minio/ingress-manifests/tenant/ingress-tenant.yaml similarity index 100% rename from installers/mgmt-cluster/minio/ingress-manifests/tenant/ingress-tenant.yaml rename to installers/minio/ingress-manifests/tenant/ingress-tenant.yaml diff --git a/installers/mgmt-cluster/gitea/library/functions.sh b/installers/minio/library/functions.sh similarity index 100% rename from installers/mgmt-cluster/gitea/library/functions.sh rename to installers/minio/library/functions.sh diff --git a/installers/mgmt-cluster/gitea/library/trap.sh b/installers/minio/library/trap.sh similarity index 100% rename from installers/mgmt-cluster/gitea/library/trap.sh rename to installers/minio/library/trap.sh diff --git a/installers/openstack/install_to_openstack.sh b/installers/openstack/install_to_openstack.sh index 30ad10d6..1c8d7a8d 100755 --- a/installers/openstack/install_to_openstack.sh +++ b/installers/openstack/install_to_openstack.sh @@ -34,10 +34,8 @@ echo "OPENSTACK_USERDATA_FILE"="$OPENSTACK_USERDATA_FILE" echo "OPENSTACK_VM_NAME"="$OPENSTACK_VM_NAME" echo "OPENSTACK_PYTHON_VENV"="$OPENSTACK_PYTHON_VENV" -source $OSM_DEVOPS/common/logging -source $OSM_DEVOPS/common/track - -install_to_openstack $OPENSTACK_OPENRC_FILE_OR_CLOUD $OPENSTACK_PUBLIC_NET_NAME $OPENSTACK_ATTACH_VOLUME +source $OSM_DEVOPS/library/logging +source $OSM_DEVOPS/library/track [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function diff --git a/installers/osm_health.sh b/installers/osm_health.sh deleted file mode 100755 index 651e9db2..00000000 --- a/installers/osm_health.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2020 Telefónica Investigación y Desarrollo S.A.U. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Default values -sampling_period=5 # seconds -time_for_readiness=2 # minutes ready -time_for_failure=7 # minutes broken -KUBERNETES= # By default, assumes Docker Swarm installation -STACK_NAME=osm # By default, "osm" - -while getopts "p:r:f:s:k" o; do - case "${o}" in - p) - sampling_period=${OPTARG} - ;; - r) - time_for_readiness=${OPTARG} - ;; - f) - time_for_failure=${OPTARG} - ;; - s) - STACK_NAME=${OPTARG} - ;; - k) - KUBERNETES="y" - ;; - esac -done - -oks_threshold=$((time_for_readiness*60/${sampling_period})) # No. ok samples to declare the system ready -failures_threshold=$((time_for_failure*60/${sampling_period})) # No. nok samples to declare the system broken -failures_in_a_row=0 -oks_in_a_row=0 - - -# Show status of the OSM services deployed with helm -echo "helm -n ${STACK_NAME} list" -helm -n ${STACK_NAME} list -echo "helm -n ${STACK_NAME} status ${STACK_NAME}" -helm -n ${STACK_NAME} status ${STACK_NAME} - -#################################################################################### -# Loop to check system readiness -#################################################################################### -while [[ (${failures_in_a_row} -lt ${failures_threshold}) && (${oks_in_a_row} -lt ${oks_threshold}) ]] -do - - #------------ CHECKS FOR KUBERNETES INSTALLATION - if [ -n "$KUBERNETES" ] - then - - # State of Deployments - DEPLOYMENTS_STATE=$(kubectl get deployment -n ${STACK_NAME} --no-headers 2>&1) - DEPLOYMENTS_READY=$(echo "${DEPLOYMENTS_STATE}" | awk '$2=="1/1" && $4=="1" {printf ("%20s\t%s\t%s\n", $1, $2, $4)}') - DEPLOYMENTS_NOT_READY=$(echo "${DEPLOYMENTS_STATE}" | awk '$2!="1/1" || $4!="1" {printf ("%20s\t%s\t%s\n", $1, $2, $4)}') - COUNT_DEPLOYMENTS_READY=$(echo "${DEPLOYMENTS_READY}"| grep -v -e '^$' | wc -l) - COUNT_DEPLOYMENTS_NOT_READY=$(echo "${DEPLOYMENTS_NOT_READY}" | grep -v -e '^$' | wc -l) - - # State of Statefulsets - STS_STATE=$(kubectl get statefulset -n ${STACK_NAME} --no-headers 2>&1) - STS_READY=$(echo "${STS_STATE}" | awk '$2=="1/1" || $2=="2/2" || $2=="3/3" {printf ("%20s\t%s\t%s\n", $1, $2, $4)}') - STS_NOT_READY=$(echo "${STS_STATE}" | awk '$2!="1/1" && $2!="2/2" && $2!="3/3" {printf ("%20s\t%s\t%s\n", $1, $2, $4)}') - COUNT_STS_READY=$(echo "${STS_READY}" | grep -v -e '^$' | wc -l) - COUNT_STS_NOT_READY=$(echo "${STS_NOT_READY}" | grep -v -e '^$' | wc -l) - - # OK sample - if [[ $((${COUNT_DEPLOYMENTS_NOT_READY}+${COUNT_STS_NOT_READY})) -eq 0 ]] - then - ((++oks_in_a_row)) - failures_in_a_row=0 - echo -ne ===\> Successful checks: "${oks_in_a_row}"/${oks_threshold}\\r - # NOK sample - else - ((++failures_in_a_row)) - oks_in_a_row=0 - echo - echo Bootstraping... "${failures_in_a_row}" attempts of ${failures_threshold} - - # Reports failed deployments - if [[ "${COUNT_DEPLOYMENTS_NOT_READY}" -ne 0 ]] - then - echo ${COUNT_DEPLOYMENTS_NOT_READY} of $((${COUNT_DEPLOYMENTS_NOT_READY}+${COUNT_DEPLOYMENTS_READY})) deployments starting: - echo "${DEPLOYMENTS_NOT_READY}" - echo - fi - - # Reports failed statefulsets - if [[ "${COUNT_STS_NOT_READY}" -ne 0 ]] - then - echo ${COUNT_STS_NOT_READY} of $((${COUNT_STS_NOT_READY}+${COUNT_STS_READY})) statefulsets starting: - echo "${STS_NOT_READY}" - echo - fi - fi - - #------------ CHECKS FOR DOCKER SWARM INSTALLATION - else - # State of Docker Services - SERVICES_STATE=$(sg docker -c "docker service ls" 2>&1 | grep " ${STACK_NAME}_") - SERVICES_READY=$(echo "${SERVICES_STATE}" | awk '$3=="replicated" && $4=="1/1" {printf ("%20s\t%s\n", $2, $4)}') - SERVICES_NOT_READY=$(echo "${SERVICES_STATE}" | awk '$3=="replicated" && $4!="1/1" {printf ("%20s\t%s\n", $2, $4)}') - COUNT_SERVICES_READY=$(echo "${SERVICES_READY}" | grep -v -e '^$' | wc -l) - COUNT_SERVICES_NOT_READY=$(echo "${SERVICES_NOT_READY}" | grep -v -e '^$' | wc -l) - - # OK sample - if [[ ${COUNT_SERVICES_NOT_READY} -eq 0 ]] - then - ((++oks_in_a_row)) - failures_in_a_row=0 - echo -ne ===\> Successful checks: "${oks_in_a_row}"/${oks_threshold}\\r - # NOK sample - else - ((++failures_in_a_row)) - oks_in_a_row=0 - echo - echo Bootstraping... "${failures_in_a_row}" attempts of ${failures_threshold} - echo ${COUNT_SERVICES_NOT_READY} of $((${COUNT_SERVICES_NOT_READY}+${COUNT_SERVICES_READY})) services starting: - echo "${SERVICES_NOT_READY}" - fi - fi - - #------------ NEXT SAMPLE - sleep ${sampling_period} - -done - - -#################################################################################### -# OUTCOME -#################################################################################### -if [[ (${failures_in_a_row} -ge ${failures_threshold}) ]] -then - echo - echo SYSTEM IS BROKEN - exit 1 -else - echo - echo SYSTEM IS READY -fi diff --git a/installers/test_track.sh b/installers/test_track.sh index 3655c5e1..3f41e1fb 100755 --- a/installers/test_track.sh +++ b/installers/test_track.sh @@ -13,8 +13,8 @@ # limitations under the License. # -source ../common/track -source ../common/logging +source ../library/track +source ../library/logging RELEASE="test_track" OSM_DOCKER_TAG=latest diff --git a/installers/uninstall_osm.sh b/installers/uninstall_osm.sh deleted file mode 100755 index a57c60f5..00000000 --- a/installers/uninstall_osm.sh +++ /dev/null @@ -1,331 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -#removes osm deployments and services -function remove_k8s_namespace() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - kubectl delete ns $1 - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function remove_volumes() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - k8_volume=$1 - echo "Removing ${k8_volume}" - sudo rm -rf ${k8_volume} - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function uninstall_k8s_monitoring() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - # uninstall OSM monitoring - sudo $OSM_DEVOPS/installers/k8s/uninstall_osm_k8s_monitoring.sh - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -#Uninstall osmclient -function uninstall_osmclient() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - sudo apt-get remove --purge -y python3-osmclient - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -#Uninstall OSM: remove deployments and services -function uninstall_osm() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - echo -e "\nUninstalling OSM" - if [ -n "$INSTALL_K8S_MONITOR" ]; then - # uninstall OSM MONITORING - uninstall_k8s_monitoring - fi - remove_k8s_namespace $OSM_NAMESPACE - echo "Now osm docker images and volumes will be deleted" - # TODO: clean-up of images should take into account if other tags were used for specific modules - newgrp docker << EONG -for module in ro lcm keystone nbi mon osmclient; do - docker image rm ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module}:${OSM_DOCKER_TAG} -done -EONG - - sg docker -c "docker image rm ${DOCKER_REGISTRY_URL}${DOCKER_USER}/ng-ui:${OSM_DOCKER_TAG}" - - OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_NAMESPACE}" - remove_volumes $OSM_NAMESPACE_VOL - - [ -z "$CONTROLLER_NAME" ] && sg lxd -c "juju kill-controller -t 0 -y $OSM_NAMESPACE" - - # Cleanup Openstack installer venv - if [ -d "$OPENSTACK_PYTHON_VENV" ]; then - rm -r $OPENSTACK_PYTHON_VENV - fi - - [ -z "$INSTALL_NOHOSTCLIENT" ] && uninstall_osmclient - echo "Some docker images will be kept in case they are used by other docker stacks" - echo "To remove them, just run 'docker image prune' in a terminal" - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function - return 0 -} - -function ask_user(){ - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - # ask to the user and parse a response among 'y', 'yes', 'n' or 'no'. Case insensitive - # Params: $1 text to ask; $2 Action by default, can be 'y' for yes, 'n' for no, other or empty for not allowed - # Return: true(0) if user type 'yes'; false (1) if user type 'no' - read -e -p "$1" USER_CONFIRMATION - while true ; do - [ -z "$USER_CONFIRMATION" ] && [ "$2" == 'y' ] && return 0 - [ -z "$USER_CONFIRMATION" ] && [ "$2" == 'n' ] && return 1 - [ "${USER_CONFIRMATION,,}" == "yes" ] || [ "${USER_CONFIRMATION,,}" == "y" ] && return 0 - [ "${USER_CONFIRMATION,,}" == "no" ] || [ "${USER_CONFIRMATION,,}" == "n" ] && return 1 - read -e -p "Please type 'yes' or 'no': " USER_CONFIRMATION - done - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -LXD_VERSION=4.0 -JUJU_VERSION=2.9 -UNINSTALL="" -DEVELOP="" -UPDATE="" -RECONFIGURE="" -TEST_INSTALLER="" -INSTALL_LXD="" -SHOWOPTS="" -COMMIT_ID="" -ASSUME_YES="" -APT_PROXY_URL="" -INSTALL_FROM_SOURCE="" -DEBUG_INSTALL="" -RELEASE="ReleaseTEN" -REPOSITORY="stable" -INSTALL_VIMEMU="" -LXD_REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/lxd" -LXD_REPOSITORY_PATH="" -INSTALL_LIGHTWEIGHT="y" -INSTALL_TO_OPENSTACK="" -OPENSTACK_OPENRC_FILE_OR_CLOUD="" -OPENSTACK_PUBLIC_NET_NAME="" -OPENSTACK_ATTACH_VOLUME="false" -OPENSTACK_SSH_KEY_FILE="" -OPENSTACK_USERDATA_FILE="" -OPENSTACK_VM_NAME="server-osm" -OPENSTACK_PYTHON_VENV="$HOME/.virtual-envs/osm" -INSTALL_ONLY="" -TO_REBUILD="" -INSTALL_NOLXD="" -INSTALL_NODOCKER="" -INSTALL_NOJUJU="" -INSTALL_K8S_MONITOR="" -INSTALL_NOHOSTCLIENT="" -INSTALL_CACHELXDIMAGES="" -OSM_DEVOPS= -OSM_VCA_HOST= -OSM_VCA_SECRET= -OSM_VCA_PUBKEY= -OSM_VCA_CLOUDNAME="localhost" -OSM_VCA_K8S_CLOUDNAME="k8scloud" -OSM_NAMESPACE=osm -NO_HOST_PORTS="" -DOCKER_NOBUILD="" -REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg" -REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/debian" -OSM_WORK_DIR="/etc/osm" -OSM_HOST_VOL="/var/lib/osm" -OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_NAMESPACE}" -OSM_DOCKER_TAG=latest -DOCKER_USER=opensourcemano -PULL_IMAGES="y" -KAFKA_TAG=2.11-1.0.2 -PROMETHEUS_TAG=v2.4.3 -GRAFANA_TAG=latest -PROMETHEUS_NODE_EXPORTER_TAG=0.18.1 -PROMETHEUS_CADVISOR_TAG=latest -KEYSTONEDB_TAG=10 -OSM_DATABASE_COMMONKEY= -ELASTIC_VERSION=6.4.2 -ELASTIC_CURATOR_VERSION=5.5.4 -POD_NETWORK_CIDR=10.244.0.0/16 -K8S_MANIFEST_DIR="/etc/kubernetes/manifests" -RE_CHECK='^[a-z0-9]([-a-z0-9]*[a-z0-9])?$' -DOCKER_REGISTRY_URL= -DOCKER_PROXY_URL= -MODULE_DOCKER_TAG= - -while getopts ":a:b:r:n:k:u:R:D:o:O:m:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o; do - case "${o}" in - a) - APT_PROXY_URL=${OPTARG} - ;; - b) - COMMIT_ID=${OPTARG} - PULL_IMAGES="" - ;; - r) - REPOSITORY="${OPTARG}" - REPO_ARGS+=(-r "$REPOSITORY") - ;; - k) - REPOSITORY_KEY="${OPTARG}" - REPO_ARGS+=(-k "$REPOSITORY_KEY") - ;; - u) - REPOSITORY_BASE="${OPTARG}" - REPO_ARGS+=(-u "$REPOSITORY_BASE") - ;; - R) - RELEASE="${OPTARG}" - REPO_ARGS+=(-R "$RELEASE") - ;; - D) - OSM_DEVOPS="${OPTARG}" - ;; - o) - INSTALL_ONLY="y" - [ "${OPTARG}" == "k8s_monitor" ] && INSTALL_K8S_MONITOR="y" && continue - ;; - O) - INSTALL_TO_OPENSTACK="y" - if [ -n "${OPTARG}" ]; then - OPENSTACK_OPENRC_FILE_OR_CLOUD="${OPTARG}" - else - echo -e "Invalid argument for -O : ' $OPTARG'\n" >&2 - usage && exit 1 - fi - ;; - f) - OPENSTACK_SSH_KEY_FILE="${OPTARG}" - ;; - F) - OPENSTACK_USERDATA_FILE="${OPTARG}" - ;; - N) - OPENSTACK_PUBLIC_NET_NAME="${OPTARG}" - ;; - m) - [ "${OPTARG}" == "NG-UI" ] && TO_REBUILD="$TO_REBUILD NG-UI" && continue - [ "${OPTARG}" == "NBI" ] && TO_REBUILD="$TO_REBUILD NBI" && continue - [ "${OPTARG}" == "LCM" ] && TO_REBUILD="$TO_REBUILD LCM" && continue - [ "${OPTARG}" == "RO" ] && TO_REBUILD="$TO_REBUILD RO" && continue - [ "${OPTARG}" == "MON" ] && TO_REBUILD="$TO_REBUILD MON" && continue - [ "${OPTARG}" == "osmclient" ] && TO_REBUILD="$TO_REBUILD osmclient" && continue - [ "${OPTARG}" == "KAFKA" ] && TO_REBUILD="$TO_REBUILD KAFKA" && continue - [ "${OPTARG}" == "MONGO" ] && TO_REBUILD="$TO_REBUILD MONGO" && continue - [ "${OPTARG}" == "PROMETHEUS" ] && TO_REBUILD="$TO_REBUILD PROMETHEUS" && continue - [ "${OPTARG}" == "PROMETHEUS-CADVISOR" ] && TO_REBUILD="$TO_REBUILD PROMETHEUS-CADVISOR" && continue - [ "${OPTARG}" == "KEYSTONE-DB" ] && TO_REBUILD="$TO_REBUILD KEYSTONE-DB" && continue - [ "${OPTARG}" == "GRAFANA" ] && TO_REBUILD="$TO_REBUILD GRAFANA" && continue - [ "${OPTARG}" == "NONE" ] && TO_REBUILD="$TO_REBUILD NONE" && continue - ;; - H) - OSM_VCA_HOST="${OPTARG}" - ;; - S) - OSM_VCA_SECRET="${OPTARG}" - ;; - s) - OSM_NAMESPACE="${OPTARG}" && [[ ! "${OPTARG}" =~ $RE_CHECK ]] && echo "Namespace $OPTARG is invalid. Regex used for validation is $RE_CHECK" && exit 0 - ;; - t) - OSM_DOCKER_TAG="${OPTARG}" - REPO_ARGS+=(-t "$OSM_DOCKER_TAG") - ;; - U) - DOCKER_USER="${OPTARG}" - ;; - P) - OSM_VCA_PUBKEY=$(cat ${OPTARG}) - ;; - A) - OSM_VCA_APIPROXY="${OPTARG}" - ;; - l) - LXD_CLOUD_FILE="${OPTARG}" - ;; - L) - LXD_CRED_FILE="${OPTARG}" - ;; - K) - CONTROLLER_NAME="${OPTARG}" - ;; - d) - DOCKER_REGISTRY_URL="${OPTARG}" - ;; - p) - DOCKER_PROXY_URL="${OPTARG}" - ;; - T) - MODULE_DOCKER_TAG="${OPTARG}" - ;; - -) - [ "${OPTARG}" == "help" ] && usage && exit 0 - [ "${OPTARG}" == "source" ] && INSTALL_FROM_SOURCE="y" && PULL_IMAGES="" && continue - [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="--debug" && continue - [ "${OPTARG}" == "develop" ] && DEVELOP="y" && continue - [ "${OPTARG}" == "uninstall" ] && UNINSTALL="y" && continue - [ "${OPTARG}" == "update" ] && UPDATE="y" && continue - [ "${OPTARG}" == "reconfigure" ] && RECONFIGURE="y" && continue - [ "${OPTARG}" == "test" ] && TEST_INSTALLER="y" && continue - [ "${OPTARG}" == "lxdinstall" ] && INSTALL_LXD="y" && continue - [ "${OPTARG}" == "nolxd" ] && INSTALL_NOLXD="y" && continue - [ "${OPTARG}" == "nodocker" ] && INSTALL_NODOCKER="y" && continue - [ "${OPTARG}" == "showopts" ] && SHOWOPTS="y" && continue - [ "${OPTARG}" == "nohostports" ] && NO_HOST_PORTS="y" && continue - [ "${OPTARG}" == "nojuju" ] && INSTALL_NOJUJU="--nojuju" && continue - [ "${OPTARG}" == "nodockerbuild" ] && DOCKER_NOBUILD="y" && continue - [ "${OPTARG}" == "nohostclient" ] && INSTALL_NOHOSTCLIENT="y" && continue - [ "${OPTARG}" == "pullimages" ] && continue - [ "${OPTARG}" == "k8s_monitor" ] && INSTALL_K8S_MONITOR="y" && continue - [ "${OPTARG}" == "charmed" ] && CHARMED="y" && continue - [ "${OPTARG}" == "bundle" ] && continue - [ "${OPTARG}" == "k8s" ] && continue - [ "${OPTARG}" == "lxd" ] && continue - [ "${OPTARG}" == "lxd-cred" ] && continue - [ "${OPTARG}" == "microstack" ] && continue - [ "${OPTARG}" == "overlay" ] && continue - [ "${OPTARG}" == "only-vca" ] && continue - [ "${OPTARG}" == "vca" ] && continue - [ "${OPTARG}" == "ha" ] && continue - [ "${OPTARG}" == "tag" ] && continue - [ "${OPTARG}" == "registry" ] && continue - [ "${OPTARG}" == "volume" ] && OPENSTACK_ATTACH_VOLUME="true" && continue - [ "${OPTARG}" == "nocachelxdimages" ] && continue - [ "${OPTARG}" == "cachelxdimages" ] && INSTALL_CACHELXDIMAGES="--cachelxdimages" && continue - echo -e "Invalid option: '--$OPTARG'\n" >&2 - usage && exit 1 - ;; - :) - echo "Option -$OPTARG requires an argument" >&2 - usage && exit 1 - ;; - \?) - echo -e "Invalid option: '-$OPTARG'\n" >&2 - usage && exit 1 - ;; - h) - usage && exit 0 - ;; - y) - ASSUME_YES="y" - ;; - *) - usage && exit 1 - ;; - esac -done - -source $OSM_DEVOPS/common/all_funcs - -uninstall_osm - diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index 41fd9d68..9ceabee4 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -615,7 +615,7 @@ node("${params.NODE}") { // if this point is reached, logs should be archived ARCHIVE_LOGS_FLAG = true sshCommand remote: remote, command: """ - OSM_HOSTNAME=nbi.${remote.host}.nip.io osm vim-list + OSM_HOSTNAME=nbi.${remote.host}.nip.io ~/.local/bin/osm vim-list """ } // stage("OSM Health") } // if ( params.DO_INSTALL ) diff --git a/common/all_funcs b/library/all_funcs similarity index 86% rename from common/all_funcs rename to library/all_funcs index f6c48fa8..144ac6a2 100644 --- a/common/all_funcs +++ b/library/all_funcs @@ -22,7 +22,7 @@ if [ -z "$OSM_DEVOPS" ]; then export OSM_DEVOPS=$(realpath ${BASH_SOURCE[0]} ) fi -for file in logging config container git_functions track; do - . ${OSM_DEVOPS}/common/$file +for file in logging config container git_functions track utils.sh functions.sh trap.sh; do + . ${OSM_DEVOPS}/library/$file INFO "$file sourced" done diff --git a/common/config b/library/config similarity index 100% rename from common/config rename to library/config diff --git a/common/container b/library/container similarity index 100% rename from common/container rename to library/container diff --git a/installers/mgmt-cluster/flux/scripts/library/functions.sh b/library/functions.sh similarity index 100% rename from installers/mgmt-cluster/flux/scripts/library/functions.sh rename to library/functions.sh diff --git a/common/git_functions b/library/git_functions similarity index 100% rename from common/git_functions rename to library/git_functions diff --git a/common/logging b/library/logging similarity index 100% rename from common/logging rename to library/logging diff --git a/common/track b/library/track similarity index 100% rename from common/track rename to library/track diff --git a/installers/mgmt-cluster/flux/scripts/library/trap.sh b/library/trap.sh similarity index 100% rename from installers/mgmt-cluster/flux/scripts/library/trap.sh rename to library/trap.sh diff --git a/library/utils.sh b/library/utils.sh new file mode 100755 index 00000000..4fda0901 --- /dev/null +++ b/library/utils.sh @@ -0,0 +1,121 @@ +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### + + +function setup_external_ip() { + echo "Determining IP address of the interface with the default route" + [ -z "$OSM_DEFAULT_IF" ] && OSM_DEFAULT_IF=$(ip route list|awk '$1=="default" {print $5; exit}') + [ -z "$OSM_DEFAULT_IF" ] && OSM_DEFAULT_IF=$(route -n |awk '$1~/^0.0.0.0/ {print $8; exit}') + [ -z "$OSM_DEFAULT_IF" ] && FATAL "Not possible to determine the interface with the default route 0.0.0.0" + OSM_DEFAULT_IP=`ip -o -4 a s ${OSM_DEFAULT_IF} |awk '{split($4,a,"/"); print a[1]; exit}'` + [ -z "$OSM_DEFAULT_IP" ] && FATAL "Not possible to determine the IP address of the interface with the default route" + OSM_K8S_EXTERNAL_IP=${OSM_K8S_EXTERNAL_IP:-${OSM_DEFAULT_IP}} +} + +function parse_docker_registry_url() { + DOCKER_REGISTRY_USER=$(echo "$1" | awk '{split($1,a,"@"); split(a[1],b,":"); print b[1]}') + DOCKER_REGISTRY_PASSWORD=$(echo "$1" | awk '{split($1,a,"@"); split(a[1],b,":"); print b[2]}') + DOCKER_REGISTRY_URL=$(echo "$1" | awk '{split($1,a,"@"); print a[2]}') +} + +function configure_apt_proxy() { + OSM_APT_PROXY=$1 + OSM_APT_PROXY_FILE="/etc/apt/apt.conf.d/osm-apt" + echo "Configuring apt proxy in file ${OSM_APT_PROXY_FILE}" + if [ ! -f ${OSM_APT_PROXY_FILE} ]; then + sudo bash -c "cat < ${OSM_APT_PROXY} +Acquire::http { Proxy \"${OSM_APT_PROXY}\"; } +EOF" + else + sudo sed -i "s|Proxy.*|Proxy \"${OSM_APT_PROXY}\"; }|" ${OSM_APT_PROXY_FILE} + fi + sudo apt-get update || FATAL "Configured apt proxy, but couldn't run 'apt-get update'. Check ${OSM_APT_PROXY_FILE}" + track prereq apt_proxy_configured_ok + [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function +} + +function ask_user(){ + # ask to the user and parse a response among 'y', 'yes', 'n' or 'no'. Case insensitive + # Params: $1 text to ask; $2 Action by default, can be 'y' for yes, 'n' for no, other or empty for not allowed + # Return: true(0) if user type 'yes'; false (1) if user type 'no' + [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function + read -e -p "$1" USER_CONFIRMATION + while true ; do + [ -z "$USER_CONFIRMATION" ] && [ "$2" == 'y' ] && return 0 + [ -z "$USER_CONFIRMATION" ] && [ "$2" == 'n' ] && return 1 + [ "${USER_CONFIRMATION,,}" == "yes" ] || [ "${USER_CONFIRMATION,,}" == "y" ] && return 0 + [ "${USER_CONFIRMATION,,}" == "no" ] || [ "${USER_CONFIRMATION,,}" == "n" ] && return 1 + read -e -p "Please type 'yes' or 'no': " USER_CONFIRMATION + done + [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function +} + +function docker_login() { + echo "Docker login" + DEBUG "Docker registry user: ${DOCKER_REGISTRY_USER}" + sg docker -c "docker login -u ${DOCKER_REGISTRY_USER} -p ${DOCKER_REGISTRY_PASSWORD} --password-stdin" +} + +function ask_proceed() { + [ -z "$ASSUME_YES" ] && ! ask_user "The installation will do the following + 1. Install client tools (helm, kubectl, osmclient, wget, git, curl, tar, yq, flux, argo, kustomize) + 2. Deploy auxiliary services (Git, S3) + 3. Deploy mgmt cluster + 4. Deploy OSM + 5. Provision OSM + Do you want to proceed (Y/n)? " y && echo "Cancelled!" && exit 1 +} + +function check_osm_behind_proxy() { + export OSM_BEHIND_PROXY="" + export OSM_PROXY_ENV_VARIABLES="" + [ -n "${http_proxy}" ] && OSM_BEHIND_PROXY="y" && echo "http_proxy=${http_proxy}" && OSM_PROXY_ENV_VARIABLES="${OSM_PROXY_ENV_VARIABLES} http_proxy" + [ -n "${https_proxy}" ] && OSM_BEHIND_PROXY="y" && echo "https_proxy=${https_proxy}" && OSM_PROXY_ENV_VARIABLES="${OSM_PROXY_ENV_VARIABLES} https_proxy" + [ -n "${HTTP_PROXY}" ] && OSM_BEHIND_PROXY="y" && echo "HTTP_PROXY=${HTTP_PROXY}" && OSM_PROXY_ENV_VARIABLES="${OSM_PROXY_ENV_VARIABLES} HTTP_PROXY" + [ -n "${HTTPS_PROXY}" ] && OSM_BEHIND_PROXY="y" && echo "HTTPS_PROXY=${HTTPS_PROXY}" && OSM_PROXY_ENV_VARIABLES="${OSM_PROXY_ENV_VARIABLES} HTTPS_PROXY" + [ -n "${no_proxy}" ] && echo "no_proxy=${no_proxy}" && OSM_PROXY_ENV_VARIABLES="${OSM_PROXY_ENV_VARIABLES} no_proxy" + [ -n "${NO_PROXY}" ] && echo "NO_PROXY=${NO_PROXY}" && OSM_PROXY_ENV_VARIABLES="${OSM_PROXY_ENV_VARIABLES} NO_PROXY" + + echo "OSM_BEHIND_PROXY=${OSM_BEHIND_PROXY}" + echo "OSM_PROXY_ENV_VARIABLES=${OSM_PROXY_ENV_VARIABLES}" + + if [ -n "${OSM_BEHIND_PROXY}" ]; then + [ -z "$ASSUME_YES" ] && ! ask_user " +The following env variables have been found for the current user: +${OSM_PROXY_ENV_VARIABLES}. + +This suggests that this machine is behind a proxy and a special configuration is required. +The installer will install Docker CE and a Kubernetes to work behind a proxy using those +env variables. + +Take into account that the installer uses apt, curl, wget and docker. +Depending on the program, the env variables to work behind a proxy might be different +(e.g. http_proxy vs HTTP_PROXY). + +For that reason, it is strongly recommended that at least http_proxy, https_proxy, HTTP_PROXY +and HTTPS_PROXY are defined. + +Finally, some of the programs (apt) are run as sudoer, requiring that those env variables +are also set for root user. If you are not sure whether those variables are configured for +the root user, you can stop the installation now. + +Do you want to proceed with the installation (Y/n)? " y && echo "Cancelled!" && exit 1 + else + echo "This machine is not behind a proxy" + fi +} + -- 2.25.1