This commit is contained in:
Ellis Johnson 2022-09-13 17:00:30 +10:00
Родитель bd7cec891e
Коммит 5569cf469a
7 изменённых файлов: 92 добавлений и 62 удалений

Просмотреть файл

@ -1,13 +1,9 @@
ARG REGISTRY
FROM ${REGISTRY}/ubi8/nodejs-14
FROM ${REGISTRY}/ubi8/nodejs-16
WORKDIR /data
USER root
COPY /portal/v2/ /data/
RUN npm install -g
COPY /portal/v2 /data/
RUN npm install
RUN set -eux \
&& ln -sf /data/node_modules/eslint/bin/eslint.js /usr/bin/eslint
ENTRYPOINT ["eslint"]
CMD ["--help"]
CMD ["npm", "run", "lint"]

Просмотреть файл

@ -184,8 +184,8 @@ lint-go:
hack/lint-go.sh
lint-admin-portal:
docker build --platform=linux/amd64 --build-arg REGISTRY=$(REGISTRY) -f Dockerfile.portal_lint . -t linter
docker run --platform=linux/amd64 -it --rm localhost/linter ./src --ext .ts
docker build --platform=linux/amd64 --build-arg REGISTRY=$(REGISTRY) -f Dockerfile.portal_lint . -t linter:latest --no-cache
docker run --platform=linux/amd64 -t --rm linter:latest
test-python: pyenv az
. pyenv/bin/activate && \

Просмотреть файл

@ -186,7 +186,7 @@
curl -X GET -k "https://localhost:8443/admin/subscriptions/$AZURE_SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.RedHatOpenShift/openShiftClusters/$CLUSTER/skus" --header "Content-Type: application/json" -d "{}"
```
* Reize master node of a dev cluster
* Resize master node of a dev cluster
```bash
VMNAME="aro-cluster-qplnw-master-0"
VMSIZE="Standard_D16s_v3"

Просмотреть файл

