コード例 #1
0
    def begin(self):
        # Configure file
        fill_service_configure(
            self.service_file_temp,
            "{0}/heapster.yaml".format(self.service_temp_path),
            self.user_params)

        fill_service_configure(
            "{0}/influxdb.yaml.temp".format(self.service_temp_path),
            "{0}/influxdb.yaml".format(self.service_temp_path),
            self.user_params)

        # Kubectl create from yaml file
        status, result = commands.getstatusoutput(
            "kubectl create -f {0}/heapster.yaml".format(
                self.service_temp_path))
        if status:
            raise Exception, result

        status, result = commands.getstatusoutput(
            "kubectl create -f {0}/influxdb.yaml".format(
                self.service_temp_path))
        if status:
            raise Exception, result

        self.finish()
コード例 #2
0
    def finish(self):
        # Create context directory
        status, result = commands.getstatusoutput("mkdir -p {0}/.kube".format(
            os.path.expanduser("~")))
        if status:
            raise Exception, result

        fill_service_configure(
            "{0}/config.temp".format(self.service_temp_path),
            "{0}/.kube/config".format(os.path.expanduser("~")),
            self.user_params)
        if status:
            raise Exception, result
コード例 #3
0
    def begin(self):
        # Configure 'etcd.service' file
        fill_service_configure(
            self.service_file_temp,
            "{0}/calico.yaml".format(self.service_temp_path), self.user_params)

        # Kubectl create from yaml file
        status, result = commands.getstatusoutput(
            "kubectl create -f {0}/calico.yaml".format(self.service_temp_path))
        if status:
            raise Exception, result

        self.finish()
コード例 #4
0
    def begin(self):
        # Configure 'etcd.service' file
        fill_service_configure(self.service_file_temp, self.service_file_target, self.user_params)

        # Reload system service files
        status, result = commands.getstatusoutput("systemctl daemon-reload")
        if status:
            raise Exception, result

        # Add service to boot startup
        status, result = commands.getstatusoutput("systemctl enable {0}.service".format(self.app_name))
        if status:
            raise Exception, result

        #Start service
        status, result = commands.getstatusoutput("systemctl start {0}.service".format(self.app_name))
        if status:
            raise Exception, result

        self.finish()