@ -5,7 +5,6 @@ package cluster
import (
"context"
"errors"
"fmt"
"time"
@ -127,7 +126,7 @@ func (m *manager) adminUpdate() []steps.Step {
}
// Hive cluster adoption and reconciliation
if isEverything {
if isEverything && m.adoptViaHive {
toRun = append(toRun,
steps.Action(m.hiveCreateNamespace),
steps.Action(m.hiveEnsureResources),
@ -148,7 +147,7 @@ func (m *manager) adminUpdate() []steps.Step {
}
func (m *manager) Update(ctx context.Context) error {
steps := []steps.Step{
s := []steps.Step{
steps.AuthorizationRefreshingAction(m.fpAuthorizer, steps.Action(m.validateResources)),
steps.Action(m.initializeKubernetesClients), // All init steps are first
steps.Action(m.initializeOperatorDeployer), // depends on kube clients
@ -163,39 +162,42 @@ func (m *manager) Update(ctx context.Context) error {
steps.Action(m.configureIngressCertificate),
steps.Action(m.updateOpenShiftSecret),
steps.Action(m.updateAROSecret),
// Hive reconciliation: we mostly need it to make sure that
// hive has the latest credentials after rotation.
steps.Action(m.hiveCreateNamespace),
steps.Action(m.hiveEnsureResources),
steps.Condition(m.hiveClusterDeploymentReady, 5*time.Minute, true),
steps.Action(m.hiveResetCorrelationData),
}
return m.runSteps(ctx, steps, false)
if m.adoptViaHive {
s = append(s,
// Hive reconciliation: we mostly need it to make sure that
// hive has the latest credentials after rotation.
steps.Action(m.hiveCreateNamespace),
steps.Action(m.hiveEnsureResources),
steps.Condition(m.hiveClusterDeploymentReady, 5*time.Minute, true),
steps.Action(m.hiveResetCorrelationData),
)
}
return m.runSteps(ctx, s, false)
}
func (m *manager) runIntegratedInstaller(ctx context.Context) error {
i := installer.NewInstaller(m.log, m.env, m.doc.ID, m.doc.OpenShiftCluster, m.subscriptionDoc.Subscription, m.fpAuthorizer, m.deployments, m.graph)
return i.Install(ctx)
}
func (m *manager) runHiveInstaller(ctx context.Context) error {
// TODO: Load from M6 database
installerPullspec, err := m.env.LiveConfig().DefaultInstallerPullSpec(ctx)
version, err := m.openShiftVersionFromVersion(ctx)
if err != nil {
return err
}
v := &api.OpenShiftVersion{
Version: version.InstallStream.Version.String(),
OpenShiftPullspec: version.InstallStream.PullSpec,
InstallerPullspec: installerPullspec,
i := installer.NewInstaller(m.log, m.env, m.doc.ID, m.doc.OpenShiftCluster, m.subscriptionDoc.Subscription, version, m.fpAuthorizer, m.deployments, m.graph)
return i.Install(ctx)
}
func (m *manager) runHiveInstaller(ctx context.Context) error {
version, err := m.openShiftVersionFromVersion(ctx)
if err != nil {
return err
}
// Run installer. For M5/M6 we will persist the graph inside the installer
// code since it's easier, but in the future, this data should be collected
// from Hive's outputs where needed.
return m.hiveClusterManager.Install(ctx, m.subscriptionDoc, m.doc, v)
return m.hiveClusterManager.Install(ctx, m.subscriptionDoc, m.doc, version)
}
func (m *manager) bootstrap() []steps.Step {
@ -220,35 +222,45 @@ func (m *manager) bootstrap() []steps.Step {
steps.AuthorizationRefreshingAction(m.fpAuthorizer, steps.Action(m.ensureGatewayCreate)),
steps.Action(m.createAPIServerPrivateEndpoint),
steps.Action(m.createCertificates),
}
if m.adoptViaHive || m.installViaHive {
// We will always need a Hive namespace, whether we are installing
// via Hive or adopting
steps.Action(m.hiveCreateNamespace),
s = append(s, steps.Action(m.hiveCreateNamespace))
}
if m.installViaHive {
s = append(s,
steps.Action(m.hiveCreateNamespace),
steps.Action(m.runHiveInstaller),
// Give Hive 60 minutes to install the cluster, since this includes
// all of bootstrapping being complete
steps.Condition(m.hiveClusterInstallationComplete, 60*time.Minute, true),
steps.Condition(m.hiveClusterDeploymentReady, 5*time.Minute, true),
steps.AuthorizationRefreshingAction(m.fpAuthorizer, steps.Action(m.generateKubeconfigs)),
)
} else {
s = append(s,
steps.Action(m.runIntegratedInstaller),
steps.Action(m.hiveCreateNamespace),
steps.Action(m.hiveEnsureResources),
steps.Condition(m.hiveClusterDeploymentReady, 5*time.Minute, true),
steps.AuthorizationRefreshingAction(m.fpAuthorizer, steps.Action(m.generateKubeconfigs)),
)
if m.adoptViaHive {
s = append(s,
steps.Action(m.hiveEnsureResources),
steps.Condition(m.hiveClusterDeploymentReady, 5*time.Minute, true),
)
}
}
if m.adoptViaHive || m.installViaHive {
s = append(s,
// Reset correlation data whether adopting or installing via Hive
steps.Action(m.hiveResetCorrelationData),
)
}
s = append(s,
// Reset correlation data whether adopting or installing via Hive
steps.Action(m.hiveResetCorrelationData),
steps.AuthorizationRefreshingAction(m.fpAuthorizer, steps.Action(m.generateKubeconfigs)),
steps.Action(m.ensureBillingRecord),
steps.Action(m.initializeKubernetesClients),
steps.Action(m.initializeOperatorDeployer), // depends on kube clients
@ -262,10 +274,6 @@ func (m *manager) bootstrap() []steps.Step {
// Install installs an ARO cluster
func (m *manager) Install(ctx context.Context) error {
if m.installViaHive && m.hiveClusterManager == nil {
return errors.New("installViaHive was requested but hiveClusterManager is unavailable")
}
steps := map[api.InstallPhase][]steps.Step{
api.InstallPhaseBootstrap: m.bootstrap(),
api.InstallPhaseRemoveBootstrap: {

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -316,6 +316,37 @@ for attempt in {1..5}; do
if [[ ${attempt} -lt 5 ]]; then sleep 10; else exit 1; fi
done
DEVICE_PARTITION=$(pvs | grep '/dev/' | awk '{print $1}' | grep -oP '[a-z]{3}[0-9]$')
DEVICE=$(echo $DEVICE_PARTITION | grep -oP '^[a-z]{3}')
PARTITION=$(echo $DEVICE_PARTITION | grep -oP '[0-9]$')
# Fix the "GPT PMBR size mismatch (134217727 != 268435455)"
echo "w" | fdisk /dev/${DEVICE}
# Steps from https://access.redhat.com/solutions/5808001
# 1. Delete the LVM partition "d\n2\n"
# 2. Recreate the partition "n\n2\n"
# 3. Accept the default start and end sectors (2 x \n)
# 4. LVM2_member signature remains by default
# 5. Change type to Linux LVM "t\n2\n31\n
# 6. Write new table "w\n"
fdisk /dev/${DEVICE} <<EOF
d
${PARTITION}
n
${PARTITION}
t
${PARTITION}
31
w
EOF
partx -u /dev/${DEVICE}
pvresize /dev/${DEVICE_PARTITION}
lvextend -l +50%FREE /dev/rootvg/homelv
xfs_growfs /home
@ -344,7 +375,7 @@ yum -y install azure-cli podman podman-docker jq gcc gpgme-devel libassuan-devel
mkdir -p /etc/containers/
touch /etc/containers/nodocker
VSTS_AGENT_VERSION=2.193.1
VSTS_AGENT_VERSION=2.206.1
mkdir /home/cloud-user/agent
pushd /home/cloud-user/agent
curl -s https://vstsagentpackage.azureedge.net/agent/${VSTS_AGENT_VERSION}/vsts-agent-linux-x64-${VSTS_AGENT_VERSION}.tar.gz | tar -xz